@depup/oclif 4.22.92-depup.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/LICENSE +21 -0
- package/README.md +44 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +7 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +7 -0
- package/changes.json +62 -0
- package/lib/aws.d.ts +22 -0
- package/lib/aws.js +146 -0
- package/lib/commands/generate/command.d.ts +12 -0
- package/lib/commands/generate/command.js +44 -0
- package/lib/commands/generate/hook.d.ts +12 -0
- package/lib/commands/generate/hook.js +87 -0
- package/lib/commands/generate.d.ts +67 -0
- package/lib/commands/generate.js +269 -0
- package/lib/commands/init.d.ts +39 -0
- package/lib/commands/init.js +165 -0
- package/lib/commands/lock.d.ts +4 -0
- package/lib/commands/lock.js +70 -0
- package/lib/commands/manifest.d.ts +13 -0
- package/lib/commands/manifest.js +156 -0
- package/lib/commands/pack/deb.d.ts +13 -0
- package/lib/commands/pack/deb.js +194 -0
- package/lib/commands/pack/macos.d.ts +14 -0
- package/lib/commands/pack/macos.js +273 -0
- package/lib/commands/pack/tarballs.d.ts +15 -0
- package/lib/commands/pack/tarballs.js +77 -0
- package/lib/commands/pack/win.d.ts +16 -0
- package/lib/commands/pack/win.js +398 -0
- package/lib/commands/promote.d.ts +20 -0
- package/lib/commands/promote.js +305 -0
- package/lib/commands/readme.d.ts +19 -0
- package/lib/commands/readme.js +143 -0
- package/lib/commands/upload/deb.d.ts +10 -0
- package/lib/commands/upload/deb.js +113 -0
- package/lib/commands/upload/macos.d.ts +11 -0
- package/lib/commands/upload/macos.js +92 -0
- package/lib/commands/upload/tarballs.d.ts +12 -0
- package/lib/commands/upload/tarballs.js +135 -0
- package/lib/commands/upload/win.d.ts +11 -0
- package/lib/commands/upload/win.js +97 -0
- package/lib/generator.d.ts +57 -0
- package/lib/generator.js +184 -0
- package/lib/help-compatibility.d.ts +11 -0
- package/lib/help-compatibility.js +22 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +4 -0
- package/lib/log.d.ts +2 -0
- package/lib/log.js +13 -0
- package/lib/readme-generator.d.ts +38 -0
- package/lib/readme-generator.js +305 -0
- package/lib/tarballs/bin.d.ts +7 -0
- package/lib/tarballs/bin.js +126 -0
- package/lib/tarballs/build.d.ts +10 -0
- package/lib/tarballs/build.js +250 -0
- package/lib/tarballs/config.d.ts +45 -0
- package/lib/tarballs/config.js +132 -0
- package/lib/tarballs/index.d.ts +4 -0
- package/lib/tarballs/index.js +20 -0
- package/lib/tarballs/node.d.ts +10 -0
- package/lib/tarballs/node.js +78 -0
- package/lib/upload-util.d.ts +17 -0
- package/lib/upload-util.js +56 -0
- package/lib/util.d.ts +18 -0
- package/lib/util.js +160 -0
- package/lib/version-indexes.d.ts +9 -0
- package/lib/version-indexes.js +119 -0
- package/oclif.manifest.json +1199 -0
- package/package.json +217 -0
- package/templates/cli/commonjs/.mocharc.json.ejs +11 -0
- package/templates/cli/commonjs/.vscode/launch.json.ejs +20 -0
- package/templates/cli/commonjs/bin/dev.cmd.ejs +3 -0
- package/templates/cli/commonjs/bin/dev.js.ejs +7 -0
- package/templates/cli/commonjs/bin/run.cmd.ejs +3 -0
- package/templates/cli/commonjs/bin/run.js.ejs +7 -0
- package/templates/cli/commonjs/eslint.config.mjs.ejs +19 -0
- package/templates/cli/commonjs/tsconfig.json.ejs +11 -0
- package/templates/cli/esm/.mocharc.json.ejs +15 -0
- package/templates/cli/esm/.vscode/launch.json.ejs +22 -0
- package/templates/cli/esm/bin/dev.cmd.ejs +3 -0
- package/templates/cli/esm/bin/dev.js.ejs +5 -0
- package/templates/cli/esm/bin/run.cmd.ejs +3 -0
- package/templates/cli/esm/bin/run.js.ejs +5 -0
- package/templates/cli/esm/eslint.config.mjs.ejs +9 -0
- package/templates/cli/esm/tsconfig.json.ejs +15 -0
- package/templates/cli/shared/.github/workflows/onPushToMain.yml.ejs +56 -0
- package/templates/cli/shared/.github/workflows/onRelease.yml.ejs +21 -0
- package/templates/cli/shared/.github/workflows/test.yml.ejs +23 -0
- package/templates/cli/shared/.gitignore.ejs +27 -0
- package/templates/cli/shared/.prettierrc.json.ejs +1 -0
- package/templates/cli/shared/README.md.ejs +396 -0
- package/templates/cli/shared/package.json.ejs +73 -0
- package/templates/cli/shared/src/commands/hello/index.ts.ejs +22 -0
- package/templates/cli/shared/src/commands/hello/world.ts.ejs +16 -0
- package/templates/cli/shared/src/index.ts.ejs +1 -0
- package/templates/cli/shared/test/commands/hello/index.test.ts.ejs +9 -0
- package/templates/cli/shared/test/commands/hello/world.test.ts.ejs +9 -0
- package/templates/cli/shared/test/tsconfig.json.ejs +9 -0
- package/templates/src/command.ts.ejs +27 -0
- package/templates/src/hook.ts.ejs +7 -0
- package/templates/src/init/dev.cmd.ejs +12 -0
- package/templates/src/init/dev.js.ejs +17 -0
- package/templates/src/init/run.cmd.ejs +3 -0
- package/templates/src/init/run.js.ejs +17 -0
- package/templates/test/command.test.ts.ejs +14 -0
- package/templates/test/hook.test.ts.ejs +9 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
40
|
+
const core_1 = require("@oclif/core");
|
|
41
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
42
|
+
const aws_1 = __importDefault(require("../aws"));
|
|
43
|
+
const Tarballs = __importStar(require("../tarballs"));
|
|
44
|
+
const upload_util_1 = require("../upload-util");
|
|
45
|
+
const util_1 = require("../util");
|
|
46
|
+
const version_indexes_1 = require("../version-indexes");
|
|
47
|
+
class Promote extends core_1.Command {
|
|
48
|
+
static description = 'Promote CLI builds to a S3 release channel.';
|
|
49
|
+
static flags = {
|
|
50
|
+
channel: core_1.Flags.string({ default: 'stable', description: 'Channel to promote to.', required: true }),
|
|
51
|
+
deb: core_1.Flags.boolean({ char: 'd', description: 'Promote debian artifacts.' }),
|
|
52
|
+
'dry-run': core_1.Flags.boolean({
|
|
53
|
+
description: 'Run the command without uploading to S3 or copying versioned tarballs/installers to channel.',
|
|
54
|
+
}),
|
|
55
|
+
'ignore-missing': core_1.Flags.boolean({
|
|
56
|
+
description: 'Ignore missing tarballs/installers and continue promoting the rest.',
|
|
57
|
+
}),
|
|
58
|
+
indexes: core_1.Flags.boolean({ description: 'Append the promoted urls into the index files.' }),
|
|
59
|
+
macos: core_1.Flags.boolean({ char: 'm', description: 'Promote macOS pkg.' }),
|
|
60
|
+
'max-age': core_1.Flags.string({ char: 'a', default: '86400', description: 'Cache control max-age in seconds.' }),
|
|
61
|
+
root: core_1.Flags.string({ char: 'r', default: '.', description: 'Path to the oclif CLI project root.', required: true }),
|
|
62
|
+
sha: core_1.Flags.string({ description: '7-digit short git commit SHA of the CLI to promote.', required: true }),
|
|
63
|
+
targets: core_1.Flags.string({ char: 't', description: 'Comma-separated targets to promote (e.g.: linux-arm,win32-x64).' }),
|
|
64
|
+
version: core_1.Flags.string({ description: 'Semantic version of the CLI to promote.', required: true }),
|
|
65
|
+
win: core_1.Flags.boolean({ char: 'w', description: 'Promote Windows exe.' }),
|
|
66
|
+
xz: core_1.Flags.boolean({ allowNo: true, description: 'Also upload xz.' }),
|
|
67
|
+
};
|
|
68
|
+
async run() {
|
|
69
|
+
const { flags } = await this.parse(Promote);
|
|
70
|
+
if (flags['ignore-missing']) {
|
|
71
|
+
this.warn("--ignore-missing flag is being used - This command will continue to run even if a promotion fails because it doesn't exist");
|
|
72
|
+
}
|
|
73
|
+
this.log(`Promoting v${flags.version} (${flags.sha}) to ${flags.channel} channel\n`);
|
|
74
|
+
const buildConfig = await Tarballs.buildConfig(flags.root, { targets: flags?.targets?.split(',') });
|
|
75
|
+
const { config, s3Config } = buildConfig;
|
|
76
|
+
const indexDefaults = {
|
|
77
|
+
maxAge: `max-age=${flags['max-age']}`,
|
|
78
|
+
s3Config,
|
|
79
|
+
version: flags.version,
|
|
80
|
+
};
|
|
81
|
+
if (!s3Config.bucket)
|
|
82
|
+
this.error('Cannot determine S3 bucket for promotion');
|
|
83
|
+
const awsDefaults = {
|
|
84
|
+
ACL: s3Config.acl ?? client_s3_1.ObjectCannedACL.public_read,
|
|
85
|
+
Bucket: s3Config.bucket,
|
|
86
|
+
CacheControl: indexDefaults.maxAge,
|
|
87
|
+
MetadataDirective: client_s3_1.MetadataDirective.REPLACE,
|
|
88
|
+
};
|
|
89
|
+
const cloudBucketCommitKey = (shortKey) => node_path_1.default.posix.join(s3Config.bucket, (0, upload_util_1.commitAWSDir)(flags.version, flags.sha, s3Config), shortKey);
|
|
90
|
+
const cloudChannelKey = (shortKey) => node_path_1.default.posix.join((0, upload_util_1.channelAWSDir)(flags.channel, s3Config), shortKey);
|
|
91
|
+
// copy tarballs manifests
|
|
92
|
+
const promoteManifest = async (target) => {
|
|
93
|
+
const manifest = (0, upload_util_1.templateShortKey)('manifest', {
|
|
94
|
+
arch: target.arch,
|
|
95
|
+
bin: config.bin,
|
|
96
|
+
platform: target.platform,
|
|
97
|
+
sha: flags.sha,
|
|
98
|
+
version: flags.version,
|
|
99
|
+
});
|
|
100
|
+
// strip version & sha so update/scripts can point to a static channel manifest
|
|
101
|
+
const unversionedManifest = manifest.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
102
|
+
await aws_1.default.s3.copyObject({
|
|
103
|
+
...awsDefaults,
|
|
104
|
+
CopySource: cloudBucketCommitKey(manifest),
|
|
105
|
+
Key: cloudChannelKey(unversionedManifest),
|
|
106
|
+
}, {
|
|
107
|
+
dryRun: flags['dry-run'],
|
|
108
|
+
ignoreMissing: flags['ignore-missing'],
|
|
109
|
+
namespace: unversionedManifest,
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
const promoteGzTarballs = async (target) => {
|
|
113
|
+
const versionedTarGzName = (0, upload_util_1.templateShortKey)('versioned', {
|
|
114
|
+
arch: target.arch,
|
|
115
|
+
bin: config.bin,
|
|
116
|
+
ext: '.tar.gz',
|
|
117
|
+
platform: target.platform,
|
|
118
|
+
sha: flags.sha,
|
|
119
|
+
version: flags.version,
|
|
120
|
+
});
|
|
121
|
+
const versionedTarGzKey = cloudBucketCommitKey(versionedTarGzName);
|
|
122
|
+
// strip version & sha so update/scripts can point to a static channel tarball
|
|
123
|
+
const unversionedTarGzName = versionedTarGzName.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
124
|
+
const unversionedTarGzKey = cloudChannelKey(unversionedTarGzName);
|
|
125
|
+
await Promise.all([
|
|
126
|
+
aws_1.default.s3.copyObject({
|
|
127
|
+
...awsDefaults,
|
|
128
|
+
CopySource: versionedTarGzKey,
|
|
129
|
+
Key: unversionedTarGzKey,
|
|
130
|
+
}, {
|
|
131
|
+
dryRun: flags['dry-run'],
|
|
132
|
+
ignoreMissing: flags['ignore-missing'],
|
|
133
|
+
namespace: unversionedTarGzName,
|
|
134
|
+
}),
|
|
135
|
+
...(flags.indexes
|
|
136
|
+
? [
|
|
137
|
+
(0, version_indexes_1.appendToIndex)({
|
|
138
|
+
...indexDefaults,
|
|
139
|
+
dryRun: flags['dry-run'],
|
|
140
|
+
filename: unversionedTarGzName,
|
|
141
|
+
originalUrl: versionedTarGzKey,
|
|
142
|
+
}),
|
|
143
|
+
]
|
|
144
|
+
: []),
|
|
145
|
+
]);
|
|
146
|
+
};
|
|
147
|
+
const promoteXzTarballs = async (target) => {
|
|
148
|
+
const versionedTarXzName = (0, upload_util_1.templateShortKey)('versioned', {
|
|
149
|
+
arch: target.arch,
|
|
150
|
+
bin: config.bin,
|
|
151
|
+
ext: '.tar.xz',
|
|
152
|
+
platform: target.platform,
|
|
153
|
+
sha: flags.sha,
|
|
154
|
+
version: flags.version,
|
|
155
|
+
});
|
|
156
|
+
const versionedTarXzKey = cloudBucketCommitKey(versionedTarXzName);
|
|
157
|
+
// strip version & sha so update/scripts can point to a static channel tarball
|
|
158
|
+
const unversionedTarXzName = versionedTarXzName.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
159
|
+
const unversionedTarXzKey = cloudChannelKey(unversionedTarXzName);
|
|
160
|
+
await Promise.all([
|
|
161
|
+
aws_1.default.s3.copyObject({
|
|
162
|
+
...awsDefaults,
|
|
163
|
+
CopySource: versionedTarXzKey,
|
|
164
|
+
Key: unversionedTarXzKey,
|
|
165
|
+
}, {
|
|
166
|
+
dryRun: flags['dry-run'],
|
|
167
|
+
ignoreMissing: flags['ignore-missing'],
|
|
168
|
+
namespace: unversionedTarXzName,
|
|
169
|
+
}),
|
|
170
|
+
...(flags.indexes
|
|
171
|
+
? [
|
|
172
|
+
(0, version_indexes_1.appendToIndex)({
|
|
173
|
+
...indexDefaults,
|
|
174
|
+
dryRun: flags['dry-run'],
|
|
175
|
+
filename: unversionedTarXzName,
|
|
176
|
+
originalUrl: versionedTarXzKey,
|
|
177
|
+
}),
|
|
178
|
+
]
|
|
179
|
+
: []),
|
|
180
|
+
]);
|
|
181
|
+
};
|
|
182
|
+
const promoteMacInstallers = async () => {
|
|
183
|
+
const arches = (0, util_1.uniq)(buildConfig.targets.filter((t) => t.platform === 'darwin').map((t) => t.arch));
|
|
184
|
+
await Promise.all(arches.map(async (arch) => {
|
|
185
|
+
const darwinPkg = (0, upload_util_1.templateShortKey)('macos', { arch, bin: config.bin, sha: flags.sha, version: flags.version });
|
|
186
|
+
const darwinCopySource = cloudBucketCommitKey(darwinPkg);
|
|
187
|
+
// strip version & sha so scripts can point to a static channel pkg
|
|
188
|
+
const unversionedPkg = darwinPkg.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
189
|
+
await Promise.all([
|
|
190
|
+
aws_1.default.s3.copyObject({
|
|
191
|
+
...awsDefaults,
|
|
192
|
+
CopySource: darwinCopySource,
|
|
193
|
+
Key: cloudChannelKey(unversionedPkg),
|
|
194
|
+
}, {
|
|
195
|
+
dryRun: flags['dry-run'],
|
|
196
|
+
ignoreMissing: flags['ignore-missing'],
|
|
197
|
+
namespace: unversionedPkg,
|
|
198
|
+
}),
|
|
199
|
+
...(flags.indexes
|
|
200
|
+
? [
|
|
201
|
+
(0, version_indexes_1.appendToIndex)({
|
|
202
|
+
...indexDefaults,
|
|
203
|
+
dryRun: flags['dry-run'],
|
|
204
|
+
filename: unversionedPkg,
|
|
205
|
+
originalUrl: darwinCopySource,
|
|
206
|
+
}),
|
|
207
|
+
]
|
|
208
|
+
: []),
|
|
209
|
+
]);
|
|
210
|
+
}));
|
|
211
|
+
};
|
|
212
|
+
const promoteWindowsInstallers = async () => {
|
|
213
|
+
// copy win exe
|
|
214
|
+
const arches = buildConfig.targets.filter((t) => t.platform === 'win32').map((t) => t.arch);
|
|
215
|
+
await Promise.all(arches.map(async (arch) => {
|
|
216
|
+
const winPkg = (0, upload_util_1.templateShortKey)('win32', { arch, bin: config.bin, sha: flags.sha, version: flags.version });
|
|
217
|
+
const winCopySource = cloudBucketCommitKey(winPkg);
|
|
218
|
+
// strip version & sha so scripts can point to a static channel exe
|
|
219
|
+
const unversionedExe = winPkg.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
220
|
+
await Promise.all([
|
|
221
|
+
aws_1.default.s3.copyObject({
|
|
222
|
+
...awsDefaults,
|
|
223
|
+
CopySource: winCopySource,
|
|
224
|
+
Key: cloudChannelKey(unversionedExe),
|
|
225
|
+
}, {
|
|
226
|
+
dryRun: flags['dry-run'],
|
|
227
|
+
ignoreMissing: flags['ignore-missing'],
|
|
228
|
+
namespace: unversionedExe,
|
|
229
|
+
}),
|
|
230
|
+
...(flags.indexes
|
|
231
|
+
? [
|
|
232
|
+
(0, version_indexes_1.appendToIndex)({
|
|
233
|
+
...indexDefaults,
|
|
234
|
+
dryRun: flags['dry-run'],
|
|
235
|
+
filename: unversionedExe,
|
|
236
|
+
originalUrl: winCopySource,
|
|
237
|
+
}),
|
|
238
|
+
]
|
|
239
|
+
: []),
|
|
240
|
+
]);
|
|
241
|
+
core_1.ux.action.stop('successfully');
|
|
242
|
+
}));
|
|
243
|
+
};
|
|
244
|
+
const promoteDebianAptPackages = async () => {
|
|
245
|
+
const arches = buildConfig.targets.filter((t) => t.platform === 'linux');
|
|
246
|
+
// copy debian artifacts
|
|
247
|
+
const debArtifacts = [
|
|
248
|
+
...arches
|
|
249
|
+
.filter((a) => !a.arch.includes('x86')) // See todo below
|
|
250
|
+
.map((a) => (0, upload_util_1.templateShortKey)('deb', {
|
|
251
|
+
arch: (0, upload_util_1.debArch)(a.arch),
|
|
252
|
+
bin: config.bin,
|
|
253
|
+
versionShaRevision: (0, upload_util_1.debVersion)(buildConfig),
|
|
254
|
+
})),
|
|
255
|
+
'Packages.gz',
|
|
256
|
+
'Packages.xz',
|
|
257
|
+
'Packages.bz2',
|
|
258
|
+
'Release',
|
|
259
|
+
'InRelease',
|
|
260
|
+
'Release.gpg',
|
|
261
|
+
];
|
|
262
|
+
await Promise.all(debArtifacts.flatMap((artifact) => {
|
|
263
|
+
const debCopySource = cloudBucketCommitKey(`apt/${artifact}`);
|
|
264
|
+
const debKey = cloudChannelKey(`apt/${artifact}`);
|
|
265
|
+
// apt expects ../apt/dists/versionName/[artifacts] but oclif wants versions/sha/apt/[artifacts]
|
|
266
|
+
// see https://github.com/oclif/oclif/issues/347 for the AWS-redirect that solves this
|
|
267
|
+
// this workaround puts the code in both places that the redirect was doing
|
|
268
|
+
// with this, the docs are correct. The copies are all done in parallel so it shouldn't be too costly.
|
|
269
|
+
const workaroundKey = `${cloudChannelKey('apt/')}./${artifact}`;
|
|
270
|
+
return [
|
|
271
|
+
aws_1.default.s3.copyObject({
|
|
272
|
+
...awsDefaults,
|
|
273
|
+
CopySource: debCopySource,
|
|
274
|
+
Key: debKey,
|
|
275
|
+
}, {
|
|
276
|
+
dryRun: flags['dry-run'],
|
|
277
|
+
ignoreMissing: flags['ignore-missing'],
|
|
278
|
+
namespace: debKey,
|
|
279
|
+
}),
|
|
280
|
+
aws_1.default.s3.copyObject({
|
|
281
|
+
...awsDefaults,
|
|
282
|
+
CopySource: debCopySource,
|
|
283
|
+
Key: workaroundKey,
|
|
284
|
+
}, {
|
|
285
|
+
dryRun: flags['dry-run'],
|
|
286
|
+
ignoreMissing: flags['ignore-missing'],
|
|
287
|
+
namespace: workaroundKey,
|
|
288
|
+
}),
|
|
289
|
+
];
|
|
290
|
+
}));
|
|
291
|
+
};
|
|
292
|
+
await Promise.all([
|
|
293
|
+
...buildConfig.targets.flatMap((target) => [
|
|
294
|
+
// always promote the manifest and gz
|
|
295
|
+
promoteManifest(target),
|
|
296
|
+
promoteGzTarballs(target),
|
|
297
|
+
]),
|
|
298
|
+
...(flags.xz ? buildConfig.targets.map((target) => promoteXzTarballs(target)) : []),
|
|
299
|
+
...(flags.macos ? [promoteMacInstallers()] : []),
|
|
300
|
+
...(flags.win ? [promoteWindowsInstallers()] : []),
|
|
301
|
+
...(flags.deb ? [promoteDebianAptPackages()] : []),
|
|
302
|
+
]);
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
exports.default = Promote;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Command, Interfaces } from '@oclif/core';
|
|
2
|
+
export default class Readme extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
aliases: Interfaces.BooleanFlag<boolean>;
|
|
6
|
+
'dry-run': Interfaces.BooleanFlag<boolean>;
|
|
7
|
+
multi: Interfaces.BooleanFlag<boolean>;
|
|
8
|
+
'nested-topics-depth': Interfaces.OptionFlag<number | undefined, Interfaces.CustomOptions>;
|
|
9
|
+
'output-dir': Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
10
|
+
'plugin-directory': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
11
|
+
'readme-path': Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
12
|
+
'repository-prefix': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
13
|
+
'tsconfig-path': Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
14
|
+
version: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
15
|
+
};
|
|
16
|
+
static summary: string;
|
|
17
|
+
private flags;
|
|
18
|
+
run(): Promise<string>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const core_1 = require("@oclif/core");
|
|
40
|
+
const fs = __importStar(require("fs-extra"));
|
|
41
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
42
|
+
const readme_generator_1 = __importDefault(require("../readme-generator"));
|
|
43
|
+
class Readme extends core_1.Command {
|
|
44
|
+
static description = `The readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:
|
|
45
|
+
# Usage
|
|
46
|
+
<!-- usage -->
|
|
47
|
+
# Commands
|
|
48
|
+
<!-- commands -->
|
|
49
|
+
# Table of contents
|
|
50
|
+
<!-- toc -->
|
|
51
|
+
|
|
52
|
+
Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
|
|
53
|
+
`;
|
|
54
|
+
static flags = {
|
|
55
|
+
aliases: core_1.Flags.boolean({
|
|
56
|
+
allowNo: true,
|
|
57
|
+
default: true,
|
|
58
|
+
description: 'Include aliases in the command list.',
|
|
59
|
+
}),
|
|
60
|
+
'dry-run': core_1.Flags.boolean({
|
|
61
|
+
description: 'Prints the generated README without modifying the file.',
|
|
62
|
+
}),
|
|
63
|
+
multi: core_1.Flags.boolean({
|
|
64
|
+
description: 'Create a different markdown page for each topic.',
|
|
65
|
+
}),
|
|
66
|
+
'nested-topics-depth': core_1.Flags.integer({
|
|
67
|
+
dependsOn: ['multi'],
|
|
68
|
+
description: 'Max nested topics depth for multi markdown page generation. Use with --multi enabled.',
|
|
69
|
+
}),
|
|
70
|
+
'output-dir': core_1.Flags.string({
|
|
71
|
+
aliases: ['dir'],
|
|
72
|
+
default: 'docs',
|
|
73
|
+
description: 'Output directory for multi docs.',
|
|
74
|
+
required: true,
|
|
75
|
+
}),
|
|
76
|
+
'plugin-directory': core_1.Flags.string({
|
|
77
|
+
description: 'Plugin directory to generate README for. Defaults to the current directory.',
|
|
78
|
+
}),
|
|
79
|
+
'readme-path': core_1.Flags.string({
|
|
80
|
+
default: 'README.md',
|
|
81
|
+
description: 'Path to the README file.',
|
|
82
|
+
required: true,
|
|
83
|
+
}),
|
|
84
|
+
'repository-prefix': core_1.Flags.string({
|
|
85
|
+
description: 'A template string used to build links to the source code.',
|
|
86
|
+
}),
|
|
87
|
+
'tsconfig-path': core_1.Flags.string({
|
|
88
|
+
default: 'tsconfig.json',
|
|
89
|
+
description: 'Path to the tsconfig file',
|
|
90
|
+
}),
|
|
91
|
+
version: core_1.Flags.string({
|
|
92
|
+
description: 'Version to use in readme links. Defaults to the version in package.json.',
|
|
93
|
+
}),
|
|
94
|
+
};
|
|
95
|
+
static summary = 'Adds commands to README.md in current directory.';
|
|
96
|
+
flags;
|
|
97
|
+
async run() {
|
|
98
|
+
const { flags } = await this.parse(Readme);
|
|
99
|
+
this.flags = flags;
|
|
100
|
+
this.flags['plugin-directory'] ??= process.cwd();
|
|
101
|
+
const readmePath = node_path_1.default.resolve(this.flags['plugin-directory'], flags['readme-path']);
|
|
102
|
+
const tsConfigPath = node_path_1.default.resolve(this.flags['plugin-directory'], flags['tsconfig-path']);
|
|
103
|
+
if (await fs.pathExists(tsConfigPath)) {
|
|
104
|
+
const { default: JSONC } = await import('tiny-jsonc');
|
|
105
|
+
const tsConfigRaw = await fs.readFile(tsConfigPath, 'utf8');
|
|
106
|
+
const tsConfig = JSONC.parse(tsConfigRaw);
|
|
107
|
+
const outDir = tsConfig.compilerOptions?.outDir ?? 'lib';
|
|
108
|
+
if (!(await fs.pathExists(outDir))) {
|
|
109
|
+
this.warn(`No compiled source found at ${outDir}. Some commands may be missing.`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const config = await core_1.Config.load({
|
|
113
|
+
devPlugins: false,
|
|
114
|
+
root: this.flags['plugin-directory'],
|
|
115
|
+
userPlugins: false,
|
|
116
|
+
});
|
|
117
|
+
try {
|
|
118
|
+
const p = require.resolve('@oclif/plugin-legacy', { paths: [this.flags['plugin-directory']] });
|
|
119
|
+
const plugin = new core_1.Plugin({ root: p, type: 'core' });
|
|
120
|
+
await plugin.load();
|
|
121
|
+
config.plugins.set(plugin.name, plugin);
|
|
122
|
+
}
|
|
123
|
+
catch { }
|
|
124
|
+
await config.runHook('init', { argv: this.argv, id: 'readme' });
|
|
125
|
+
const generator = new readme_generator_1.default(config, {
|
|
126
|
+
aliases: this.flags.aliases,
|
|
127
|
+
dryRun: this.flags['dry-run'],
|
|
128
|
+
multi: this.flags.multi,
|
|
129
|
+
nestedTopicsDepth: this.flags['nested-topics-depth'],
|
|
130
|
+
outputDir: this.flags['output-dir'],
|
|
131
|
+
pluginDir: this.flags['plugin-directory'],
|
|
132
|
+
readmePath,
|
|
133
|
+
repositoryPrefix: this.flags['repository-prefix'],
|
|
134
|
+
version: this.flags.version,
|
|
135
|
+
});
|
|
136
|
+
const readme = await generator.generate();
|
|
137
|
+
if (this.flags['dry-run']) {
|
|
138
|
+
this.log(readme);
|
|
139
|
+
}
|
|
140
|
+
return readme;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.default = Readme;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class UploadDeb extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'dry-run': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
6
|
+
root: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
sha: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
38
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
const core_1 = require("@oclif/core");
|
|
40
|
+
const fs = __importStar(require("node:fs"));
|
|
41
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
42
|
+
const aws_1 = __importDefault(require("../../aws"));
|
|
43
|
+
const log_1 = require("../../log");
|
|
44
|
+
const Tarballs = __importStar(require("../../tarballs"));
|
|
45
|
+
const upload_util_1 = require("../../upload-util");
|
|
46
|
+
class UploadDeb extends core_1.Command {
|
|
47
|
+
static description = 'Upload deb package built with `pack deb`.';
|
|
48
|
+
static flags = {
|
|
49
|
+
'dry-run': core_1.Flags.boolean({ description: 'Run the command without uploading to S3.' }),
|
|
50
|
+
root: core_1.Flags.string({ char: 'r', default: '.', description: 'Path to oclif CLI root.', required: true }),
|
|
51
|
+
sha: core_1.Flags.string({
|
|
52
|
+
description: '7-digit short git commit SHA (defaults to current checked out commit).',
|
|
53
|
+
required: false,
|
|
54
|
+
}),
|
|
55
|
+
};
|
|
56
|
+
async run() {
|
|
57
|
+
const { flags } = await this.parse(UploadDeb);
|
|
58
|
+
const buildConfig = await Tarballs.buildConfig(flags.root, { sha: flags?.sha });
|
|
59
|
+
const { config, s3Config } = buildConfig;
|
|
60
|
+
const dist = (f) => buildConfig.dist(node_path_1.default.join('deb', f));
|
|
61
|
+
const S3Options = {
|
|
62
|
+
ACL: s3Config.acl || 'public-read',
|
|
63
|
+
Bucket: s3Config.bucket,
|
|
64
|
+
};
|
|
65
|
+
if (!fs.existsSync(dist('Release')))
|
|
66
|
+
this.error('Cannot find debian artifacts', {
|
|
67
|
+
suggestions: ['Run "oclif pack deb" before uploading'],
|
|
68
|
+
});
|
|
69
|
+
const cloudKeyBase = (0, upload_util_1.commitAWSDir)(config.pjson.version, buildConfig.gitSha, s3Config);
|
|
70
|
+
const upload = (file) => {
|
|
71
|
+
const cloudKey = `${cloudKeyBase}/apt/${file}`;
|
|
72
|
+
return aws_1.default.s3.uploadFile(dist(file), { ...S3Options, CacheControl: 'max-age=86400', Key: cloudKey }, {
|
|
73
|
+
dryRun: flags['dry-run'],
|
|
74
|
+
});
|
|
75
|
+
};
|
|
76
|
+
// apt expects ../apt/dists/versionName/[artifacts] but oclif wants versions/sha/apt/[artifacts]
|
|
77
|
+
// see https://github.com/oclif/oclif/issues/347 for the AWS-redirect that solves this
|
|
78
|
+
// this workaround puts the code in both places that the redirect was doing
|
|
79
|
+
// with this, the docs are correct. The copies are all done in parallel so it shouldn't be too costly.
|
|
80
|
+
const uploadWorkaround = (file) => {
|
|
81
|
+
const cloudKey = `${cloudKeyBase}/apt/./${file}`;
|
|
82
|
+
return aws_1.default.s3.uploadFile(dist(file), { ...S3Options, CacheControl: 'max-age=86400', Key: cloudKey }, {
|
|
83
|
+
dryRun: flags['dry-run'],
|
|
84
|
+
});
|
|
85
|
+
};
|
|
86
|
+
const uploadDeb = async (arch) => {
|
|
87
|
+
const deb = (0, upload_util_1.templateShortKey)('deb', {
|
|
88
|
+
arch,
|
|
89
|
+
bin: config.bin,
|
|
90
|
+
versionShaRevision: (0, upload_util_1.debVersion)(buildConfig),
|
|
91
|
+
});
|
|
92
|
+
if (fs.existsSync(dist(deb)))
|
|
93
|
+
await Promise.all([upload(deb), uploadWorkaround(deb)]);
|
|
94
|
+
};
|
|
95
|
+
(0, log_1.log)(`starting upload of deb artifacts for v${config.version}-${buildConfig.gitSha}`);
|
|
96
|
+
const arches = buildConfig.targets.filter((t) => t.platform === 'linux');
|
|
97
|
+
await Promise.all([
|
|
98
|
+
...arches.map((a) => uploadDeb((0, upload_util_1.debArch)(a.arch))),
|
|
99
|
+
upload('Packages.gz'),
|
|
100
|
+
upload('Packages.xz'),
|
|
101
|
+
upload('Packages.bz2'),
|
|
102
|
+
upload('Release'),
|
|
103
|
+
uploadWorkaround('Packages.gz'),
|
|
104
|
+
uploadWorkaround('Packages.xz'),
|
|
105
|
+
uploadWorkaround('Packages.bz2'),
|
|
106
|
+
uploadWorkaround('Release'),
|
|
107
|
+
...(fs.existsSync(dist('InRelease')) ? [upload('InRelease'), uploadWorkaround('InRelease')] : []),
|
|
108
|
+
...(fs.existsSync(dist('Release.gpg')) ? [upload('Release.gpg'), uploadWorkaround('Release.gpg')] : []),
|
|
109
|
+
]);
|
|
110
|
+
(0, log_1.log)(`done uploading deb artifacts for v${config.version}-${buildConfig.gitSha}`);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
exports.default = UploadDeb;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Command, Interfaces } from '@oclif/core';
|
|
2
|
+
export default class UploadMacos extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {
|
|
5
|
+
'dry-run': Interfaces.BooleanFlag<boolean>;
|
|
6
|
+
root: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
|
|
7
|
+
sha: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
8
|
+
targets: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
|
|
9
|
+
};
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|