oclif 4.0.3 → 4.1.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.
@@ -6,8 +6,6 @@ class CommandBase extends core_1.Command {
6
6
  async generate(type, generatorOptions = {}) {
7
7
  const env = (0, yeoman_environment_1.createEnv)();
8
8
  env.register(require.resolve(`./generators/${type}`), `oclif:${type}`);
9
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
- // @ts-ignore
11
9
  await env.run(`oclif:${type}`, generatorOptions);
12
10
  }
13
11
  }
@@ -3,6 +3,7 @@ export default class PackWin extends Command {
3
3
  static description: string;
4
4
  static flags: {
5
5
  'additional-cli': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
6
+ 'defender-exclusion': Interfaces.OptionFlag<"hidden" | "checked" | "unchecked", Interfaces.CustomOptions>;
6
7
  root: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
7
8
  tarball: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
8
9
  targets: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
@@ -12,8 +12,7 @@ const upload_util_1 = require("../../upload-util");
12
12
  const exec = (0, node_util_1.promisify)(node_child_process_1.exec);
13
13
  const scripts = {
14
14
  /* eslint-disable no-useless-escape */
15
- // eslint-disable-next-line unicorn/no-useless-undefined
16
- cmd: (config, additionalCLI = undefined) => `@echo off
15
+ cmd: (config, additionalCLI) => `@echo off
17
16
  setlocal enableextensions
18
17
 
19
18
  set ${additionalCLI ? `${additionalCLI.toUpperCase()}_BINPATH` : config.scopedEnvVarKey('BINPATH')}=%~dp0\\${additionalCLI ?? config.bin}.cmd
@@ -23,7 +22,7 @@ if exist "%LOCALAPPDATA%\\${config.dirname}\\client\\bin\\${additionalCLI ?? con
23
22
  "%~dp0\\..\\client\\bin\\node.exe" "%~dp0\\..\\client\\${additionalCLI ? `${additionalCLI}\\bin\\run` : 'bin\\run'}" %*
24
23
  )
25
24
  `,
26
- nsis: (config, arch, customization) => `!include MUI2.nsh
25
+ nsis: ({ arch, config, customization, defenderOptionDefault, hideDefenderOption, }) => `!include MUI2.nsh
27
26
 
28
27
  !define Version '${config.version.split('-')[0]}'
29
28
  Name "${config.name}"
@@ -76,7 +75,7 @@ Section "Set PATH to ${config.name}"
76
75
  Call AddToPath
77
76
  SectionEnd
78
77
 
79
- Section "Add %LOCALAPPDATA%\\${config.dirname} to Windows Defender exclusions (highly recommended for performance!)"
78
+ Section ${defenderOptionDefault ? '' : '/o '}"${hideDefenderOption ? '-' : ''}Add %LOCALAPPDATA%\\${config.dirname} to Windows Defender exclusions (highly recommended for performance!)"
80
79
  ExecShell "" '"$0"' "/C powershell -ExecutionPolicy Bypass -Command $\\"& {Add-MpPreference -ExclusionPath $\\"$LOCALAPPDATA\\${config.dirname}$\\"}$\\" -FFFeatureOff" SW_HIDE
81
80
  SectionEnd
82
81
 
@@ -203,14 +202,21 @@ exit $ret
203
202
  };
204
203
  class PackWin extends core_1.Command {
205
204
  static description = `create windows installer from oclif CLI
206
-
207
- This command requires WINDOWS_SIGNING (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) to be set in the environment`;
205
+
206
+ This command will produce unsigned installers unless you supply WINDOWS_SIGNING_PASS (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) in the environment and have set the windows.name and windows.keypath properties in your package.json's oclif property.`;
208
207
  static flags = {
209
208
  'additional-cli': core_1.Flags.string({
210
209
  description: `an Oclif CLI other than the one listed in config.bin that should be made available to the user
211
210
  the CLI should already exist in a directory named after the CLI that is the root of the tarball produced by "oclif pack:tarballs"`,
212
211
  hidden: true,
213
212
  }),
213
+ 'defender-exclusion': core_1.Flags.option({
214
+ options: ['checked', 'unchecked', 'hidden'],
215
+ })({
216
+ default: 'checked',
217
+ description: 'there is no way to set a hidden checkbox with "true" as a default...the user can always allow full security',
218
+ summary: `set to "checked" or "unchecked" to set the default value for the checkbox. Set to "hidden" to hide the option (will let defender do its thing)`,
219
+ }),
214
220
  root: core_1.Flags.string({
215
221
  char: 'r',
216
222
  default: '.',
@@ -231,9 +237,9 @@ the CLI should already exist in a directory named after the CLI that is the root
231
237
  const { flags } = await this.parse(PackWin);
232
238
  const buildConfig = await Tarballs.buildConfig(flags.root, { targets: flags?.targets?.split(',') });
233
239
  const { config } = buildConfig;
234
- await Tarballs.build(buildConfig, { pack: false, parallel: true, platform: 'win32', tarball: flags.tarball });
235
- const arches = buildConfig.targets.filter((t) => t.platform === 'win32').map((t) => t.arch);
236
240
  const nsisCustomization = config.nsisCustomization ? (0, node_fs_1.readFileSync)(config.nsisCustomization, 'utf8') : '';
241
+ const arches = buildConfig.targets.filter((t) => t.platform === 'win32').map((t) => t.arch);
242
+ await Tarballs.build(buildConfig, { pack: false, parallel: true, platform: 'win32', tarball: flags.tarball });
237
243
  await Promise.all(arches.map(async (arch) => {
238
244
  const installerBase = path.join(buildConfig.tmp, `windows-${arch}-installer`);
239
245
  await (0, promises_1.rm)(installerBase, { force: true, recursive: true });
@@ -241,7 +247,14 @@ the CLI should already exist in a directory named after the CLI that is the root
241
247
  await Promise.all([
242
248
  (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${config.bin}.cmd`), scripts.cmd(config)),
243
249
  (0, promises_1.writeFile)(path.join(installerBase, 'bin', `${config.bin}`), scripts.sh(config)),
244
- (0, promises_1.writeFile)(path.join(installerBase, `${config.bin}.nsi`), scripts.nsis(config, arch, nsisCustomization)),
250
+ (0, promises_1.writeFile)(path.join(installerBase, `${config.bin}.nsi`), scripts.nsis({
251
+ arch,
252
+ config,
253
+ customization: nsisCustomization,
254
+ // hiding it also unchecks it
255
+ defenderOptionDefault: flags['defender-exclusion'] === 'hidden' ? false : flags['default-defender-exclusion'],
256
+ hideDefenderOption: flags['hide-defender-option'] === 'hidden',
257
+ })),
245
258
  ...(config.binAliases
246
259
  ? config.binAliases.flatMap((alias) =>
247
260
  // write duplicate files for windows aliases
@@ -5,6 +5,7 @@ export default class Readme extends Command {
5
5
  aliases: Interfaces.BooleanFlag<boolean>;
6
6
  dir: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
7
7
  multi: Interfaces.BooleanFlag<boolean>;
8
+ 'readme-path': Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
8
9
  'repository-prefix': Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
9
10
  version: Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
10
11
  };
@@ -26,6 +26,7 @@ Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
26
26
  aliases: core_1.Flags.boolean({ allowNo: true, default: true, description: 'include aliases in the command list' }),
27
27
  dir: core_1.Flags.string({ default: 'docs', description: 'output directory for multi docs', required: true }),
28
28
  multi: core_1.Flags.boolean({ description: 'create a different markdown page for each topic' }),
29
+ 'readme-path': core_1.Flags.string({ default: 'README.md', description: 'Path to the README file.', required: true }),
29
30
  'repository-prefix': core_1.Flags.string({ description: 'a template string used to build links to the source code' }),
30
31
  version: core_1.Flags.string({
31
32
  description: 'version to use in readme links. defaults to the version in package.json',
@@ -138,7 +139,7 @@ Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
138
139
  if (readme.includes(`<!-- ${tag}stop -->`)) {
139
140
  readme = readme.replace(new RegExp(`<!-- ${tag} -->(.|\n)*<!-- ${tag}stop -->`, 'm'), `<!-- ${tag} -->`);
140
141
  }
141
- this.log(`replacing <!-- ${tag} --> in README.md`);
142
+ this.log(`replacing <!-- ${tag} --> in ${this.flags['readme-path']}`);
142
143
  }
143
144
  return readme.replace(`<!-- ${tag} -->`, `<!-- ${tag} -->\n${body}\n<!-- ${tag}stop -->`);
144
145
  }
@@ -146,7 +147,7 @@ Customize the code URL prefix by setting oclif.repositoryPrefix in package.json.
146
147
  const { flags } = await this.parse(Readme);
147
148
  this.flags = flags;
148
149
  const cwd = process.cwd();
149
- const readmePath = path.resolve(cwd, 'README.md');
150
+ const readmePath = path.resolve(cwd, flags['readme-path']);
150
151
  const tsConfigPath = path.resolve(cwd, 'tsconfig.json');
151
152
  const tsConfig = await fs.readJSON(tsConfigPath).catch(() => ({}));
152
153
  const outDir = tsConfig.compilerOptions?.outDir ?? 'lib';
@@ -19,6 +19,7 @@
19
19
  }
20
20
  },
21
21
  "hasDynamicHelp": false,
22
+ "hiddenAliases": [],
22
23
  "id": "generate",
23
24
  "pluginAlias": "oclif",
24
25
  "pluginName": "oclif",
@@ -37,6 +38,7 @@
37
38
  "description": "Using oclif.lock allows your plugins dependencies to be locked to the version specified in the lock file during plugin install.\nOnce the oclif.lock file is created you can include it your npm package by adding it to the files property of your package.json. We do not recommend committing the oclif.lock file to git.",
38
39
  "flags": {},
39
40
  "hasDynamicHelp": false,
41
+ "hiddenAliases": [],
40
42
  "id": "lock",
41
43
  "pluginAlias": "oclif",
42
44
  "pluginName": "oclif",
@@ -70,6 +72,7 @@
70
72
  }
71
73
  },
72
74
  "hasDynamicHelp": false,
75
+ "hiddenAliases": [],
73
76
  "id": "manifest",
74
77
  "pluginAlias": "oclif",
75
78
  "pluginName": "oclif",
@@ -175,6 +178,7 @@
175
178
  }
176
179
  },
177
180
  "hasDynamicHelp": false,
181
+ "hiddenAliases": [],
178
182
  "id": "promote",
179
183
  "pluginAlias": "oclif",
180
184
  "pluginName": "oclif",
@@ -214,6 +218,15 @@
214
218
  "allowNo": false,
215
219
  "type": "boolean"
216
220
  },
221
+ "readme-path": {
222
+ "description": "Path to the README file.",
223
+ "name": "readme-path",
224
+ "required": true,
225
+ "default": "README.md",
226
+ "hasDynamicHelp": false,
227
+ "multiple": false,
228
+ "type": "option"
229
+ },
217
230
  "repository-prefix": {
218
231
  "description": "a template string used to build links to the source code",
219
232
  "name": "repository-prefix",
@@ -230,6 +243,7 @@
230
243
  }
231
244
  },
232
245
  "hasDynamicHelp": false,
246
+ "hiddenAliases": [],
233
247
  "id": "readme",
234
248
  "pluginAlias": "oclif",
235
249
  "pluginName": "oclif",
@@ -262,6 +276,7 @@
262
276
  }
263
277
  },
264
278
  "hasDynamicHelp": false,
279
+ "hiddenAliases": [],
265
280
  "id": "generate:command",
266
281
  "pluginAlias": "oclif",
267
282
  "pluginName": "oclif",
@@ -302,6 +317,7 @@
302
317
  }
303
318
  },
304
319
  "hasDynamicHelp": false,
320
+ "hiddenAliases": [],
305
321
  "id": "generate:hook",
306
322
  "pluginAlias": "oclif",
307
323
  "pluginName": "oclif",
@@ -341,6 +357,7 @@
341
357
  }
342
358
  },
343
359
  "hasDynamicHelp": false,
360
+ "hiddenAliases": [],
344
361
  "id": "pack:deb",
345
362
  "pluginAlias": "oclif",
346
363
  "pluginName": "oclif",
@@ -396,6 +413,7 @@
396
413
  }
397
414
  },
398
415
  "hasDynamicHelp": false,
416
+ "hiddenAliases": [],
399
417
  "id": "pack:macos",
400
418
  "pluginAlias": "oclif",
401
419
  "pluginName": "oclif",
@@ -456,6 +474,7 @@
456
474
  }
457
475
  },
458
476
  "hasDynamicHelp": false,
477
+ "hiddenAliases": [],
459
478
  "id": "pack:tarballs",
460
479
  "pluginAlias": "oclif",
461
480
  "pluginName": "oclif",
@@ -473,7 +492,7 @@
473
492
  "pack:win": {
474
493
  "aliases": [],
475
494
  "args": {},
476
- "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",
495
+ "description": "create windows installer from oclif CLI\n \n This command will produce unsigned installers unless you supply WINDOWS_SIGNING_PASS (prefixed with the name of your executable, e.g. OCLIF_WINDOWS_SIGNING_PASS) in the environment and have set the windows.name and windows.keypath properties in your package.json's oclif property.",
477
496
  "flags": {
478
497
  "additional-cli": {
479
498
  "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\"",
@@ -483,6 +502,20 @@
483
502
  "multiple": false,
484
503
  "type": "option"
485
504
  },
505
+ "defender-exclusion": {
506
+ "description": "there is no way to set a hidden checkbox with \"true\" as a default...the user can always allow full security",
507
+ "name": "defender-exclusion",
508
+ "summary": "set to \"checked\" or \"unchecked\" to set the default value for the checkbox. Set to \"hidden\" to hide the option (will let defender do its thing)",
509
+ "default": "checked",
510
+ "hasDynamicHelp": false,
511
+ "multiple": false,
512
+ "options": [
513
+ "checked",
514
+ "unchecked",
515
+ "hidden"
516
+ ],
517
+ "type": "option"
518
+ },
486
519
  "root": {
487
520
  "char": "r",
488
521
  "description": "path to oclif CLI root",
@@ -511,6 +544,7 @@
511
544
  }
512
545
  },
513
546
  "hasDynamicHelp": false,
547
+ "hiddenAliases": [],
514
548
  "id": "pack:win",
515
549
  "pluginAlias": "oclif",
516
550
  "pluginName": "oclif",
@@ -542,6 +576,7 @@
542
576
  }
543
577
  },
544
578
  "hasDynamicHelp": false,
579
+ "hiddenAliases": [],
545
580
  "id": "upload:deb",
546
581
  "pluginAlias": "oclif",
547
582
  "pluginName": "oclif",
@@ -581,6 +616,7 @@
581
616
  }
582
617
  },
583
618
  "hasDynamicHelp": false,
619
+ "hiddenAliases": [],
584
620
  "id": "upload:macos",
585
621
  "pluginAlias": "oclif",
586
622
  "pluginName": "oclif",
@@ -626,6 +662,7 @@
626
662
  }
627
663
  },
628
664
  "hasDynamicHelp": false,
665
+ "hiddenAliases": [],
629
666
  "id": "upload:tarballs",
630
667
  "pluginAlias": "oclif",
631
668
  "pluginName": "oclif",
@@ -664,6 +701,7 @@
664
701
  }
665
702
  },
666
703
  "hasDynamicHelp": false,
704
+ "hiddenAliases": [],
667
705
  "id": "upload:win",
668
706
  "pluginAlias": "oclif",
669
707
  "pluginName": "oclif",
@@ -679,5 +717,5 @@
679
717
  ]
680
718
  }
681
719
  },
682
- "version": "4.0.3"
720
+ "version": "4.1.0"
683
721
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "4.0.3",
4
+ "version": "4.1.0",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run.js"
@@ -31,13 +31,13 @@
31
31
  "@commitlint/config-conventional": "^17.7.0",
32
32
  "@oclif/plugin-legacy": "^1.3.0",
33
33
  "@oclif/prettier-config": "^0.2.1",
34
- "@oclif/test": "^3.0.2",
34
+ "@oclif/test": "^3.1.2",
35
35
  "@types/async-retry": "^1.4.5",
36
36
  "@types/chai": "^4.3.4",
37
37
  "@types/cli-progress": "^3.11.0",
38
38
  "@types/fs-extra": "^9.0",
39
- "@types/lodash.template": "^4.5.0",
40
39
  "@types/lodash": "^4.14.191",
40
+ "@types/lodash.template": "^4.5.0",
41
41
  "@types/mocha": "^10.0.2",
42
42
  "@types/node": "^18",
43
43
  "@types/semver": "^7.3.13",
@@ -46,10 +46,10 @@
46
46
  "chai": "^4.3.7",
47
47
  "commitlint": "^17.7.2",
48
48
  "conventional-changelog-cli": "^2.2.2",
49
- "eslint-config-oclif-typescript": "^3.0.1",
49
+ "eslint": "^8.50.0",
50
50
  "eslint-config-oclif": "^5.0.0",
51
+ "eslint-config-oclif-typescript": "^3.0.1",
51
52
  "eslint-config-prettier": "^9.0.0",
52
- "eslint": "^8.50.0",
53
53
  "fancy-test": "^3.0.1",
54
54
  "globby": "^11.1.0",
55
55
  "husky": "^8.0.3",