oclif 3.9.2 → 3.11.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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "3.9.2",
2
+ "version": "3.11.0",
3
3
  "commands": {
4
4
  "generate": {
5
5
  "id": "generate",
@@ -97,9 +97,12 @@ class Promote extends core_1.Command {
97
97
  }));
98
98
  };
99
99
  const promoteDebianAptPackages = async () => {
100
+ const arches = buildConfig.targets.filter(t => t.platform === 'linux');
100
101
  // copy debian artifacts
101
102
  const debArtifacts = [
102
- (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: 'amd64' }),
103
+ ...arches
104
+ .filter(a => !a.arch.includes('x86')) // See todo below
105
+ .map(a => (0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: (0, upload_util_1.debArch)(a.arch) })),
103
106
  'Packages.gz',
104
107
  'Packages.xz',
105
108
  'Packages.bz2',
@@ -111,7 +114,6 @@ class Promote extends core_1.Command {
111
114
  // TODO: remove in next major release
112
115
  // node dropped 32-bit support for linux a long time ago, see:
113
116
  // https://github.com/oclif/oclif/issues/770#issuecomment-1508719530
114
- const arches = buildConfig.targets.filter(t => t.platform === 'linux');
115
117
  if (arches.find(a => a.arch.includes('x86')) && (0, semver_1.lte)(buildConfig.nodeVersion, '9.11.2')) {
116
118
  debArtifacts.push((0, upload_util_1.templateShortKey)('deb', { bin: config.bin, versionShaRevision: (0, upload_util_1.debVersion)(buildConfig), arch: 'i386' }));
117
119
  }
@@ -40,9 +40,9 @@ class UploadDeb extends core_1.Command {
40
40
  await Promise.all([upload(deb), uploadWorkaround(deb)]);
41
41
  };
42
42
  (0, log_1.log)(`starting upload of deb artifacts for v${config.version}-${buildConfig.gitSha}`);
43
+ const arches = buildConfig.targets.filter(t => t.platform === 'linux');
43
44
  await Promise.all([
44
- uploadDeb('amd64'),
45
- uploadDeb('i386'),
45
+ ...arches.map(a => uploadDeb((0, upload_util_1.debArch)(a.arch))),
46
46
  upload('Packages.gz'),
47
47
  upload('Packages.xz'),
48
48
  upload('Packages.bz2'),
@@ -27,7 +27,20 @@ class CLI extends Generator {
27
27
  async prompting() {
28
28
  const msg = 'Time to build an oclif CLI!';
29
29
  this.log(yosay(`${msg} Version: ${version}`));
30
- (0, child_process_1.execSync)(`git clone https://github.com/oclif/hello-world.git "${path.resolve(this.name)}"`);
30
+ const { moduleType } = await this.prompt([
31
+ {
32
+ type: 'list',
33
+ name: 'moduleType',
34
+ message: 'Select a module type',
35
+ choices: [
36
+ { name: 'CommonJS', value: 'cjs' },
37
+ { name: 'ESM', value: 'esm' },
38
+ ],
39
+ default: 'cjs',
40
+ },
41
+ ]);
42
+ const repo = moduleType === 'esm' ? 'hello-world-esm' : 'hello-world';
43
+ (0, child_process_1.execSync)(`git clone https://github.com/oclif/${repo}.git "${path.resolve(this.name)}" --depth=1`);
31
44
  fs.rmSync(`${path.resolve(this.name, '.git')}`, { recursive: true });
32
45
  this.destinationRoot(path.resolve(this.name));
33
46
  this.env.cwd = this.destinationPath();
@@ -146,8 +159,15 @@ class CLI extends Generator {
146
159
  this.fs.delete(this.destinationPath('LICENSE'));
147
160
  }
148
161
  end() {
149
- this.spawnCommandSync(this.env.options.nodePackageManager, ['run', 'build']);
150
- this.spawnCommandSync(path.join(this.env.cwd, 'node_modules', '.bin', 'oclif'), ['readme'], { cwd: this.env.cwd });
162
+ this.spawnCommandSync(this.env.options.nodePackageManager, ['run', 'build'], { cwd: this.env.cwd });
163
+ this.spawnCommandSync(path.join(this.env.cwd, 'node_modules', '.bin', 'oclif'), ['readme'], {
164
+ cwd: this.env.cwd,
165
+ // When testing this command in development, you get noisy compilation errors as a result of running
166
+ // this in a spawned process. Setting the NODE_ENV to production will silence these warnings. This
167
+ // doesn't affect the behavior of the command in production since the NODE_ENV is already set to production
168
+ // in that scenario.
169
+ env: Object.assign(Object.assign({}, process.env), { NODE_ENV: 'production' }),
170
+ });
151
171
  console.log(`\nCreated ${this.pjson.name} in ${this.destinationRoot()}`);
152
172
  }
153
173
  _gitignore() {
@@ -13,6 +13,7 @@ const exec = (0, node_util_1.promisify)(child_process_1.exec);
13
13
  exports.TARGETS = [
14
14
  'linux-x64',
15
15
  'linux-arm',
16
+ 'linux-arm64',
16
17
  'win32-x64',
17
18
  'win32-x86',
18
19
  'darwin-x64',
@@ -3,5 +3,6 @@ import { BuildConfig as TarballConfig } from './tarballs/config';
3
3
  export declare function commitAWSDir(version: string, sha: string, s3Config: TarballConfig['s3Config']): string;
4
4
  export declare function channelAWSDir(channel: string, s3Config: TarballConfig['s3Config']): string;
5
5
  export declare function templateShortKey(type: keyof Interfaces.PJSON.S3.Templates | 'macos' | 'win32' | 'deb', ext?: '.tar.gz' | '.tar.xz' | Interfaces.Config.s3Key.Options, options?: Interfaces.Config.s3Key.Options): string;
6
- export declare function debArch(arch: Interfaces.ArchTypes): string;
6
+ export declare type DebArch = 'amd64' | 'i386' | 'armel' | 'arm64';
7
+ export declare function debArch(arch: Interfaces.ArchTypes): DebArch;
7
8
  export declare function debVersion(buildConfig: TarballConfig): string;
@@ -47,6 +47,8 @@ function debArch(arch) {
47
47
  return 'i386';
48
48
  if (arch === 'arm')
49
49
  return 'armel';
50
+ if (arch === 'arm64')
51
+ return 'arm64';
50
52
  throw new Error(`invalid arch: ${arch}`);
51
53
  }
52
54
  exports.debArch = debArch;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "3.9.2",
4
+ "version": "3.11.0",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run",