oclif 4.15.0 → 4.15.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/lib/aws.d.ts +1 -1
- package/lib/aws.js +18 -2
- package/lib/commands/promote.d.ts +1 -0
- package/lib/commands/promote.js +17 -11
- package/lib/readme-generator.js +1 -1
- package/oclif.manifest.json +7 -1
- package/package.json +2 -2
package/lib/aws.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ declare const _default: {
|
|
|
5
5
|
createCloudfrontInvalidation: (options: CreateInvalidationRequest) => Promise<CreateInvalidationCommandOutput>;
|
|
6
6
|
};
|
|
7
7
|
readonly s3: {
|
|
8
|
-
copyObject: (options: CopyObjectRequest) => Promise<CopyObjectOutput>;
|
|
8
|
+
copyObject: (options: CopyObjectRequest, ignoreMissing?: boolean) => Promise<CopyObjectOutput>;
|
|
9
9
|
deleteObjects: (options: DeleteObjectsRequest) => Promise<DeleteObjectsOutput>;
|
|
10
10
|
getObject: (options: GetObjectRequest) => Promise<GetObjectOutput>;
|
|
11
11
|
headObject: (options: HeadObjectRequest) => Promise<HeadObjectOutput>;
|
package/lib/aws.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const client_cloudfront_1 = require("@aws-sdk/client-cloudfront");
|
|
4
4
|
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
5
|
+
const errors_1 = require("@oclif/core/errors");
|
|
5
6
|
const fs_extra_1 = require("fs-extra");
|
|
6
7
|
const log_1 = require("./log");
|
|
7
8
|
const util_1 = require("./util");
|
|
@@ -59,12 +60,27 @@ exports.default = {
|
|
|
59
60
|
},
|
|
60
61
|
get s3() {
|
|
61
62
|
return {
|
|
62
|
-
copyObject: (options) => new Promise((resolve, reject) => {
|
|
63
|
+
copyObject: (options, ignoreMissing = false) => new Promise((resolve, reject) => {
|
|
63
64
|
(0, log_1.log)('s3:copyObject', `from s3://${options.CopySource}`, `to s3://${options.Bucket}/${options.Key}`);
|
|
64
65
|
aws.s3
|
|
65
66
|
?.send(new client_s3_1.CopyObjectCommand(options))
|
|
66
67
|
.then((data) => resolve(data))
|
|
67
|
-
.catch((error) =>
|
|
68
|
+
.catch((error) => {
|
|
69
|
+
if (error.Code === 'NoSuchKey') {
|
|
70
|
+
if (ignoreMissing) {
|
|
71
|
+
(0, log_1.log)('s3:copyObject', `s3://${options.CopySource} does not exist - skipping because of --ignore-missing`);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
reject(new errors_1.CLIError(`Failed to copy source object s3://${options.CopySource} to s3://${options.Bucket}/${options.Key} because the source object does not exist`, {
|
|
75
|
+
suggestions: [
|
|
76
|
+
'Use the "oclif upload" to upload the object first',
|
|
77
|
+
'Use the "--targets" flag to specify existing targets',
|
|
78
|
+
'Use the "--ignore-missing" flag to skip this error',
|
|
79
|
+
],
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
reject(error);
|
|
83
|
+
});
|
|
68
84
|
}),
|
|
69
85
|
deleteObjects: (options) => new Promise((resolve, reject) => {
|
|
70
86
|
debug('deleteObjects', `s3://${options.Bucket}`);
|
|
@@ -4,6 +4,7 @@ export default class Promote extends Command {
|
|
|
4
4
|
static flags: {
|
|
5
5
|
channel: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
6
|
deb: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
|
+
'ignore-missing': import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
7
8
|
indexes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
9
|
macos: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
'max-age': import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
package/lib/commands/promote.js
CHANGED
|
@@ -39,6 +39,9 @@ class Promote extends core_1.Command {
|
|
|
39
39
|
static flags = {
|
|
40
40
|
channel: core_1.Flags.string({ default: 'stable', description: 'Channel to promote to.', required: true }),
|
|
41
41
|
deb: core_1.Flags.boolean({ char: 'd', description: 'Promote debian artifacts.' }),
|
|
42
|
+
'ignore-missing': core_1.Flags.boolean({
|
|
43
|
+
description: 'Ignore missing tarballs/installers and continue promoting the rest.',
|
|
44
|
+
}),
|
|
42
45
|
indexes: core_1.Flags.boolean({ description: 'Append the promoted urls into the index files.' }),
|
|
43
46
|
macos: core_1.Flags.boolean({ char: 'm', description: 'Promote macOS pkg.' }),
|
|
44
47
|
'max-age': core_1.Flags.string({ char: 'a', default: '86400', description: 'Cache control max-age in seconds.' }),
|
|
@@ -51,6 +54,9 @@ class Promote extends core_1.Command {
|
|
|
51
54
|
};
|
|
52
55
|
async run() {
|
|
53
56
|
const { flags } = await this.parse(Promote);
|
|
57
|
+
if (flags['ignore-missing']) {
|
|
58
|
+
this.warn("--ignore-missing flag is being used - This command will continue to run even if a promotion fails because it doesn't exist");
|
|
59
|
+
}
|
|
54
60
|
const buildConfig = await Tarballs.buildConfig(flags.root, { targets: flags?.targets?.split(',') });
|
|
55
61
|
const { config, s3Config } = buildConfig;
|
|
56
62
|
const indexDefaults = {
|
|
@@ -70,7 +76,7 @@ class Promote extends core_1.Command {
|
|
|
70
76
|
const cloudChannelKey = (shortKey) => path.join((0, upload_util_1.channelAWSDir)(flags.channel, s3Config), shortKey);
|
|
71
77
|
// copy tarballs manifests
|
|
72
78
|
if (buildConfig.targets.length > 0)
|
|
73
|
-
this.log(
|
|
79
|
+
this.log(`\nPromoting buildmanifests & unversioned tarballs to ${flags.channel}`);
|
|
74
80
|
const promoteManifest = async (target) => {
|
|
75
81
|
const manifest = (0, upload_util_1.templateShortKey)('manifest', {
|
|
76
82
|
arch: target.arch,
|
|
@@ -85,7 +91,7 @@ class Promote extends core_1.Command {
|
|
|
85
91
|
...awsDefaults,
|
|
86
92
|
CopySource: cloudBucketCommitKey(manifest),
|
|
87
93
|
Key: cloudChannelKey(unversionedManifest),
|
|
88
|
-
});
|
|
94
|
+
}, flags['ignore-missing']);
|
|
89
95
|
};
|
|
90
96
|
const promoteGzTarballs = async (target) => {
|
|
91
97
|
const versionedTarGzName = (0, upload_util_1.templateShortKey)('versioned', {
|
|
@@ -105,7 +111,7 @@ class Promote extends core_1.Command {
|
|
|
105
111
|
...awsDefaults,
|
|
106
112
|
CopySource: versionedTarGzKey,
|
|
107
113
|
Key: unversionedTarGzKey,
|
|
108
|
-
}),
|
|
114
|
+
}, flags['ignore-missing']),
|
|
109
115
|
...(flags.indexes
|
|
110
116
|
? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, filename: unversionedTarGzName, originalUrl: versionedTarGzKey })]
|
|
111
117
|
: []),
|
|
@@ -129,14 +135,14 @@ class Promote extends core_1.Command {
|
|
|
129
135
|
...awsDefaults,
|
|
130
136
|
CopySource: versionedTarXzKey,
|
|
131
137
|
Key: unversionedTarXzKey,
|
|
132
|
-
}),
|
|
138
|
+
}, flags['ignore-missing']),
|
|
133
139
|
...(flags.indexes
|
|
134
140
|
? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, filename: unversionedTarXzName, originalUrl: versionedTarXzKey })]
|
|
135
141
|
: []),
|
|
136
142
|
]);
|
|
137
143
|
};
|
|
138
144
|
const promoteMacInstallers = async () => {
|
|
139
|
-
this.log(
|
|
145
|
+
this.log(`\nPromoting macos pkgs to ${flags.channel}`);
|
|
140
146
|
const arches = (0, util_1.uniq)(buildConfig.targets.filter((t) => t.platform === 'darwin').map((t) => t.arch));
|
|
141
147
|
await Promise.all(arches.map(async (arch) => {
|
|
142
148
|
const darwinPkg = (0, upload_util_1.templateShortKey)('macos', { arch, bin: config.bin, sha: flags.sha, version: flags.version });
|
|
@@ -148,7 +154,7 @@ class Promote extends core_1.Command {
|
|
|
148
154
|
...awsDefaults,
|
|
149
155
|
CopySource: darwinCopySource,
|
|
150
156
|
Key: cloudChannelKey(unversionedPkg),
|
|
151
|
-
}),
|
|
157
|
+
}, flags['ignore-missing']),
|
|
152
158
|
...(flags.indexes
|
|
153
159
|
? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, filename: unversionedPkg, originalUrl: darwinCopySource })]
|
|
154
160
|
: []),
|
|
@@ -157,7 +163,7 @@ class Promote extends core_1.Command {
|
|
|
157
163
|
};
|
|
158
164
|
const promoteWindowsInstallers = async () => {
|
|
159
165
|
// copy win exe
|
|
160
|
-
this.log(
|
|
166
|
+
this.log(`\nPromoting windows exe to ${flags.channel}`);
|
|
161
167
|
const arches = buildConfig.targets.filter((t) => t.platform === 'win32').map((t) => t.arch);
|
|
162
168
|
await Promise.all(arches.map(async (arch) => {
|
|
163
169
|
const winPkg = (0, upload_util_1.templateShortKey)('win32', { arch, bin: config.bin, sha: flags.sha, version: flags.version });
|
|
@@ -169,7 +175,7 @@ class Promote extends core_1.Command {
|
|
|
169
175
|
...awsDefaults,
|
|
170
176
|
CopySource: winCopySource,
|
|
171
177
|
Key: cloudChannelKey(unversionedExe),
|
|
172
|
-
}),
|
|
178
|
+
}, flags['ignore-missing']),
|
|
173
179
|
...(flags.indexes
|
|
174
180
|
? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, filename: unversionedExe, originalUrl: winCopySource })]
|
|
175
181
|
: []),
|
|
@@ -195,7 +201,7 @@ class Promote extends core_1.Command {
|
|
|
195
201
|
'InRelease',
|
|
196
202
|
'Release.gpg',
|
|
197
203
|
];
|
|
198
|
-
this.log(
|
|
204
|
+
this.log(`\nPromoting debian artifacts to ${flags.channel}`);
|
|
199
205
|
await Promise.all(debArtifacts.flatMap((artifact) => {
|
|
200
206
|
const debCopySource = cloudBucketCommitKey(`apt/${artifact}`);
|
|
201
207
|
const debKey = cloudChannelKey(`apt/${artifact}`);
|
|
@@ -209,12 +215,12 @@ class Promote extends core_1.Command {
|
|
|
209
215
|
...awsDefaults,
|
|
210
216
|
CopySource: debCopySource,
|
|
211
217
|
Key: debKey,
|
|
212
|
-
}),
|
|
218
|
+
}, flags['ignore-missing']),
|
|
213
219
|
aws_1.default.s3.copyObject({
|
|
214
220
|
...awsDefaults,
|
|
215
221
|
CopySource: debCopySource,
|
|
216
222
|
Key: workaroundKey,
|
|
217
|
-
}),
|
|
223
|
+
}, flags['ignore-missing']),
|
|
218
224
|
];
|
|
219
225
|
}));
|
|
220
226
|
};
|
package/lib/readme-generator.js
CHANGED
|
@@ -152,7 +152,7 @@ class ReadmeGenerator {
|
|
|
152
152
|
const title = (0, ejs_1.render)(c.summary ?? c.description ?? '', { command: c, config: this.config })
|
|
153
153
|
.trim()
|
|
154
154
|
.split('\n')[0];
|
|
155
|
-
const help = new HelpClass(this.config, { maxWidth: columns, stripAnsi: true });
|
|
155
|
+
const help = new HelpClass(this.config, { maxWidth: columns, respectNoCacheDefault: true, stripAnsi: true });
|
|
156
156
|
const wrapper = new help_compatibility_1.HelpCompatibilityWrapper(help);
|
|
157
157
|
const header = () => {
|
|
158
158
|
const usage = this.commandUsage(c);
|
package/oclif.manifest.json
CHANGED
|
@@ -381,6 +381,12 @@
|
|
|
381
381
|
"allowNo": false,
|
|
382
382
|
"type": "boolean"
|
|
383
383
|
},
|
|
384
|
+
"ignore-missing": {
|
|
385
|
+
"description": "Ignore missing tarballs/installers and continue promoting the rest.",
|
|
386
|
+
"name": "ignore-missing",
|
|
387
|
+
"allowNo": false,
|
|
388
|
+
"type": "boolean"
|
|
389
|
+
},
|
|
384
390
|
"indexes": {
|
|
385
391
|
"description": "Append the promoted urls into the index files.",
|
|
386
392
|
"name": "indexes",
|
|
@@ -1087,5 +1093,5 @@
|
|
|
1087
1093
|
]
|
|
1088
1094
|
}
|
|
1089
1095
|
},
|
|
1090
|
-
"version": "4.15.
|
|
1096
|
+
"version": "4.15.2"
|
|
1091
1097
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "oclif",
|
|
3
3
|
"description": "oclif: create your own CLI",
|
|
4
|
-
"version": "4.15.
|
|
4
|
+
"version": "4.15.2",
|
|
5
5
|
"author": "Salesforce",
|
|
6
6
|
"bin": {
|
|
7
7
|
"oclif": "bin/run.js"
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"@inquirer/confirm": "^3.1.22",
|
|
14
14
|
"@inquirer/input": "^2.2.4",
|
|
15
15
|
"@inquirer/select": "^2.5.0",
|
|
16
|
-
"@oclif/core": "^4",
|
|
16
|
+
"@oclif/core": "^4.0.27",
|
|
17
17
|
"@oclif/plugin-help": "^6.2.10",
|
|
18
18
|
"@oclif/plugin-not-found": "^3.2.21",
|
|
19
19
|
"@oclif/plugin-warn-if-update-available": "^3.1.11",
|