@decaf-ts/utils 1.3.2 → 1.5.2
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/README.md +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.js +1 -1
- package/dist/utils.js.map +1 -1
- package/lib/cjs/bin/modules.cjs +14 -0
- package/lib/cjs/bin/modules.cjs.map +1 -0
- package/lib/cjs/bin/npm-link.cjs +14 -0
- package/lib/cjs/bin/npm-link.cjs.map +1 -0
- package/lib/cjs/bin/npm-token.cjs +14 -0
- package/lib/cjs/bin/npm-token.cjs.map +1 -0
- package/lib/cjs/bin/run-all.cjs +14 -0
- package/lib/cjs/bin/run-all.cjs.map +1 -0
- package/lib/cjs/cli/commands/help.cjs +29 -0
- package/lib/cjs/cli/commands/help.cjs.map +1 -0
- package/lib/cjs/cli/commands/index.cjs +5 -0
- package/lib/cjs/cli/commands/index.cjs.map +1 -1
- package/lib/cjs/cli/commands/modules.cjs +80 -0
- package/lib/cjs/cli/commands/modules.cjs.map +1 -0
- package/lib/cjs/cli/commands/npm-link.cjs +196 -0
- package/lib/cjs/cli/commands/npm-link.cjs.map +1 -0
- package/lib/cjs/cli/commands/npm-token.cjs +87 -0
- package/lib/cjs/cli/commands/npm-token.cjs.map +1 -0
- package/lib/cjs/cli/commands/release-chain.cjs +82 -0
- package/lib/cjs/cli/commands/release-chain.cjs.map +1 -1
- package/lib/cjs/cli/commands/run-all.cjs +78 -0
- package/lib/cjs/cli/commands/run-all.cjs.map +1 -0
- package/lib/cjs/cli/commands/tag-release-shell.cjs +229 -0
- package/lib/cjs/cli/commands/tag-release-shell.cjs.map +1 -0
- package/lib/cjs/cli/commands/tag-release.cjs +33 -2
- package/lib/cjs/cli/commands/tag-release.cjs.map +1 -1
- package/lib/cjs/index.cjs +1 -1
- package/lib/esm/bin/modules.js +10 -0
- package/lib/esm/bin/modules.js.map +1 -0
- package/lib/esm/bin/npm-link.js +10 -0
- package/lib/esm/bin/npm-link.js.map +1 -0
- package/lib/esm/bin/npm-token.js +10 -0
- package/lib/esm/bin/npm-token.js.map +1 -0
- package/lib/esm/bin/run-all.js +10 -0
- package/lib/esm/bin/run-all.js.map +1 -0
- package/lib/esm/cli/commands/help.js +25 -0
- package/lib/esm/cli/commands/help.js.map +1 -0
- package/lib/esm/cli/commands/index.js +5 -0
- package/lib/esm/cli/commands/index.js.map +1 -1
- package/lib/esm/cli/commands/modules.js +70 -0
- package/lib/esm/cli/commands/modules.js.map +1 -0
- package/lib/esm/cli/commands/npm-link.js +188 -0
- package/lib/esm/cli/commands/npm-link.js.map +1 -0
- package/lib/esm/cli/commands/npm-token.js +79 -0
- package/lib/esm/cli/commands/npm-token.js.map +1 -0
- package/lib/esm/cli/commands/release-chain.js +82 -0
- package/lib/esm/cli/commands/release-chain.js.map +1 -1
- package/lib/esm/cli/commands/run-all.js +70 -0
- package/lib/esm/cli/commands/run-all.js.map +1 -0
- package/lib/esm/cli/commands/tag-release-shell.js +221 -0
- package/lib/esm/cli/commands/tag-release-shell.js.map +1 -0
- package/lib/esm/cli/commands/tag-release.js +33 -2
- package/lib/esm/cli/commands/tag-release.js.map +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/types/bin/modules.d.cts +1 -0
- package/lib/types/bin/modules.d.mts +1 -0
- package/lib/types/bin/npm-link.d.cts +1 -0
- package/lib/types/bin/npm-link.d.mts +1 -0
- package/lib/types/bin/npm-token.d.cts +1 -0
- package/lib/types/bin/npm-token.d.mts +1 -0
- package/lib/types/bin/run-all.d.cts +1 -0
- package/lib/types/bin/run-all.d.mts +1 -0
- package/lib/types/cli/commands/help.d.cts +7 -0
- package/lib/types/cli/commands/help.d.mts +7 -0
- package/lib/types/cli/commands/index.d.cts +5 -0
- package/lib/types/cli/commands/index.d.mts +5 -0
- package/lib/types/cli/commands/modules.d.cts +19 -0
- package/lib/types/cli/commands/modules.d.mts +19 -0
- package/lib/types/cli/commands/npm-link.d.cts +34 -0
- package/lib/types/cli/commands/npm-link.d.mts +34 -0
- package/lib/types/cli/commands/npm-token.d.cts +23 -0
- package/lib/types/cli/commands/npm-token.d.mts +23 -0
- package/lib/types/cli/commands/release-chain.d.cts +2 -0
- package/lib/types/cli/commands/release-chain.d.mts +2 -0
- package/lib/types/cli/commands/run-all.d.cts +22 -0
- package/lib/types/cli/commands/run-all.d.mts +22 -0
- package/lib/types/cli/commands/tag-release-shell.d.cts +57 -0
- package/lib/types/cli/commands/tag-release-shell.d.mts +57 -0
- package/lib/types/cli/commands/tag-release.d.cts +1 -0
- package/lib/types/cli/commands/tag-release.d.mts +1 -0
- package/lib/types/index.d.cts +1 -1
- package/lib/types/index.d.mts +1 -1
- package/package.json +5 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TagReleaseCommand = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_child_process_1 = require("node:child_process");
|
|
10
|
+
const command_js_1 = require("./../command.cjs");
|
|
11
|
+
const input_js_1 = require("./../../input/input.cjs");
|
|
12
|
+
const constants_js_1 = require("./../../utils/constants.cjs");
|
|
13
|
+
const help_js_1 = require("./help.cjs");
|
|
14
|
+
const options = {
|
|
15
|
+
public: {
|
|
16
|
+
type: "boolean",
|
|
17
|
+
default: false,
|
|
18
|
+
},
|
|
19
|
+
private: {
|
|
20
|
+
type: "boolean",
|
|
21
|
+
default: false,
|
|
22
|
+
},
|
|
23
|
+
gitToken: {
|
|
24
|
+
type: "string",
|
|
25
|
+
default: ".token",
|
|
26
|
+
},
|
|
27
|
+
npmToken: {
|
|
28
|
+
type: "string",
|
|
29
|
+
default: ".npmtoken",
|
|
30
|
+
},
|
|
31
|
+
gitUser: {
|
|
32
|
+
type: "string",
|
|
33
|
+
default: undefined,
|
|
34
|
+
},
|
|
35
|
+
allowFromBranch: {
|
|
36
|
+
type: "boolean",
|
|
37
|
+
default: false,
|
|
38
|
+
},
|
|
39
|
+
tag: {
|
|
40
|
+
type: "string",
|
|
41
|
+
default: undefined,
|
|
42
|
+
},
|
|
43
|
+
message: {
|
|
44
|
+
type: "string",
|
|
45
|
+
default: undefined,
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
class TagReleaseCommand extends command_js_1.Command {
|
|
49
|
+
constructor() {
|
|
50
|
+
super("TagReleaseCommand", options);
|
|
51
|
+
}
|
|
52
|
+
async ensureReleaseBranch(allowFromBranch = false) {
|
|
53
|
+
if (allowFromBranch)
|
|
54
|
+
return;
|
|
55
|
+
const currentBranch = (0, node_child_process_1.execSync)("git rev-parse --abbrev-ref HEAD", {
|
|
56
|
+
cwd: process.cwd(),
|
|
57
|
+
encoding: "utf8",
|
|
58
|
+
}).trim();
|
|
59
|
+
if (currentBranch !== "master" && currentBranch !== "main") {
|
|
60
|
+
throw new Error(`release must be run from 'master' or 'main' branch. Current branch: ${currentBranch}`);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async prepareTag(tag) {
|
|
64
|
+
tag = `${tag || ""}`.trim();
|
|
65
|
+
if (tag.length > 0) {
|
|
66
|
+
return tag;
|
|
67
|
+
}
|
|
68
|
+
(0, node_child_process_1.execSync)("git tag --sort=-taggerdate | head -n 5", {
|
|
69
|
+
cwd: process.cwd(),
|
|
70
|
+
stdio: "inherit",
|
|
71
|
+
});
|
|
72
|
+
return input_js_1.UserInput.insistForText("tag", "What should be the new tag? (accepts v*.*.*[-...])", (val) => !!val.toString().match(/^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9a-zA-Z-]+)?$/));
|
|
73
|
+
}
|
|
74
|
+
async prepareMessage(message) {
|
|
75
|
+
message = `${message || ""}`.trim();
|
|
76
|
+
if (message.length > 0) {
|
|
77
|
+
return message;
|
|
78
|
+
}
|
|
79
|
+
return input_js_1.UserInput.insistForText("message", "Tag Message", (val) => !!val && val.toString().length > 0);
|
|
80
|
+
}
|
|
81
|
+
hasToken(fileName) {
|
|
82
|
+
try {
|
|
83
|
+
return node_fs_1.default.statSync(node_path_1.default.join(process.cwd(), fileName)).size > 0;
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
readToken(fileName) {
|
|
90
|
+
return node_fs_1.default.readFileSync(node_path_1.default.join(process.cwd(), fileName), "utf8").trim();
|
|
91
|
+
}
|
|
92
|
+
help() {
|
|
93
|
+
(0, help_js_1.printCommandHelp)(this.log, "tag-release", "Prepare a release, create a git tag, push, and optionally publish to npm.", "tag-release [options] [tag] [message]", [
|
|
94
|
+
{
|
|
95
|
+
flag: "--public",
|
|
96
|
+
description: "Publish to the public npm registry",
|
|
97
|
+
defaultValue: "false",
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
flag: "--private",
|
|
101
|
+
description: "Publish to the restricted npm registry",
|
|
102
|
+
defaultValue: "false",
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
flag: "--git-token <file>",
|
|
106
|
+
description: "File containing the token used for authenticated git pushes",
|
|
107
|
+
defaultValue: ".token",
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
flag: "--npm-token <file>",
|
|
111
|
+
description: "File containing the token used for npm publish",
|
|
112
|
+
defaultValue: ".npmtoken",
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
flag: "--git-user <name>",
|
|
116
|
+
description: "Git user name embedded in authenticated pushes",
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
flag: "--allow-from-branch",
|
|
120
|
+
description: "Skip the master/main branch guard",
|
|
121
|
+
defaultValue: "false",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
flag: "--tag <version>",
|
|
125
|
+
description: "Release tag to create",
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
flag: "--message <text>",
|
|
129
|
+
description: "Release message to use",
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
flag: "-h, --help",
|
|
133
|
+
description: "Show this help text and exit",
|
|
134
|
+
},
|
|
135
|
+
], [
|
|
136
|
+
"If tag or message are omitted, the command prompts interactively.",
|
|
137
|
+
"The command uses .token for git pushes and .npmtoken for npm publish unless overridden.",
|
|
138
|
+
], [
|
|
139
|
+
"tag-release --public --tag v1.2.3 --message \"Release 1.2.3\"",
|
|
140
|
+
"tag-release --private --allow-from-branch --tag v1.2.3",
|
|
141
|
+
]);
|
|
142
|
+
}
|
|
143
|
+
async run(answers) {
|
|
144
|
+
await this.ensureReleaseBranch(answers.allowFromBranch === true);
|
|
145
|
+
const publishAccessFlag = answers.private === true ? "private" : "public";
|
|
146
|
+
const tag = await this.prepareTag(answers.tag);
|
|
147
|
+
const message = await this.prepareMessage(answers.message);
|
|
148
|
+
const gitTokenFile = `${answers.gitToken || ".token"}`;
|
|
149
|
+
const npmTokenFile = `${answers.npmToken || ".npmtoken"}`;
|
|
150
|
+
const gitUser = typeof answers.gitUser === "string" && answers.gitUser.trim().length > 0
|
|
151
|
+
? answers.gitUser.trim()
|
|
152
|
+
: (0, node_child_process_1.execSync)("git config user.name", {
|
|
153
|
+
cwd: process.cwd(),
|
|
154
|
+
encoding: "utf8",
|
|
155
|
+
}).trim();
|
|
156
|
+
(0, node_child_process_1.execSync)("npm run prepare-release", {
|
|
157
|
+
cwd: process.cwd(),
|
|
158
|
+
stdio: "inherit",
|
|
159
|
+
});
|
|
160
|
+
const status = (0, node_child_process_1.execSync)("git status --porcelain", {
|
|
161
|
+
cwd: process.cwd(),
|
|
162
|
+
encoding: "utf8",
|
|
163
|
+
});
|
|
164
|
+
if (status.trim().length > 0) {
|
|
165
|
+
(0, node_child_process_1.execSync)("git add .", { cwd: process.cwd(), stdio: "inherit" });
|
|
166
|
+
(0, node_child_process_1.execSync)(`git commit -m "${tag} - ${message} - after release preparation"`, {
|
|
167
|
+
cwd: process.cwd(),
|
|
168
|
+
stdio: "inherit",
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
(0, node_child_process_1.execSync)(`npm version "${tag}" -m "${message}"`, {
|
|
172
|
+
cwd: process.cwd(),
|
|
173
|
+
stdio: "inherit",
|
|
174
|
+
});
|
|
175
|
+
const remoteUrl = (0, node_child_process_1.execSync)("git remote get-url origin", {
|
|
176
|
+
cwd: process.cwd(),
|
|
177
|
+
encoding: "utf8",
|
|
178
|
+
}).trim();
|
|
179
|
+
if (this.hasToken(gitTokenFile)) {
|
|
180
|
+
const currentBranch = (0, node_child_process_1.execSync)("git rev-parse --abbrev-ref HEAD", {
|
|
181
|
+
cwd: process.cwd(),
|
|
182
|
+
encoding: "utf8",
|
|
183
|
+
});
|
|
184
|
+
let upstream = "";
|
|
185
|
+
try {
|
|
186
|
+
upstream = (0, node_child_process_1.execSync)("git rev-parse --abbrev-ref --symbolic-full-name '@{u}'", {
|
|
187
|
+
cwd: process.cwd(),
|
|
188
|
+
encoding: "utf8",
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
catch {
|
|
192
|
+
upstream = "";
|
|
193
|
+
}
|
|
194
|
+
const token = this.readToken(gitTokenFile);
|
|
195
|
+
(0, node_child_process_1.execSync)(`git push "https://${gitUser}:${token}@${remoteUrl.replace(/^https:\/\//, "")}" --follow-tags`, {
|
|
196
|
+
cwd: process.cwd(),
|
|
197
|
+
stdio: "inherit",
|
|
198
|
+
});
|
|
199
|
+
if (upstream.trim().length > 0) {
|
|
200
|
+
try {
|
|
201
|
+
(0, node_child_process_1.execSync)(`git branch --set-upstream-to="${upstream.trim()}" "${currentBranch.trim()}"`, {
|
|
202
|
+
cwd: process.cwd(),
|
|
203
|
+
stdio: "inherit",
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
catch {
|
|
207
|
+
// ignore restore failures
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
(0, node_child_process_1.execSync)("git push --follow-tags", {
|
|
213
|
+
cwd: process.cwd(),
|
|
214
|
+
stdio: "inherit",
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
const npmAccessValue = publishAccessFlag === "public" ? "public" : "restricted";
|
|
218
|
+
if (message.endsWith(constants_js_1.NoCIFLag) && this.hasToken(npmTokenFile)) {
|
|
219
|
+
const npmToken = this.readToken(npmTokenFile);
|
|
220
|
+
(0, node_child_process_1.execSync)(`NPM_TOKEN="${npmToken}" npm publish --access "${npmAccessValue}"`, {
|
|
221
|
+
cwd: process.cwd(),
|
|
222
|
+
stdio: "inherit",
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
exports.TagReleaseCommand = TagReleaseCommand;
|
|
228
|
+
//# sourceMappingURL=tag-release-shell.js.map
|
|
229
|
+
//# sourceMappingURL=tag-release-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag-release-shell.js","sourceRoot":"","sources":["tag-release-shell.js"],"names":[],"mappings":";;;;;;AAAA,sDAAyB;AACzB,0DAA6B;AAC7B,2DAA8C;AAC9C,gDAA0C;AAC1C,qDAAmD;AACnD,6DAAsD;AACtD,uCAA6C;AAC7C,MAAM,OAAO,GAAG;IACZ,MAAM,EAAE;QACJ,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACjB;IACD,OAAO,EAAE;QACL,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,KAAK;KACjB;IACD,QAAQ,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,QAAQ;KACpB;IACD,QAAQ,EAAE;QACN,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,WAAW;KACvB;IACD,OAAO,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,SAA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C,CAAC,CAAC,YAAY,CAAC;QAChF,IAAI,OAAO,CAAC,QAAQ,CAAC,uBAAQ,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;YAC5D,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;YAC9C,IAAA,6BAAQ,EAAC,cAAc,QAAQ,2BAA2B,cAAc,GAAG,EAAE;gBACzE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE;gBAClB,KAAK,EAAE,SAAS;aACnB,CAAC,CAAC;QACP,CAAC;IACL,CAAC;CACJ;AAlLD,8CAkLC;AACD,6CAA6C"}
|
|
@@ -6,6 +6,7 @@ const utils_js_1 = require("./../../utils/utils.cjs");
|
|
|
6
6
|
const constants_js_1 = require("./../../utils/constants.cjs");
|
|
7
7
|
const input_js_1 = require("./../../input/input.cjs");
|
|
8
8
|
const command_js_1 = require("./../command.cjs");
|
|
9
|
+
const help_js_1 = require("./help.cjs");
|
|
9
10
|
const options = {
|
|
10
11
|
ci: {
|
|
11
12
|
type: "boolean",
|
|
@@ -64,10 +65,12 @@ class ReleaseScript extends command_js_1.Command {
|
|
|
64
65
|
const log = this.log.for(this.prepareVersion);
|
|
65
66
|
tag = this.testVersion(tag || "");
|
|
66
67
|
if (!tag) {
|
|
67
|
-
log.verbose("No release
|
|
68
|
+
log.verbose("No release version provided. Prompting for one:");
|
|
68
69
|
log.info(`Listing latest git tags:`);
|
|
69
70
|
await (0, utils_js_1.runCommand)("git tag --sort=-taggerdate | head -n 5").promise;
|
|
70
|
-
return await input_js_1.UserInput.insistForText("tag", "Enter the new tag number (accepts v*.*.*[-...])", (val) => !!val
|
|
71
|
+
return await input_js_1.UserInput.insistForText("tag", "Enter the new tag number (accepts v*.*.*[-...])", (val) => !!val
|
|
72
|
+
.toString()
|
|
73
|
+
.match(/^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9a-zA-Z-]+)?$/));
|
|
71
74
|
}
|
|
72
75
|
return tag;
|
|
73
76
|
}
|
|
@@ -110,6 +113,34 @@ class ReleaseScript extends command_js_1.Command {
|
|
|
110
113
|
}
|
|
111
114
|
return message;
|
|
112
115
|
}
|
|
116
|
+
help() {
|
|
117
|
+
(0, help_js_1.printCommandHelp)(this.log, "tag-release", "Prepare, tag, and publish a release from the current repository.", "tag-release [options]", [
|
|
118
|
+
{ flag: "--tag <version>", description: "Release tag to use" },
|
|
119
|
+
{
|
|
120
|
+
flag: "--message <text>",
|
|
121
|
+
description: "Release message or ticket reference",
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
flag: "--ci <true|false>",
|
|
125
|
+
description: "Whether to treat the run as CI",
|
|
126
|
+
defaultValue: "true",
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
flag: "--version",
|
|
130
|
+
description: "Print the package version and exit",
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
flag: "-h, --help",
|
|
134
|
+
description: "Show this help text and exit",
|
|
135
|
+
},
|
|
136
|
+
], [
|
|
137
|
+
"If tag or message are omitted, the command prompts interactively.",
|
|
138
|
+
"A successful run updates the package version, creates a git tag, pushes tags, and optionally publishes to npm.",
|
|
139
|
+
], [
|
|
140
|
+
"tag-release --tag v1.2.3 --message \"Release 1.2.3\"",
|
|
141
|
+
"tag-release --tag patch --message \"Fix release\"",
|
|
142
|
+
]);
|
|
143
|
+
}
|
|
113
144
|
/**
|
|
114
145
|
* @description Runs the release script.
|
|
115
146
|
* @summary This method orchestrates the entire release process, including version preparation, message creation,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag-release.js","sourceRoot":"","sources":["tag-release.js"],"names":[],"mappings":";;;AAAA,0BAA0B;AAC1B,qDAAoD;AACpD,6DAAmF;AACnF,qDAAmD;AACnD,gDAA0C;AAC1C,MAAM,OAAO,GAAG;IACZ,EAAE,EAAE;QACA,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,IAAI;KAChB;IACD,OAAO,EAA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GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,uBAAQ,GAAG,CAAC,CAAC,OAAO,CAAC;QACtF,MAAM,IAAA,qBAAU,EAAC,wBAAwB,CAAC,CAAC,OAAO,CAAC;QACnD,IAAI,CAAC,EAAE,EAAE,CAAC;YACN,MAAM,IAAA,qBAAU,EAAC,wDAAwD,CAAC;iBACrE,OAAO,CAAC;QACjB,CAAC;IACL,CAAC;CACJ;AA/JD,sCA+JC;AACD,uCAAuC"}
|
package/lib/cjs/index.cjs
CHANGED
|
@@ -44,7 +44,7 @@ __exportStar(require("./release-chain/index.cjs"), exports);
|
|
|
44
44
|
* @const VERSION
|
|
45
45
|
* @memberOf module:utils
|
|
46
46
|
*/
|
|
47
|
-
exports.VERSION = "1.
|
|
47
|
+
exports.VERSION = "1.5.1";
|
|
48
48
|
/**
|
|
49
49
|
* @description Represents the current version of the module.
|
|
50
50
|
* @summary Stores the version for the @decaf-ts/utils package. The build replaces
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
import { ModulesCommand } from "./../cli/commands/index.js";
|
|
3
|
+
new ModulesCommand()
|
|
4
|
+
.execute()
|
|
5
|
+
.then(() => ModulesCommand.log.info("Module list collected successfully"))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
ModulesCommand.log.error(`Failed to retrieve modules`, error);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../src/bin/modules.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,cAAc,EAAE,mCAAwB;AAEjD,IAAI,cAAc,EAAE;KACjB,OAAO,EAAE;KACT,IAAI,CAAC,GAAG,EAAE,CAAC,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,oCAAoC,CAAC,CAAC;KACzE,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAc,CAAC,CAAC;IACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
import { NpmLinkCommand } from "./../cli/commands/index.js";
|
|
3
|
+
new NpmLinkCommand()
|
|
4
|
+
.execute()
|
|
5
|
+
.then(() => NpmLinkCommand.log.info("NPM link operation completed successfully"))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
NpmLinkCommand.log.error(`Failed to link npm modules`, error);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=npm-link.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-link.js","sourceRoot":"","sources":["../../../src/bin/npm-link.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,cAAc,EAAE,mCAAwB;AAEjD,IAAI,cAAc,EAAE;KACjB,OAAO,EAAE;KACT,IAAI,CAAC,GAAG,EAAE,CACT,cAAc,CAAC,GAAG,CAAC,IAAI,CAAC,2CAA2C,CAAC,CACrE;KACA,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,cAAc,CAAC,GAAG,CAAC,KAAK,CAAC,4BAA4B,EAAE,KAAc,CAAC,CAAC;IACvE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
import { NpmTokenCommand } from "./../cli/commands/index.js";
|
|
3
|
+
new NpmTokenCommand()
|
|
4
|
+
.execute()
|
|
5
|
+
.then(() => NpmTokenCommand.log.info("token links updated successfully"))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
NpmTokenCommand.log.error(`Failed to link tokens`, error);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=npm-token.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"npm-token.js","sourceRoot":"","sources":["../../../src/bin/npm-token.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,eAAe,EAAE,mCAAwB;AAElD,IAAI,eAAe,EAAE;KAClB,OAAO,EAAE;KACT,IAAI,CAAC,GAAG,EAAE,CAAC,eAAe,CAAC,GAAG,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;KACxE,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,eAAe,CAAC,GAAG,CAAC,KAAK,CAAC,uBAAuB,EAAE,KAAc,CAAC,CAAC;IACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* istanbul ignore file */
|
|
2
|
+
import { RunAllCommand } from "./../cli/commands/index.js";
|
|
3
|
+
new RunAllCommand()
|
|
4
|
+
.execute()
|
|
5
|
+
.then(() => RunAllCommand.log.info("Run-all command completed successfully"))
|
|
6
|
+
.catch((error) => {
|
|
7
|
+
RunAllCommand.log.error(`Failed to run command across modules`, error);
|
|
8
|
+
process.exit(1);
|
|
9
|
+
});
|
|
10
|
+
//# sourceMappingURL=run-all.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-all.js","sourceRoot":"","sources":["../../../src/bin/run-all.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,EAAE,aAAa,EAAE,mCAAwB;AAEhD,IAAI,aAAa,EAAE;KAChB,OAAO,EAAE;KACT,IAAI,CAAC,GAAG,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;KAC5E,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IACxB,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,sCAAsC,EAAE,KAAc,CAAC,CAAC;IAChF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function printCommandHelp(log, commandName, summary, usage, options, notes = [], examples = []) {
|
|
2
|
+
log.info(`${commandName}`);
|
|
3
|
+
log.info(summary);
|
|
4
|
+
log.info(`Usage: ${usage}`);
|
|
5
|
+
log.info("Options:");
|
|
6
|
+
for (const option of options) {
|
|
7
|
+
const suffix = option.defaultValue
|
|
8
|
+
? ` (default: ${option.defaultValue})`
|
|
9
|
+
: "";
|
|
10
|
+
log.info(` ${option.flag} ${option.description}${suffix}`);
|
|
11
|
+
}
|
|
12
|
+
if (notes.length > 0) {
|
|
13
|
+
log.info("Notes:");
|
|
14
|
+
for (const note of notes) {
|
|
15
|
+
log.info(` ${note}`);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (examples.length > 0) {
|
|
19
|
+
log.info("Examples:");
|
|
20
|
+
for (const example of examples) {
|
|
21
|
+
log.info(` ${example}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=help.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../../../src/cli/commands/help.ts"],"names":[],"mappings":"AAQA,MAAM,UAAU,gBAAgB,CAC9B,GAAW,EACX,WAAmB,EACnB,OAAe,EACf,KAAa,EACb,OAAqB,EACrB,QAAkB,EAAE,EACpB,WAAqB,EAAE;IAEvB,GAAG,CAAC,IAAI,CAAC,GAAG,WAAW,EAAE,CAAC,CAAC;IAC3B,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClB,GAAG,CAAC,IAAI,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;IAC5B,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAErB,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE,CAAC;QAC7B,MAAM,MAAM,GAAG,MAAM,CAAC,YAAY;YAChC,CAAC,CAAC,cAAc,MAAM,CAAC,YAAY,GAAG;YACtC,CAAC,CAAC,EAAE,CAAC;QACP,GAAG,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,IAAI,KAAK,MAAM,CAAC,WAAW,GAAG,MAAM,EAAE,CAAC,CAAC;IAC/D,CAAC;IAED,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACrB,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACnB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QACtB,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,GAAG,CAAC,IAAI,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
export * from "./build-scripts.js";
|
|
2
2
|
export * from "./tag-release.js";
|
|
3
3
|
export * from "./release-chain.js";
|
|
4
|
+
export * from "./modules.js";
|
|
5
|
+
export * from "./npm-link.js";
|
|
6
|
+
export * from "./npm-token.js";
|
|
7
|
+
export * from "./run-all.js";
|
|
8
|
+
export * from "./tag-release-shell.js";
|
|
4
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,mCAAgC;AAChC,iCAA8B;AAC9B,mCAAgC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/cli/commands/index.ts"],"names":[],"mappings":"AAAA,mCAAgC;AAChC,iCAA8B;AAC9B,mCAAgC;AAChC,6BAA0B;AAC1B,8BAA2B;AAC3B,+BAA4B;AAC5B,6BAA0B;AAC1B,uCAAoC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { Command } from "./../command.js";
|
|
4
|
+
import { printCommandHelp } from "./help.js";
|
|
5
|
+
export function readGitModules(basePath = process.cwd()) {
|
|
6
|
+
const gitmodulesPath = path.join(basePath, ".gitmodules");
|
|
7
|
+
const data = fs.readFileSync(gitmodulesPath, "utf8");
|
|
8
|
+
return data.toString().match(/(?<=").*?(?="])/g) || [];
|
|
9
|
+
}
|
|
10
|
+
export function readGitModulesDeep(basePath = process.cwd(), maxTraversal = 2) {
|
|
11
|
+
const modules = new Set();
|
|
12
|
+
const visited = new Set();
|
|
13
|
+
const walk = (currentBasePath, depth, relativePrefix = "") => {
|
|
14
|
+
const normalizedBase = path.resolve(currentBasePath);
|
|
15
|
+
if (visited.has(normalizedBase))
|
|
16
|
+
return;
|
|
17
|
+
visited.add(normalizedBase);
|
|
18
|
+
let entries = [];
|
|
19
|
+
try {
|
|
20
|
+
entries = readGitModules(currentBasePath);
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
for (const entry of entries) {
|
|
26
|
+
const modulePath = relativePrefix
|
|
27
|
+
? path.join(relativePrefix, entry)
|
|
28
|
+
: entry;
|
|
29
|
+
modules.add(modulePath);
|
|
30
|
+
if (depth <= 0)
|
|
31
|
+
continue;
|
|
32
|
+
const nestedBase = path.join(currentBasePath, entry);
|
|
33
|
+
const nestedGitmodules = path.join(nestedBase, ".gitmodules");
|
|
34
|
+
if (fs.existsSync(nestedGitmodules)) {
|
|
35
|
+
walk(nestedBase, depth - 1, modulePath);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
walk(basePath, maxTraversal);
|
|
40
|
+
return Array.from(modules);
|
|
41
|
+
}
|
|
42
|
+
const options = {
|
|
43
|
+
basePath: {
|
|
44
|
+
type: "string",
|
|
45
|
+
default: process.cwd(),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
export class ModulesCommand extends Command {
|
|
49
|
+
constructor() {
|
|
50
|
+
super("ModulesCommand", options);
|
|
51
|
+
}
|
|
52
|
+
help() {
|
|
53
|
+
printCommandHelp(this.log, "modules", "List modules discovered from .gitmodules.", "modules [options]", [
|
|
54
|
+
{
|
|
55
|
+
flag: "--base-path <path>",
|
|
56
|
+
description: "Directory to read .gitmodules from",
|
|
57
|
+
defaultValue: "current working directory",
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
flag: "-h, --help",
|
|
61
|
+
description: "Show this help text and exit",
|
|
62
|
+
},
|
|
63
|
+
], ["Each discovered module path is printed on its own line."], ["modules", "modules --base-path ../repo"]);
|
|
64
|
+
}
|
|
65
|
+
async run(answers) {
|
|
66
|
+
const modules = readGitModules(answers.basePath);
|
|
67
|
+
modules.forEach((module) => this.log.info(module));
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=modules.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"modules.js","sourceRoot":"","sources":["../../../../src/cli/commands/modules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,wBAAmB;AAGrC,OAAO,EAAE,gBAAgB,EAAE,kBAAe;AAE1C,MAAM,UAAU,cAAc,CAAC,WAAmB,OAAO,CAAC,GAAG,EAAE;IAC7D,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,aAAa,CAAC,CAAC;IAC1D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