rman 0.13.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/cli.js +2 -0
- package/cjs/commands/build-command.js +32 -0
- package/cjs/commands/publish-command.js +12 -2
- package/cjs/commands/run-command.js +1 -1
- package/cjs/debug.js +1 -1
- package/cjs/utils/npm-utils.js +2 -2
- package/esm/cli.mjs +2 -0
- package/esm/commands/build-command.d.ts +11 -0
- package/esm/commands/build-command.mjs +28 -0
- package/esm/commands/publish-command.d.ts +1 -0
- package/esm/commands/publish-command.mjs +12 -2
- package/esm/commands/run-command.mjs +1 -1
- package/esm/debug.mjs +1 -1
- package/esm/utils/npm-utils.mjs +2 -2
- package/package.json +1 -1
package/cjs/cli.js
CHANGED
|
@@ -19,6 +19,7 @@ const run_command_1 = require("./commands/run-command");
|
|
|
19
19
|
const version_command_1 = require("./commands/version-command");
|
|
20
20
|
const publish_command_1 = require("./commands/publish-command");
|
|
21
21
|
const ci_command_1 = require("./commands/ci-command");
|
|
22
|
+
const build_command_1 = require("./commands/build-command");
|
|
22
23
|
async function runCli(options) {
|
|
23
24
|
const s = path_1.default.resolve((0, utils_1.getDirname)(), '../package.json');
|
|
24
25
|
const pkgJson = JSON.parse(await promises_1.default.readFile(s, 'utf-8'));
|
|
@@ -50,6 +51,7 @@ async function runCli(options) {
|
|
|
50
51
|
version_command_1.VersionCommand.initCli(repository, program);
|
|
51
52
|
publish_command_1.PublishCommand.initCli(repository, program);
|
|
52
53
|
ci_command_1.CleanInstallCommand.initCli(repository, program);
|
|
54
|
+
build_command_1.BuildCommand.initCli(repository, program);
|
|
53
55
|
if (!_argv.length)
|
|
54
56
|
program.showHelp();
|
|
55
57
|
else
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildCommand = void 0;
|
|
4
|
+
const command_1 = require("../core/command");
|
|
5
|
+
const run_command_1 = require("./run-command");
|
|
6
|
+
class BuildCommand extends run_command_1.RunCommand {
|
|
7
|
+
constructor(repository, options) {
|
|
8
|
+
super(repository, 'build', options);
|
|
9
|
+
this.repository = repository;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
exports.BuildCommand = BuildCommand;
|
|
13
|
+
BuildCommand.commandName = 'build';
|
|
14
|
+
(function (BuildCommand) {
|
|
15
|
+
function initCli(repository, program) {
|
|
16
|
+
program.command({
|
|
17
|
+
command: 'build [options...]',
|
|
18
|
+
describe: 'Alias for "run build"',
|
|
19
|
+
builder: (cmd) => {
|
|
20
|
+
return cmd
|
|
21
|
+
.example("$0 build", "# Builds packages")
|
|
22
|
+
.option(BuildCommand.cliCommandOptions);
|
|
23
|
+
},
|
|
24
|
+
handler: async (args) => {
|
|
25
|
+
const options = command_1.Command.composeOptions(BuildCommand.commandName, args, repository.config);
|
|
26
|
+
await new BuildCommand(repository, options)
|
|
27
|
+
.execute();
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
BuildCommand.initCli = initCli;
|
|
32
|
+
})(BuildCommand = exports.BuildCommand || (exports.BuildCommand = {}));
|
|
@@ -51,8 +51,11 @@ class PublishCommand extends run_command_1.RunCommand {
|
|
|
51
51
|
return super._exec({
|
|
52
52
|
...args,
|
|
53
53
|
cwd,
|
|
54
|
-
command: 'npm publish'
|
|
55
|
-
}, {
|
|
54
|
+
command: 'npm publish' + (this.options.access ? ' --access=' + this.options.access : '')
|
|
55
|
+
}, {
|
|
56
|
+
...options,
|
|
57
|
+
stdio: npmlog_1.default.levelIndex < 1000 ? 'inherit' : 'pipe'
|
|
58
|
+
});
|
|
56
59
|
}
|
|
57
60
|
return super._exec(args, options);
|
|
58
61
|
}
|
|
@@ -65,6 +68,13 @@ PublishCommand.commandName = 'publish';
|
|
|
65
68
|
'contents': {
|
|
66
69
|
describe: '# Subdirectory to publish',
|
|
67
70
|
type: 'string'
|
|
71
|
+
},
|
|
72
|
+
'access': {
|
|
73
|
+
describe: '# Tells the registry whether this package should be published as public or restricted. ' +
|
|
74
|
+
'Only applies to scoped packages, which default to restricted. If you don\'t have a paid account, ' +
|
|
75
|
+
'you must publish with --access public to publish scoped packages.',
|
|
76
|
+
type: 'string',
|
|
77
|
+
choices: ['public', 'restricted']
|
|
68
78
|
}
|
|
69
79
|
};
|
|
70
80
|
function initCli(repository, program) {
|
|
@@ -114,7 +114,7 @@ RunCommand.commandName = 'run';
|
|
|
114
114
|
function initCli(repository, program) {
|
|
115
115
|
program.command({
|
|
116
116
|
command: 'run <script>',
|
|
117
|
-
describe: 'Execute an arbitrary
|
|
117
|
+
describe: 'Execute an arbitrary script in each package',
|
|
118
118
|
builder: (cmd) => {
|
|
119
119
|
return cmd
|
|
120
120
|
.example("$0 run build", '')
|
package/cjs/debug.js
CHANGED
package/cjs/utils/npm-utils.js
CHANGED
|
@@ -14,8 +14,8 @@ class NpmHelper {
|
|
|
14
14
|
cwd: this.cwd,
|
|
15
15
|
argv: ['view', packageName, '--json']
|
|
16
16
|
});
|
|
17
|
-
if (x.stdout) {
|
|
18
|
-
if (x.stdout.includes('404'))
|
|
17
|
+
if (x && x.stdout) {
|
|
18
|
+
if (x.code && x.stdout.includes('404'))
|
|
19
19
|
return new PackageNotFoundError('Package ' + packageName + ' not found in repository');
|
|
20
20
|
const b = x.stdout.indexOf('{');
|
|
21
21
|
const e = x.stdout.lastIndexOf('}');
|
package/esm/cli.mjs
CHANGED
|
@@ -13,6 +13,7 @@ import { RunCommand } from './commands/run-command.mjs';
|
|
|
13
13
|
import { VersionCommand } from './commands/version-command.mjs';
|
|
14
14
|
import { PublishCommand } from './commands/publish-command.mjs';
|
|
15
15
|
import { CleanInstallCommand } from './commands/ci-command.mjs';
|
|
16
|
+
import { BuildCommand } from './commands/build-command.mjs';
|
|
16
17
|
export async function runCli(options) {
|
|
17
18
|
const s = path.resolve(getDirname(), '../package.json');
|
|
18
19
|
const pkgJson = JSON.parse(await fs.readFile(s, 'utf-8'));
|
|
@@ -44,6 +45,7 @@ export async function runCli(options) {
|
|
|
44
45
|
VersionCommand.initCli(repository, program);
|
|
45
46
|
PublishCommand.initCli(repository, program);
|
|
46
47
|
CleanInstallCommand.initCli(repository, program);
|
|
48
|
+
BuildCommand.initCli(repository, program);
|
|
47
49
|
if (!_argv.length)
|
|
48
50
|
program.showHelp();
|
|
49
51
|
else
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import yargs from 'yargs';
|
|
2
|
+
import { Repository } from '../core/repository';
|
|
3
|
+
import { RunCommand } from './run-command';
|
|
4
|
+
export declare class BuildCommand extends RunCommand<any> {
|
|
5
|
+
readonly repository: Repository;
|
|
6
|
+
static commandName: string;
|
|
7
|
+
constructor(repository: Repository, options?: RunCommand.Options);
|
|
8
|
+
}
|
|
9
|
+
export declare namespace BuildCommand {
|
|
10
|
+
function initCli(repository: Repository, program: yargs.Argv): void;
|
|
11
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Command } from './../core/command.mjs';
|
|
2
|
+
import { RunCommand } from './run-command.mjs';
|
|
3
|
+
export class BuildCommand extends RunCommand {
|
|
4
|
+
constructor(repository, options) {
|
|
5
|
+
super(repository, 'build', options);
|
|
6
|
+
this.repository = repository;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
BuildCommand.commandName = 'build';
|
|
10
|
+
(function (BuildCommand) {
|
|
11
|
+
function initCli(repository, program) {
|
|
12
|
+
program.command({
|
|
13
|
+
command: 'build [options...]',
|
|
14
|
+
describe: 'Alias for "run build"',
|
|
15
|
+
builder: (cmd) => {
|
|
16
|
+
return cmd
|
|
17
|
+
.example("$0 build", "# Builds packages")
|
|
18
|
+
.option(BuildCommand.cliCommandOptions);
|
|
19
|
+
},
|
|
20
|
+
handler: async (args) => {
|
|
21
|
+
const options = Command.composeOptions(BuildCommand.commandName, args, repository.config);
|
|
22
|
+
await new BuildCommand(repository, options)
|
|
23
|
+
.execute();
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
BuildCommand.initCli = initCli;
|
|
28
|
+
})(BuildCommand || (BuildCommand = {}));
|
|
@@ -20,6 +20,7 @@ export declare class PublishCommand extends RunCommand<PublishCommand.Options> {
|
|
|
20
20
|
export declare namespace PublishCommand {
|
|
21
21
|
interface Options extends RunCommand.Options {
|
|
22
22
|
contents?: string;
|
|
23
|
+
access?: string;
|
|
23
24
|
}
|
|
24
25
|
const cliCommandOptions: Record<string, yargs.Options>;
|
|
25
26
|
function initCli(repository: Repository, program: yargs.Argv): void;
|
|
@@ -45,8 +45,11 @@ export class PublishCommand extends RunCommand {
|
|
|
45
45
|
return super._exec({
|
|
46
46
|
...args,
|
|
47
47
|
cwd,
|
|
48
|
-
command: 'npm publish'
|
|
49
|
-
}, {
|
|
48
|
+
command: 'npm publish' + (this.options.access ? ' --access=' + this.options.access : '')
|
|
49
|
+
}, {
|
|
50
|
+
...options,
|
|
51
|
+
stdio: logger.levelIndex < 1000 ? 'inherit' : 'pipe'
|
|
52
|
+
});
|
|
50
53
|
}
|
|
51
54
|
return super._exec(args, options);
|
|
52
55
|
}
|
|
@@ -58,6 +61,13 @@ PublishCommand.commandName = 'publish';
|
|
|
58
61
|
'contents': {
|
|
59
62
|
describe: '# Subdirectory to publish',
|
|
60
63
|
type: 'string'
|
|
64
|
+
},
|
|
65
|
+
'access': {
|
|
66
|
+
describe: '# Tells the registry whether this package should be published as public or restricted. ' +
|
|
67
|
+
'Only applies to scoped packages, which default to restricted. If you don\'t have a paid account, ' +
|
|
68
|
+
'you must publish with --access public to publish scoped packages.',
|
|
69
|
+
type: 'string',
|
|
70
|
+
choices: ['public', 'restricted']
|
|
61
71
|
}
|
|
62
72
|
};
|
|
63
73
|
function initCli(repository, program) {
|
|
@@ -107,7 +107,7 @@ RunCommand.commandName = 'run';
|
|
|
107
107
|
function initCli(repository, program) {
|
|
108
108
|
program.command({
|
|
109
109
|
command: 'run <script>',
|
|
110
|
-
describe: 'Execute an arbitrary
|
|
110
|
+
describe: 'Execute an arbitrary script in each package',
|
|
111
111
|
builder: (cmd) => {
|
|
112
112
|
return cmd
|
|
113
113
|
.example("$0 run build", '')
|
package/esm/debug.mjs
CHANGED
package/esm/utils/npm-utils.mjs
CHANGED
|
@@ -10,8 +10,8 @@ export class NpmHelper {
|
|
|
10
10
|
cwd: this.cwd,
|
|
11
11
|
argv: ['view', packageName, '--json']
|
|
12
12
|
});
|
|
13
|
-
if (x.stdout) {
|
|
14
|
-
if (x.stdout.includes('404'))
|
|
13
|
+
if (x && x.stdout) {
|
|
14
|
+
if (x.code && x.stdout.includes('404'))
|
|
15
15
|
return new PackageNotFoundError('Package ' + packageName + ' not found in repository');
|
|
16
16
|
const b = x.stdout.indexOf('{');
|
|
17
17
|
const e = x.stdout.lastIndexOf('}');
|