1 | #!/usr/bin/env node
|
2 |
|
3 | 'use strict';
|
4 |
|
5 | const isScoped = require(`is-scoped`);
|
6 | const pkg = require(`../package.json`);
|
7 | const program = require(`commander`);
|
8 | const publishGitTag = require(`./index`);
|
9 | const readPkg = require(`read-pkg`);
|
10 |
|
11 | program
|
12 | .description(pkg.description)
|
13 | .version(pkg.version)
|
14 | .option(`-a, --access <access>`, `published as [public] or [restricted]`, /^(public|restricted)$/i, `restricted`)
|
15 | .option(`-s, --skip-token`, `skip the authentication step`)
|
16 | .parse(process.argv);
|
17 |
|
18 | readPkg()
|
19 | .then(pkg => isScoped(pkg.name))
|
20 |
|
21 |
|
22 | .then(scoped => publishGitTag({access: scoped ? program.access : `public`, skipToken: program.skipToken}))
|
23 | .catch(error => {
|
24 | console.error(`npm-publish-git-tag failed for the following reason - ${error}`);
|
25 | process.exit(1);
|
26 | });
|
27 |
|