Skip to content

Commit

Permalink
fix: shortened the V3 banner and added it to init readme
Browse files Browse the repository at this point in the history
  • Loading branch information
snorrees committed Nov 15, 2022
1 parent dd75950 commit 31757d7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/presets/semver-workflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import path from 'path'
import {readFile, writeFile} from '../util/files'
import {errorToUndefined} from '../util/errorToUndefined'
import {PackageJson} from '../actions/verify/types'
import {developTestSnippet, getLicenseText, installationSnippet} from '../util/readme'
import {
developTestSnippet,
getLicenseText,
installationSnippet,
v3BannerNotice,
} from '../util/readme'
import {getUserInfo} from '../util/user'

export const semverWorkflowPreset: Preset = {
Expand Down Expand Up @@ -95,14 +100,6 @@ async function readmeSnippets(options: InjectOptions) {

const bestEffortUrl = readmeBaseurl(pkg)

const v3Banner = outdent`
> **NOTE**
>
> This is the **Sanity Studio v3 version** of ${pkg.name}.
>
> For the v2 version, please refer to the [v2-branch](${bestEffortUrl}).
`

const install = installationSnippet(pkg.name ?? 'unknown')

const usage = outdent`
Expand All @@ -121,7 +118,7 @@ async function readmeSnippets(options: InjectOptions) {
`

return {
v3Banner,
v3Banner: v3BannerNotice(),
install,
usage,
license,
Expand Down
6 changes: 6 additions & 0 deletions src/util/readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export function generateReadme(data: PackageData) {
return outdent`
# ${pluginName}
${v3BannerNotice()}
${installationSnippet(pluginName ?? 'unknown')}
## Usage
Expand All @@ -31,6 +33,10 @@ export function generateReadme(data: PackageData) {
`
}

export function v3BannerNotice() {
return `> This is a **Sanity Studio v3** plugin.`
}

export function installationSnippet(packageName: string) {
return outdent`
## Installation
Expand Down

0 comments on commit 31757d7

Please sign in to comment.