oclif 4.18.4 → 4.20.0
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.js +7 -1
- package/lib/tarballs/build.js +10 -8
- package/lib/tarballs/config.d.ts +3 -0
- package/lib/tarballs/config.js +4 -0
- package/lib/util.d.ts +2 -0
- package/lib/util.js +8 -0
- package/oclif.manifest.json +1 -1
- package/package.json +3 -3
package/lib/aws.js
CHANGED
|
@@ -29,13 +29,19 @@ const aws = {
|
|
|
29
29
|
},
|
|
30
30
|
get s3() {
|
|
31
31
|
try {
|
|
32
|
+
const endpoint = process.env.AWS_S3_ENDPOINT;
|
|
33
|
+
const checksumConfig = (0, util_1.getS3ChecksumConfig)(endpoint, process.env.AWS_REQUEST_CHECKSUM_CALCULATION);
|
|
32
34
|
cache.s3 =
|
|
33
35
|
cache.s3 ??
|
|
34
36
|
new (require('@aws-sdk/client-s3').S3Client)({
|
|
35
37
|
credentials: this.creds,
|
|
36
|
-
endpoint
|
|
38
|
+
endpoint,
|
|
37
39
|
forcePathStyle: Boolean(process.env.AWS_S3_FORCE_PATH_STYLE),
|
|
38
40
|
region: process.env.AWS_REGION ?? 'us-east-1',
|
|
41
|
+
// Support disabling checksums for S3-compatible storage
|
|
42
|
+
...(checksumConfig && {
|
|
43
|
+
requestChecksumCalculation: checksumConfig,
|
|
44
|
+
}),
|
|
39
45
|
});
|
|
40
46
|
return cache.s3;
|
|
41
47
|
}
|
package/lib/tarballs/build.js
CHANGED
|
@@ -19,16 +19,15 @@ const util_1 = require("../util");
|
|
|
19
19
|
const bin_1 = require("./bin");
|
|
20
20
|
const node_1 = require("./node");
|
|
21
21
|
const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
|
|
22
|
-
const pack = async (from, to) => {
|
|
22
|
+
const pack = async (from, to, c) => {
|
|
23
23
|
const cwd = node_path_1.default.dirname(from);
|
|
24
24
|
await (0, promises_1.mkdir)(node_path_1.default.dirname(to), { recursive: true });
|
|
25
25
|
(0, log_1.log)(`packing tarball from ${(0, util_1.prettifyPaths)(node_path_1.default.dirname(from))} to ${(0, util_1.prettifyPaths)(to)}`);
|
|
26
|
+
const platformFlag = c.tarFlags?.[process.platform] ?? '';
|
|
26
27
|
if (to.endsWith('gz')) {
|
|
27
|
-
return exec(`tar czf ${to} ${node_path_1.default.basename(from)}${
|
|
28
|
-
cwd,
|
|
29
|
-
});
|
|
28
|
+
return exec(`tar czf ${to} ${node_path_1.default.basename(from)} ${platformFlag}`, { cwd });
|
|
30
29
|
}
|
|
31
|
-
await exec(`tar cfJ ${to} ${node_path_1.default.basename(from)}${
|
|
30
|
+
await exec(`tar cfJ ${to} ${node_path_1.default.basename(from)} ${platformFlag}`, { cwd });
|
|
32
31
|
};
|
|
33
32
|
const isYarnProject = (yarnRootPath) => {
|
|
34
33
|
const yarnLockFileName = 'yarn.lock';
|
|
@@ -215,12 +214,15 @@ const buildTarget = async (target, c, options) => {
|
|
|
215
214
|
if (options.pack === false)
|
|
216
215
|
return;
|
|
217
216
|
if (options.parallel) {
|
|
218
|
-
await Promise.all([
|
|
217
|
+
await Promise.all([
|
|
218
|
+
pack(workspace, c.dist(gzLocalKey), c),
|
|
219
|
+
...(c.xz ? [pack(workspace, c.dist(xzLocalKey), c)] : []),
|
|
220
|
+
]);
|
|
219
221
|
}
|
|
220
222
|
else {
|
|
221
|
-
await pack(workspace, c.dist(gzLocalKey));
|
|
223
|
+
await pack(workspace, c.dist(gzLocalKey), c);
|
|
222
224
|
if (c.xz)
|
|
223
|
-
await pack(workspace, c.dist(xzLocalKey));
|
|
225
|
+
await pack(workspace, c.dist(xzLocalKey), c);
|
|
224
226
|
}
|
|
225
227
|
if (!c.updateConfig.s3?.host)
|
|
226
228
|
return;
|
package/lib/tarballs/config.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ObjectCannedACL } from '@aws-sdk/client-s3';
|
|
2
2
|
import { Interfaces } from '@oclif/core';
|
|
3
3
|
export declare const TARGETS: string[];
|
|
4
|
+
type TarFlags = Interfaces.OclifConfiguration['tarFlags'];
|
|
4
5
|
export type S3Config = BuildConfig['updateConfig']['s3'] & {
|
|
5
6
|
acl?: ObjectCannedACL;
|
|
6
7
|
} & {
|
|
@@ -20,6 +21,7 @@ export type BuildConfig = {
|
|
|
20
21
|
nodeVersion: string;
|
|
21
22
|
root: string;
|
|
22
23
|
s3Config: S3Config;
|
|
24
|
+
tarFlags?: TarFlags;
|
|
23
25
|
targets: {
|
|
24
26
|
arch: Interfaces.ArchTypes;
|
|
25
27
|
platform: Interfaces.PlatformTypes;
|
|
@@ -39,3 +41,4 @@ export declare function buildConfig(root: string, options?: {
|
|
|
39
41
|
targets?: string[];
|
|
40
42
|
xz?: boolean;
|
|
41
43
|
}): Promise<BuildConfig>;
|
|
44
|
+
export {};
|
package/lib/tarballs/config.js
CHANGED
|
@@ -58,6 +58,7 @@ exports.TARGETS = [
|
|
|
58
58
|
'darwin-x64',
|
|
59
59
|
'darwin-arm64',
|
|
60
60
|
];
|
|
61
|
+
const DEFAULT_TAR_FLAGS = { win32: '--force-local' };
|
|
61
62
|
async function gitSha(cwd, options = {}) {
|
|
62
63
|
const args = options.short ? ['rev-parse', '--short', 'HEAD'] : ['rev-parse', 'HEAD'];
|
|
63
64
|
const { stdout } = await exec(`git ${args.join(' ')}`, { cwd });
|
|
@@ -94,6 +95,8 @@ async function buildConfig(root, options = {}) {
|
|
|
94
95
|
...updateConfig.s3,
|
|
95
96
|
acl: updateConfig.s3.acl,
|
|
96
97
|
};
|
|
98
|
+
const existingTarFlags = config.pjson.oclif.tarFlags;
|
|
99
|
+
const tarFlags = existingTarFlags ? { ...DEFAULT_TAR_FLAGS, ...existingTarFlags } : DEFAULT_TAR_FLAGS;
|
|
97
100
|
return {
|
|
98
101
|
config,
|
|
99
102
|
dist: (...args) => node_path_1.default.join(config.root, 'dist', ...args),
|
|
@@ -102,6 +105,7 @@ async function buildConfig(root, options = {}) {
|
|
|
102
105
|
nodeVersion,
|
|
103
106
|
root,
|
|
104
107
|
s3Config,
|
|
108
|
+
tarFlags,
|
|
105
109
|
targets,
|
|
106
110
|
tmp,
|
|
107
111
|
updateConfig,
|
package/lib/util.d.ts
CHANGED
|
@@ -13,4 +13,6 @@ export declare const hash: (algo: string, fp: string | string[]) => Promise<stri
|
|
|
13
13
|
export declare function checkFor7Zip(): Promise<void>;
|
|
14
14
|
export declare function isEmpty(obj: Record<string, unknown>): boolean;
|
|
15
15
|
export declare function validateBin(bin: string): boolean;
|
|
16
|
+
export declare function isS3Compatible(endpoint: string | undefined): boolean;
|
|
17
|
+
export declare function getS3ChecksumConfig(endpoint: string | undefined, envValue: string | undefined): string | undefined;
|
|
16
18
|
export {};
|
package/lib/util.js
CHANGED
|
@@ -42,6 +42,8 @@ exports.sortBy = sortBy;
|
|
|
42
42
|
exports.checkFor7Zip = checkFor7Zip;
|
|
43
43
|
exports.isEmpty = isEmpty;
|
|
44
44
|
exports.validateBin = validateBin;
|
|
45
|
+
exports.isS3Compatible = isS3Compatible;
|
|
46
|
+
exports.getS3ChecksumConfig = getS3ChecksumConfig;
|
|
45
47
|
const core_1 = require("@oclif/core");
|
|
46
48
|
const node_child_process_1 = require("node:child_process");
|
|
47
49
|
const crypto = __importStar(require("node:crypto"));
|
|
@@ -150,3 +152,9 @@ function isEmpty(obj) {
|
|
|
150
152
|
function validateBin(bin) {
|
|
151
153
|
return /^[\w-]+$/.test(bin);
|
|
152
154
|
}
|
|
155
|
+
function isS3Compatible(endpoint) {
|
|
156
|
+
return Boolean(endpoint && !endpoint.includes('amazonaws.com'));
|
|
157
|
+
}
|
|
158
|
+
function getS3ChecksumConfig(endpoint, envValue) {
|
|
159
|
+
return envValue || (isS3Compatible(endpoint) ? 'WHEN_REQUIRED' : undefined);
|
|
160
|
+
}
|
package/oclif.manifest.json
CHANGED
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.
|
|
4
|
+
"version": "4.20.0",
|
|
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.4.0",
|
|
17
17
|
"@oclif/plugin-help": "^6.2.29",
|
|
18
18
|
"@oclif/plugin-not-found": "^3.2.57",
|
|
19
19
|
"@oclif/plugin-warn-if-update-available": "^3.1.38",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@commitlint/config-conventional": "^19",
|
|
38
38
|
"@eslint/compat": "^1.3.0",
|
|
39
|
-
"@oclif/plugin-legacy": "^2.0.
|
|
39
|
+
"@oclif/plugin-legacy": "^2.0.24",
|
|
40
40
|
"@oclif/prettier-config": "^0.2.1",
|
|
41
41
|
"@oclif/test": "^4",
|
|
42
42
|
"@types/async-retry": "^1.4.5",
|