Skip to content

Commit f4dd00e

Browse files
committed
build(scripts/publish): use npm otp code
Use OTP code instead of a token.
1 parent bccfc00 commit f4dd00e

File tree

1 file changed

+28
-34
lines changed

1 file changed

+28
-34
lines changed

scripts/publish.js

Lines changed: 28 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,33 @@
11
const inquirer = require('inquirer')
22
const execa = require('execa')
33

4-
inquirer.prompt([
5-
{
6-
type: 'password',
7-
name: 'NPM_AUTH_TOKEN',
8-
message: 'npm token',
9-
filter (input) {
10-
return input.trim()
4+
;(async () => {
5+
const { NPM_OTP, CONVENTIONAL_GITHUB_RELEASER_TOKEN } = await inquirer.prompt([
6+
{
7+
type: 'password',
8+
name: 'NPM_OTP',
9+
message: 'npm OTP code',
10+
filter (input) {
11+
return input.trim()
12+
},
13+
validate (input, answers) {
14+
return input && input.length > 0 ? true : 'Cannot be emtpy'
15+
}
1116
},
12-
validate (input, answers) {
13-
return input && input.length > 0 ? true : 'Cannot be emtpy'
17+
{
18+
type: 'password',
19+
name: 'CONVENTIONAL_GITHUB_RELEASER_TOKEN',
20+
message: 'GitHub Token (for GitHub Releases)',
21+
filter (input) {
22+
return input.trim()
23+
},
24+
validate (input, answers) {
25+
return input && input.length > 0 ? true : 'Cannot be emtpy'
26+
}
1427
}
15-
},
16-
{
17-
type: 'password',
18-
name: 'CONVENTIONAL_GITHUB_RELEASER_TOKEN',
19-
message: 'GitHub Token (for GitHub Releases)',
20-
filter (input) {
21-
return input.trim()
22-
},
23-
validate (input, answers) {
24-
return input && input.length > 0 ? true : 'Cannot be emtpy'
25-
}
26-
}
27-
]).then(async answers => {
28-
const { NPM_AUTH_TOKEN, CONVENTIONAL_GITHUB_RELEASER_TOKEN } = answers
29-
await execa('npm', ['publish'], {
30-
env: {
31-
NPM_AUTH_TOKEN
32-
}
33-
})
34-
await execa('conventional-github-releaser', ['-p', 'angular'], {
35-
env: {
36-
CONVENTIONAL_GITHUB_RELEASER_TOKEN
37-
}
38-
})
39-
})
28+
])
29+
await execa('npm', ['publish', '--otp', NPM_OTP])
30+
await execa('conventional-github-releaser', [
31+
'-p', 'angular', '-t', CONVENTIONAL_GITHUB_RELEASER_TOKEN
32+
])
33+
})()

0 commit comments

Comments
 (0)