@gluhar/cli 6.0.0-next.1 → 6.0.0-next.10
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/package.json +2 -3
- package/src/commands/build/build.d.ts.map +1 -1
- package/src/commands/build/build.js +15 -3
- package/src/commands/generate/GenerateOptions.d.ts +2 -1
- package/src/commands/generate/GenerateOptions.d.ts.map +1 -1
- package/src/commands/generate/generateProject.d.ts.map +1 -1
- package/src/commands/generate/generateProject.js +3 -1
- package/src/commands/upgrade/UpgradeOptions.d.ts +2 -0
- package/src/commands/upgrade/UpgradeOptions.d.ts.map +1 -1
- package/src/commands/upgrade/index.d.ts.map +1 -1
- package/src/commands/upgrade/index.js +1 -0
- package/src/commands/upgrade/upgrade.d.ts.map +1 -1
- package/src/commands/upgrade/upgrade.js +81 -10
- package/src/scripts/cmd/executeBash.d.ts +1 -1
- package/src/scripts/cmd/executeBash.d.ts.map +1 -1
- package/src/scripts/cmd/executeBash.js +2 -1
- package/src/scripts/cmd/executeCmd.d.ts +1 -1
- package/src/scripts/cmd/executeCmd.d.ts.map +1 -1
- package/src/scripts/cmd/parseArgs.d.ts +6 -1
- package/src/scripts/cmd/parseArgs.d.ts.map +1 -1
- package/src/scripts/cmd/parseArgs.js +10 -2
- package/src/scripts/cmd/parseBashArgs.d.ts +1 -1
- package/src/scripts/cmd/parseBashArgs.d.ts.map +1 -1
- package/src/scripts/cmd/parseBashArgs.js +2 -2
- package/src/scripts/git/branch/checkout.d.ts +1 -1
- package/src/scripts/git/branch/checkout.d.ts.map +1 -1
- package/src/scripts/git/index.d.ts +7 -7
- package/src/scripts/git/tag/createTag.d.ts +1 -1
- package/src/scripts/git/tag/createTag.d.ts.map +1 -1
- package/src/scripts/git/tag/pushAllTags.d.ts +1 -1
- package/src/scripts/git/tag/pushAllTags.d.ts.map +1 -1
- package/src/scripts/lerna/index.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gluhar/cli",
|
|
3
|
-
"version": "6.0.0-next.
|
|
3
|
+
"version": "6.0.0-next.10",
|
|
4
4
|
"description": "Gluhar cli commands and scripts",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -8,8 +8,7 @@
|
|
|
8
8
|
"directory": "packages/cli"
|
|
9
9
|
},
|
|
10
10
|
"exports": {
|
|
11
|
-
".": "./src/index.
|
|
12
|
-
"./*": "./src/*/index.ts"
|
|
11
|
+
".": "./src/index.js"
|
|
13
12
|
},
|
|
14
13
|
"main": "./src/index.js",
|
|
15
14
|
"bin": {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../../src/commands/build/build.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAG9C,eAAO,MAAM,KAAK,GAAI,SAAS,YAAY,SAmC1C,CAAC"}
|
|
@@ -1,22 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.build = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
4
5
|
const cmd_1 = require("../../scripts/cmd");
|
|
5
6
|
const log_1 = require("./log");
|
|
6
7
|
const build = (options) => {
|
|
7
8
|
const { type } = options;
|
|
8
9
|
// INFO Nuxt modules need a structure of [pkg.json, dist/] to function properly where as my release script needs all pkgs to be released from a dist folder
|
|
9
10
|
if (type === "module") {
|
|
11
|
+
// The package's own builder, not whatever `nuxt-module-build` is first on PATH: the CLI runs
|
|
12
|
+
// through the root workspace, whose .bin holds @nuxtjs/device's module-builder 0.8.3 (Nuxt 3).
|
|
13
|
+
// Every 6.0.0-next.* up to .1 was built with it instead of the declared ^1. npm only nests ^1
|
|
14
|
+
// under each package while that conflict lasts; once it can hoist ^1, the root bin is right.
|
|
15
|
+
const local = "./node_modules/.bin/nuxt-module-build";
|
|
16
|
+
const builder = (0, fs_1.existsSync)(local) ? local : "nuxt-module-build";
|
|
17
|
+
// Every module's tsconfig extends ./.nuxt/tsconfig.json, which only `prepare` generates.
|
|
18
|
+
// Locally `dev:prepare` has always run; on a clean CI checkout it hasn't, the build
|
|
19
|
+
// fails, and an empty dist used to get published (6.0.0-next.1).
|
|
20
|
+
log_1.log.info("Prepare nuxt module types");
|
|
21
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)(`${builder} prepare`), "nuxt-module-build prepare");
|
|
10
22
|
log_1.log.info("Build nuxt module in dist");
|
|
11
|
-
(0, cmd_1.executeCmd)("nuxt-module-build build");
|
|
23
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)(`${builder} build`), "nuxt-module-build build");
|
|
12
24
|
log_1.log.info("Copy contents of dist on level down");
|
|
13
|
-
(0, cmd_1.executeCmd)('copyfiles "dist/**/*" dist');
|
|
25
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)('copyfiles "dist/**/*" dist'), "copyfiles dist");
|
|
14
26
|
// log.info("Delete the copied files");
|
|
15
27
|
// executeCmd(
|
|
16
28
|
// "find ./dist -mindepth 1 ! -path './dist/dist*' -exec rm -rf {} +"
|
|
17
29
|
// );
|
|
18
30
|
log_1.log.info("Copy pkg.json and mds to dist as well");
|
|
19
|
-
(0, cmd_1.executeCmd)("copyfiles package.json README.md CHANGELOG.md dist");
|
|
31
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)("copyfiles package.json README.md CHANGELOG.md dist"), "copyfiles package.json");
|
|
20
32
|
}
|
|
21
33
|
};
|
|
22
34
|
exports.build = build;
|
|
@@ -2,7 +2,8 @@ export declare const generateTypes: readonly ["project", "package", "command"];
|
|
|
2
2
|
export type GenerateType = (typeof generateTypes)[number];
|
|
3
3
|
export interface GenerateOptions {
|
|
4
4
|
starter?: string;
|
|
5
|
-
|
|
5
|
+
/** `--no-repo` sets this to false (commander's negatable option); default true. */
|
|
6
|
+
repo?: boolean;
|
|
6
7
|
keepHistory?: boolean;
|
|
7
8
|
yes: boolean;
|
|
8
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/GenerateOptions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,4CAA6C,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,
|
|
1
|
+
{"version":3,"file":"GenerateOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/GenerateOptions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,4CAA6C,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,mFAAmF;IACnF,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;CACd"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateProject.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/generateProject.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,KAAK,MAAM,EACX,SAAS,eAAe,
|
|
1
|
+
{"version":3,"file":"generateProject.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/generateProject.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,KAAK,MAAM,EACX,SAAS,eAAe,kBA0GzB,CAAC"}
|
|
@@ -9,7 +9,9 @@ const cmd_1 = require("../../scripts/cmd");
|
|
|
9
9
|
const utils_1 = require("../../utils");
|
|
10
10
|
const generateProject = async (name, cwd, options) => {
|
|
11
11
|
// `dev` is the starters' main branch; others (e.g. `mobile`) are variants.
|
|
12
|
-
const { starter = "dev",
|
|
12
|
+
const { starter = "dev", repo = true, keepHistory, yes } = options;
|
|
13
|
+
// `--no-repo` arrives as `repo: false`; there is no `noRepo` key
|
|
14
|
+
const noRepo = !repo;
|
|
13
15
|
log_1.log.verbose("Check if project name is valid");
|
|
14
16
|
if (!name.match(/^[a-z0-9-]+$/)) {
|
|
15
17
|
log_1.log.error("Project name must be lowercase, alphanumeric, and contain hyphens only.");
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
export interface UpgradeOptions {
|
|
2
2
|
/** npm dist-tag or version to install, e.g. `latest`, `next`, `6`. */
|
|
3
3
|
tag: string;
|
|
4
|
+
/** Print the planned package.json changes without writing or installing. */
|
|
5
|
+
dryRun?: boolean;
|
|
4
6
|
}
|
|
5
7
|
//# sourceMappingURL=UpgradeOptions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpgradeOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/upgrade/UpgradeOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"UpgradeOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/upgrade/UpgradeOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,sEAAsE;IACtE,GAAG,EAAE,MAAM,CAAC;IACZ,4EAA4E;IAC5E,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;;AAGpC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/upgrade/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;;AAGpC,wBAUmB"}
|
|
@@ -6,4 +6,5 @@ exports.default = new commander_1.Command()
|
|
|
6
6
|
.name("upgrade")
|
|
7
7
|
.description("Upgrade all @gluhar/* dependencies in a project, across major versions.")
|
|
8
8
|
.option("-t, --tag <tag>", "npm dist-tag or version to install.", "latest")
|
|
9
|
+
.option("-d, --dry-run", "Print the planned package.json changes without writing or installing.")
|
|
9
10
|
.action(upgrade_1.upgrade);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../../src/commands/upgrade/upgrade.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../../../../src/commands/upgrade/upgrade.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAyClD,eAAO,MAAM,OAAO,GAAI,SAAS,cAAc,SAyE9C,CAAC"}
|
|
@@ -3,20 +3,91 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.upgrade = void 0;
|
|
4
4
|
const fs_1 = require("fs");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
+
const semver_1 = require("semver");
|
|
6
7
|
const cmd_1 = require("../../scripts/cmd");
|
|
7
8
|
const log_1 = require("./log");
|
|
9
|
+
const fields = ["dependencies", "devDependencies"];
|
|
10
|
+
/** The version a tag or range resolves to on npm, with that version's peers. */
|
|
11
|
+
const resolve = (name, tag) => {
|
|
12
|
+
const output = JSON.parse((0, cmd_1.getCmdOutput)(`npm view ${name}@${tag} version peerDependencies --json`));
|
|
13
|
+
// A single field comes back as a bare string; a range (`6`) as an array
|
|
14
|
+
// of matches, oldest first
|
|
15
|
+
const latest = Array.isArray(output) ? output[output.length - 1] : output;
|
|
16
|
+
return typeof latest === "string" ? { version: latest } : latest;
|
|
17
|
+
};
|
|
18
|
+
/** The version npm installed, else the lowest the range in package.json allows. */
|
|
19
|
+
const currentVersion = (cwd, name, range) => {
|
|
20
|
+
const installed = (0, path_1.join)(cwd, "node_modules", name, "package.json");
|
|
21
|
+
if (!(0, fs_1.existsSync)(installed))
|
|
22
|
+
return (0, semver_1.minVersion)(range)?.version;
|
|
23
|
+
const { version } = JSON.parse((0, fs_1.readFileSync)(installed).toString());
|
|
24
|
+
return version;
|
|
25
|
+
};
|
|
26
|
+
/** Of several ranges, the one whose lowest version is highest. */
|
|
27
|
+
const strictest = (ranges) => ranges.reduce((a, b) => {
|
|
28
|
+
const [minA, minB] = [(0, semver_1.minVersion)(a), (0, semver_1.minVersion)(b)];
|
|
29
|
+
return minA && minB && minB.compare(minA) > 0 ? b : a;
|
|
30
|
+
});
|
|
8
31
|
const upgrade = (options) => {
|
|
9
|
-
const { tag } = options;
|
|
10
|
-
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
const { tag, dryRun } = options;
|
|
33
|
+
const cwd = process.cwd();
|
|
34
|
+
const pkgPath = (0, path_1.join)(cwd, "package.json");
|
|
35
|
+
const source = (0, fs_1.readFileSync)(pkgPath).toString();
|
|
36
|
+
const pkg = JSON.parse(source);
|
|
37
|
+
// The dependency map that lists `name` (dependencies or devDependencies)
|
|
38
|
+
const depsOf = (name) => fields
|
|
39
|
+
.map((field) => pkg[field])
|
|
40
|
+
.find((deps) => deps?.[name] !== undefined);
|
|
41
|
+
const names = fields
|
|
42
|
+
.flatMap((field) => Object.keys(pkg[field] ?? {}))
|
|
43
|
+
.filter((name) => name.startsWith("@gluhar/"));
|
|
16
44
|
if (!names.length)
|
|
17
45
|
return log_1.log.info("No @gluhar/* dependencies found.");
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
46
|
+
log_1.log.info(`Upgrading gluhar dependencies to "${tag}".`);
|
|
47
|
+
const changes = new Map();
|
|
48
|
+
const peerRanges = new Map();
|
|
49
|
+
for (const name of names) {
|
|
50
|
+
const { version, peerDependencies = {} } = resolve(name, tag);
|
|
51
|
+
changes.set(name, `^${version}`);
|
|
52
|
+
for (const [peer, range] of Object.entries(peerDependencies))
|
|
53
|
+
peerRanges.set(peer, [...(peerRanges.get(peer) ?? []), range]);
|
|
54
|
+
}
|
|
55
|
+
// A peer the project depends on directly (in practice `nuxt`) has to move in
|
|
56
|
+
// the same install. `npm install @gluhar/*@<tag>` alone fails with ERESOLVE:
|
|
57
|
+
// the old nuxt pins its own @nuxt/vite-builder exactly, so npm won't replace
|
|
58
|
+
// nuxt unless package.json already asks for the new range.
|
|
59
|
+
for (const [peer, ranges] of peerRanges) {
|
|
60
|
+
const deps = depsOf(peer);
|
|
61
|
+
if (!deps || peer.startsWith("@gluhar/"))
|
|
62
|
+
continue;
|
|
63
|
+
const current = currentVersion(cwd, peer, deps[peer]);
|
|
64
|
+
const opts = { includePrerelease: true };
|
|
65
|
+
if (current && ranges.every((range) => (0, semver_1.satisfies)(current, range, opts)))
|
|
66
|
+
continue;
|
|
67
|
+
changes.set(peer, strictest(ranges));
|
|
68
|
+
}
|
|
69
|
+
for (const [name, range] of changes) {
|
|
70
|
+
const deps = depsOf(name);
|
|
71
|
+
if (!deps || deps[name] === range)
|
|
72
|
+
continue;
|
|
73
|
+
const note = name.startsWith("@gluhar/") ? "" : " (peer of @gluhar/*)";
|
|
74
|
+
log_1.log.info(`${name}: ${deps[name]} -> ${range}${note}`);
|
|
75
|
+
deps[name] = range;
|
|
76
|
+
}
|
|
77
|
+
if (dryRun)
|
|
78
|
+
return log_1.log.info("Dry run: package.json not written.");
|
|
79
|
+
const indent = source.match(/^[ \t]+/m)?.[0] ?? " ";
|
|
80
|
+
(0, fs_1.writeFileSync)(pkgPath, `${JSON.stringify(pkg, null, indent)}\n`);
|
|
81
|
+
// A plain install with the existing lockfile: npm re-resolves only what the
|
|
82
|
+
// new ranges require
|
|
83
|
+
const result = (0, cmd_1.executeCmd)("npm install");
|
|
84
|
+
if (result.status !== 0) {
|
|
85
|
+
log_1.log.error("npm install failed. package.json already has the new ranges; if it is still ERESOLVE, delete package-lock.json and node_modules and run npm install.");
|
|
86
|
+
process.exit(result.status || 1);
|
|
87
|
+
}
|
|
88
|
+
const studioPkg = (0, path_1.join)(cwd, "sanity", "package.json");
|
|
89
|
+
if ((0, fs_1.existsSync)(studioPkg) &&
|
|
90
|
+
(0, fs_1.readFileSync)(studioPkg).toString().includes('"@gluhar/'))
|
|
91
|
+
log_1.log.info("The Studio in sanity/ has its own @gluhar/* dependencies: run `gluhar upgrade` there too.");
|
|
21
92
|
};
|
|
22
93
|
exports.upgrade = upgrade;
|
|
@@ -6,5 +6,5 @@ import type { Args } from './types';
|
|
|
6
6
|
* @param absolute Flag if you are providing an absolute path.
|
|
7
7
|
* @returns Executes the bash script file in the same stdio.
|
|
8
8
|
*/
|
|
9
|
-
export declare const executeBash: (path: string, args?: Args, absolute?: boolean) => import("child_process").SpawnSyncReturns<
|
|
9
|
+
export declare const executeBash: (path: string, args?: Args, absolute?: boolean) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
10
10
|
//# sourceMappingURL=executeBash.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeBash.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeBash.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,IAAI,EAAE,WAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"executeBash.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeBash.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpC;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,OAAO,IAAI,EAAE,WAAW,OAAO,8DASxE,CAAC"}
|
|
@@ -11,7 +11,8 @@ const parseBashArgs_1 = require("./parseBashArgs");
|
|
|
11
11
|
* @returns Executes the bash script file in the same stdio.
|
|
12
12
|
*/
|
|
13
13
|
const executeBash = (path, args, absolute) => {
|
|
14
|
-
|
|
14
|
+
// An argv array, not a shell line: values must not be quoted
|
|
15
|
+
const bashArgs = (0, parseBashArgs_1.parseBashArgs)(path, args, absolute, false);
|
|
15
16
|
// TODO make stdio configurable
|
|
16
17
|
// TODO make an async option
|
|
17
18
|
return (0, child_process_1.spawnSync)('bash', bashArgs, {
|
|
@@ -5,5 +5,5 @@ import type { Args } from './types';
|
|
|
5
5
|
* @param args Option flags to pass to the script: { m: 'Message', msg: 'asdf' }.
|
|
6
6
|
* @returns Executes the bash script in the same stdio.
|
|
7
7
|
*/
|
|
8
|
-
export declare const executeCmd: (cmd: string, args?: Args) => import("child_process").SpawnSyncReturns<
|
|
8
|
+
export declare const executeCmd: (cmd: string, args?: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
9
9
|
//# sourceMappingURL=executeCmd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"executeCmd.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeCmd.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,OAAO,IAAI,
|
|
1
|
+
{"version":3,"file":"executeCmd.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/executeCmd.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,OAAO,IAAI,8DASlD,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
import type { Args } from "./types";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* @param shell The result is joined into a shell command line, so values with spaces stay
|
|
4
|
+
* quoted. Pass `false` for an argv array (`spawnSync` without a shell), where quotes would
|
|
5
|
+
* end up in the value itself.
|
|
6
|
+
*/
|
|
7
|
+
export declare const parseArgs: (args: Args, shell?: boolean) => string[];
|
|
3
8
|
//# sourceMappingURL=parseArgs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA+B,MAAM,SAAS,CAAC;AAQjE,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,KAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"parseArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAA+B,MAAM,SAAS,CAAC;AAQjE;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,IAAI,EAAE,eAAY,KAAG,MAAM,EAoC1D,CAAC"}
|
|
@@ -9,7 +9,12 @@ const hyphenize = (s) => humps_1.default.decamelize(s, { separator: "-" });
|
|
|
9
9
|
const hasValue = (arg) => {
|
|
10
10
|
return arg.value !== undefined;
|
|
11
11
|
};
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* @param shell The result is joined into a shell command line, so values with spaces stay
|
|
14
|
+
* quoted. Pass `false` for an argv array (`spawnSync` without a shell), where quotes would
|
|
15
|
+
* end up in the value itself.
|
|
16
|
+
*/
|
|
17
|
+
const parseArgs = (args, shell = true) => {
|
|
13
18
|
return Object.entries(args)
|
|
14
19
|
.map(([name, value]) => ({
|
|
15
20
|
name,
|
|
@@ -26,7 +31,10 @@ const parseArgs = (args) => {
|
|
|
26
31
|
result.push(`-${parsedName}`);
|
|
27
32
|
}
|
|
28
33
|
value.toString();
|
|
29
|
-
if (value !== true) {
|
|
34
|
+
if (value !== true && !shell) {
|
|
35
|
+
result.push(String(value));
|
|
36
|
+
}
|
|
37
|
+
else if (value !== true) {
|
|
30
38
|
let v = parsedValue;
|
|
31
39
|
if (v.length > 2 &&
|
|
32
40
|
v[0] === '"' &&
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Args } from './types';
|
|
2
|
-
export declare const parseBashArgs: (path: string, args?: Args, absolute?: boolean) => string[];
|
|
2
|
+
export declare const parseBashArgs: (path: string, args?: Args, absolute?: boolean, shell?: boolean) => string[];
|
|
3
3
|
//# sourceMappingURL=parseBashArgs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseBashArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseBashArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EACZ,OAAO,IAAI,EACX,WAAW,OAAO,
|
|
1
|
+
{"version":3,"file":"parseBashArgs.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/parseBashArgs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAGpC,eAAO,MAAM,aAAa,GACxB,MAAM,MAAM,EACZ,OAAO,IAAI,EACX,WAAW,OAAO,EAClB,eAAY,aAab,CAAC"}
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.parseBashArgs = void 0;
|
|
4
4
|
const log_1 = require("./log");
|
|
5
5
|
const parseArgs_1 = require("./parseArgs");
|
|
6
|
-
const parseBashArgs = (path, args, absolute) => {
|
|
6
|
+
const parseBashArgs = (path, args, absolute, shell = true) => {
|
|
7
7
|
const filePath = path.endsWith('.sh') ? path : `${path}.sh`;
|
|
8
8
|
const absolutePath = !absolute ? `${__dirname}/../${filePath}` : filePath;
|
|
9
9
|
const flags = [absolutePath];
|
|
10
10
|
if (args) {
|
|
11
|
-
flags.push(...(0, parseArgs_1.parseArgs)(args));
|
|
11
|
+
flags.push(...(0, parseArgs_1.parseArgs)(args, shell));
|
|
12
12
|
}
|
|
13
13
|
log_1.log.verbose('executeBash:', flags.join(' '));
|
|
14
14
|
return flags;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export interface CheckoutOptions {
|
|
2
2
|
newBranch?: boolean;
|
|
3
3
|
}
|
|
4
|
-
export declare const checkout: (branchName: string, opt?: CheckoutOptions) => import("child_process").SpawnSyncReturns<
|
|
4
|
+
export declare const checkout: (branchName: string, opt?: CheckoutOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
5
5
|
//# sourceMappingURL=checkout.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/branch/checkout.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,QAAQ,GAAI,YAAY,MAAM,EAAE,MAAK,eAAoB,
|
|
1
|
+
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/branch/checkout.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,eAAO,MAAM,QAAQ,GAAI,YAAY,MAAM,EAAE,MAAK,eAAoB,8DAYrE,CAAC"}
|
|
@@ -3,10 +3,10 @@ export declare const git: {
|
|
|
3
3
|
openPr: (sourceBranch: string, destinationBranch: string) => void;
|
|
4
4
|
getRepo: () => string;
|
|
5
5
|
remoteStatus: (branch?: string, upstream?: string) => import("./remoteStatus").RemoteStatus;
|
|
6
|
-
commit: (args: Args) => import("child_process").SpawnSyncReturns<
|
|
7
|
-
push: (branchOrTag: string, remote?: string) => import("child_process").SpawnSyncReturns<
|
|
8
|
-
pull: (branchName: string, remote?: string) => import("child_process").SpawnSyncReturns<
|
|
9
|
-
merge: (branchName: string, y?: boolean) => import("child_process").SpawnSyncReturns<
|
|
6
|
+
commit: (args: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
7
|
+
push: (branchOrTag: string, remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
8
|
+
pull: (branchName: string, remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
9
|
+
merge: (branchName: string, y?: boolean) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
10
10
|
branch: {
|
|
11
11
|
exists: (branchName: string) => {
|
|
12
12
|
local: boolean;
|
|
@@ -14,14 +14,14 @@ export declare const git: {
|
|
|
14
14
|
};
|
|
15
15
|
delete: (branch: string, options?: import("./branch/branchDelete").BranchDeleteOptions) => void;
|
|
16
16
|
getCurrent: () => import("./branch/getCurrentBranch").BranchInfo;
|
|
17
|
-
checkout: (branchName: string, opt?: import("./branch/checkout").CheckoutOptions) => import("child_process").SpawnSyncReturns<
|
|
17
|
+
checkout: (branchName: string, opt?: import("./branch/checkout").CheckoutOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
18
18
|
};
|
|
19
19
|
tag: {
|
|
20
20
|
getAll: () => string[];
|
|
21
|
-
create: (name: string, options?: import("./tag/createTag").TagCreateOptions) => import("child_process").SpawnSyncReturns<
|
|
21
|
+
create: (name: string, options?: import("./tag/createTag").TagCreateOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
22
22
|
delete: (name: string) => void;
|
|
23
23
|
rename: (oldTagName: string, newTagName: string) => void;
|
|
24
|
-
pushAll: (remote?: string) => import("child_process").SpawnSyncReturns<
|
|
24
|
+
pushAll: (remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
25
25
|
};
|
|
26
26
|
clone: (repo: string, dir?: string, options?: import("./clone").CloneOptions) => void;
|
|
27
27
|
};
|
|
@@ -14,5 +14,5 @@ export interface TagCreateOptions {
|
|
|
14
14
|
* @param name The name of the tag to create.
|
|
15
15
|
* @param object The object that the new tag will refer to, usually a commit. Defaults to HEAD.
|
|
16
16
|
*/
|
|
17
|
-
export declare const createTag: (name: string, options?: TagCreateOptions) => import("child_process").SpawnSyncReturns<
|
|
17
|
+
export declare const createTag: (name: string, options?: TagCreateOptions) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
18
18
|
//# sourceMappingURL=createTag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTag.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/createTag.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,UAAS,gBAAqB,
|
|
1
|
+
{"version":3,"file":"createTag.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/createTag.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,EAAE,UAAS,gBAAqB,8DAOrE,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const pushAllTags: (remote?: string) => import("child_process").SpawnSyncReturns<
|
|
1
|
+
export declare const pushAllTags: (remote?: string) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
2
2
|
//# sourceMappingURL=pushAllTags.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pushAllTags.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/pushAllTags.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,eAAiB,
|
|
1
|
+
{"version":3,"file":"pushAllTags.d.ts","sourceRoot":"","sources":["../../../../../src/scripts/git/tag/pushAllTags.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW,GAAI,eAAiB,8DAGzC,CAAC"}
|
|
@@ -2,8 +2,8 @@ import { getDependencies } from './getDependencies';
|
|
|
2
2
|
import { filterByDependency } from './filterByDependency';
|
|
3
3
|
import type { Args } from '../cmd/types';
|
|
4
4
|
export declare const lerna: {
|
|
5
|
-
version: (args?: Args) => import("child_process").SpawnSyncReturns<
|
|
6
|
-
list: (args?: Args) => import("child_process").SpawnSyncReturns<
|
|
5
|
+
version: (args?: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
6
|
+
list: (args?: Args) => import("child_process").SpawnSyncReturns<NonSharedBuffer>;
|
|
7
7
|
changed: () => import("./types").LernaPackage[];
|
|
8
8
|
getConfig: () => import("./types").LernaConfig | null;
|
|
9
9
|
getDependencies: typeof getDependencies;
|