Skip to content

Commit 94ec2a1

Browse files
authored
Add a flag to pass in a token #70
1 parent 9c32567 commit 94ec2a1

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,20 @@ async function main() {
7575
describe: 'Set log level to verbose',
7676
default: false,
7777
})
78+
.option('token', {
79+
type: 'string',
80+
describe: 'If set, update the .npmrc file with this token rather than the token obtained from ADC or gcloud.',
81+
default: '',
82+
})
7883
.help()
7984
.argv;
8085

8186
logger.logVerbose = allArgs.verbose;
8287
const configPath = allArgs.config;
83-
const creds = await auth.getCreds();
88+
var creds = allArgs.token;
89+
if (creds == '') {
90+
creds = await auth.getCreds();
91+
}
8492
if (configPath) {
8593
console.warn('Updating project .npmrc inline is deprecated and may no longer be supported\n'
8694
+ 'in future versions. Run the plugin with `--repo-config` and `--credential-config`.');

0 commit comments

Comments
 (0)