oclif 3.2.31 → 3.3.0-beta.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.
@@ -1 +1 @@
1
- {"version":"3.2.31","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":[]}}}
1
+ {"version":"3.3.0-beta.2","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/aws.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const fs = require("fs-extra");
4
- const qq = require("qqjs");
5
4
  const log_1 = require("./log");
5
+ const util_1 = require("./util");
6
6
  const debug = log_1.debug.new('aws');
7
7
  const cache = {};
8
8
  const aws = {
@@ -53,7 +53,7 @@ exports.default = {
53
53
  get s3() {
54
54
  return {
55
55
  uploadFile: (local, options) => new Promise((resolve, reject) => {
56
- (0, log_1.log)('s3:uploadFile', qq.prettifyPaths(local), `s3://${options.Bucket}/${options.Key}`);
56
+ (0, log_1.log)('s3:uploadFile', (0, util_1.prettifyPaths)(local), `s3://${options.Bucket}/${options.Key}`);
57
57
  options.Body = fs.createReadStream(local);
58
58
  aws.s3.upload(options, err => {
59
59
  if (err)
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
+ const fs = require("fs-extra");
4
5
  const _ = require("lodash");
5
- const qq = require("qqjs");
6
+ const path = require("path");
6
7
  const Tarballs = require("../../tarballs");
7
8
  const upload_util_1 = require("../../upload-util");
9
+ const child_process_1 = require("child_process");
10
+ const node_util_1 = require("node:util");
11
+ const exec = (0, node_util_1.promisify)(child_process_1.exec);
8
12
  const scripts = {
9
13
  /* eslint-disable no-useless-escape */
10
14
  bin: (config) => `#!/usr/bin/env bash
@@ -48,44 +52,52 @@ class PackDeb extends core_1.Command {
48
52
  const { flags } = await this.parse(PackDeb);
49
53
  const buildConfig = await Tarballs.buildConfig(flags.root);
50
54
  const { config } = buildConfig;
51
- await Tarballs.build(buildConfig, { platform: 'linux', pack: false, tarball: flags.tarball });
55
+ await Tarballs.build(buildConfig, { platform: 'linux', pack: false, tarball: flags.tarball, parallel: true });
52
56
  const dist = buildConfig.dist('deb');
53
- await qq.emptyDir(dist);
57
+ await fs.emptyDir(dist);
54
58
  const build = async (arch) => {
59
+ this.log(`building debian / ${arch}`);
55
60
  const target = { platform: 'linux', arch };
56
61
  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
- const workspace = qq.join(buildConfig.tmp, 'apt', versionedDebBase.replace('.deb', '.apt'));
58
- await qq.rm(workspace);
59
- await qq.mkdirp([workspace, 'DEBIAN']);
60
- await qq.mkdirp([workspace, 'usr/bin']);
61
- await qq.mkdirp([workspace, 'usr/lib']);
62
- await qq.mv(buildConfig.workspace(target), [workspace, 'usr/lib', config.dirname]);
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, (0, upload_util_1.debArch)(arch)));
65
- await qq.chmod([workspace, 'usr/lib', config.dirname, 'bin', config.bin], 0o755);
66
- await qq.x(`ln -s "../lib/${config.dirname}/bin/${config.bin}" "${workspace}/usr/bin/${config.bin}"`);
67
- await qq.x(`sudo chown -R root "${workspace}"`);
68
- await qq.x(`sudo chgrp -R root "${workspace}"`);
69
- await qq.x(`dpkg --build "${workspace}" "${qq.join(dist, versionedDebBase)}"`);
62
+ const workspace = path.join(buildConfig.tmp, 'apt', versionedDebBase.replace('.deb', '.apt'));
63
+ await fs.remove(workspace);
64
+ await Promise.all([
65
+ fs.promises.mkdir(path.join(workspace, 'DEBIAN'), { recursive: true }),
66
+ fs.promises.mkdir(path.join(workspace, 'usr', 'bin'), { recursive: true }),
67
+ ]);
68
+ await fs.copy(buildConfig.workspace(target), path.join(workspace, 'usr', 'lib', config.dirname));
69
+ await Promise.all([
70
+ // usr/lib/oclif/bin/oclif (the executable)
71
+ fs.promises.writeFile(path.join(workspace, 'usr', 'lib', config.dirname, 'bin', config.bin), scripts.bin(config), { mode: 0o755 }),
72
+ fs.promises.writeFile(path.join(workspace, 'DEBIAN', 'control'), scripts.control(buildConfig, (0, upload_util_1.debArch)(arch))),
73
+ ]);
74
+ // symlink usr/bin/oclif points to usr/lib/oclif/bin/oclif
75
+ await exec(`ln -s "${path.join('..', 'lib', config.dirname, 'bin', config.bin)}" "${config.bin}"`, { cwd: path.join(workspace, 'usr', 'bin') });
76
+ await exec(`sudo chown -R root "${workspace}"`);
77
+ await exec(`sudo chgrp -R root "${workspace}"`);
78
+ await exec(`dpkg --build "${workspace}" "${path.join(dist, versionedDebBase)}"`);
79
+ this.log(`finished building debian / ${arch}`);
70
80
  };
71
81
  const arches = _.uniq(buildConfig.targets
72
82
  .filter(t => t.platform === 'linux')
73
83
  .map(t => t.arch));
74
- // eslint-disable-next-line no-await-in-loop
75
- for (const a of arches)
76
- await build(a);
77
- await qq.x('apt-ftparchive packages . > Packages', { cwd: dist });
78
- await qq.x('gzip -c Packages > Packages.gz', { cwd: dist });
79
- await qq.x('bzip2 -k Packages', { cwd: dist });
80
- await qq.x('xz -k Packages', { cwd: dist });
81
- const ftparchive = qq.join(buildConfig.tmp, 'apt', 'apt-ftparchive.conf');
82
- await qq.write(ftparchive, scripts.ftparchive(config));
83
- await qq.x(`apt-ftparchive -c "${ftparchive}" release . > Release`, { cwd: dist });
84
+ await Promise.all(arches.map(a => build(a)));
85
+ await exec('apt-ftparchive packages . > Packages', { cwd: dist });
86
+ this.log('debian packages created');
87
+ await Promise.all([
88
+ exec('gzip -c Packages > Packages.gz', { cwd: dist }),
89
+ exec('bzip2 -k Packages', { cwd: dist }),
90
+ exec('xz -k Packages', { cwd: dist }),
91
+ packForFTP(buildConfig, config, dist),
92
+ ]);
93
+ this.log('debian packages archived');
84
94
  const gpgKey = config.scopedEnvVar('DEB_KEY');
85
95
  if (gpgKey) {
86
- await qq.x(`gpg --digest-algo SHA512 --clearsign -u ${gpgKey} -o InRelease Release`, { cwd: dist });
87
- await qq.x(`gpg --digest-algo SHA512 -abs -u ${gpgKey} -o Release.gpg Release`, { cwd: dist });
96
+ this.log('adding gpg signatures to Release');
97
+ await exec(`gpg --digest-algo SHA512 --clearsign -u ${gpgKey} -o InRelease Release`, { cwd: dist });
98
+ await exec(`gpg --digest-algo SHA512 -abs -u ${gpgKey} -o Release.gpg Release`, { cwd: dist });
88
99
  }
100
+ this.log('debian packing complete');
89
101
  }
90
102
  }
91
103
  exports.default = PackDeb;
@@ -94,3 +106,9 @@ PackDeb.flags = {
94
106
  root: core_1.Flags.string({ char: 'r', description: 'path to oclif CLI root', default: '.', required: true }),
95
107
  tarball: core_1.Flags.string({ char: 't', description: 'optionally specify a path to a tarball already generated by NPM', required: false }),
96
108
  };
109
+ async function packForFTP(buildConfig, config, dist) {
110
+ const ftparchive = path.join(buildConfig.tmp, 'apt', 'apt-ftparchive.conf');
111
+ await fs.promises.mkdir(path.basename(ftparchive), { recursive: true });
112
+ await fs.writeFile(ftparchive, scripts.ftparchive(config));
113
+ await exec(`apt-ftparchive -c "${ftparchive}" release . > Release`, { cwd: dist });
114
+ }
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ const path = require("path");
3
4
  const _ = require("lodash");
4
- const qq = require("qqjs");
5
+ const fs = require("fs-extra");
5
6
  const core_1 = require("@oclif/core");
6
7
  const Tarballs = require("../../tarballs");
7
8
  const upload_util_1 = require("../../upload-util");
9
+ const child_process_1 = require("child_process");
10
+ const node_util_1 = require("node:util");
11
+ const exec = (0, node_util_1.promisify)(child_process_1.exec);
8
12
  const noBundleConfiguration = `<?xml version="1.0" encoding="UTF-8"?>
9
13
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
10
14
  <plist version="1.0">
@@ -65,7 +69,7 @@ while [ "$1" != "-y" ]; do
65
69
  done
66
70
 
67
71
  echo "Application uninstalling process started"
68
- # remove link to shorcut file
72
+ # remove link to shortcut file
69
73
  find "/usr/local/bin/" -name "${config.bin}" | xargs rm
70
74
  ${additionalCLI ? `find "/usr/local/bin/" -name "${additionalCLI}" | xargs rm` : ''}
71
75
  if [ $? -eq 0 ]
@@ -122,28 +126,30 @@ class PackMacos extends core_1.Command {
122
126
  this.error('package.json must have oclif.macos.identifier set');
123
127
  const macos = c.macos;
124
128
  const packageIdentifier = macos.identifier;
125
- await Tarballs.build(buildConfig, { platform: 'darwin', pack: false, tarball: flags.tarball });
126
- const scriptsDir = qq.join(buildConfig.tmp, 'macos/scripts');
127
- await qq.emptyDir(buildConfig.dist('macos'));
128
- const noBundleConfigurationPath = qq.join(buildConfig.tmp, 'macos/no-bundle.plist');
129
+ await Tarballs.build(buildConfig, { platform: 'darwin', pack: false, tarball: flags.tarball, parallel: true });
130
+ const scriptsDir = path.join(buildConfig.tmp, 'macos/scripts');
131
+ await fs.emptyDir(buildConfig.dist('macos'));
132
+ const noBundleConfigurationPath = path.join(buildConfig.tmp, 'macos', 'no-bundle.plist');
129
133
  const build = async (arch) => {
130
134
  const templateKey = (0, upload_util_1.templateShortKey)('macos', { bin: config.bin, version: config.version, sha: buildConfig.gitSha, arch });
131
135
  const dist = buildConfig.dist(`macos/${templateKey}`);
132
136
  const rootDir = buildConfig.workspace({ platform: 'darwin', arch });
133
137
  const writeNoBundleConfiguration = async () => {
134
- await qq.write(noBundleConfigurationPath, noBundleConfiguration);
135
- await qq.chmod(noBundleConfigurationPath, 0o755);
138
+ await fs.mkdir(path.dirname(noBundleConfigurationPath), { recursive: true });
139
+ await fs.writeFile(noBundleConfigurationPath, noBundleConfiguration, { mode: 0o755 });
136
140
  };
137
141
  const writeScript = async (script) => {
138
- const path = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir];
139
- path.push(script);
140
- await qq.write(path, scripts[script](config, flags['additional-cli']));
141
- await qq.chmod(path, 0o755);
142
+ const scriptLocation = script === 'uninstall' ? [rootDir, 'bin'] : [scriptsDir];
143
+ scriptLocation.push(script);
144
+ await fs.mkdir(path.dirname(path.join(...scriptLocation)), { recursive: true });
145
+ await fs.writeFile(path.join(...scriptLocation), scripts[script](config, flags['additional-cli']), { mode: 0o755 });
142
146
  };
143
- await writeNoBundleConfiguration();
144
- await writeScript('preinstall');
145
- await writeScript('postinstall');
146
- await writeScript('uninstall');
147
+ await Promise.all([
148
+ writeNoBundleConfiguration(),
149
+ writeScript('preinstall'),
150
+ writeScript('postinstall'),
151
+ writeScript('uninstall'),
152
+ ]);
147
153
  /* eslint-disable array-element-newline */
148
154
  const args = [
149
155
  '--root', rootDir,
@@ -162,14 +168,12 @@ class PackMacos extends core_1.Command {
162
168
  if (process.env.OSX_KEYCHAIN)
163
169
  args.push('--keychain', process.env.OSX_KEYCHAIN);
164
170
  args.push(dist);
165
- await qq.x('pkgbuild', args);
171
+ await exec(`pkgbuild ${args.join(' ')}`);
166
172
  };
167
173
  const arches = _.uniq(buildConfig.targets
168
174
  .filter(t => t.platform === 'darwin')
169
175
  .map(t => t.arch));
170
- // eslint-disable-next-line no-await-in-loop
171
- for (const a of arches)
172
- await build(a);
176
+ await Promise.all(arches.map(a => build(a)));
173
177
  }
174
178
  }
175
179
  exports.default = PackMacos;
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const qq = require("qqjs");
5
4
  const Tarballs = require("../../tarballs");
6
5
  class PackTarballs extends core_1.Command {
7
6
  async run() {
8
7
  var _a;
9
- const prevCwd = qq.cwd();
10
8
  if (process.platform === 'win32')
11
9
  throw new Error('pack does not function on windows');
12
10
  const { flags } = await this.parse(PackTarballs);
@@ -18,7 +16,6 @@ class PackTarballs extends core_1.Command {
18
16
  tarball: flags.tarball,
19
17
  parallel: flags.parallel,
20
18
  });
21
- qq.cd(prevCwd);
22
19
  }
23
20
  }
24
21
  exports.default = PackTarballs;
@@ -1,9 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const core_1 = require("@oclif/core");
4
- const qq = require("qqjs");
4
+ const path = require("path");
5
+ const fs = require("fs-extra");
5
6
  const Tarballs = require("../../tarballs");
6
7
  const upload_util_1 = require("../../upload-util");
8
+ const child_process_1 = require("child_process");
9
+ const node_util_1 = require("node:util");
10
+ const exec = (0, node_util_1.promisify)(child_process_1.exec);
7
11
  const scripts = {
8
12
  /* eslint-disable no-useless-escape */
9
13
  // eslint-disable-next-line unicorn/no-useless-undefined
@@ -199,58 +203,37 @@ class PackWin extends core_1.Command {
199
203
  const { flags } = await this.parse(PackWin);
200
204
  const buildConfig = await Tarballs.buildConfig(flags.root);
201
205
  const { config } = buildConfig;
202
- await Tarballs.build(buildConfig, { platform: 'win32', pack: false, tarball: flags.tarball });
206
+ await Tarballs.build(buildConfig, { platform: 'win32', pack: false, tarball: flags.tarball, parallel: true });
203
207
  const arches = buildConfig.targets.filter(t => t.platform === 'win32').map(t => t.arch);
204
- for (const arch of arches) {
205
- const installerBase = qq.join(buildConfig.tmp, `windows-${arch}-installer`);
206
- // eslint-disable-next-line no-await-in-loop
207
- await qq.write([installerBase, `bin/${config.bin}.cmd`], scripts.cmd(config));
208
- // eslint-disable-next-line no-await-in-loop
209
- await qq.write([installerBase, `bin/${config.bin}`], scripts.sh(config));
210
- if (flags['additional-cli']) {
211
- await qq.write([installerBase, `bin/${flags['additional-cli']}.cmd`], scripts.cmd(config, flags['additional-cli'])); // eslint-disable-line no-await-in-loop
212
- await qq.write([installerBase, `bin/${flags['additional-cli']}`], scripts.sh({ bin: flags['additional-cli'] })); // eslint-disable-line no-await-in-loop
213
- }
214
- // eslint-disable-next-line no-await-in-loop
215
- await qq.write([installerBase, `${config.bin}.nsi`], scripts.nsis(config, arch));
216
- // eslint-disable-next-line no-await-in-loop
217
- await qq.mv(buildConfig.workspace({ platform: 'win32', arch }), [installerBase, 'client']);
218
- // eslint-disable-next-line no-await-in-loop
219
- await qq.x(`makensis ${installerBase}/${config.bin}.nsi | grep -v "\\[compress\\]" | grep -v "^File: Descending to"`);
208
+ await Promise.all(arches.map(async (arch) => {
209
+ const installerBase = path.join(buildConfig.tmp, `windows-${arch}-installer`);
210
+ await fs.promises.rm(installerBase, { recursive: true, force: true });
211
+ await fs.promises.mkdir(path.join(installerBase, 'bin'), { recursive: true });
212
+ await Promise.all([
213
+ fs.writeFile(path.join(installerBase, 'bin', `${config.bin}.cmd`), scripts.cmd(config)),
214
+ fs.writeFile(path.join(installerBase, 'bin', `${config.bin}`), scripts.sh(config)),
215
+ fs.writeFile(path.join(installerBase, `${config.bin}.nsi`), scripts.nsis(config, arch)),
216
+ ].concat(flags['additional-cli'] ? [
217
+ fs.writeFile(path.join(installerBase, 'bin', `${flags['additional-cli']}.cmd`), scripts.cmd(config, flags['additional-cli'])),
218
+ fs.writeFile(path.join(installerBase, 'bin', `${flags['additional-cli']}`), scripts.sh({ bin: flags['additional-cli'] })),
219
+ ] : []));
220
+ await fs.move(buildConfig.workspace({ platform: 'win32', arch }), path.join(installerBase, 'client'));
221
+ await exec(`makensis ${installerBase}/${config.bin}.nsi | grep -v "\\[compress\\]" | grep -v "^File: Descending to"`);
220
222
  const templateKey = (0, upload_util_1.templateShortKey)('win32', { bin: config.bin, version: config.version, sha: buildConfig.gitSha, arch });
221
223
  const o = buildConfig.dist(`win32/${templateKey}`);
222
- // eslint-disable-next-line no-await-in-loop
223
- await qq.mv([installerBase, 'installer.exe'], o);
224
+ await fs.move(path.join(installerBase, 'installer.exe'), o);
224
225
  const windows = config.pjson.oclif.windows;
225
226
  if (windows && windows.name && windows.keypath) {
226
- const buildLocationUnsigned = o.replace(`${arch}.exe`, `${arch}-unsigned.exe`);
227
- // eslint-disable-next-line no-await-in-loop
228
- await qq.mv(o, buildLocationUnsigned);
229
- const pass = config.scopedEnvVar('WINDOWS_SIGNING_PASS');
230
- if (!pass) {
231
- throw new Error(`${config.scopedEnvVarKey('WINDOWS_SIGNING_PASS')} not set in the environment`);
232
- }
233
- /* eslint-disable array-element-newline */
234
- const args = [
235
- '-pkcs12', windows.keypath,
236
- '-pass', pass,
237
- '-n', windows.name,
238
- '-i', windows.homepage || config.pjson.homepage,
239
- '-h', 'sha512',
240
- '-in', buildLocationUnsigned,
241
- '-out', o,
242
- ];
243
- // eslint-disable-next-line no-await-in-loop
244
- await qq.x('osslsigncode', args);
227
+ await signWindows(o, arch, config, windows);
245
228
  }
246
229
  else
247
230
  this.debug('Skipping windows exe signing');
248
231
  this.log(`built ${o}`);
249
- }
232
+ }));
250
233
  }
251
234
  async checkForNSIS() {
252
235
  try {
253
- await qq.x('makensis', { stdio: [0, null, 2] });
236
+ await exec('makensis');
254
237
  }
255
238
  catch (error) {
256
239
  if (error.code === 1)
@@ -284,3 +267,22 @@ the CLI should already exist in a directory named after the CLI that is the root
284
267
  required: false,
285
268
  }),
286
269
  };
270
+ async function signWindows(o, arch, config, windows) {
271
+ const buildLocationUnsigned = o.replace(`${arch}.exe`, `${arch}-unsigned.exe`);
272
+ await fs.move(o, buildLocationUnsigned);
273
+ const pass = config.scopedEnvVar('WINDOWS_SIGNING_PASS');
274
+ if (!pass) {
275
+ throw new Error(`${config.scopedEnvVarKey('WINDOWS_SIGNING_PASS')} not set in the environment`);
276
+ }
277
+ /* eslint-disable array-element-newline */
278
+ const args = [
279
+ '-pkcs12', windows.keypath,
280
+ '-pass', pass,
281
+ '-n', windows.name,
282
+ '-i', windows.homepage || config.pjson.homepage,
283
+ '-h', 'sha512',
284
+ '-in', buildLocationUnsigned,
285
+ '-out', o,
286
+ ];
287
+ await exec(`osslsigncode ${args}.join(' ')`);
288
+ }