oclif 1.18.2-dev.2 → 2.0.0-dev.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/CHANGELOG.md +71 -10
- package/README.md +223 -96
- package/bin/dev +19 -0
- package/bin/dev.cmd +3 -0
- package/bin/run +5 -2
- package/lib/aws.d.ts +5 -5
- package/lib/aws.js +5 -5
- package/lib/command-base.d.ts +1 -1
- package/lib/command-base.js +3 -3
- package/lib/commands/generate.d.ts +11 -0
- package/lib/commands/generate.js +19 -0
- package/lib/commands/manifest.d.ts +1 -2
- package/lib/commands/manifest.js +4 -7
- package/lib/commands/pack/deb.d.ts +3 -3
- package/lib/commands/pack/deb.js +7 -8
- package/lib/commands/pack/macos.d.ts +4 -4
- package/lib/commands/pack/macos.js +16 -17
- package/lib/commands/pack/tarballs.d.ts +4 -5
- package/lib/commands/pack/tarballs.js +6 -7
- package/lib/commands/pack/win.d.ts +4 -4
- package/lib/commands/pack/win.js +26 -20
- package/lib/commands/promote.d.ts +12 -13
- package/lib/commands/promote.js +27 -28
- package/lib/commands/readme.d.ts +11 -12
- package/lib/commands/readme.js +27 -28
- package/lib/commands/upload/deb.d.ts +2 -3
- package/lib/commands/upload/deb.js +7 -8
- package/lib/commands/upload/macos.d.ts +2 -3
- package/lib/commands/upload/macos.js +7 -8
- package/lib/commands/upload/tarballs.d.ts +5 -5
- package/lib/commands/upload/tarballs.js +15 -18
- package/lib/commands/upload/win.d.ts +2 -3
- package/lib/commands/upload/win.js +8 -9
- package/lib/generators/{app.d.ts → cli.d.ts} +1 -21
- package/lib/generators/cli.js +183 -0
- package/lib/help-compatibility.d.ts +4 -5
- package/lib/help-compatibility.js +1 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +3 -2
- package/lib/log.js +2 -1
- package/lib/tarballs/bin.d.ts +2 -2
- package/lib/tarballs/bin.js +1 -0
- package/lib/tarballs/build.js +13 -12
- package/lib/tarballs/config.d.ts +6 -6
- package/lib/tarballs/config.js +6 -5
- package/lib/tarballs/index.js +4 -4
- package/lib/tarballs/node.js +5 -4
- package/lib/upload-util.d.ts +3 -3
- package/lib/upload-util.js +1 -0
- package/lib/util.js +5 -2
- package/lib/version-indexes.d.ts +2 -4
- package/lib/version-indexes.js +3 -1
- package/package.json +5 -7
- package/lib/app-command.d.ts +0 -16
- package/lib/app-command.js +0 -26
- package/lib/commands/base.d.ts +0 -5
- package/lib/commands/base.js +0 -11
- package/lib/commands/command.d.ts +0 -19
- package/lib/commands/command.js +0 -23
- package/lib/commands/hook.d.ts +0 -22
- package/lib/commands/hook.js +0 -25
- package/lib/commands/multi.d.ts +0 -5
- package/lib/commands/multi.js +0 -11
- package/lib/commands/plugin.d.ts +0 -5
- package/lib/commands/plugin.js +0 -11
- package/lib/commands/single.d.ts +0 -5
- package/lib/commands/single.js +0 -11
- package/lib/generators/app.js +0 -470
- package/lib/generators/command.d.ts +0 -15
- package/lib/generators/command.js +0 -51
- package/lib/generators/hook.d.ts +0 -14
- package/lib/generators/hook.js +0 -51
- package/templates/LICENSE.mit +0 -21
- package/templates/README.md.ejs +0 -21
- package/templates/appveyor.yml.ejs +0 -33
- package/templates/base/src/index.js +0 -1
- package/templates/base/src/index.ts +0 -1
- package/templates/base/test/index.test.js +0 -8
- package/templates/base/test/index.test.ts +0 -9
- package/templates/bin/run +0 -5
- package/templates/bin/run.cmd +0 -3
- package/templates/circle.yml.ejs +0 -65
- package/templates/editorconfig +0 -11
- package/templates/eslintrc +0 -3
- package/templates/eslintrc.typescript +0 -12
- package/templates/multi/src/index.js +0 -1
- package/templates/multi/src/index.ts +0 -1
- package/templates/plugin/bin/run +0 -4
- package/templates/plugin/src/index.ts +0 -1
- package/templates/scripts/setup_git +0 -12
- package/templates/single/bin/run.js +0 -4
- package/templates/single/bin/run.ts +0 -13
- package/templates/src/command.js.ejs +0 -27
- package/templates/src/command.ts.ejs +0 -46
- package/templates/src/hook.js.ejs +0 -3
- package/templates/src/hook.ts.ejs +0 -7
- package/templates/test/command.test.js.ejs +0 -28
- package/templates/test/command.test.ts.ejs +0 -29
- package/templates/test/hook.test.js.ejs +0 -9
- package/templates/test/hook.test.ts.ejs +0 -9
- package/templates/test/mocha.opts +0 -4
- package/templates/test/tsconfig.json +0 -9
- package/templates/travis.yml.ejs +0 -14
- package/templates/tsconfig.json +0 -14
package/lib/aws.js
CHANGED
|
@@ -38,12 +38,12 @@ exports.default = {
|
|
|
38
38
|
get cloudfront() {
|
|
39
39
|
return {
|
|
40
40
|
createCloudfrontInvalidation: (options) => new Promise((resolve, reject) => {
|
|
41
|
-
log_1.log('createCloudfrontInvalidation', options.DistributionId, options.InvalidationBatch.Paths.Items);
|
|
41
|
+
(0, log_1.log)('createCloudfrontInvalidation', options.DistributionId, options.InvalidationBatch.Paths.Items);
|
|
42
42
|
aws.cloudfront.createInvalidation(options, err => {
|
|
43
43
|
if (err)
|
|
44
44
|
reject(err);
|
|
45
45
|
else
|
|
46
|
-
resolve();
|
|
46
|
+
resolve(null);
|
|
47
47
|
});
|
|
48
48
|
}),
|
|
49
49
|
};
|
|
@@ -51,13 +51,13 @@ exports.default = {
|
|
|
51
51
|
get s3() {
|
|
52
52
|
return {
|
|
53
53
|
uploadFile: (local, options) => new Promise((resolve, reject) => {
|
|
54
|
-
log_1.log('s3:uploadFile', qq.prettifyPaths(local), `s3://${options.Bucket}/${options.Key}`);
|
|
54
|
+
(0, log_1.log)('s3:uploadFile', qq.prettifyPaths(local), `s3://${options.Bucket}/${options.Key}`);
|
|
55
55
|
options.Body = fs.createReadStream(local);
|
|
56
56
|
aws.s3.upload(options, err => {
|
|
57
57
|
if (err)
|
|
58
58
|
reject(err);
|
|
59
59
|
else
|
|
60
|
-
resolve();
|
|
60
|
+
resolve(null);
|
|
61
61
|
});
|
|
62
62
|
}),
|
|
63
63
|
headObject: (options) => new Promise((resolve, reject) => {
|
|
@@ -70,7 +70,7 @@ exports.default = {
|
|
|
70
70
|
});
|
|
71
71
|
}),
|
|
72
72
|
copyObject: (options) => new Promise((resolve, reject) => {
|
|
73
|
-
log_1.log('s3:copyObject', `from s3://${options.CopySource}`, `to s3://${options.Bucket}/${options.Key}`);
|
|
73
|
+
(0, log_1.log)('s3:copyObject', `from s3://${options.CopySource}`, `to s3://${options.Bucket}/${options.Key}`);
|
|
74
74
|
aws.s3.copyObject(options, function (err, data) {
|
|
75
75
|
if (err)
|
|
76
76
|
reject(err);
|
package/lib/command-base.d.ts
CHANGED
package/lib/command-base.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
4
|
const yeoman_environment_1 = require("yeoman-environment");
|
|
5
|
-
class CommandBase extends
|
|
5
|
+
class CommandBase extends core_1.Command {
|
|
6
6
|
async generate(type, generatorOptions = {}) {
|
|
7
|
-
const env = yeoman_environment_1.createEnv();
|
|
7
|
+
const env = (0, yeoman_environment_1.createEnv)();
|
|
8
8
|
env.register(require.resolve(`./generators/${type}`), `oclif:${type}`);
|
|
9
9
|
await new Promise((resolve, reject) => {
|
|
10
10
|
env.run(`oclif:${type}`, generatorOptions, ((err, results) => {
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import CommandBase from './../command-base';
|
|
2
|
+
export default class Generate extends CommandBase {
|
|
3
|
+
static description: string;
|
|
4
|
+
static flags: {};
|
|
5
|
+
static args: {
|
|
6
|
+
name: string;
|
|
7
|
+
required: boolean;
|
|
8
|
+
description: string;
|
|
9
|
+
}[];
|
|
10
|
+
run(): Promise<void>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const command_base_1 = require("./../command-base");
|
|
4
|
+
class Generate extends command_base_1.default {
|
|
5
|
+
async run() {
|
|
6
|
+
const { args } = await this.parse(Generate);
|
|
7
|
+
await super.generate('cli', {
|
|
8
|
+
name: args.name,
|
|
9
|
+
force: true,
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.default = Generate;
|
|
14
|
+
Generate.description = `generate a new CLI
|
|
15
|
+
This will clone the template repo 'oclif/hello-world' and update package properties`;
|
|
16
|
+
Generate.flags = {};
|
|
17
|
+
Generate.args = [
|
|
18
|
+
{ name: 'name', required: true, description: 'directory name of new project' },
|
|
19
|
+
];
|
package/lib/commands/manifest.js
CHANGED
|
@@ -1,25 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const Config = require("@oclif/config");
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
5
4
|
const fs = require("fs-extra");
|
|
6
5
|
const path = require("path");
|
|
7
|
-
class Manifest extends
|
|
6
|
+
class Manifest extends core_1.Command {
|
|
8
7
|
async run() {
|
|
9
8
|
try {
|
|
10
9
|
fs.unlinkSync('oclif.manifest.json');
|
|
11
10
|
}
|
|
12
11
|
catch (_a) { }
|
|
13
|
-
const { args } = this.parse(Manifest);
|
|
12
|
+
const { args } = await this.parse(Manifest);
|
|
14
13
|
const root = path.resolve(args.path);
|
|
15
|
-
let plugin = new
|
|
14
|
+
let plugin = new core_1.Plugin({ root, type: 'core', ignoreManifest: true, errorOnManifestCreate: true });
|
|
16
15
|
if (!plugin)
|
|
17
16
|
throw new Error('plugin not found');
|
|
18
17
|
await plugin.load();
|
|
19
18
|
if (!plugin.valid) {
|
|
20
19
|
const p = require.resolve('@oclif/plugin-legacy', { paths: [process.cwd()] });
|
|
21
20
|
const { PluginLegacy } = require(p);
|
|
22
|
-
delete plugin.name;
|
|
23
21
|
plugin = new PluginLegacy(this.config, plugin);
|
|
24
22
|
await plugin.load();
|
|
25
23
|
}
|
|
@@ -33,7 +31,6 @@ class Manifest extends command_1.Command {
|
|
|
33
31
|
}
|
|
34
32
|
}
|
|
35
33
|
exports.default = Manifest;
|
|
36
|
-
Manifest.hidden = true;
|
|
37
34
|
Manifest.description = 'generates plugin manifest json';
|
|
38
35
|
Manifest.args = [
|
|
39
36
|
{ name: 'path', description: 'path to plugin', default: '.' },
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { Interfaces } from '@oclif/core';
|
|
2
3
|
export default class PackDeb extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
-
root:
|
|
6
|
+
root: Interfaces.OptionFlag<string>;
|
|
7
7
|
};
|
|
8
8
|
run(): Promise<void>;
|
|
9
9
|
}
|
package/lib/commands/pack/deb.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
4
|
const _ = require("lodash");
|
|
5
5
|
const qq = require("qqjs");
|
|
6
6
|
const Tarballs = require("../../tarballs");
|
|
@@ -28,7 +28,7 @@ export ${config.scopedEnvVarKey('UPDATE_INSTRUCTIONS')}="update with \\"sudo apt
|
|
|
28
28
|
`,
|
|
29
29
|
/* eslint-enable no-useless-escape */
|
|
30
30
|
control: (config, arch) => `Package: ${config.config.bin}
|
|
31
|
-
Version: ${upload_util_1.debVersion(config)}
|
|
31
|
+
Version: ${(0, upload_util_1.debVersion)(config)}
|
|
32
32
|
Section: main
|
|
33
33
|
Priority: standard
|
|
34
34
|
Architecture: ${arch}
|
|
@@ -41,11 +41,11 @@ APT::FTPArchive::Release {
|
|
|
41
41
|
Suite "stable";
|
|
42
42
|
`,
|
|
43
43
|
};
|
|
44
|
-
class PackDeb extends
|
|
44
|
+
class PackDeb extends core_1.Command {
|
|
45
45
|
async run() {
|
|
46
46
|
if (process.platform !== 'linux')
|
|
47
47
|
throw new Error('debian packing must be run on linux');
|
|
48
|
-
const { flags } = this.parse(PackDeb);
|
|
48
|
+
const { flags } = await this.parse(PackDeb);
|
|
49
49
|
const buildConfig = await Tarballs.buildConfig(flags.root);
|
|
50
50
|
const { config } = buildConfig;
|
|
51
51
|
await Tarballs.build(buildConfig, { platform: 'linux', pack: false });
|
|
@@ -53,7 +53,7 @@ class PackDeb extends command_1.Command {
|
|
|
53
53
|
await qq.emptyDir(dist);
|
|
54
54
|
const build = async (arch) => {
|
|
55
55
|
const target = { platform: 'linux', arch };
|
|
56
|
-
const versionedDebBase = upload_util_1.templateShortKey('deb', { bin: config.bin, versionShaRevision: upload_util_1.debVersion(buildConfig), arch: upload_util_1.debArch(arch) });
|
|
56
|
+
const versionedDebBase = (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: (0, upload_util_1.debArch)(arch) });
|
|
57
57
|
const workspace = qq.join(buildConfig.tmp, 'apt', versionedDebBase.replace('.deb', '.apt'));
|
|
58
58
|
await qq.rm(workspace);
|
|
59
59
|
await qq.mkdirp([workspace, 'DEBIAN']);
|
|
@@ -61,7 +61,7 @@ class PackDeb extends command_1.Command {
|
|
|
61
61
|
await qq.mkdirp([workspace, 'usr/lib']);
|
|
62
62
|
await qq.mv(buildConfig.workspace(target), [workspace, 'usr/lib', config.dirname]);
|
|
63
63
|
await qq.write([workspace, 'usr/lib', config.dirname, 'bin', config.bin], scripts.bin(config));
|
|
64
|
-
await qq.write([workspace, 'DEBIAN/control'], scripts.control(buildConfig, upload_util_1.debArch(arch)));
|
|
64
|
+
await qq.write([workspace, 'DEBIAN/control'], scripts.control(buildConfig, (0, upload_util_1.debArch)(arch)));
|
|
65
65
|
await qq.chmod([workspace, 'usr/lib', config.dirname, 'bin', config.bin], 0o755);
|
|
66
66
|
await qq.x(`ln -s "../lib/${config.dirname}/bin/${config.bin}" "${workspace}/usr/bin/${config.bin}"`);
|
|
67
67
|
await qq.x(`chown -R root "${workspace}"`);
|
|
@@ -89,8 +89,7 @@ class PackDeb extends command_1.Command {
|
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
exports.default = PackDeb;
|
|
92
|
-
PackDeb.hidden = true;
|
|
93
92
|
PackDeb.description = 'pack CLI into debian package';
|
|
94
93
|
PackDeb.flags = {
|
|
95
|
-
root:
|
|
94
|
+
root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
|
|
96
95
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { Interfaces } from '@oclif/core';
|
|
2
3
|
export default class PackMacos extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
-
root:
|
|
7
|
-
'additional-
|
|
6
|
+
root: Interfaces.OptionFlag<string>;
|
|
7
|
+
'additional-cli': Interfaces.OptionFlag<string | undefined>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
4
|
const path = require("path");
|
|
5
5
|
const qq = require("qqjs");
|
|
6
6
|
const Tarballs = require("../../tarballs");
|
|
7
7
|
const upload_util_1 = require("../../upload-util");
|
|
8
8
|
const scripts = {
|
|
9
|
-
preinstall: (config,
|
|
9
|
+
preinstall: (config, additionalCLI) => `#!/usr/bin/env bash
|
|
10
10
|
sudo rm -rf /usr/local/lib/${config.dirname}
|
|
11
11
|
sudo rm -rf /usr/local/${config.bin}
|
|
12
12
|
sudo rm -rf /usr/local/bin/${config.bin}
|
|
13
|
-
${
|
|
14
|
-
`sudo rm -rf /usr/local/${
|
|
15
|
-
sudo rm -rf /usr/local/bin/${
|
|
13
|
+
${additionalCLI ?
|
|
14
|
+
`sudo rm -rf /usr/local/${additionalCLI}
|
|
15
|
+
sudo rm -rf /usr/local/bin/${additionalCLI}` : ''}
|
|
16
16
|
`,
|
|
17
|
-
postinstall: (config,
|
|
17
|
+
postinstall: (config, additionalCLI) => `#!/usr/bin/env bash
|
|
18
18
|
set -x
|
|
19
19
|
sudo mkdir -p /usr/local/bin
|
|
20
20
|
sudo ln -sf /usr/local/lib/${config.dirname}/bin/${config.bin} /usr/local/bin/${config.bin}
|
|
21
|
-
${
|
|
21
|
+
${additionalCLI ? `sudo ln -sf /usr/local/lib/${config.dirname}/bin/${additionalCLI} /usr/local/bin/${additionalCLI}` : ''}
|
|
22
22
|
`,
|
|
23
|
-
uninstall: (config,
|
|
23
|
+
uninstall: (config, additionalCLI) => {
|
|
24
24
|
const packageIdentifier = config.pjson.oclif.macos.identifier;
|
|
25
25
|
return `#!/usr/bin/env bash
|
|
26
26
|
|
|
@@ -61,7 +61,7 @@ done
|
|
|
61
61
|
echo "Application uninstalling process started"
|
|
62
62
|
# remove link to shorcut file
|
|
63
63
|
find "/usr/local/bin/" -name "${config.bin}" | xargs rm
|
|
64
|
-
${
|
|
64
|
+
${additionalCLI ? `find "/usr/local/bin/" -name "${additionalCLI}" | xargs rm` : ''}
|
|
65
65
|
if [ $? -eq 0 ]
|
|
66
66
|
then
|
|
67
67
|
echo "[1/3] [DONE] Successfully deleted shortcut links"
|
|
@@ -92,11 +92,11 @@ exit 0
|
|
|
92
92
|
`;
|
|
93
93
|
},
|
|
94
94
|
};
|
|
95
|
-
class PackMacos extends
|
|
95
|
+
class PackMacos extends core_1.Command {
|
|
96
96
|
async run() {
|
|
97
97
|
if (process.platform !== 'darwin')
|
|
98
98
|
this.error('must be run from macos');
|
|
99
|
-
const { flags } = this.parse(PackMacos);
|
|
99
|
+
const { flags } = await this.parse(PackMacos);
|
|
100
100
|
const buildConfig = await Tarballs.buildConfig(flags.root);
|
|
101
101
|
const { config } = buildConfig;
|
|
102
102
|
const c = config.pjson.oclif;
|
|
@@ -107,7 +107,7 @@ class PackMacos extends command_1.Command {
|
|
|
107
107
|
const macos = c.macos;
|
|
108
108
|
const packageIdentifier = macos.identifier;
|
|
109
109
|
await Tarballs.build(buildConfig, { platform: 'darwin', pack: false });
|
|
110
|
-
const templateKey = upload_util_1.templateShortKey('macos', { bin: config.bin, version:
|
|
110
|
+
const templateKey = (0, upload_util_1.templateShortKey)('macos', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha });
|
|
111
111
|
const dist = buildConfig.dist(`macos/${templateKey}`);
|
|
112
112
|
await qq.emptyDir(path.dirname(dist));
|
|
113
113
|
const scriptsDir = qq.join(buildConfig.tmp, 'macos/scripts');
|
|
@@ -115,7 +115,7 @@ class PackMacos extends command_1.Command {
|
|
|
115
115
|
const writeScript = async (script) => {
|
|
116
116
|
const path = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir];
|
|
117
117
|
path.push(script);
|
|
118
|
-
await qq.write(path, scripts[script](config, flags['additional-
|
|
118
|
+
await qq.write(path, scripts[script](config, flags['additional-cli']));
|
|
119
119
|
await qq.chmod(path, 0o755);
|
|
120
120
|
};
|
|
121
121
|
await writeScript('preinstall');
|
|
@@ -142,10 +142,9 @@ class PackMacos extends command_1.Command {
|
|
|
142
142
|
}
|
|
143
143
|
}
|
|
144
144
|
exports.default = PackMacos;
|
|
145
|
-
PackMacos.hidden = true;
|
|
146
145
|
PackMacos.description = 'pack CLI into macOS .pkg';
|
|
147
146
|
PackMacos.flags = {
|
|
148
|
-
root:
|
|
149
|
-
'additional-
|
|
150
|
-
the
|
|
147
|
+
root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
|
|
148
|
+
'additional-cli': core_1.Flags.string({ description: `an Oclif CLI other than the one listed in config.bin that should be made available to the user
|
|
149
|
+
the 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 }),
|
|
151
150
|
};
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
2
|
export default class PackTarballs extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
3
|
static description: string;
|
|
5
4
|
static flags: {
|
|
6
|
-
root:
|
|
7
|
-
targets:
|
|
8
|
-
xz: import("@oclif/
|
|
5
|
+
root: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
targets: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
7
|
+
xz: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
8
|
};
|
|
10
9
|
run(): Promise<void>;
|
|
11
10
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
4
|
const qq = require("qqjs");
|
|
5
5
|
const Tarballs = require("../../tarballs");
|
|
6
|
-
class PackTarballs extends
|
|
6
|
+
class PackTarballs extends core_1.Command {
|
|
7
7
|
async run() {
|
|
8
8
|
const prevCwd = qq.cwd();
|
|
9
9
|
if (process.platform === 'win32')
|
|
10
10
|
throw new Error('pack does not function on windows');
|
|
11
|
-
const { flags } = this.parse(PackTarballs);
|
|
11
|
+
const { flags } = await this.parse(PackTarballs);
|
|
12
12
|
const targets = flags.targets.split(',');
|
|
13
13
|
const buildConfig = await Tarballs.buildConfig(flags.root, { xz: flags.xz, targets: targets });
|
|
14
14
|
await Tarballs.build(buildConfig);
|
|
@@ -16,16 +16,15 @@ class PackTarballs extends command_1.Command {
|
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
exports.default = PackTarballs;
|
|
19
|
-
PackTarballs.hidden = true;
|
|
20
19
|
PackTarballs.description = `packages oclif CLI into tarballs
|
|
21
20
|
|
|
22
21
|
This can be used to create oclif CLIs that use the system node or that come preloaded with a node binary.
|
|
23
22
|
`;
|
|
24
23
|
PackTarballs.flags = {
|
|
25
|
-
root:
|
|
26
|
-
targets:
|
|
24
|
+
root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
|
|
25
|
+
targets: core_1.Flags.string({ char: 't',
|
|
27
26
|
description: 'comma-separated targets to pack (e.g.: linux-arm,win32-x64)',
|
|
28
27
|
default: Tarballs.TARGETS.join(','),
|
|
29
28
|
}),
|
|
30
|
-
xz:
|
|
29
|
+
xz: core_1.Flags.boolean({ description: 'also build xz', allowNo: true, default: true }),
|
|
31
30
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { Interfaces } from '@oclif/core';
|
|
2
3
|
export default class PackWin extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
4
|
static description: string;
|
|
5
5
|
static flags: {
|
|
6
|
-
root:
|
|
7
|
-
'additional-
|
|
6
|
+
root: Interfaces.OptionFlag<string>;
|
|
7
|
+
'additional-cli': Interfaces.OptionFlag<string | undefined>;
|
|
8
8
|
};
|
|
9
9
|
run(): Promise<void>;
|
|
10
10
|
private checkForNSIS;
|
package/lib/commands/pack/win.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
3
|
+
const core_1 = require("@oclif/core");
|
|
4
4
|
const qq = require("qqjs");
|
|
5
5
|
const Tarballs = require("../../tarballs");
|
|
6
6
|
const upload_util_1 = require("../../upload-util");
|
|
7
7
|
const scripts = {
|
|
8
8
|
/* eslint-disable no-useless-escape */
|
|
9
|
-
cmd: (config,
|
|
9
|
+
cmd: (config, additionalCLI = undefined) => `@echo off
|
|
10
10
|
setlocal enableextensions
|
|
11
11
|
|
|
12
|
-
set ${config.scopedEnvVarKey('BINPATH')}=%~dp0\\${
|
|
13
|
-
if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${
|
|
14
|
-
"%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${
|
|
12
|
+
set ${additionalCLI ? `${additionalCLI.toUpperCase()}_BINPATH` : config.scopedEnvVarKey('BINPATH')}=%~dp0\\${additionalCLI !== null && additionalCLI !== void 0 ? additionalCLI : config.bin}.cmd
|
|
13
|
+
if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalCLI !== null && additionalCLI !== void 0 ? additionalCLI : config.bin}.cmd" (
|
|
14
|
+
"%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalCLI !== null && additionalCLI !== void 0 ? additionalCLI : config.bin}.cmd" %*
|
|
15
15
|
) else (
|
|
16
|
-
"%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client
|
|
16
|
+
"%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client\\${additionalCLI ? `${additionalCLI}\\bin\\run` : 'bin\\run'}" %*
|
|
17
17
|
)
|
|
18
18
|
`,
|
|
19
|
-
sh: (config
|
|
19
|
+
sh: (config) => `#!/bin/sh
|
|
20
20
|
basedir=$(dirname "$(echo "$0" | sed -e 's,\\\\,/,g')")
|
|
21
21
|
|
|
22
|
-
"$basedir/../client/bin/${
|
|
22
|
+
"$basedir/../client/bin/${config.bin}.cmd" "$@"
|
|
23
23
|
ret=$?
|
|
24
24
|
exit $ret
|
|
25
25
|
`,
|
|
@@ -188,11 +188,12 @@ done:
|
|
|
188
188
|
Exch $R1 ; $R1=old$R1, stack=[result,...]
|
|
189
189
|
FunctionEnd
|
|
190
190
|
`,
|
|
191
|
+
/* eslint-enable no-useless-escape */
|
|
191
192
|
};
|
|
192
|
-
class PackWin extends
|
|
193
|
+
class PackWin extends core_1.Command {
|
|
193
194
|
async run() {
|
|
194
195
|
await this.checkForNSIS();
|
|
195
|
-
const { flags } = this.parse(PackWin);
|
|
196
|
+
const { flags } = await this.parse(PackWin);
|
|
196
197
|
const buildConfig = await Tarballs.buildConfig(flags.root);
|
|
197
198
|
const { config } = buildConfig;
|
|
198
199
|
await Tarballs.build(buildConfig, { platform: 'win32', pack: false });
|
|
@@ -203,9 +204,9 @@ class PackWin extends command_1.Command {
|
|
|
203
204
|
await qq.write([installerBase, `bin/${config.bin}.cmd`], scripts.cmd(config));
|
|
204
205
|
// eslint-disable-next-line no-await-in-loop
|
|
205
206
|
await qq.write([installerBase, `bin/${config.bin}`], scripts.sh(config));
|
|
206
|
-
if (flags['additional-
|
|
207
|
-
await qq.write([installerBase, `bin/${flags['additional-
|
|
208
|
-
await qq.write([installerBase, `bin/${flags['additional-
|
|
207
|
+
if (flags['additional-cli']) {
|
|
208
|
+
await qq.write([installerBase, `bin/${flags['additional-cli']}.cmd`], scripts.cmd(config, flags['additional-cli'])); // eslint-disable-line no-await-in-loop
|
|
209
|
+
await qq.write([installerBase, `bin/${flags['additional-cli']}`], scripts.sh({ bin: flags['additional-cli'] })); // eslint-disable-line no-await-in-loop
|
|
209
210
|
}
|
|
210
211
|
// eslint-disable-next-line no-await-in-loop
|
|
211
212
|
await qq.write([installerBase, `${config.bin}.nsi`], scripts.nsis(config, arch));
|
|
@@ -213,7 +214,7 @@ class PackWin extends command_1.Command {
|
|
|
213
214
|
await qq.mv(buildConfig.workspace({ platform: 'win32', arch }), [installerBase, 'client']);
|
|
214
215
|
// eslint-disable-next-line no-await-in-loop
|
|
215
216
|
await qq.x(`makensis ${installerBase}/${config.bin}.nsi | grep -v "\\[compress\\]" | grep -v "^File: Descending to"`);
|
|
216
|
-
const templateKey = upload_util_1.templateShortKey('win32', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha, arch });
|
|
217
|
+
const templateKey = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: buildConfig.version, sha: buildConfig.gitSha, arch });
|
|
217
218
|
const o = buildConfig.dist(`win32/${templateKey}`);
|
|
218
219
|
// eslint-disable-next-line no-await-in-loop
|
|
219
220
|
await qq.mv([installerBase, 'installer.exe'], o);
|
|
@@ -222,10 +223,14 @@ class PackWin extends command_1.Command {
|
|
|
222
223
|
const buildLocationUnsigned = o.replace(`${arch}.exe`, `${arch}-unsigned.exe`);
|
|
223
224
|
// eslint-disable-next-line no-await-in-loop
|
|
224
225
|
await qq.mv(o, buildLocationUnsigned);
|
|
226
|
+
const pass = config.scopedEnvVar('WINDOWS_SIGNING_PASS');
|
|
227
|
+
if (!pass) {
|
|
228
|
+
throw new Error(`${config.scopedEnvVarKey('WINDOWS_SIGNING_PASS')} not set in the environment`);
|
|
229
|
+
}
|
|
225
230
|
/* eslint-disable array-element-newline */
|
|
226
231
|
const args = [
|
|
227
232
|
'-pkcs12', windows.keypath,
|
|
228
|
-
'-pass',
|
|
233
|
+
'-pass', pass,
|
|
229
234
|
'-n', windows.name,
|
|
230
235
|
'-i', windows.homepage || config.pjson.homepage,
|
|
231
236
|
'-h', 'sha512',
|
|
@@ -255,10 +260,11 @@ class PackWin extends command_1.Command {
|
|
|
255
260
|
}
|
|
256
261
|
}
|
|
257
262
|
exports.default = PackWin;
|
|
258
|
-
PackWin.
|
|
259
|
-
|
|
263
|
+
PackWin.description = `create windows installer from oclif CLI
|
|
264
|
+
|
|
265
|
+
This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment`;
|
|
260
266
|
PackWin.flags = {
|
|
261
|
-
root:
|
|
262
|
-
'additional-
|
|
263
|
-
the
|
|
267
|
+
root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
|
|
268
|
+
'additional-cli': core_1.Flags.string({ description: `an Oclif CLI other than the one listed in config.bin that should be made available to the user
|
|
269
|
+
the 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 }),
|
|
264
270
|
};
|
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { Command
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
2
|
export default class Promote extends Command {
|
|
3
|
-
static hidden: boolean;
|
|
4
3
|
static description: string;
|
|
5
4
|
static flags: {
|
|
6
|
-
root:
|
|
7
|
-
version:
|
|
8
|
-
sha:
|
|
9
|
-
channel:
|
|
10
|
-
targets:
|
|
11
|
-
deb: import("@oclif/
|
|
12
|
-
macos: import("@oclif/
|
|
13
|
-
win: import("@oclif/
|
|
14
|
-
'max-age':
|
|
15
|
-
xz: import("@oclif/
|
|
16
|
-
indexes: import("@oclif/
|
|
5
|
+
root: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
6
|
+
version: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
7
|
+
sha: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
8
|
+
channel: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
9
|
+
targets: import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
10
|
+
deb: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
11
|
+
macos: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
12
|
+
win: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
13
|
+
'max-age': import("@oclif/core/lib/interfaces").OptionFlag<string>;
|
|
14
|
+
xz: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
15
|
+
indexes: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
17
16
|
};
|
|
18
17
|
run(): Promise<void>;
|
|
19
18
|
}
|