oclif 3.3.0-beta.1 → 3.3.0-beta.11
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/commands/pack/win.js +7 -3
- package/lib/commands/promote.js +58 -64
- package/lib/tarballs/build.js +5 -4
- package/package.json +1 -1
package/.oclif.manifest.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":"3.3.0-beta.
|
|
1
|
+
{"version":"3.3.0-beta.11","commands":{"generate":{"id":"generate","description":"generate a new CLI\nThis will clone the template repo 'oclif/hello-world' and update package properties","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"name","description":"directory name of new project","required":true}]},"manifest":{"id":"manifest","description":"generates plugin manifest json","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{},"args":[{"name":"path","description":"path to plugin","default":"."}]},"promote":{"id":"promote","description":"promote CLI builds to a S3 release channel","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to the oclif CLI project root","required":true,"multiple":false,"default":"."},"version":{"name":"version","type":"option","description":"semantic version of the CLI to promote","required":true,"multiple":false},"sha":{"name":"sha","type":"option","description":"7-digit short git commit SHA of the CLI to promote","required":true,"multiple":false},"channel":{"name":"channel","type":"option","description":"which channel to promote to","required":true,"multiple":false,"default":"stable"},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to promote (e.g.: linux-arm,win32-x64)","multiple":false},"deb":{"name":"deb","type":"boolean","char":"d","description":"promote debian artifacts","allowNo":false},"macos":{"name":"macos","type":"boolean","char":"m","description":"promote macOS pkg","allowNo":false},"win":{"name":"win","type":"boolean","char":"w","description":"promote Windows exe","allowNo":false},"max-age":{"name":"max-age","type":"option","char":"a","description":"cache control max-age in seconds","multiple":false,"default":"86400"},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true},"indexes":{"name":"indexes","type":"boolean","description":"append the promoted urls into the index files","allowNo":false}},"args":[]},"readme":{"id":"readme","description":"adds commands to README.md in current directory\nThe readme must have any of the following tags inside of it for it to be replaced or else it will do nothing:\n# Usage\n<!-- usage -->\n# Commands\n<!-- commands -->\n# Table of contents\n<!-- toc -->\n\nCustomize the code URL prefix by setting oclif.repositoryPrefix in package.json.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"dir":{"name":"dir","type":"option","description":"output directory for multi docs","required":true,"multiple":false,"default":"docs"},"multi":{"name":"multi","type":"boolean","description":"create a different markdown page for each topic","allowNo":false},"aliases":{"name":"aliases","type":"boolean","description":"include aliases in the command list","allowNo":true}},"args":[]},"generate:command":{"id":"generate:command","description":"add a command to an existing CLI or plugin","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false}},"args":[{"name":"name","description":"name of command","required":true}]},"generate:hook":{"id":"generate:hook","description":"add a hook to an existing CLI or plugin","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"force":{"name":"force","type":"boolean","description":"overwrite existing files","allowNo":false},"event":{"name":"event","type":"option","description":"event to run hook on","multiple":false,"default":"init"}},"args":[{"name":"name","description":"name of hook (snake_case)","required":true}]},"pack:deb":{"id":"pack:deb","description":"pack CLI into debian package","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"tarball":{"name":"tarball","type":"option","char":"t","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false}},"args":[]},"pack:macos":{"id":"pack:macos","description":"pack CLI into macOS .pkg","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false},"tarball":{"name":"tarball","type":"option","char":"t","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false}},"args":[]},"pack:tarballs":{"id":"pack:tarballs","description":"packages oclif CLI into tarballs\n\nThis can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to pack (e.g.: linux-arm,win32-x64)","multiple":false},"xz":{"name":"xz","type":"boolean","description":"also build xz","allowNo":true},"parallel":{"name":"parallel","type":"boolean","description":"build tarballs in parallel","allowNo":false},"tarball":{"name":"tarball","type":"option","char":"l","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false}},"args":[]},"pack:win":{"id":"pack:win","description":"create windows installer from oclif CLI\n\n This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"additional-cli":{"name":"additional-cli","type":"option","description":"an Oclif CLI other than the one listed in config.bin that should be made available to the user\nthe CLI should already exist in a directory named after the CLI that is the root of the tarball produced by \"oclif pack:tarballs\"","hidden":true,"multiple":false},"tarball":{"name":"tarball","type":"option","char":"t","description":"optionally specify a path to a tarball already generated by NPM","required":false,"multiple":false}},"args":[]},"upload:deb":{"id":"upload:deb","description":"upload deb package built with pack:deb","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"upload:macos":{"id":"upload:macos","description":"upload macos installers built with pack:macos","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]},"upload:tarballs":{"id":"upload:tarballs","description":"upload an oclif CLI to S3\n\n\"aws-sdk\" will need to be installed as a devDependency to upload.\n","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."},"targets":{"name":"targets","type":"option","char":"t","description":"comma-separated targets to upload (e.g.: linux-arm,win32-x64)","multiple":false},"xz":{"name":"xz","type":"boolean","description":"also upload xz","allowNo":true}},"args":[]},"upload:win":{"id":"upload:win","description":"upload windows installers built with pack:win","strict":true,"pluginName":"oclif","pluginAlias":"oclif","pluginType":"core","aliases":[],"flags":{"root":{"name":"root","type":"option","char":"r","description":"path to oclif CLI root","required":true,"multiple":false,"default":"."}},"args":[]}}}
|
package/lib/commands/pack/win.js
CHANGED
|
@@ -269,7 +269,7 @@ the CLI should already exist in a directory named after the CLI that is the root
|
|
|
269
269
|
};
|
|
270
270
|
async function signWindows(o, arch, config, windows) {
|
|
271
271
|
const buildLocationUnsigned = o.replace(`${arch}.exe`, `${arch}-unsigned.exe`);
|
|
272
|
-
await fs.move(o, buildLocationUnsigned);
|
|
272
|
+
await fs.move(o, buildLocationUnsigned, { overwrite: true });
|
|
273
273
|
const pass = config.scopedEnvVar('WINDOWS_SIGNING_PASS');
|
|
274
274
|
if (!pass) {
|
|
275
275
|
throw new Error(`${config.scopedEnvVarKey('WINDOWS_SIGNING_PASS')} not set in the environment`);
|
|
@@ -278,11 +278,15 @@ async function signWindows(o, arch, config, windows) {
|
|
|
278
278
|
const args = [
|
|
279
279
|
'-pkcs12', windows.keypath,
|
|
280
280
|
'-pass', pass,
|
|
281
|
-
'-n', windows.name
|
|
281
|
+
'-n', `"${windows.name}"`,
|
|
282
282
|
'-i', windows.homepage || config.pjson.homepage,
|
|
283
283
|
'-h', 'sha512',
|
|
284
284
|
'-in', buildLocationUnsigned,
|
|
285
285
|
'-out', o,
|
|
286
286
|
];
|
|
287
|
-
|
|
287
|
+
console.log(`key exists at ${windows.keypath} : ${fs.existsSync(windows.keypath)}`);
|
|
288
|
+
console.log(`input file exists at ${buildLocationUnsigned} : ${fs.existsSync(buildLocationUnsigned)}`);
|
|
289
|
+
const signCommand = `osslsigncode sign ${args.join(' ')}`;
|
|
290
|
+
console.log(`will run sign command : ${signCommand}`);
|
|
291
|
+
await exec(signCommand);
|
|
288
292
|
}
|
package/lib/commands/promote.js
CHANGED
|
@@ -43,7 +43,7 @@ class Promote extends core_1.Command {
|
|
|
43
43
|
const unversionedManifest = manifest.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
44
44
|
await aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: cloudBucketCommitKey(manifest), Key: cloudChannelKey(unversionedManifest) }));
|
|
45
45
|
};
|
|
46
|
-
const
|
|
46
|
+
const promoteGzTarballs = async (target) => {
|
|
47
47
|
const versionedTarGzName = (0, upload_util_1.templateShortKey)('versioned', '.tar.gz', {
|
|
48
48
|
arch: target.arch,
|
|
49
49
|
bin: config.bin,
|
|
@@ -57,51 +57,45 @@ class Promote extends core_1.Command {
|
|
|
57
57
|
const unversionedTarGzKey = cloudChannelKey(unversionedTarGzName);
|
|
58
58
|
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 }))] : []));
|
|
59
59
|
};
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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 }))] : []));
|
|
74
|
-
}
|
|
60
|
+
const promoteXzTarballs = async (target) => {
|
|
61
|
+
const versionedTarXzName = (0, upload_util_1.templateShortKey)('versioned', '.tar.xz', {
|
|
62
|
+
arch: target.arch,
|
|
63
|
+
bin: config.bin,
|
|
64
|
+
platform: target.platform,
|
|
65
|
+
sha: flags.sha,
|
|
66
|
+
version: flags.version,
|
|
67
|
+
});
|
|
68
|
+
const versionedTarXzKey = cloudBucketCommitKey(versionedTarXzName);
|
|
69
|
+
// strip version & sha so update/scripts can point to a static channel tarball
|
|
70
|
+
const unversionedTarXzName = versionedTarXzName.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
71
|
+
const unversionedTarXzKey = cloudChannelKey(unversionedTarXzName);
|
|
72
|
+
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 }))] : []));
|
|
75
73
|
};
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}));
|
|
87
|
-
}
|
|
74
|
+
const promoteMacInstallers = async () => {
|
|
75
|
+
this.log(`Promoting macos pkgs to ${flags.channel}`);
|
|
76
|
+
const arches = _.uniq(buildConfig.targets.filter(t => t.platform === 'darwin').map(t => t.arch));
|
|
77
|
+
await Promise.all(arches.map(async (arch) => {
|
|
78
|
+
const darwinPkg = (0, upload_util_1.templateShortKey)('macos', { bin: config.bin, version: flags.version, sha: flags.sha, arch });
|
|
79
|
+
const darwinCopySource = cloudBucketCommitKey(darwinPkg);
|
|
80
|
+
// strip version & sha so scripts can point to a static channel pkg
|
|
81
|
+
const unversionedPkg = darwinPkg.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
82
|
+
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 }))] : []));
|
|
83
|
+
}));
|
|
88
84
|
};
|
|
89
|
-
const
|
|
85
|
+
const promoteWindowsInstallers = async () => {
|
|
90
86
|
// copy win exe
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
87
|
+
this.log(`Promoting windows exe to ${flags.channel}`);
|
|
88
|
+
const arches = buildConfig.targets.filter(t => t.platform === 'win32').map(t => t.arch);
|
|
89
|
+
await Promise.all(arches.map(async (arch) => {
|
|
90
|
+
const winPkg = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: flags.version, sha: flags.sha, arch });
|
|
91
|
+
const winCopySource = cloudBucketCommitKey(winPkg);
|
|
92
|
+
// strip version & sha so scripts can point to a static channel exe
|
|
93
|
+
const unversionedExe = winPkg.replace(`-v${flags.version}-${flags.sha}`, '');
|
|
94
|
+
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 }))] : []));
|
|
95
|
+
core_1.CliUx.ux.action.stop('successfully');
|
|
96
|
+
}));
|
|
103
97
|
};
|
|
104
|
-
const
|
|
98
|
+
const promoteDebianAptPackages = async () => {
|
|
105
99
|
// copy debian artifacts
|
|
106
100
|
const debArtifacts = [
|
|
107
101
|
(0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: 'amd64' }),
|
|
@@ -113,31 +107,31 @@ class Promote extends core_1.Command {
|
|
|
113
107
|
'InRelease',
|
|
114
108
|
'Release.gpg',
|
|
115
109
|
];
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
}));
|
|
131
|
-
}
|
|
110
|
+
this.log(`Promoting debian artifacts to ${flags.channel}`);
|
|
111
|
+
await Promise.all(debArtifacts.flatMap(artifact => {
|
|
112
|
+
const debCopySource = cloudBucketCommitKey(`apt/${artifact}`);
|
|
113
|
+
const debKey = cloudChannelKey(`apt/${artifact}`);
|
|
114
|
+
// apt expects ../apt/dists/versionName/[artifacts] but oclif wants varsions/sha/apt/[artifacts]
|
|
115
|
+
// see https://github.com/oclif/oclif/issues/347 for the AWS-redirect that solves this
|
|
116
|
+
// this workaround puts the code in both places that the redirect was doing
|
|
117
|
+
// with this, the docs are correct. The copies are all done in parallel so it shouldn't be too costly.
|
|
118
|
+
const workaroundKey = cloudChannelKey(`apt/./${artifact}`);
|
|
119
|
+
return [
|
|
120
|
+
aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: debCopySource, Key: debKey })),
|
|
121
|
+
aws_1.default.s3.copyObject(Object.assign(Object.assign({}, awsDefaults), { CopySource: debCopySource, Key: workaroundKey })),
|
|
122
|
+
];
|
|
123
|
+
}));
|
|
132
124
|
};
|
|
133
125
|
await Promise.all(buildConfig.targets.flatMap(target => [
|
|
126
|
+
// always promote the manifest and gz
|
|
134
127
|
promoteManifest(target),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
128
|
+
promoteGzTarballs(target),
|
|
129
|
+
])
|
|
130
|
+
// optionally promote other artifacts depending on the specified flags
|
|
131
|
+
.concat(flags.xz ? buildConfig.targets.map(target => promoteXzTarballs(target)) : [])
|
|
132
|
+
.concat(flags.macos ? [promoteMacInstallers()] : [])
|
|
133
|
+
.concat(flags.win ? [promoteWindowsInstallers()] : [])
|
|
134
|
+
.concat(flags.deb ? [promoteDebianAptPackages()] : []));
|
|
141
135
|
}
|
|
142
136
|
}
|
|
143
137
|
exports.default = Promote;
|
package/lib/tarballs/build.js
CHANGED
|
@@ -68,8 +68,8 @@ async function build(c, options = {}) {
|
|
|
68
68
|
const yarn = fs.existsSync(path.join(yarnRoot, 'yarn.lock'));
|
|
69
69
|
if (pjson.scripts.pretarball) {
|
|
70
70
|
yarn ?
|
|
71
|
-
await exec('yarn run pretarball') :
|
|
72
|
-
await exec('npm run pretarball', {});
|
|
71
|
+
await exec('yarn run pretarball', { cwd: c.workspace() }) :
|
|
72
|
+
await exec('npm run pretarball', { cwd: c.workspace() });
|
|
73
73
|
}
|
|
74
74
|
};
|
|
75
75
|
const buildTarget = async (target) => {
|
|
@@ -116,6 +116,7 @@ async function build(c, options = {}) {
|
|
|
116
116
|
const rollout = (typeof c.updateConfig.autoupdate === 'object' && c.updateConfig.autoupdate.rollout);
|
|
117
117
|
const gzCloudKey = `${(0, upload_util_1.commitAWSDir)(config.version, c.gitSha, c.updateConfig.s3)}/${gzLocalKey}`;
|
|
118
118
|
const xzCloudKey = `${(0, upload_util_1.commitAWSDir)(config.version, c.gitSha, c.updateConfig.s3)}/${xzLocalKey}`;
|
|
119
|
+
const [sha256gz, sha256xz] = await Promise.all([(0, util_1.hash)('sha256', c.dist(gzLocalKey))].concat(xz ? [(0, util_1.hash)('sha256', c.dist(xzLocalKey))] : []));
|
|
119
120
|
const manifest = {
|
|
120
121
|
rollout: rollout === false ? undefined : rollout,
|
|
121
122
|
version: config.version,
|
|
@@ -123,8 +124,8 @@ async function build(c, options = {}) {
|
|
|
123
124
|
baseDir: (0, upload_util_1.templateShortKey)('baseDir', target, { bin: c.config.bin }),
|
|
124
125
|
gz: config.s3Url(gzCloudKey),
|
|
125
126
|
xz: xz ? config.s3Url(xzCloudKey) : undefined,
|
|
126
|
-
sha256gz
|
|
127
|
-
sha256xz
|
|
127
|
+
sha256gz,
|
|
128
|
+
sha256xz,
|
|
128
129
|
node: {
|
|
129
130
|
compatible: config.pjson.engines.node,
|
|
130
131
|
recommended: c.nodeVersion,
|