@versatiles/release-tool 1.2.1 → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/release.js +11 -9
- package/package.json +1 -1
package/dist/commands/release.js
CHANGED
|
@@ -37,15 +37,17 @@ export async function release(directory, branch = 'main') {
|
|
|
37
37
|
// get current sha
|
|
38
38
|
const { sha: shaCurrent } = await check('get current github commit', getCurrentGitHubCommit());
|
|
39
39
|
// handle version
|
|
40
|
-
const nextVersion = await
|
|
41
|
-
// prepare release notes
|
|
42
|
-
const releaseNotes = await check('prepare release notes', getReleaseNotes(nextVersion, shaLast, shaCurrent));
|
|
43
|
-
// update version
|
|
44
|
-
await check('update version', setNextVersion(nextVersion));
|
|
40
|
+
const nextVersion = await getNewVersion(versionLastPackage);
|
|
45
41
|
// test
|
|
46
42
|
await check('run checks', shell.run('npm run check'));
|
|
47
|
-
//
|
|
48
|
-
await check('
|
|
43
|
+
// update version
|
|
44
|
+
await check('update version', setNextVersion(nextVersion));
|
|
45
|
+
// prepare release notes
|
|
46
|
+
const releaseNotes = await check('prepare release notes', getReleaseNotes(nextVersion, shaLast, shaCurrent));
|
|
47
|
+
if (!('private' in pkg) || !Boolean(pkg.private)) {
|
|
48
|
+
// npm publish
|
|
49
|
+
await check('npm publish', shell.run('npm publish --access public'));
|
|
50
|
+
}
|
|
49
51
|
// git push
|
|
50
52
|
await check('git add', shell.run('git add .'));
|
|
51
53
|
await check('git commit', shell.run(`git commit -m "v${nextVersion}"`, false));
|
|
@@ -80,10 +82,10 @@ export async function release(directory, branch = 'main') {
|
|
|
80
82
|
let notes = commits.reverse()
|
|
81
83
|
.map(commit => '- ' + commit.message.replace(/\s+/g, ' '))
|
|
82
84
|
.join('\n');
|
|
83
|
-
notes = `# Release v${version}\n\nchanges
|
|
85
|
+
notes = `# Release v${version}\n\nchanges:\n${notes}\n\n`;
|
|
84
86
|
return notes;
|
|
85
87
|
}
|
|
86
|
-
async function
|
|
88
|
+
async function getNewVersion(versionPackage) {
|
|
87
89
|
// ask for new version
|
|
88
90
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
89
91
|
const versionNew = (await inquirer.prompt({
|