Skip to content

Commit a0462e8

Browse files
committed
build: add release tagging to releaser script
1 parent b82ee11 commit a0462e8

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

build/releaser.js

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,13 @@ inquirer
1515
name: 'customVersion',
1616
type: 'input',
1717
message: 'Input version',
18-
choices: ['alpha', 'beta', 'patch', 'pre-release'],
18+
// choices: ['alpha', 'beta', 'patch', 'pre-release'],
19+
when: ({bump}) => bump === 'custom'
20+
},
21+
{
22+
name: 'releaseTag',
23+
type: 'input',
24+
message: 'Input release tag',
1925
when: ({bump}) => bump === 'custom'
2026
}
2127
])
@@ -29,17 +35,20 @@ inquirer
2935
inquirer.prompt([{
3036
name: 'confirmed',
3137
type: 'confirm',
32-
message: 'Are you sure you want to release v' + v.version,
38+
message: 'Are you sure you want to release v' + v.version + (res.releaseTag ? ' with tag: ' + res.releaseTag: ''),
3339
default: false
3440
}]).then((res) => {
3541
if (res.confirmed) {
36-
return resolve(v.version)
42+
return resolve({
43+
version: v.version,
44+
releaseTag: res.releaseTag
45+
})
3746
}
3847
reject()
3948
}).catch(reject)
4049
})
4150
})
42-
.then(version => {
51+
.then(({version, releaseTag}) => {
4352
console.log(blue(`Releasing v${version}...`))
4453
console.log(blue('-'.repeat(80)))
4554

@@ -61,7 +70,7 @@ inquirer
6170
git push origin refs/tags/v${version}
6271
git push origin master
6372
echo "Publishing to npm"
64-
npm publish
73+
npm publish${releaseTag ? ' --tag ' + releaseTag : ''}
6574
npm run changelog
6675
git add CHANGELOG.md
6776
git commit --no-verify -m "chore: update changelog"
@@ -83,7 +92,7 @@ inquirer
8392
function runCommands(commands) {
8493
return commands.split('\n')
8594
.map(c => c.trim())
86-
.filter(c => c.length)
95+
.filter(c => !!c.length)
8796
.reduce((promise, command) => {
8897
return promise.then(() => runCommand(command))
8998
}, Promise.resolve())

0 commit comments

Comments
 (0)