Skip to content

Commit

Permalink
Merge branch 'sth-use-emptyAsUndefined-in-scaffold' of https://github…
Browse files Browse the repository at this point in the history
….com/samthuang/redwood into sth-use-emptyAsUndefined-in-scaffold
  • Loading branch information
Tobbe committed Apr 10, 2023
2 parents 8d76da1 + f0218b1 commit 05f56fd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion docs/docs/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -2043,7 +2043,7 @@ A canary release is published to npm every time a PR is merged to the `main` bra
| Option | Description |
| :-------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `--dry-run, -d` | Check for outdated packages without upgrading |
| `--tag, -t` | Choices are "canary", "rc", or a specific version (e.g. "0.19.3"). WARNING: Unstable releases in the case of "canary" and "rc", which will force upgrade packages to the most recent release of the specified tag. |
| `--tag, -t` | Choices are "rc", "canary", "latest", "next", "experimental", or a specific version (e.g. "0.19.3"). WARNING: Unstable releases in the case of "canary", "rc", "next", and "experimental". And "canary" releases include breaking changes often requiring codemods if upgrading a project. |
**Example**
Expand Down
8 changes: 3 additions & 5 deletions packages/cli/src/commands/upgrade.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const builder = (yargs) => {
.option('tag', {
alias: 't',
description:
'[choices: "canary", "rc", or specific-version (see example below)] WARNING: "canary" and "rc" tags are unstable releases!',
'[choices: "latest", "rc", "next", "canary", "experimental", or a specific-version (see example below)] WARNING: "canary", "rc" and "experimental" are unstable releases! And "canary" releases include breaking changes often requiring codemods if upgrading a project.',
requiresArg: true,
type: 'string',
coerce: validateTag,
Expand Down Expand Up @@ -67,16 +67,14 @@ const SEMVER_REGEX =
/(?<=^v?|\sv?)(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)\.(?:0|[1-9]\d*)(?:-(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*)(?:\.(?:0|[1-9]\d*|[\da-z-]*[a-z-][\da-z-]*))*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?(?=$|\s)/i
export const validateTag = (tag) => {
const isTagValid =
tag === 'rc' ||
tag === 'canary' ||
tag === 'latest' ||
['rc', 'canary', 'latest', 'next', 'experimental'].includes(tag) ||
SEMVER_REGEX.test(tag)

if (!isTagValid) {
// Stop execution
throw new Error(
c.error(
'Invalid tag supplied. Supported values: rc, canary, latest, or valid semver version\n'
"Invalid tag supplied. Supported values: 'rc', 'canary', 'latest', 'next', 'experimental', or a valid semver version\n"
)
)
}
Expand Down

0 comments on commit 05f56fd

Please sign in to comment.