oclif 3.13.0 → 3.13.1-beta.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/.oclif.manifest.json +1 -1
- package/lib/aws.js +1 -5
- package/lib/commands/manifest.js +6 -6
- package/lib/commands/promote.js +7 -35
- package/lib/commands/readme.js +4 -4
- package/lib/commands/upload/deb.js +2 -2
- package/lib/commands/upload/macos.js +1 -1
- package/lib/commands/upload/tarballs.js +3 -3
- package/lib/commands/upload/win.js +1 -1
- package/lib/generators/cli.js +5 -39
- package/lib/generators/command.js +1 -1
- package/lib/upload-util.js +1 -1
- package/lib/version-indexes.js +1 -4
- package/package.json +1 -1
package/.oclif.manifest.json
CHANGED
package/lib/aws.js
CHANGED
|
@@ -20,11 +20,7 @@ const aws = {
|
|
|
20
20
|
},
|
|
21
21
|
get s3() {
|
|
22
22
|
try {
|
|
23
|
-
cache.s3 = cache.s3 || new (require('aws-sdk/clients/s3'))({
|
|
24
|
-
...this.creds,
|
|
25
|
-
endpoint: process.env.AWS_S3_ENDPOINT,
|
|
26
|
-
s3ForcePathStyle: Boolean(process.env.AWS_S3_FORCE_PATH_STYLE),
|
|
27
|
-
});
|
|
23
|
+
cache.s3 = cache.s3 || new (require('aws-sdk/clients/s3'))(Object.assign(Object.assign({}, this.creds), { endpoint: process.env.AWS_S3_ENDPOINT, s3ForcePathStyle: Boolean(process.env.AWS_S3_FORCE_PATH_STYLE) }));
|
|
28
24
|
return cache.s3;
|
|
29
25
|
}
|
|
30
26
|
catch (error) {
|
package/lib/commands/manifest.js
CHANGED
|
@@ -11,7 +11,7 @@ async function fileExists(filePath) {
|
|
|
11
11
|
await fs.access(filePath);
|
|
12
12
|
return true;
|
|
13
13
|
}
|
|
14
|
-
catch {
|
|
14
|
+
catch (_a) {
|
|
15
15
|
return false;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
@@ -22,7 +22,7 @@ class Manifest extends core_1.Command {
|
|
|
22
22
|
try {
|
|
23
23
|
fs.unlinkSync('oclif.manifest.json');
|
|
24
24
|
}
|
|
25
|
-
catch { }
|
|
25
|
+
catch (_b) { }
|
|
26
26
|
const { args } = await this.parse(Manifest);
|
|
27
27
|
const root = path.resolve(args.path);
|
|
28
28
|
const packageJson = fs.readJSONSync('package.json');
|
|
@@ -73,7 +73,7 @@ class Manifest extends core_1.Command {
|
|
|
73
73
|
const dotfile = plugin.pjson.files.find((f) => f.endsWith('.oclif.manifest.json'));
|
|
74
74
|
const file = path.join(plugin.root, `${dotfile ? '.' : ''}oclif.manifest.json`);
|
|
75
75
|
for (const manifest of jitPluginManifests) {
|
|
76
|
-
plugin.manifest.commands = {
|
|
76
|
+
plugin.manifest.commands = Object.assign(Object.assign({}, plugin.manifest.commands), manifest.commands);
|
|
77
77
|
}
|
|
78
78
|
fs.writeFileSync(file, JSON.stringify(plugin.manifest, null, 2));
|
|
79
79
|
this.log(`wrote manifest to ${file}`);
|
|
@@ -82,11 +82,11 @@ class Manifest extends core_1.Command {
|
|
|
82
82
|
try {
|
|
83
83
|
this.executeCommand(`git clone --branch ${tag} ${repoUrl} ${fullPath} --depth 1`);
|
|
84
84
|
}
|
|
85
|
-
catch {
|
|
85
|
+
catch (_a) {
|
|
86
86
|
try {
|
|
87
87
|
this.executeCommand(`git clone --branch v${tag} ${repoUrl} ${fullPath} --depth 1`);
|
|
88
88
|
}
|
|
89
|
-
catch {
|
|
89
|
+
catch (_b) {
|
|
90
90
|
throw new Error(`Unable to clone repo ${repoUrl} with tag ${tag}`);
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -94,7 +94,7 @@ class Manifest extends core_1.Command {
|
|
|
94
94
|
executeCommand(command, options) {
|
|
95
95
|
const debugString = (options === null || options === void 0 ? void 0 : options.cwd) ? `executing command: ${command} in ${options.cwd}` : `executing command: ${command}`;
|
|
96
96
|
this.debug(debugString);
|
|
97
|
-
const result = (0, shelljs_1.exec)(command, {
|
|
97
|
+
const result = (0, shelljs_1.exec)(command, Object.assign(Object.assign({}, options), { silent: true, async: false }));
|
|
98
98
|
if (result.code !== 0) {
|
|
99
99
|
this.error(result.stderr);
|
|
100
100
|
}
|
package/lib/commands/promote.js
CHANGED
|
@@ -42,11 +42,7 @@ class Promote extends core_1.Command {
|
|
|
42
42
|
});
|
|
43
43
|
// strip version & sha so update/scripts can point to a static channel manifest
|
|
44
44
|
const unversionedManifest = manifest.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
45
|
-
await aws_1.default.s3.copyObject({
|
|
46
|
-
...awsDefaults,
|
|
47
|
-
CopySource: cloudBucketCommitKey(manifest),
|
|
48
|
-
Key: cloudChannelKey(unversionedManifest),
|
|
49
|
-
});
|
|
45
|
+
await aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: cloudBucketCommitKey(manifest), Key: cloudChannelKey(unversionedManifest) }));
|
|
50
46
|
};
|
|
51
47
|
const promoteGzTarballs = async (target) => {
|
|
52
48
|
const versionedTarGzName = (0, upload_util_1.templateShortKey)('versioned', '.tar.gz', {
|
|
@@ -60,11 +56,7 @@ class Promote extends core_1.Command {
|
|
|
60
56
|
// strip version & sha so update/scripts can point to a static channel tarball
|
|
61
57
|
const unversionedTarGzName = versionedTarGzName.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
62
58
|
const unversionedTarGzKey = cloudChannelKey(unversionedTarGzName);
|
|
63
|
-
await Promise.all([aws_1.default.s3.copyObject({
|
|
64
|
-
...awsDefaults,
|
|
65
|
-
CopySource: versionedTarGzKey,
|
|
66
|
-
Key: unversionedTarGzKey,
|
|
67
|
-
})].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, originalUrl: versionedTarGzKey, filename: unversionedTarGzName })] : []));
|
|
59
|
+
await Promise.all([aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: versionedTarGzKey, Key: unversionedTarGzKey }))].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarGzKey, filename: unversionedTarGzName }))] : []));
|
|
68
60
|
};
|
|
69
61
|
const promoteXzTarballs = async (target) => {
|
|
70
62
|
const versionedTarXzName = (0, upload_util_1.templateShortKey)('versioned', '.tar.xz', {
|
|
@@ -78,11 +70,7 @@ class Promote extends core_1.Command {
|
|
|
78
70
|
// strip version & sha so update/scripts can point to a static channel tarball
|
|
79
71
|
const unversionedTarXzName = versionedTarXzName.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
80
72
|
const unversionedTarXzKey = cloudChannelKey(unversionedTarXzName);
|
|
81
|
-
await Promise.all([aws_1.default.s3.copyObject({
|
|
82
|
-
...awsDefaults,
|
|
83
|
-
CopySource: versionedTarXzKey,
|
|
84
|
-
Key: unversionedTarXzKey,
|
|
85
|
-
})].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, originalUrl: versionedTarXzKey, filename: unversionedTarXzName })] : []));
|
|
73
|
+
await Promise.all([aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: versionedTarXzKey, Key: unversionedTarXzKey }))].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: versionedTarXzKey, filename: unversionedTarXzName }))] : []));
|
|
86
74
|
};
|
|
87
75
|
const promoteMacInstallers = async () => {
|
|
88
76
|
this.log(`Promoting macos pkgs to ${flags.channel}`);
|
|
@@ -92,11 +80,7 @@ class Promote extends core_1.Command {
|
|
|
92
80
|
const darwinCopySource = cloudBucketCommitKey(darwinPkg);
|
|
93
81
|
// strip version & sha so scripts can point to a static channel pkg
|
|
94
82
|
const unversionedPkg = darwinPkg.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
95
|
-
await Promise.all([aws_1.default.s3.copyObject({
|
|
96
|
-
...awsDefaults,
|
|
97
|
-
CopySource: darwinCopySource,
|
|
98
|
-
Key: cloudChannelKey(unversionedPkg),
|
|
99
|
-
})].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, originalUrl: darwinCopySource, filename: unversionedPkg })] : []));
|
|
83
|
+
await Promise.all([aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: darwinCopySource, Key: cloudChannelKey(unversionedPkg) }))].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: darwinCopySource, filename: unversionedPkg }))] : []));
|
|
100
84
|
}));
|
|
101
85
|
};
|
|
102
86
|
const promoteWindowsInstallers = async () => {
|
|
@@ -108,11 +92,7 @@ class Promote extends core_1.Command {
|
|
|
108
92
|
const winCopySource = cloudBucketCommitKey(winPkg);
|
|
109
93
|
// strip version & sha so scripts can point to a static channel exe
|
|
110
94
|
const unversionedExe = winPkg.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
111
|
-
await Promise.all([aws_1.default.s3.copyObject({
|
|
112
|
-
...awsDefaults,
|
|
113
|
-
CopySource: winCopySource,
|
|
114
|
-
Key: cloudChannelKey(unversionedExe),
|
|
115
|
-
})].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)({ ...indexDefaults, originalUrl: winCopySource, filename: unversionedExe })] : []));
|
|
95
|
+
await Promise.all([aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: winCopySource, Key: cloudChannelKey(unversionedExe) }))].concat(flags.indexes ? [(0, version_indexes_1.appendToIndex)(Object.assign(Object.assign({}, indexDefaults), { originalUrl: winCopySource, filename: unversionedExe }))] : []));
|
|
116
96
|
core_1.ux.action.stop('successfully');
|
|
117
97
|
}));
|
|
118
98
|
};
|
|
@@ -148,16 +128,8 @@ class Promote extends core_1.Command {
|
|
|
148
128
|
// with this, the docs are correct. The copies are all done in parallel so it shouldn't be too costly.
|
|
149
129
|
const workaroundKey = cloudChannelKey(`apt/./${artifact}`);
|
|
150
130
|
return [
|
|
151
|
-
aws_1.default.s3.copyObject({
|
|
152
|
-
|
|
153
|
-
CopySource: debCopySource,
|
|
154
|
-
Key: debKey,
|
|
155
|
-
}),
|
|
156
|
-
aws_1.default.s3.copyObject({
|
|
157
|
-
...awsDefaults,
|
|
158
|
-
CopySource: debCopySource,
|
|
159
|
-
Key: workaroundKey,
|
|
160
|
-
}),
|
|
131
|
+
aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: debCopySource, Key: debKey })),
|
|
132
|
+
aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: debCopySource, Key: workaroundKey })),
|
|
161
133
|
];
|
|
162
134
|
}));
|
|
163
135
|
};
|
package/lib/commands/readme.js
CHANGED
|
@@ -23,14 +23,14 @@ class Readme extends core_1.Command {
|
|
|
23
23
|
await plugin.load();
|
|
24
24
|
config.plugins.set(plugin.name, plugin);
|
|
25
25
|
}
|
|
26
|
-
catch { }
|
|
26
|
+
catch (_a) { }
|
|
27
27
|
await config.runHook('init', { id: 'readme', argv: this.argv });
|
|
28
28
|
this.HelpClass = await (0, core_1.loadHelpClass)(config);
|
|
29
29
|
let readme = await fs.readFile(readmePath, 'utf8');
|
|
30
30
|
let commands = config.commands
|
|
31
31
|
.filter(c => !c.hidden && c.pluginType === 'core')
|
|
32
32
|
.filter(c => flags.aliases ? true : !c.aliases.includes(c.id))
|
|
33
|
-
.map(c => c.id === '.' ? {
|
|
33
|
+
.map(c => c.id === '.' ? Object.assign(Object.assign({}, c), { id: '' }) : c);
|
|
34
34
|
this.debug('commands:', commands.map(c => c.id).length);
|
|
35
35
|
commands = (0, util_1.uniqBy)(commands, c => c.id);
|
|
36
36
|
commands = (0, util_1.sortBy)(commands, c => c.id);
|
|
@@ -127,7 +127,7 @@ USAGE
|
|
|
127
127
|
try {
|
|
128
128
|
// copy c to keep the command ID with colons, see:
|
|
129
129
|
// https://github.com/oclif/oclif/pull/1165#discussion_r1282305242
|
|
130
|
-
const command = {
|
|
130
|
+
const command = Object.assign({}, c);
|
|
131
131
|
return (0, util_1.compact)([
|
|
132
132
|
header(),
|
|
133
133
|
title,
|
|
@@ -162,7 +162,7 @@ USAGE
|
|
|
162
162
|
return `_See code: [${label}](${_.template(template)({ repo, version, commandPath, config, c })})_`;
|
|
163
163
|
}
|
|
164
164
|
repo(plugin) {
|
|
165
|
-
const pjson = {
|
|
165
|
+
const pjson = Object.assign({}, plugin.pjson);
|
|
166
166
|
normalize(pjson);
|
|
167
167
|
const repo = pjson.repository && pjson.repository.url;
|
|
168
168
|
if (!repo)
|
|
@@ -24,7 +24,7 @@ class UploadDeb extends core_1.Command {
|
|
|
24
24
|
const cloudKeyBase = (0, upload_util_1.commitAWSDir)(config.pjson.version, buildConfig.gitSha, s3Config);
|
|
25
25
|
const upload = (file) => {
|
|
26
26
|
const cloudKey = `${cloudKeyBase}/apt/${file}`;
|
|
27
|
-
return aws_1.default.s3.uploadFile(dist(file), {
|
|
27
|
+
return aws_1.default.s3.uploadFile(dist(file), Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', Key: cloudKey }));
|
|
28
28
|
};
|
|
29
29
|
// apt expects ../apt/dists/versionName/[artifacts] but oclif wants versions/sha/apt/[artifacts]
|
|
30
30
|
// see https://github.com/oclif/oclif/issues/347 for the AWS-redirect that solves this
|
|
@@ -32,7 +32,7 @@ class UploadDeb extends core_1.Command {
|
|
|
32
32
|
// with this, the docs are correct. The copies are all done in parallel so it shouldn't be too costly.
|
|
33
33
|
const uploadWorkaround = (file) => {
|
|
34
34
|
const cloudKey = `${cloudKeyBase}/apt/./${file}`;
|
|
35
|
-
return aws_1.default.s3.uploadFile(dist(file), {
|
|
35
|
+
return aws_1.default.s3.uploadFile(dist(file), Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', Key: cloudKey }));
|
|
36
36
|
};
|
|
37
37
|
const uploadDeb = async (arch) => {
|
|
38
38
|
const deb = (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: arch });
|
|
@@ -23,7 +23,7 @@ class UploadMacos extends core_1.Command {
|
|
|
23
23
|
const cloudKey = `${cloudKeyBase}/${templateKey}`;
|
|
24
24
|
const localPkg = dist(`macos/${templateKey}`);
|
|
25
25
|
if (fs.existsSync(localPkg))
|
|
26
|
-
await aws_1.default.s3.uploadFile(localPkg, {
|
|
26
|
+
await aws_1.default.s3.uploadFile(localPkg, Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', Key: cloudKey }));
|
|
27
27
|
else
|
|
28
28
|
this.error('Cannot find macOS pkg', {
|
|
29
29
|
suggestions: ['Run "oclif pack macos" before uploading'],
|
|
@@ -16,7 +16,7 @@ class UploadTarballs extends core_1.Command {
|
|
|
16
16
|
const { s3Config, dist, config, xz } = buildConfig;
|
|
17
17
|
// fail early if targets are not built
|
|
18
18
|
for (const target of buildConfig.targets) {
|
|
19
|
-
const tarball = dist((0, upload_util_1.templateShortKey)('versioned', { ext: '.tar.gz', bin: config.bin, version: config.version, sha: buildConfig.gitSha,
|
|
19
|
+
const tarball = dist((0, upload_util_1.templateShortKey)('versioned', Object.assign({ ext: '.tar.gz', bin: config.bin, version: config.version, sha: buildConfig.gitSha }, target)));
|
|
20
20
|
if (!fs.existsSync(tarball))
|
|
21
21
|
this.error(`Cannot find a tarball ${tarball} for ${target.platform}-${target.arch}`, {
|
|
22
22
|
suggestions: [`Run "oclif pack --target ${target.platform}-${target.arch}" before uploading`],
|
|
@@ -39,11 +39,11 @@ class UploadTarballs extends core_1.Command {
|
|
|
39
39
|
const releaseTarballs = async (ext) => {
|
|
40
40
|
const localKey = (0, upload_util_1.templateShortKey)('versioned', ext, shortKeyInputs);
|
|
41
41
|
const cloudKey = `${(0, upload_util_1.commitAWSDir)(config.version, buildConfig.gitSha, s3Config)}/${localKey}`;
|
|
42
|
-
await aws_1.default.s3.uploadFile(dist(localKey), {
|
|
42
|
+
await aws_1.default.s3.uploadFile(dist(localKey), Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=604800', ContentType: 'application/gzip', Key: cloudKey }));
|
|
43
43
|
};
|
|
44
44
|
const manifest = (0, upload_util_1.templateShortKey)('manifest', shortKeyInputs);
|
|
45
45
|
const cloudKey = `${(0, upload_util_1.commitAWSDir)(config.version, buildConfig.gitSha, s3Config)}/${manifest}`;
|
|
46
|
-
await Promise.all([releaseTarballs('.tar.gz'), aws_1.default.s3.uploadFile(dist(manifest), {
|
|
46
|
+
await Promise.all([releaseTarballs('.tar.gz'), aws_1.default.s3.uploadFile(dist(manifest), Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', ContentType: 'application/json', Key: cloudKey }))].concat(xz ? [releaseTarballs('.tar.xz')] : []));
|
|
47
47
|
};
|
|
48
48
|
if (buildConfig.targets.length > 0)
|
|
49
49
|
(0, log_1.log)('uploading targets');
|
|
@@ -30,7 +30,7 @@ class UploadWin extends core_1.Command {
|
|
|
30
30
|
const localExe = dist(`win32/${templateKey}`);
|
|
31
31
|
const cloudKey = `${cloudKeyBase}/${templateKey}`;
|
|
32
32
|
if (fs.existsSync(localExe))
|
|
33
|
-
await aws_1.default.s3.uploadFile(localExe, {
|
|
33
|
+
await aws_1.default.s3.uploadFile(localExe, Object.assign(Object.assign({}, S3Options), { CacheControl: 'max-age=86400', Key: cloudKey }));
|
|
34
34
|
};
|
|
35
35
|
await Promise.all([uploadWin('x64'), uploadWin('x86')]);
|
|
36
36
|
(0, log_1.log)(`done uploading windows executables for v${config.version}-${buildConfig.gitSha}`);
|
package/lib/generators/cli.js
CHANGED
|
@@ -12,7 +12,7 @@ try {
|
|
|
12
12
|
(0, child_process_1.execSync)('yarn -v', { stdio: 'ignore' });
|
|
13
13
|
hasYarn = true;
|
|
14
14
|
}
|
|
15
|
-
catch { }
|
|
15
|
+
catch (_a) { }
|
|
16
16
|
class CLI extends Generator {
|
|
17
17
|
constructor(args, opts) {
|
|
18
18
|
super(args, opts);
|
|
@@ -45,41 +45,11 @@ class CLI extends Generator {
|
|
|
45
45
|
this.env.cwd = this.destinationPath();
|
|
46
46
|
this.githubUser = await this.user.github.username().catch(debug);
|
|
47
47
|
// establish order of properties in the resulting package.json
|
|
48
|
-
this.pjson = {
|
|
49
|
-
name: '',
|
|
50
|
-
version: '',
|
|
51
|
-
description: '',
|
|
52
|
-
author: '',
|
|
53
|
-
bin: {},
|
|
54
|
-
homepage: '',
|
|
55
|
-
license: '',
|
|
56
|
-
main: '',
|
|
57
|
-
repository: '',
|
|
58
|
-
files: [],
|
|
59
|
-
dependencies: {},
|
|
60
|
-
devDependencies: {},
|
|
61
|
-
oclif: {},
|
|
62
|
-
scripts: {},
|
|
63
|
-
engines: {},
|
|
64
|
-
...this.fs.readJSON(path.join(this.env.cwd, 'package.json'), {}),
|
|
65
|
-
};
|
|
48
|
+
this.pjson = Object.assign({ name: '', version: '', description: '', author: '', bin: {}, homepage: '', license: '', main: '', repository: '', files: [], dependencies: {}, devDependencies: {}, oclif: {}, scripts: {}, engines: {} }, this.fs.readJSON(path.join(this.env.cwd, 'package.json'), {}));
|
|
66
49
|
let repository = this.destinationRoot().split(path.sep).slice(-2).join('/');
|
|
67
50
|
if (this.githubUser)
|
|
68
51
|
repository = `${this.githubUser}/${repository.split('/')[1]}`;
|
|
69
|
-
const defaults = {
|
|
70
|
-
...this.pjson,
|
|
71
|
-
name: this.name ? this.name.replace(/ /g, '-') : this.determineAppname().replace(/ /g, '-'),
|
|
72
|
-
version: '0.0.0',
|
|
73
|
-
license: 'MIT',
|
|
74
|
-
author: this.githubUser ? `${this.user.git.name()} @${this.githubUser}` : this.user.git.name(),
|
|
75
|
-
dependencies: {},
|
|
76
|
-
repository,
|
|
77
|
-
engines: {
|
|
78
|
-
node: '>=12.0.0',
|
|
79
|
-
...this.pjson.engines,
|
|
80
|
-
},
|
|
81
|
-
options: this.options,
|
|
82
|
-
};
|
|
52
|
+
const defaults = Object.assign(Object.assign({}, this.pjson), { name: this.name ? this.name.replace(/ /g, '-') : this.determineAppname().replace(/ /g, '-'), version: '0.0.0', license: 'MIT', author: this.githubUser ? `${this.user.git.name()} @${this.githubUser}` : this.user.git.name(), dependencies: {}, repository, engines: Object.assign({ node: '>=12.0.0' }, this.pjson.engines), options: this.options });
|
|
83
53
|
this.repository = defaults.repository;
|
|
84
54
|
if (this.repository && this.repository.url) {
|
|
85
55
|
this.repository = this.repository.url;
|
|
@@ -152,11 +122,7 @@ class CLI extends Generator {
|
|
|
152
122
|
}
|
|
153
123
|
debug(this.answers);
|
|
154
124
|
if (!this.options.defaults) {
|
|
155
|
-
this.options = {
|
|
156
|
-
...this.answers.ci,
|
|
157
|
-
yarn: this.answers.pkg === 'yarn',
|
|
158
|
-
force: true,
|
|
159
|
-
};
|
|
125
|
+
this.options = Object.assign(Object.assign({}, this.answers.ci), { yarn: this.answers.pkg === 'yarn', force: true });
|
|
160
126
|
}
|
|
161
127
|
this.yarn = this.options.yarn;
|
|
162
128
|
this.env.options.nodePackageManager = this.yarn ? 'yarn' : 'npm';
|
|
@@ -199,7 +165,7 @@ class CLI extends Generator {
|
|
|
199
165
|
// this in a spawned process. Setting the NODE_ENV to production will silence these warnings. This
|
|
200
166
|
// doesn't affect the behavior of the command in production since the NODE_ENV is already set to production
|
|
201
167
|
// in that scenario.
|
|
202
|
-
env: {
|
|
168
|
+
env: Object.assign(Object.assign({}, process.env), { NODE_ENV: 'production' }),
|
|
203
169
|
});
|
|
204
170
|
console.log(`\nCreated ${this.pjson.name} in ${this.destinationRoot()}`);
|
|
205
171
|
}
|
|
@@ -32,7 +32,7 @@ class Command extends Generator {
|
|
|
32
32
|
bin = bin.split('/').pop();
|
|
33
33
|
const cmd = `${bin} ${this.options.name}`;
|
|
34
34
|
const commandPath = this.destinationPath(`src/commands/${cmdPath}.ts`);
|
|
35
|
-
const opts = {
|
|
35
|
+
const opts = Object.assign(Object.assign({}, this.options), { bin, cmd, _, type: 'command', path: commandPath });
|
|
36
36
|
this.fs.copyTpl(this.templatePath('src/command.ts.ejs'), commandPath, opts);
|
|
37
37
|
if (this.hasMocha()) {
|
|
38
38
|
this.fs.copyTpl(this.templatePath('test/command.test.ts.ejs'), this.destinationPath(`test/commands/${cmdPath}.test.ts`), opts);
|
package/lib/upload-util.js
CHANGED
|
@@ -37,7 +37,7 @@ options = { root: '.' }) {
|
|
|
37
37
|
win32: '<%- bin %>-v<%- version %>-<%- sha %>-<%- arch %>.exe',
|
|
38
38
|
deb: '<%- bin %>_<%- versionShaRevision %>_<%- arch %>.deb',
|
|
39
39
|
};
|
|
40
|
-
return _.template(templates[type])({
|
|
40
|
+
return _.template(templates[type])(Object.assign({}, options));
|
|
41
41
|
}
|
|
42
42
|
exports.templateShortKey = templateShortKey;
|
|
43
43
|
function debArch(arch) {
|
package/lib/version-indexes.js
CHANGED
|
@@ -59,10 +59,7 @@ const appendToIndex = async (input) => {
|
|
|
59
59
|
debug(`error on ${key}`, error);
|
|
60
60
|
}
|
|
61
61
|
// appends new version from this promotion if not already present (idempotent)
|
|
62
|
-
await fs.writeJSON(jsonFileName, sortVersionsObjectByKeysDesc({
|
|
63
|
-
...existing,
|
|
64
|
-
[version]: originalUrl.replace(s3Config.bucket, s3Config.host),
|
|
65
|
-
}, s3Config.indexVersionLimit), { spaces: 2 });
|
|
62
|
+
await fs.writeJSON(jsonFileName, sortVersionsObjectByKeysDesc(Object.assign(Object.assign({}, existing), { [version]: originalUrl.replace(s3Config.bucket, s3Config.host) }), s3Config.indexVersionLimit), { spaces: 2 });
|
|
66
63
|
// put the file back in the same place
|
|
67
64
|
await aws_1.default.s3.uploadFile(jsonFileName, {
|
|
68
65
|
Bucket: s3Config.bucket,
|