@gluhar/cli 3.1.5 → 6.0.0-next.1
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 +11 -5
- package/src/commands/generate/generateProject.d.ts.map +1 -1
- package/src/commands/generate/generateProject.js +3 -2
- package/src/commands/release/ReleaseOptions.d.ts +1 -1
- package/src/commands/release/ReleaseOptions.d.ts.map +1 -1
- package/src/commands/release/index.d.ts.map +1 -1
- package/src/commands/release/index.js +5 -2
- package/src/commands/release/publish.d.ts +5 -2
- package/src/commands/release/publish.d.ts.map +1 -1
- package/src/commands/release/publish.js +9 -12
- package/src/commands/release/release.d.ts.map +1 -1
- package/src/commands/release/release.js +8 -1
- package/src/commands/release/tag.d.ts.map +1 -1
- package/src/commands/release/tag.js +5 -2
- package/src/commands/upgrade/UpgradeOptions.d.ts +2 -1
- package/src/commands/upgrade/UpgradeOptions.d.ts.map +1 -1
- package/src/commands/upgrade/index.js +2 -2
- package/src/commands/upgrade/upgrade.d.ts.map +1 -1
- package/src/commands/upgrade/upgrade.js +14 -3
- package/src/commands/version/version.d.ts.map +1 -1
- package/src/commands/version/version.js +3 -1
- package/src/preAction.d.ts.map +1 -1
- package/src/preAction.js +7 -6
- package/src/scripts/cmd/exitOnFailure.d.ts +8 -0
- package/src/scripts/cmd/exitOnFailure.d.ts.map +1 -0
- package/src/scripts/cmd/exitOnFailure.js +20 -0
- package/src/scripts/cmd/index.d.ts +1 -0
- package/src/scripts/cmd/index.d.ts.map +1 -1
- package/src/scripts/cmd/index.js +1 -0
- package/src/scripts/git/index.d.ts +1 -1
- 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/createTag.js +1 -1
- package/src/scripts/lerna/index.d.ts +0 -1
- package/src/scripts/lerna/index.d.ts.map +1 -1
- package/src/scripts/lerna/index.js +0 -1
- package/src/scripts/lerna/publish.sh +0 -1
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gluhar/cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-next.1",
|
|
4
4
|
"description": "Gluhar cli commands and scripts",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/gluharco/gluhar.git",
|
|
8
|
+
"directory": "packages/cli"
|
|
9
|
+
},
|
|
5
10
|
"exports": {
|
|
6
11
|
".": "./src/index.ts",
|
|
7
12
|
"./*": "./src/*/index.ts"
|
|
8
13
|
},
|
|
9
14
|
"main": "./src/index.js",
|
|
10
15
|
"bin": {
|
|
11
|
-
"gluhar": "
|
|
16
|
+
"gluhar": "src/index.js"
|
|
12
17
|
},
|
|
13
18
|
"scripts": {
|
|
14
19
|
"clean": "rm -rf dist",
|
|
@@ -26,6 +31,7 @@
|
|
|
26
31
|
"inquirer": "^8.2.6",
|
|
27
32
|
"istextorbinary": "^9.5.0",
|
|
28
33
|
"npmlog": "^7.0.1",
|
|
34
|
+
"semver": "^7.8.5",
|
|
29
35
|
"shelljs": "^0.8.5",
|
|
30
36
|
"ts-morph": "^25.0.0"
|
|
31
37
|
},
|
|
@@ -36,13 +42,13 @@
|
|
|
36
42
|
"@types/humps": "^2.0.6",
|
|
37
43
|
"@types/inquirer": "^8.2.10",
|
|
38
44
|
"@types/istextorbinary": "^2.3.4",
|
|
39
|
-
"@types/node": "^
|
|
45
|
+
"@types/node": "^22.5.4",
|
|
40
46
|
"@types/npmlog": "^7.0.0",
|
|
47
|
+
"@types/semver": "^7.8.0",
|
|
41
48
|
"@types/shelljs": "^0.8.15",
|
|
42
49
|
"eslint": "^9.10.0",
|
|
43
50
|
"tsc-alias": "^1.8.10",
|
|
44
51
|
"tsconfig-paths": "^4.2.0",
|
|
45
52
|
"typescript": "^5.5.4"
|
|
46
|
-
}
|
|
47
|
-
"gitHead": "a60bf29f338bc3af3212a3a8ed647f75c69a2c4a"
|
|
53
|
+
}
|
|
48
54
|
}
|
|
@@ -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,kBAwGzB,CAAC"}
|
|
@@ -8,7 +8,8 @@ const common_1 = require("../../utils/common");
|
|
|
8
8
|
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", noRepo, keepHistory, yes } = options;
|
|
12
13
|
log_1.log.verbose("Check if project name is valid");
|
|
13
14
|
if (!name.match(/^[a-z0-9-]+$/)) {
|
|
14
15
|
log_1.log.error("Project name must be lowercase, alphanumeric, and contain hyphens only.");
|
|
@@ -42,7 +43,7 @@ const generateProject = async (name, cwd, options) => {
|
|
|
42
43
|
log_1.log.verbose("Skipping gh verification");
|
|
43
44
|
}
|
|
44
45
|
log_1.log.verbose("Cloning gluhar project template");
|
|
45
|
-
git_1.git.clone("
|
|
46
|
+
git_1.git.clone("gluharco/starters", name, { branch: starter });
|
|
46
47
|
cmd_1.cmd.cd(name);
|
|
47
48
|
log_1.log.verbose("Replacing gluhar-app with project's name");
|
|
48
49
|
await filesystem_1.filesystem.copyFiles([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReleaseOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/ReleaseOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,
|
|
1
|
+
{"version":3,"file":"ReleaseOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/ReleaseOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,OAAO,GAAG,MAAM,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;IACjB,MAAM,EAAE,OAAO,GAAG,MAAM,CAAC;CAC1B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;;AAIpC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;;AAIpC,wBAwCmB"}
|
|
@@ -5,11 +5,14 @@ const release_1 = require("./release");
|
|
|
5
5
|
const tag_1 = require("./tag");
|
|
6
6
|
exports.default = new commander_1.Command()
|
|
7
7
|
.name("release")
|
|
8
|
-
.description(
|
|
8
|
+
.description([
|
|
9
|
+
"Version packages, then tag and push. The `v*` tag triggers .github/workflows/release.yml,",
|
|
10
|
+
"which publishes to npm through trusted publishing (no OTP).",
|
|
11
|
+
].join("\n"))
|
|
9
12
|
.option("-y, --yes", "When run with this flag, we will skip all confirmation prompts. NOTE does not currently work.", false)
|
|
10
13
|
.option("--pre [id]", "Prerelease identifier. Use this when releasing a prerelease version.", false)
|
|
11
14
|
.option("-d, --dev", "Release a dev version. This is a shorthand for a prerelease with a 'dev' identifier.", false)
|
|
12
|
-
.option("--
|
|
15
|
+
.option("--publish", "Also publish from this machine with scripts/publish.mjs (npm asks for 2FA in the browser). Only needed for packages that aren't on npm yet, since trusted publishing can't be set up before a first publish.", false)
|
|
13
16
|
.option("--no-version", "Disable versioning and changelog gen.")
|
|
14
17
|
.option("--git-tag [tag]", [
|
|
15
18
|
"Create and push git tag(s). Optionally provide a template.",
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Publishes from this machine with the same script CI runs. Plain `npm publish` handles
|
|
3
|
+
* passkey 2FA in the browser, which lerna's OTP prompt can't. Run from the monorepo root.
|
|
4
|
+
*/
|
|
5
|
+
export declare const publish: () => void;
|
|
3
6
|
//# sourceMappingURL=publish.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/publish.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/publish.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,OAAO,YAInB,CAAC"}
|
|
@@ -1,18 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.publish = void 0;
|
|
4
|
-
const
|
|
4
|
+
const cmd_1 = require("../../scripts/cmd");
|
|
5
5
|
const log_1 = require("./log");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
log_1.log.info("
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
contents: directory,
|
|
15
|
-
yes,
|
|
16
|
-
});
|
|
6
|
+
/**
|
|
7
|
+
* Publishes from this machine with the same script CI runs. Plain `npm publish` handles
|
|
8
|
+
* passkey 2FA in the browser, which lerna's OTP prompt can't. Run from the monorepo root.
|
|
9
|
+
*/
|
|
10
|
+
const publish = () => {
|
|
11
|
+
log_1.log.info("Building and publishing from this machine (npm will ask for 2FA).");
|
|
12
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)("npm run build"), "npm run build");
|
|
13
|
+
(0, cmd_1.exitOnFailure)((0, cmd_1.executeCmd)("node scripts/publish.mjs"), "scripts/publish.mjs");
|
|
17
14
|
};
|
|
18
15
|
exports.publish = publish;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/release.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,eAAO,MAAM,OAAO,GAAU,SAAS,cAAc,
|
|
1
|
+
{"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/release.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,eAAO,MAAM,OAAO,GAAU,SAAS,cAAc,kBAwBpD,CAAC"}
|
|
@@ -18,7 +18,14 @@ const release = async (options) => {
|
|
|
18
18
|
changelog: !dev,
|
|
19
19
|
commit: "chore: Releasing gluhar packages.",
|
|
20
20
|
});
|
|
21
|
-
(
|
|
21
|
+
if (options.publish)
|
|
22
|
+
(0, publish_1.publish)();
|
|
22
23
|
await (0, tag_1.tag)(options);
|
|
24
|
+
if (!options.publish) {
|
|
25
|
+
if (options.gitTag)
|
|
26
|
+
log_1.log.info("Pushed the tag; GitHub Actions publishes to npm (workflow: Release).");
|
|
27
|
+
else
|
|
28
|
+
log_1.log.warn("Nothing was published: pass --git-tag for CI, or --publish to publish locally.");
|
|
29
|
+
}
|
|
23
30
|
};
|
|
24
31
|
exports.release = release;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/tag.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../../src/commands/release/tag.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGvD,eAAO,MAAM,OAAO;IAClB,yBAAyB;;IAEzB,iBAAiB;;IAEjB,mBAAmB;;;QAGjB,wBAAwB;;QAExB,oBAAoB;;;CAGvB,CAAC;AAiBF,MAAM,WAAW,WAAW;IAC1B,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,YAAY,GAAI,YAAY,MAAM,EAAE,KAAK,WAAW,KAAG,MAyBnE,CAAC;AAEF,eAAO,MAAM,GAAG,GAAU,SAAS,cAAc,kBAkDhD,CAAC"}
|
|
@@ -5,6 +5,7 @@ const lerna_1 = require("../../scripts/lerna");
|
|
|
5
5
|
const constants_1 = require("../../scripts/lerna/constants");
|
|
6
6
|
const git_1 = require("../../scripts/git");
|
|
7
7
|
const utils_1 = require("../../utils");
|
|
8
|
+
const cmd_1 = require("../../scripts/cmd");
|
|
8
9
|
const log_1 = require("./log");
|
|
9
10
|
exports.pattern = {
|
|
10
11
|
/** e.g. `@gluhar/cli` */
|
|
@@ -82,9 +83,11 @@ const tag = async (options) => {
|
|
|
82
83
|
const confirm = await (0, utils_1.confirmQuestion)(`Create and push tag(s): ${tagList}. Confirm?`, yes);
|
|
83
84
|
if (confirm) {
|
|
84
85
|
tags.forEach((t) => {
|
|
85
|
-
git_1.git.tag.create(t);
|
|
86
|
+
(0, cmd_1.exitOnFailure)(git_1.git.tag.create(t), `git tag ${t}`);
|
|
86
87
|
});
|
|
87
|
-
|
|
88
|
+
// The branch first, so the release commit is on it before CI starts from the tag
|
|
89
|
+
(0, cmd_1.exitOnFailure)(git_1.git.push("HEAD"), "git push");
|
|
90
|
+
(0, cmd_1.exitOnFailure)(git_1.git.tag.pushAll(), "git push --tags");
|
|
88
91
|
}
|
|
89
92
|
};
|
|
90
93
|
exports.tag = tag;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UpgradeOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/upgrade/UpgradeOptions.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,
|
|
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;CACb"}
|
|
@@ -4,6 +4,6 @@ const commander_1 = require("commander");
|
|
|
4
4
|
const upgrade_1 = require("./upgrade");
|
|
5
5
|
exports.default = new commander_1.Command()
|
|
6
6
|
.name("upgrade")
|
|
7
|
-
.description("Upgrade all gluhar dependencies in a project
|
|
8
|
-
.option("-
|
|
7
|
+
.description("Upgrade all @gluhar/* dependencies in a project, across major versions.")
|
|
8
|
+
.option("-t, --tag <tag>", "npm dist-tag or version to install.", "latest")
|
|
9
9
|
.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":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAGlD,eAAO,MAAM,OAAO,GAAI,SAAS,cAAc,SAiB9C,CAAC"}
|
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.upgrade = void 0;
|
|
4
|
+
const fs_1 = require("fs");
|
|
5
|
+
const path_1 = require("path");
|
|
4
6
|
const cmd_1 = require("../../scripts/cmd");
|
|
5
7
|
const log_1 = require("./log");
|
|
6
8
|
const upgrade = (options) => {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(0,
|
|
9
|
+
const { tag } = options;
|
|
10
|
+
log_1.log.info(`Upgrading gluhar dependencies to "${tag}".`);
|
|
11
|
+
const pkg = JSON.parse((0, fs_1.readFileSync)((0, path_1.join)(process.cwd(), "package.json")).toString());
|
|
12
|
+
const names = Object.keys({
|
|
13
|
+
...pkg.dependencies,
|
|
14
|
+
...pkg.devDependencies,
|
|
15
|
+
}).filter((name) => name.startsWith("@gluhar/"));
|
|
16
|
+
if (!names.length)
|
|
17
|
+
return log_1.log.info("No @gluhar/* dependencies found.");
|
|
18
|
+
// `npm install pkg@tag`, not `npm update`: update stays inside the semver
|
|
19
|
+
// range already in package.json, so it can never cross a major version.
|
|
20
|
+
(0, cmd_1.executeCmd)(`npm install ${names.map((name) => `${name}@${tag}`).join(" ")}`);
|
|
10
21
|
};
|
|
11
22
|
exports.upgrade = upgrade;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/commands/version/version.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../../src/commands/version/version.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAKvD,eAAO,MAAM,OAAO,GAAU,SAAS,cAAc,kBA0BpD,CAAC"}
|
|
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.version = void 0;
|
|
4
4
|
const lerna_1 = require("../../scripts/lerna");
|
|
5
5
|
const git_1 = require("../../scripts/git");
|
|
6
|
+
const cmd_1 = require("../../scripts/cmd");
|
|
6
7
|
const log_1 = require("./log");
|
|
7
8
|
const getPreid_1 = require("./getPreid");
|
|
8
9
|
const pimpChangelogs_1 = require("./pimpChangelogs");
|
|
9
10
|
const version = async (options) => {
|
|
10
11
|
const { pre, dev, changelog, commit, yes } = options;
|
|
11
|
-
lerna_1.lerna.version({
|
|
12
|
+
const result = lerna_1.lerna.version({
|
|
12
13
|
conventionalCommits: true,
|
|
13
14
|
conventionalGraduate: (!dev && !pre) || undefined,
|
|
14
15
|
conventionalPrerelease: !!dev || !!pre || undefined,
|
|
@@ -20,6 +21,7 @@ const version = async (options) => {
|
|
|
20
21
|
changelog,
|
|
21
22
|
yes,
|
|
22
23
|
});
|
|
24
|
+
(0, cmd_1.exitOnFailure)(result, "lerna version");
|
|
23
25
|
if (changelog)
|
|
24
26
|
await (0, pimpChangelogs_1.pimpChangelogs)();
|
|
25
27
|
if (commit) {
|
package/src/preAction.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"preAction.d.ts","sourceRoot":"","sources":["../../src/preAction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"preAction.d.ts","sourceRoot":"","sources":["../../src/preAction.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA8EzC,eAAO,MAAM,SAAS,GAAU,SAAS,OAAO,EAAE,WAAW,OAAO,kBAoBnE,CAAC"}
|
package/src/preAction.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.preAction = void 0;
|
|
4
|
-
const
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
const semver_1 = require("semver");
|
|
5
6
|
const utils_1 = require("./utils");
|
|
6
7
|
const cmd_1 = require("./scripts/cmd");
|
|
7
8
|
const constants_1 = require("./constants");
|
|
8
|
-
const git_1 = require("./scripts/git");
|
|
9
9
|
// import { getConfigOpt, setConfigOpt } from './config';
|
|
10
10
|
const getOptions = (command) => command.opts();
|
|
11
11
|
const log = (0, utils_1.logger)("cli");
|
|
@@ -38,16 +38,17 @@ const logCli = (actionCmd) => {
|
|
|
38
38
|
log.verbose("options:", getOptions(actionCmd));
|
|
39
39
|
log.verbose("cwd:", process.cwd());
|
|
40
40
|
};
|
|
41
|
+
/** The CLI runs from the monorepo checkout (`packages/cli/dist`), not from an install. */
|
|
42
|
+
const isDevCheckout = () => !__dirname.split(path_1.sep).includes("node_modules");
|
|
41
43
|
const checkCliVersion = async (rootCmd) => {
|
|
42
|
-
|
|
43
|
-
if (hasGit && git_1.git.getRepo() === "gluhar")
|
|
44
|
+
if (isDevCheckout())
|
|
44
45
|
return;
|
|
45
46
|
// Skip version check entirely when not in an interactive terminal
|
|
46
47
|
if (!process.stdout.isTTY)
|
|
47
48
|
return;
|
|
48
49
|
const latestVersion = (0, cmd_1.getCmdOutput)("npm show @gluhar/cli version");
|
|
49
|
-
//
|
|
50
|
-
if (latestVersion
|
|
50
|
+
// Only offer an upgrade, never a downgrade from a prerelease to `latest`
|
|
51
|
+
if (!(0, semver_1.valid)(latestVersion) || !(0, semver_1.gt)(latestVersion, constants_1.VERSION))
|
|
51
52
|
return;
|
|
52
53
|
const { yes } = getOptions(rootCmd);
|
|
53
54
|
// Version is old, ask to install latest
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SpawnSyncReturns } from 'child_process';
|
|
2
|
+
/**
|
|
3
|
+
* Exits the process when a spawned command failed, so later steps don't run on a broken state.
|
|
4
|
+
* @param result The return value of `executeBash` / `executeCmd`.
|
|
5
|
+
* @param label What failed, for the error message: 'lerna version'.
|
|
6
|
+
*/
|
|
7
|
+
export declare const exitOnFailure: (result: SpawnSyncReturns<Buffer>, label: string) => void;
|
|
8
|
+
//# sourceMappingURL=exitOnFailure.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exitOnFailure.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/exitOnFailure.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAGtD;;;;GAIG;AACH,eAAO,MAAM,aAAa,GACxB,QAAQ,gBAAgB,CAAC,MAAM,CAAC,EAChC,OAAO,MAAM,SAWd,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.exitOnFailure = void 0;
|
|
4
|
+
const log_1 = require("./log");
|
|
5
|
+
/**
|
|
6
|
+
* Exits the process when a spawned command failed, so later steps don't run on a broken state.
|
|
7
|
+
* @param result The return value of `executeBash` / `executeCmd`.
|
|
8
|
+
* @param label What failed, for the error message: 'lerna version'.
|
|
9
|
+
*/
|
|
10
|
+
const exitOnFailure = (result, label) => {
|
|
11
|
+
if (result.error) {
|
|
12
|
+
log_1.log.error(`${label} could not run:`, result.error.message);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
}
|
|
15
|
+
if (result.status !== 0) {
|
|
16
|
+
log_1.log.error(`${label} failed with exit code ${result.status ?? result.signal}.`);
|
|
17
|
+
process.exit(result.status || 1);
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
exports.exitOnFailure = exitOnFailure;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAEhC,eAAO,MAAM,GAAG;;CAEf,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAEhC,eAAO,MAAM,GAAG;;CAEf,CAAC"}
|
package/src/scripts/cmd/index.js
CHANGED
|
@@ -20,6 +20,7 @@ __exportStar(require("./executeBash"), exports);
|
|
|
20
20
|
__exportStar(require("./executeCmd"), exports);
|
|
21
21
|
__exportStar(require("./getCmdOutput"), exports);
|
|
22
22
|
__exportStar(require("./getBashOutput"), exports);
|
|
23
|
+
__exportStar(require("./exitOnFailure"), exports);
|
|
23
24
|
exports.cmd = {
|
|
24
25
|
cd: cd_1.cd,
|
|
25
26
|
};
|
|
@@ -18,7 +18,7 @@ export declare const git: {
|
|
|
18
18
|
};
|
|
19
19
|
tag: {
|
|
20
20
|
getAll: () => string[];
|
|
21
|
-
create: (name: string, options?: import("./tag/createTag").TagCreateOptions) =>
|
|
21
|
+
create: (name: string, options?: import("./tag/createTag").TagCreateOptions) => import("child_process").SpawnSyncReturns<Buffer>;
|
|
22
22
|
delete: (name: string) => void;
|
|
23
23
|
rename: (oldTagName: string, newTagName: string) => void;
|
|
24
24
|
pushAll: (remote?: string) => import("child_process").SpawnSyncReturns<Buffer>;
|
|
@@ -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) =>
|
|
17
|
+
export declare const createTag: (name: string, options?: TagCreateOptions) => import("child_process").SpawnSyncReturns<Buffer>;
|
|
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,qDAOrE,CAAC"}
|
|
@@ -9,7 +9,7 @@ const cmd_1 = require("../../cmd");
|
|
|
9
9
|
*/
|
|
10
10
|
const createTag = (name, options = {}) => {
|
|
11
11
|
const { object = '', force } = options;
|
|
12
|
-
(0, cmd_1.executeCmd)(`git tag ${name} ${object}`, {
|
|
12
|
+
return (0, cmd_1.executeCmd)(`git tag ${name} ${object}`, {
|
|
13
13
|
force,
|
|
14
14
|
annotate: true,
|
|
15
15
|
message: '',
|
|
@@ -3,7 +3,6 @@ import { filterByDependency } from './filterByDependency';
|
|
|
3
3
|
import type { Args } from '../cmd/types';
|
|
4
4
|
export declare const lerna: {
|
|
5
5
|
version: (args?: Args) => import("child_process").SpawnSyncReturns<Buffer>;
|
|
6
|
-
publish: (args?: Args) => import("child_process").SpawnSyncReturns<Buffer>;
|
|
7
6
|
list: (args?: Args) => import("child_process").SpawnSyncReturns<Buffer>;
|
|
8
7
|
changed: () => import("./types").LernaPackage[];
|
|
9
8
|
getConfig: () => import("./types").LernaConfig | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scripts/lerna/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,KAAK;qBACC,IAAI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scripts/lerna/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEzC,eAAO,MAAM,KAAK;qBACC,IAAI;kBACP,IAAI;;;;;;CAMnB,CAAC"}
|
|
@@ -9,7 +9,6 @@ const filterByDependency_1 = require("./filterByDependency");
|
|
|
9
9
|
const getDetails_1 = require("./getDetails");
|
|
10
10
|
exports.lerna = {
|
|
11
11
|
version: (args) => (0, cmd_1.executeBash)('lerna/version', args),
|
|
12
|
-
publish: (args) => (0, cmd_1.executeBash)('lerna/publish', args),
|
|
13
12
|
list: (args) => (0, cmd_1.executeBash)('lerna/list', args),
|
|
14
13
|
changed: changed_1.changed,
|
|
15
14
|
getConfig: getConfig_1.getConfig,
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
npx lerna publish from-package "$@"
|