Skip to content

Commit

Permalink
fix: do not use yarnpkg registry while generating token
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeWitchBella committed Aug 15, 2021
1 parent 0ef7b3b commit 8103797
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 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.7.0",
"version": "0.7.1",
"description": "Simplifies creating git(lab|hub) releases and publishes to npm",
"main": "index.js",
"repository": {
Expand Down
8 changes: 7 additions & 1 deletion src/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createRunner } from './run-command'
import { URL } from 'url'
import * as ChildProcess from 'child_process'
import open from 'open'
import path from 'path'

const welcome = `
Welcome to @isbl/publisher ❤️
Expand Down Expand Up @@ -94,7 +95,8 @@ export async function setup(

console.log('\nRunning `npm token create`')
const res = ChildProcess.spawnSync('npm', ['token', 'create'], {
stdio: ['inherit', 'inherit', 'inherit']
stdio: ['inherit', 'inherit', 'inherit'],
env: clearEnv(env),
})
if (res.status === 0) break
else console.log('\nSeems like token creation failed.')
Expand Down Expand Up @@ -131,6 +133,10 @@ export async function setup(
}
}

function clearEnv(env: typeof process.env) {
return Object.fromEntries(Object.entries(env).filter(([key]) => !key.startsWith('npm_')))
}

function prepublishOnly(scripts: any) {
const p = scripts.prepublishOnly
if (p?.endsWith('isbl-publisher prepublishOnly')) return p
Expand Down

0 comments on commit 8103797

Please sign in to comment.