Skip to content

Commit

Permalink
Merge branch 'main' into v3.0.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
rwaskiewicz committed Nov 28, 2022
2 parents 3f4b963 + 60bda3e commit d676deb
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 47 deletions.
68 changes: 34 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"license": "node scripts/build --license",
"lint": "eslint 'bin/*' 'scripts/*.ts' 'scripts/**/*.ts' 'src/*.ts' 'src/**/*.ts' 'src/**/*.tsx'",
"prettier": "npm run prettier.base -- --write",
"prettier.base": "prettier \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil|.github/(**/)?*.(yml|yaml)|*.js\"",
"prettier.base": "prettier --cache \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/stencil|.github/(**/)?*.(yml|yaml)|*.js\"",
"prettier.dry-run": "npm run prettier.base -- --list-different",
"release": "npm run tsc.scripts && node scripts/build --release --publish",
"release.prepare": "npm run tsc.scripts && node scripts/build --release --prepare",
Expand Down Expand Up @@ -59,7 +59,7 @@
"devDependencies": {
"@ionic/prettier-config": "^2.0.0",
"@rollup/plugin-commonjs": "15.1.0",
"@rollup/plugin-json": "5.0.1",
"@rollup/plugin-json": "5.0.2",
"@rollup/plugin-node-resolve": "9.0.0",
"@rollup/plugin-replace": "2.3.4",
"@rollup/pluginutils": "5.0.2",
Expand Down Expand Up @@ -114,7 +114,7 @@
"path-browserify": "^1.0.1",
"pixelmatch": "5.3.0",
"postcss": "^8.2.8",
"prettier": "2.7.1",
"prettier": "2.8.0",
"prompts": "2.4.2",
"puppeteer": "~10.0.0",
"rollup": "2.42.3",
Expand Down
24 changes: 14 additions & 10 deletions scripts/release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,15 @@ async function prepareRelease(opts: BuildOptions, args: ReadonlyArray<string>, r
},
{
type: 'input',
name: 'version',
message: 'Version',
// this name is intentionally different from 'version' above to make the `when` check below work properly
// (this prompt should only run if `version` was not already input)
name: 'specifiedVersion',
message: 'Specify Version',
when: (answers: any) => !answers.version,
filter: (input: string) => (isValidVersionInput(input) ? getNewVersion(pkg.version, input) : input),
validate: (input: string) => {
if (!isValidVersionInput(input)) {
return 'Please specify a valid semver, for example, `1.2.3`. See http://semver.org';
return 'Please specify a valid semver, for example, `1.2.3`, or `3.0.0-alpha.0`. See http://semver.org';
}
return true;
},
Expand All @@ -99,7 +101,8 @@ async function prepareRelease(opts: BuildOptions, args: ReadonlyArray<string>, r
type: 'confirm',
name: 'confirm',
message: (answers: any) => {
return `Prepare release ${opts.vermoji} ${color.yellow(answers.version)} from ${oldVersion}. Continue?`;
const version = answers.version ?? answers.specifiedVersion;
return `Prepare release ${opts.vermoji} ${color.yellow(version)} from ${oldVersion}. Continue?`;
},
},
];
Expand All @@ -108,7 +111,7 @@ async function prepareRelease(opts: BuildOptions, args: ReadonlyArray<string>, r
.prompt(prompts)
.then((answers) => {
if (answers.confirm) {
opts.version = answers.version;
opts.version = answers.version ?? answers.specifiedVersion;
// write `release-data.json`
fs.writeJsonSync(releaseDataPath, opts, { spaces: 2 });
runReleaseTasks(opts, args);
Expand Down Expand Up @@ -169,14 +172,15 @@ async function publishRelease(opts: BuildOptions, args: ReadonlyArray<string>):
},
{
type: 'input',
name: 'tag',
message: 'Tag',
// this name is intentionally different from 'tag' above. if they collide, this input prompt will not run.
name: 'specifiedTag',
message: 'Specify Tag',
when: (answers: any) => !pkg.private && isPrereleaseVersion(opts.version) && !answers.tag,
validate: (input: any) => {
if (input.length === 0) {
return 'Please specify a tag, for example, `next`.';
return 'Please specify a tag, for example, `next` or `3.0.0-alpha.0`.';
} else if (input.toLowerCase() === 'latest') {
return "It's not possible to publish pre-releases under the `latest` tag. Please specify something else, for example, `next`.";
return "It's not possible to publish pre-releases under the `latest` tag. Please specify something else, for example, `next` or `3.0.0-alpha.0`.";
}
return true;
},
Expand All @@ -185,7 +189,7 @@ async function publishRelease(opts: BuildOptions, args: ReadonlyArray<string>):
type: 'confirm',
name: 'confirm',
message: (answers: any) => {
opts.tag = answers.tag;
opts.tag = answers.tag ?? answers.specifiedTag;
const tagPart = opts.tag ? ` and tag this release in npm as ${color.yellow(opts.tag)}` : '';
return `Will publish ${opts.vermoji} ${color.yellow(opts.version)}${tagPart}. Continue?`;
},
Expand Down

0 comments on commit d676deb

Please sign in to comment.