oclif 3.10.0 → 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.10.0",
2
+ "version": "3.11.0",
3
3
  "commands": {
4
4
  "generate": {
5
5
  "id": "generate",
@@ -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() {
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.10.0",
4
+ "version": "3.11.0",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run",