rman 0.16.1 → 0.18.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 +29 -28
- package/cjs/commands/build-command.js +4 -4
- package/cjs/commands/changed-command.js +5 -5
- package/cjs/commands/ci-command.js +9 -9
- package/cjs/commands/execute-command.js +8 -8
- package/cjs/commands/info-command.js +3 -3
- package/cjs/commands/list-command.js +7 -6
- package/cjs/commands/multi-task-command.js +4 -6
- package/cjs/commands/publish-command.js +35 -15
- package/cjs/commands/run-command.js +8 -8
- package/cjs/commands/version-command.js +10 -10
- package/cjs/core/command.js +8 -8
- package/cjs/core/constants.js +2 -2
- package/cjs/core/repository.js +7 -7
- package/cjs/index.js +1 -1
- package/cjs/utils/exec.js +2 -2
- package/cjs/utils/file-utils.js +1 -2
- package/cjs/utils/get-dirname.js +1 -3
- package/cjs/utils/git-utils.js +5 -5
- package/cjs/utils/npm-run-path.js +1 -1
- package/cjs/utils/npm-utils.js +2 -2
- package/esm/{cli.mjs → cli.js} +16 -15
- package/esm/commands/build-command.d.ts +2 -2
- package/esm/commands/{build-command.mjs → build-command.js} +2 -2
- package/esm/commands/changed-command.d.ts +3 -3
- package/esm/commands/{changed-command.mjs → changed-command.js} +2 -2
- package/esm/commands/ci-command.d.ts +5 -5
- package/esm/commands/{ci-command.mjs → ci-command.js} +4 -4
- package/esm/commands/execute-command.d.ts +4 -4
- package/esm/commands/{execute-command.mjs → execute-command.js} +4 -4
- package/esm/commands/info-command.d.ts +2 -2
- package/esm/commands/{info-command.mjs → info-command.js} +1 -1
- package/esm/commands/list-command.d.ts +4 -4
- package/esm/commands/{list-command.mjs → list-command.js} +4 -3
- package/esm/commands/multi-task-command.d.ts +4 -4
- package/esm/commands/{multi-task-command.mjs → multi-task-command.js} +2 -4
- package/esm/commands/publish-command.d.ts +6 -5
- package/esm/commands/{publish-command.mjs → publish-command.js} +32 -12
- package/esm/commands/run-command.d.ts +5 -5
- package/esm/commands/{run-command.mjs → run-command.js} +5 -5
- package/esm/commands/version-command.d.ts +5 -5
- package/esm/commands/{version-command.mjs → version-command.js} +7 -7
- package/esm/core/command.d.ts +1 -1
- package/esm/core/{command.mjs → command.js} +6 -6
- package/esm/core/constants.d.ts +0 -1
- package/esm/core/constants.js +2 -0
- package/esm/core/{logger.mjs → logger.js} +0 -0
- package/esm/core/{package.mjs → package.js} +0 -0
- package/esm/core/repository.d.ts +1 -1
- package/esm/core/{repository.mjs → repository.js} +4 -4
- package/esm/index.d.ts +1 -1
- package/esm/index.js +1 -0
- package/esm/utils/{exec.mjs → exec.js} +1 -1
- package/esm/utils/file-utils.d.ts +0 -2
- package/esm/utils/{file-utils.mjs → file-utils.js} +0 -1
- package/esm/utils/{get-dirname.mjs → get-dirname.js} +1 -3
- package/esm/utils/{git-utils.mjs → git-utils.js} +1 -1
- package/esm/utils/{npm-run-path.mjs → npm-run-path.js} +1 -1
- package/esm/utils/{npm-utils.mjs → npm-utils.js} +1 -1
- package/package.json +32 -28
- package/cjs/core/types.js +0 -2
- package/cjs/debug.js +0 -5
- package/esm/core/constants.mjs +0 -2
- package/esm/core/types.d.ts +0 -14
- package/esm/core/types.mjs +0 -1
- package/esm/debug.d.ts +0 -1
- package/esm/debug.mjs +0 -3
- package/esm/index.mjs +0 -1
package/cjs/utils/file-utils.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.fsDelete = exports.
|
|
6
|
+
exports.fsDelete = exports.tryStat = exports.fsExists = void 0;
|
|
7
7
|
const promises_1 = __importDefault(require("fs/promises"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
async function fsExists(s) {
|
|
@@ -14,7 +14,6 @@ async function tryStat(s) {
|
|
|
14
14
|
return promises_1.default.lstat(s).catch(() => undefined);
|
|
15
15
|
}
|
|
16
16
|
exports.tryStat = tryStat;
|
|
17
|
-
exports.fsReadFile = promises_1.default.readFile;
|
|
18
17
|
async function fsDelete(fileOrDir) {
|
|
19
18
|
const stat = await tryStat(fileOrDir);
|
|
20
19
|
if (stat) {
|
package/cjs/utils/get-dirname.js
CHANGED
|
@@ -4,10 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.getPackageJson = exports.getDirname = void 0;
|
|
7
|
-
// noinspection ES6UnusedImports
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
9
|
-
const path_1 = __importDefault(require("path"));
|
|
10
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
11
9
|
function getDirname() {
|
|
12
10
|
const pst = Error.prepareStackTrace;
|
|
13
11
|
Error.prepareStackTrace = function (_, stack) {
|
package/cjs/utils/git-utils.js
CHANGED
|
@@ -4,14 +4,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.GitHelper = void 0;
|
|
7
|
-
const exec_1 = require("./exec");
|
|
8
7
|
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const exec_js_1 = require("./exec.js");
|
|
9
9
|
class GitHelper {
|
|
10
10
|
constructor(options) {
|
|
11
11
|
this.cwd = options?.cwd || process.cwd();
|
|
12
12
|
}
|
|
13
13
|
async listDirtyFileStatus(options) {
|
|
14
|
-
const x = await (0,
|
|
14
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
15
15
|
cwd: this.cwd,
|
|
16
16
|
argv: ['status', '--porcelain']
|
|
17
17
|
});
|
|
@@ -32,7 +32,7 @@ class GitHelper {
|
|
|
32
32
|
return (await this.listDirtyFileStatus(options)).map(x => x.filename);
|
|
33
33
|
}
|
|
34
34
|
async listCommitSha() {
|
|
35
|
-
const x = await (0,
|
|
35
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
36
36
|
cwd: this.cwd,
|
|
37
37
|
argv: ['cherry']
|
|
38
38
|
});
|
|
@@ -49,7 +49,7 @@ class GitHelper {
|
|
|
49
49
|
: await this.listCommitSha();
|
|
50
50
|
let result = [];
|
|
51
51
|
for (const s of shaArr) {
|
|
52
|
-
const x = await (0,
|
|
52
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
53
53
|
cwd: this.cwd,
|
|
54
54
|
argv: ['show', s, '--name-only', '--pretty="format:"']
|
|
55
55
|
});
|
|
@@ -60,7 +60,7 @@ class GitHelper {
|
|
|
60
60
|
return result;
|
|
61
61
|
}
|
|
62
62
|
async readFileLastPublished(filePath, commitSha) {
|
|
63
|
-
const x = await (0,
|
|
63
|
+
const x = await (0, exec_js_1.exec)('git', {
|
|
64
64
|
cwd: this.cwd,
|
|
65
65
|
argv: ['show', (commitSha || 'HEAD') + ':"' + filePath + '"']
|
|
66
66
|
});
|
|
@@ -8,9 +8,9 @@ exports.npmRunPathEnv = exports.npmRunPath = void 0;
|
|
|
8
8
|
/**
|
|
9
9
|
* Inspired from [npm-run-path](https://github.com/sindresorhus/npm-run-path)
|
|
10
10
|
*/
|
|
11
|
-
const process_1 = __importDefault(require("process"));
|
|
12
11
|
const path_1 = __importDefault(require("path"));
|
|
13
12
|
const path_key_1 = __importDefault(require("path-key"));
|
|
13
|
+
const process_1 = __importDefault(require("process"));
|
|
14
14
|
/**
|
|
15
15
|
Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
|
|
16
16
|
@returns The augmented path string.
|
package/cjs/utils/npm-utils.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NpmHelper = exports.PackageNotFoundError = void 0;
|
|
4
|
-
const
|
|
4
|
+
const exec_js_1 = require("./exec.js");
|
|
5
5
|
class PackageNotFoundError extends Error {
|
|
6
6
|
}
|
|
7
7
|
exports.PackageNotFoundError = PackageNotFoundError;
|
|
@@ -10,7 +10,7 @@ class NpmHelper {
|
|
|
10
10
|
this.cwd = options?.cwd || process.cwd();
|
|
11
11
|
}
|
|
12
12
|
async getPackageInfo(packageName) {
|
|
13
|
-
const x = await (0,
|
|
13
|
+
const x = await (0, exec_js_1.exec)('npm', {
|
|
14
14
|
cwd: this.cwd,
|
|
15
15
|
argv: ['view', packageName, '--json']
|
|
16
16
|
});
|
package/esm/{cli.mjs → cli.js}
RENAMED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
|
-
import fs from 'fs/promises';
|
|
3
|
-
import yargs from "yargs";
|
|
4
1
|
import chalk from 'chalk';
|
|
2
|
+
import fs from 'fs/promises';
|
|
5
3
|
import logger from 'npmlog';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import yargs from "yargs";
|
|
6
|
+
import { BuildCommand } from './commands/build-command.js';
|
|
7
|
+
import { ChangedCommand } from './commands/changed-command.js';
|
|
8
|
+
import { CleanInstallCommand } from './commands/ci-command.js';
|
|
9
|
+
import { ExecuteCommand } from './commands/execute-command.js';
|
|
10
|
+
import { InfoCommand } from './commands/info-command.js';
|
|
11
|
+
import { ListCommand } from './commands/list-command.js';
|
|
12
|
+
import { PublishCommand } from './commands/publish-command.js';
|
|
13
|
+
import { RunCommand } from './commands/run-command.js';
|
|
14
|
+
import { VersionCommand } from './commands/version-command.js';
|
|
15
|
+
import { Command } from './core/command.js';
|
|
16
|
+
import { Repository } from './core/repository.js';
|
|
17
|
+
import { getDirname } from './utils/get-dirname.js';
|
|
18
18
|
export async function runCli(options) {
|
|
19
19
|
try {
|
|
20
20
|
const s = path.resolve(getDirname(), '../package.json');
|
|
@@ -33,6 +33,7 @@ export async function runCli(options) {
|
|
|
33
33
|
const text = (msg
|
|
34
34
|
? msg + '\n\n' + chalk.whiteBright('Run with --help for available options')
|
|
35
35
|
: (err ? err.message : ''));
|
|
36
|
+
// eslint-disable-next-line no-console
|
|
36
37
|
console.log('\n' + chalk.red(text));
|
|
37
38
|
throw msg;
|
|
38
39
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import { Repository } from '../core/repository';
|
|
3
|
-
import { RunCommand } from './run-command';
|
|
2
|
+
import { Repository } from '../core/repository.js';
|
|
3
|
+
import { RunCommand } from './run-command.js';
|
|
4
4
|
export declare class BuildCommand extends RunCommand<any> {
|
|
5
5
|
readonly repository: Repository;
|
|
6
6
|
static commandName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Command } from '
|
|
2
|
-
import { RunCommand } from './run-command.
|
|
1
|
+
import { Command } from '../core/command.js';
|
|
2
|
+
import { RunCommand } from './run-command.js';
|
|
3
3
|
export class BuildCommand extends RunCommand {
|
|
4
4
|
constructor(repository, options) {
|
|
5
5
|
super(repository, 'build', options);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { Package } from '../core/package.js';
|
|
3
|
+
import { Repository } from '../core/repository.js';
|
|
4
|
+
import { ListCommand } from './list-command.js';
|
|
5
5
|
export declare class ChangedCommand extends ListCommand {
|
|
6
6
|
readonly repository: Repository;
|
|
7
7
|
static commandName: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Command } from '../core/command.js';
|
|
2
|
+
import { ListCommand } from './list-command.js';
|
|
3
3
|
export class ChangedCommand extends ListCommand {
|
|
4
4
|
constructor(repository, options) {
|
|
5
5
|
super(repository, options);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
1
|
import { Task } from 'power-tasks';
|
|
3
|
-
import
|
|
4
|
-
import { Package } from '../core/package';
|
|
5
|
-
import {
|
|
6
|
-
import { ExecuteCommandResult } from '../utils/exec';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { Package } from '../core/package.js';
|
|
4
|
+
import { Repository } from '../core/repository.js';
|
|
5
|
+
import { ExecuteCommandResult } from '../utils/exec.js';
|
|
6
|
+
import { RunCommand } from './run-command.js';
|
|
7
7
|
export declare class CleanInstallCommand extends RunCommand<CleanInstallCommand.Options> {
|
|
8
8
|
readonly repository: Repository;
|
|
9
9
|
static commandName: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Task } from 'power-tasks';
|
|
2
1
|
import chalk from 'chalk';
|
|
3
2
|
import logger from 'npmlog';
|
|
4
|
-
import { Command } from './../core/command.mjs';
|
|
5
|
-
import { RunCommand } from './run-command.mjs';
|
|
6
|
-
import { fsDelete, fsExists } from './../utils/file-utils.mjs';
|
|
7
3
|
import path from 'path';
|
|
4
|
+
import { Task } from 'power-tasks';
|
|
5
|
+
import { Command } from '../core/command.js';
|
|
6
|
+
import { fsDelete, fsExists } from '../utils/file-utils.js';
|
|
7
|
+
import { RunCommand } from './run-command.js';
|
|
8
8
|
export class CleanInstallCommand extends RunCommand {
|
|
9
9
|
constructor(repository, options) {
|
|
10
10
|
super(repository, 'clean_', options);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
|
-
import { Repository } from '../core/repository';
|
|
3
|
-
import { MultiTaskCommand } from './multi-task-command';
|
|
4
1
|
import { Task } from 'power-tasks';
|
|
5
|
-
import
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { Package } from '../core/package.js';
|
|
4
|
+
import { Repository } from '../core/repository.js';
|
|
5
|
+
import { MultiTaskCommand } from './multi-task-command.js';
|
|
6
6
|
export declare class ExecuteCommand extends MultiTaskCommand<ExecuteCommand.Options> {
|
|
7
7
|
readonly repository: Repository;
|
|
8
8
|
cmd: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import logger from 'npmlog';
|
|
2
1
|
import chalk from 'chalk';
|
|
3
|
-
import
|
|
2
|
+
import logger from 'npmlog';
|
|
4
3
|
import { Task } from 'power-tasks';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { Command } from '../core/command.js';
|
|
5
|
+
import { exec } from '../utils/exec.js';
|
|
6
|
+
import { MultiTaskCommand } from './multi-task-command.js';
|
|
7
7
|
export class ExecuteCommand extends MultiTaskCommand {
|
|
8
8
|
constructor(repository, cmd, argv, options) {
|
|
9
9
|
super(repository, options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import yargs from 'yargs';
|
|
2
|
-
import { Command } from '../core/command';
|
|
3
|
-
import { Repository } from '../core/repository';
|
|
2
|
+
import { Command } from '../core/command.js';
|
|
3
|
+
import { Repository } from '../core/repository.js';
|
|
4
4
|
export declare class InfoCommand extends Command {
|
|
5
5
|
static commandName: string;
|
|
6
6
|
protected _execute(): Promise<any>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import envinfo from 'envinfo';
|
|
3
3
|
import semver from 'semver';
|
|
4
|
-
import { Command } from '
|
|
4
|
+
import { Command } from '../core/command.js';
|
|
5
5
|
export class InfoCommand extends Command {
|
|
6
6
|
async _execute() {
|
|
7
7
|
const systemInfo = JSON.parse(await envinfo.run({
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
1
|
import EasyTable from 'easy-table';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { Package } from '../core/package';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { Command } from '../core/command.js';
|
|
4
|
+
import { Package } from '../core/package.js';
|
|
5
|
+
import { Repository } from '../core/repository.js';
|
|
6
6
|
export declare class ListCommand<TOptions extends ListCommand.Options = ListCommand.Options> extends Command<TOptions> {
|
|
7
7
|
readonly repository: Repository;
|
|
8
8
|
static commandName: string;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import chalk from 'chalk';
|
|
3
2
|
import EasyTable from 'easy-table';
|
|
4
3
|
import logger from 'npmlog';
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
4
|
+
import path from 'path';
|
|
5
|
+
import { Command } from '../core/command.js';
|
|
6
|
+
import { GitHelper } from '../utils/git-utils.js';
|
|
7
7
|
export class ListCommand extends Command {
|
|
8
8
|
constructor(repository, options) {
|
|
9
9
|
super(options);
|
|
@@ -83,6 +83,7 @@ export class ListCommand extends Command {
|
|
|
83
83
|
}
|
|
84
84
|
else if (table.rows.length) {
|
|
85
85
|
logger.output('', '%s', table.toString().trim());
|
|
86
|
+
// eslint-disable-next-line no-console
|
|
86
87
|
console.log('');
|
|
87
88
|
logger.info('list', '%i Package(s) found', count);
|
|
88
89
|
return arr;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
1
|
import { Task } from 'power-tasks';
|
|
3
|
-
import
|
|
4
|
-
import { Command } from '../core/command';
|
|
5
|
-
import { Package } from '../core/package';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { Command } from '../core/command.js';
|
|
4
|
+
import { Package } from '../core/package.js';
|
|
5
|
+
import { Repository } from '../core/repository.js';
|
|
6
6
|
export declare abstract class MultiTaskCommand<TOptions extends MultiTaskCommand.Options = MultiTaskCommand.Options> extends Command<TOptions> {
|
|
7
7
|
readonly repository: Repository;
|
|
8
8
|
protected _task?: Task;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import os from 'os';
|
|
2
|
-
import logger from 'npmlog';
|
|
3
2
|
import { Task } from 'power-tasks';
|
|
4
3
|
import { toNumber } from 'putil-varhelpers';
|
|
5
|
-
import { Command } from '
|
|
6
|
-
import { isTTY } from '
|
|
4
|
+
import { Command } from '../core/command.js';
|
|
5
|
+
import { isTTY } from '../core/constants.js';
|
|
7
6
|
export class MultiTaskCommand extends Command {
|
|
8
7
|
constructor(repository, options) {
|
|
9
8
|
super(options);
|
|
@@ -19,7 +18,6 @@ export class MultiTaskCommand extends Command {
|
|
|
19
18
|
const packages = await this._getPackages();
|
|
20
19
|
const childTasks = await this._prepareTasks(packages);
|
|
21
20
|
if (!(childTasks && childTasks.length)) {
|
|
22
|
-
logger.info(this.commandName, '', 'There is no task to process');
|
|
23
21
|
return;
|
|
24
22
|
}
|
|
25
23
|
// this.enableProgress();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
1
|
import { Task } from 'power-tasks';
|
|
3
|
-
import
|
|
4
|
-
import { Package } from '../core/package';
|
|
5
|
-
import {
|
|
6
|
-
import { ExecuteCommandResult } from '../utils/exec';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { Package } from '../core/package.js';
|
|
4
|
+
import { Repository } from '../core/repository.js';
|
|
5
|
+
import { ExecuteCommandResult } from '../utils/exec.js';
|
|
6
|
+
import { RunCommand } from './run-command.js';
|
|
7
7
|
export declare class PublishCommand extends RunCommand<PublishCommand.Options> {
|
|
8
8
|
readonly repository: Repository;
|
|
9
9
|
static commandName: string;
|
|
@@ -21,6 +21,7 @@ export declare namespace PublishCommand {
|
|
|
21
21
|
interface Options extends RunCommand.Options {
|
|
22
22
|
contents?: string;
|
|
23
23
|
access?: string;
|
|
24
|
+
checkOnly?: boolean;
|
|
24
25
|
}
|
|
25
26
|
const cliCommandOptions: Record<string, yargs.Options>;
|
|
26
27
|
function initCli(repository: Repository, program: yargs.Argv): void;
|
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import logger from 'npmlog';
|
|
3
|
-
import { Command } from './../core/command.mjs';
|
|
4
|
-
import { RunCommand } from './run-command.mjs';
|
|
5
3
|
import path from 'path';
|
|
6
|
-
import {
|
|
4
|
+
import { Command } from '../core/command.js';
|
|
5
|
+
import { NpmHelper } from '../utils/npm-utils.js';
|
|
6
|
+
import { RunCommand } from './run-command.js';
|
|
7
7
|
export class PublishCommand extends RunCommand {
|
|
8
8
|
constructor(repository, options) {
|
|
9
|
-
super(repository, 'publish',
|
|
9
|
+
super(repository, 'publish', {
|
|
10
|
+
...options,
|
|
11
|
+
bail: false,
|
|
12
|
+
parallel: true
|
|
13
|
+
});
|
|
10
14
|
this.repository = repository;
|
|
11
15
|
}
|
|
12
16
|
async _prepareTasks(packages) {
|
|
13
17
|
const newVersions = {};
|
|
14
18
|
const selectedPackages = [];
|
|
19
|
+
const promises = [];
|
|
15
20
|
for (const p of packages) {
|
|
16
21
|
const logPkgName = chalk.yellow(p.name);
|
|
17
22
|
if (p.json.private) {
|
|
@@ -19,20 +24,31 @@ export class PublishCommand extends RunCommand {
|
|
|
19
24
|
continue;
|
|
20
25
|
}
|
|
21
26
|
logger.info(this.commandName, logPkgName, logger.separator, `Fetching package information from repository`);
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
27
|
+
const npmHelper = new NpmHelper({ cwd: p.dirname });
|
|
28
|
+
promises.push(npmHelper.getPackageInfo(p.json.name)
|
|
29
|
+
.then(r => {
|
|
30
|
+
const sameVersion = !!(r && r.version === p.version);
|
|
31
|
+
if (this.options.checkOnly) {
|
|
32
|
+
logger.info(this.commandName, logPkgName, logger.separator, !r.version
|
|
33
|
+
? chalk.yellow('No package information found in repository')
|
|
34
|
+
: (sameVersion
|
|
35
|
+
? `Version "${chalk.magenta(p.version)}" same in repository`
|
|
36
|
+
: `Version "${chalk.magenta(p.version)}" differs from version in repository (${chalk.magenta(r.version)})`));
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
25
39
|
if (r && r.version === p.version) {
|
|
26
40
|
logger.info(this.commandName, logPkgName, logger.separator, `Ignored. Same version (${p.version}) in repository`);
|
|
27
|
-
continue;
|
|
28
41
|
}
|
|
29
|
-
|
|
30
|
-
|
|
42
|
+
else {
|
|
43
|
+
logger.info(this.commandName, logPkgName, logger.separator, `Version (${r.version}) in repository`);
|
|
44
|
+
selectedPackages.push(p);
|
|
45
|
+
}
|
|
46
|
+
}).catch(e => {
|
|
31
47
|
if (e.name !== 'PackageNotFoundError')
|
|
32
48
|
throw e;
|
|
33
|
-
}
|
|
34
|
-
selectedPackages.push(p);
|
|
49
|
+
}));
|
|
35
50
|
}
|
|
51
|
+
await Promise.all(promises);
|
|
36
52
|
return super._prepareTasks(selectedPackages, { newVersions });
|
|
37
53
|
}
|
|
38
54
|
async _exec(args, options) {
|
|
@@ -68,6 +84,10 @@ PublishCommand.commandName = 'publish';
|
|
|
68
84
|
'you must publish with --access public to publish scoped packages.',
|
|
69
85
|
type: 'string',
|
|
70
86
|
choices: ['public', 'restricted']
|
|
87
|
+
},
|
|
88
|
+
'check-only': {
|
|
89
|
+
describe: '# Only performs version checking and do not apply "publish" to the registry.',
|
|
90
|
+
type: 'boolean'
|
|
71
91
|
}
|
|
72
92
|
};
|
|
73
93
|
function initCli(repository, program) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
1
|
import { Task } from 'power-tasks';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { Package } from '../core/package.js';
|
|
4
|
+
import { Repository } from '../core/repository.js';
|
|
5
|
+
import { ExecuteCommandResult } from '../utils/exec.js';
|
|
6
|
+
import { MultiTaskCommand } from './multi-task-command.js';
|
|
7
7
|
export declare class RunCommand<TOptions extends RunCommand.Options> extends MultiTaskCommand<TOptions> {
|
|
8
8
|
readonly repository: Repository;
|
|
9
9
|
script: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
1
2
|
import logger from 'npmlog';
|
|
2
3
|
import { Task } from 'power-tasks';
|
|
3
|
-
import chalk from 'chalk';
|
|
4
4
|
import parseNpmScript from '@netlify/parse-npm-script';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { Command } from '../core/command.js';
|
|
6
|
+
import { exec } from '../utils/exec.js';
|
|
7
|
+
import { MultiTaskCommand } from './multi-task-command.js';
|
|
8
8
|
export class RunCommand extends MultiTaskCommand {
|
|
9
9
|
constructor(repository, script, options) {
|
|
10
10
|
super(repository, options);
|
|
@@ -87,7 +87,7 @@ export class RunCommand extends MultiTaskCommand {
|
|
|
87
87
|
if (logLevel)
|
|
88
88
|
logger.verbose(this.commandName, chalk.cyan(args.name), chalk.cyanBright.bold('executing'), logger.separator, args.command);
|
|
89
89
|
const t = Date.now();
|
|
90
|
-
const r = await exec(args.command, { cwd: args.cwd, stdio: args.stdio });
|
|
90
|
+
const r = await exec(args.command, { cwd: args.cwd, stdio: args.stdio, throwOnError: false });
|
|
91
91
|
if (logLevel)
|
|
92
92
|
if (r.error) {
|
|
93
93
|
logger.error(this.commandName, chalk.cyan(args.name), chalk.red.bold('failed'), logger.separator, args.command, logger.separator, r.error.message.trim() + ('\n' + r.stdout).trim());
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import yargs from 'yargs';
|
|
2
1
|
import { Task } from 'power-tasks';
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExecuteCommandResult } from '../utils/exec';
|
|
2
|
+
import yargs from 'yargs';
|
|
3
|
+
import { Package } from '../core/package.js';
|
|
4
|
+
import { Repository } from '../core/repository.js';
|
|
5
|
+
import { ExecuteCommandResult } from '../utils/exec.js';
|
|
6
|
+
import { RunCommand } from './run-command.js';
|
|
7
7
|
export declare class VersionCommand extends RunCommand<VersionCommand.Options> {
|
|
8
8
|
readonly repository: Repository;
|
|
9
9
|
bump: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import path from 'path';
|
|
2
1
|
import chalk from 'chalk';
|
|
3
|
-
import
|
|
2
|
+
import fs from 'fs/promises';
|
|
4
3
|
import logger from 'npmlog';
|
|
5
|
-
import
|
|
4
|
+
import path from 'path';
|
|
6
5
|
import { Task } from 'power-tasks';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { Command } from '
|
|
10
|
-
import
|
|
6
|
+
import semver from 'semver';
|
|
7
|
+
import stripColor from 'strip-color';
|
|
8
|
+
import { Command } from '../core/command.js';
|
|
9
|
+
import { GitHelper } from '../utils/git-utils.js';
|
|
10
|
+
import { RunCommand } from './run-command.js';
|
|
11
11
|
export class VersionCommand extends RunCommand {
|
|
12
12
|
constructor(repository, bump, options) {
|
|
13
13
|
super(repository, 'version', options);
|
package/esm/core/command.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import npmlog from 'npmlog';
|
|
3
|
-
import isCi from 'is-ci';
|
|
4
|
-
import merge from 'putil-merge';
|
|
5
|
-
import './logger.mjs';
|
|
6
|
-
import { isTTY } from './constants.mjs';
|
|
1
|
+
import './logger.js';
|
|
7
2
|
import chalk from 'chalk';
|
|
8
3
|
import figures from 'figures';
|
|
4
|
+
import isCi from 'is-ci';
|
|
5
|
+
import npmlog from 'npmlog';
|
|
6
|
+
import merge from 'putil-merge';
|
|
7
|
+
import { AsyncEventEmitter, TypedEventEmitterClass } from 'strict-typed-events';
|
|
8
|
+
import { isTTY } from './constants.js';
|
|
9
9
|
const noOp = () => void (0);
|
|
10
10
|
export class Command extends TypedEventEmitterClass(AsyncEventEmitter) {
|
|
11
11
|
constructor(options) {
|
package/esm/core/constants.d.ts
CHANGED
|
File without changes
|
|
File without changes
|
package/esm/core/repository.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import glob from 'fast-glob';
|
|
1
2
|
import fs from 'fs';
|
|
3
|
+
import yaml from 'js-yaml';
|
|
2
4
|
import path from 'path';
|
|
3
|
-
import glob from 'fast-glob';
|
|
4
5
|
import merge from 'putil-merge';
|
|
5
|
-
import
|
|
6
|
-
import { Package } from './package.
|
|
7
|
-
import { getPackageJson } from './../utils/get-dirname.mjs';
|
|
6
|
+
import { getPackageJson } from '../utils/get-dirname.js';
|
|
7
|
+
import { Package } from './package.js';
|
|
8
8
|
export class Repository extends Package {
|
|
9
9
|
constructor(dirname, config, packages) {
|
|
10
10
|
super(dirname);
|
package/esm/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './core/repository';
|
|
1
|
+
export * from './core/repository.js';
|
package/esm/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core/repository.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
2
|
import onExit from 'signal-exit';
|
|
3
|
-
import { npmRunPathEnv } from './npm-run-path.
|
|
3
|
+
import { npmRunPathEnv } from './npm-run-path.js';
|
|
4
4
|
const runningChildren = new Map();
|
|
5
5
|
export async function exec(command, options) {
|
|
6
6
|
const opts = {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import fsa from 'fs/promises';
|
|
3
2
|
import { Stats } from 'node:fs';
|
|
4
3
|
export declare function fsExists(s: string): Promise<boolean>;
|
|
5
4
|
export declare function tryStat(s: any): Promise<Stats | undefined>;
|
|
6
|
-
export declare const fsReadFile: typeof fsa.readFile;
|
|
7
5
|
export declare function fsDelete(fileOrDir: string): Promise<boolean>;
|
|
@@ -6,7 +6,6 @@ export async function fsExists(s) {
|
|
|
6
6
|
export async function tryStat(s) {
|
|
7
7
|
return fsa.lstat(s).catch(() => undefined);
|
|
8
8
|
}
|
|
9
|
-
export const fsReadFile = fsa.readFile;
|
|
10
9
|
export async function fsDelete(fileOrDir) {
|
|
11
10
|
const stat = await tryStat(fileOrDir);
|
|
12
11
|
if (stat) {
|