Skip to content

Commit

Permalink
feat: prompt to generate token again if previous attempt failed
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWitchBella committed Aug 15, 2021
1 parent e684899 commit 0ef7b3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@isbl/publisher",
"version": "0.6.1",
"version": "0.7.0",
"description": "Simplifies creating git(lab|hub) releases and publishes to npm",
"main": "index.js",
"repository": {
Expand Down
11 changes: 8 additions & 3 deletions src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,17 @@ export async function setup(
console.log('Changes done\n')

if (github && ci && await yesno('Do you want to setup NPM_TOKEN?', true)) {
const generateToken = await yesno('Do you want to generate npm token now?', true)
if (generateToken) {
let generateToken = false
while(true) {
generateToken = await yesno('Do you want to generate npm token now?', true)
if (!generateToken) break;

console.log('\nRunning `npm token create`')
ChildProcess.spawnSync('npm', ['token', 'create'], {
const res = ChildProcess.spawnSync('npm', ['token', 'create'], {
stdio: ['inherit', 'inherit', 'inherit']
})
if (res.status === 0) break
else console.log('\nSeems like token creation failed.')
}

console.log('\nℹ️ Now you have to add the token to your repository secrets section')
Expand Down

0 comments on commit 0ef7b3b

Please sign in to comment.