oclif 2.0.0 → 2.0.1

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.
Files changed (106) hide show
  1. package/.oclif.manifest.json +1 -1
  2. package/CHANGELOG.md +100 -11
  3. package/README.md +228 -101
  4. package/bin/dev +19 -0
  5. package/bin/dev.cmd +3 -0
  6. package/bin/run +5 -2
  7. package/lib/aws.d.ts +5 -5
  8. package/lib/aws.js +7 -5
  9. package/lib/command-base.d.ts +2 -2
  10. package/lib/command-base.js +3 -3
  11. package/lib/commands/generate.d.ts +11 -0
  12. package/lib/commands/generate.js +19 -0
  13. package/lib/commands/manifest.d.ts +1 -2
  14. package/lib/commands/manifest.js +4 -7
  15. package/lib/commands/pack/deb.d.ts +3 -3
  16. package/lib/commands/pack/deb.js +11 -12
  17. package/lib/commands/pack/macos.d.ts +4 -3
  18. package/lib/commands/pack/macos.js +19 -13
  19. package/lib/commands/pack/tarballs.d.ts +6 -3
  20. package/lib/commands/pack/tarballs.js +9 -7
  21. package/lib/commands/pack/win.d.ts +4 -3
  22. package/lib/commands/pack/win.js +29 -16
  23. package/lib/commands/promote.d.ts +14 -3
  24. package/lib/commands/promote.js +27 -28
  25. package/lib/commands/readme.d.ts +13 -11
  26. package/lib/commands/readme.js +33 -34
  27. package/lib/commands/upload/deb.d.ts +2 -3
  28. package/lib/commands/upload/deb.js +8 -9
  29. package/lib/commands/upload/macos.d.ts +2 -3
  30. package/lib/commands/upload/macos.js +8 -9
  31. package/lib/commands/upload/tarballs.d.ts +7 -3
  32. package/lib/commands/upload/tarballs.js +23 -20
  33. package/lib/commands/upload/win.d.ts +2 -3
  34. package/lib/commands/upload/win.js +10 -11
  35. package/lib/generators/{app.d.ts → cli.d.ts} +2 -22
  36. package/lib/generators/cli.js +182 -0
  37. package/lib/help-compatibility.d.ts +4 -5
  38. package/lib/help-compatibility.js +1 -0
  39. package/lib/index.d.ts +1 -1
  40. package/lib/index.js +3 -2
  41. package/lib/log.js +3 -2
  42. package/lib/tarballs/bin.d.ts +2 -2
  43. package/lib/tarballs/bin.js +2 -1
  44. package/lib/tarballs/build.js +29 -28
  45. package/lib/tarballs/config.d.ts +6 -7
  46. package/lib/tarballs/config.js +24 -12
  47. package/lib/tarballs/index.js +4 -4
  48. package/lib/tarballs/node.d.ts +7 -4
  49. package/lib/tarballs/node.js +5 -5
  50. package/lib/upload-util.d.ts +3 -3
  51. package/lib/upload-util.js +5 -2
  52. package/lib/util.js +24 -20
  53. package/lib/version-indexes.d.ts +2 -4
  54. package/lib/version-indexes.js +3 -1
  55. package/package.json +27 -27
  56. package/lib/app-command.d.ts +0 -12
  57. package/lib/app-command.js +0 -26
  58. package/lib/commands/base.d.ts +0 -5
  59. package/lib/commands/base.js +0 -11
  60. package/lib/commands/command.d.ts +0 -17
  61. package/lib/commands/command.js +0 -23
  62. package/lib/commands/hook.d.ts +0 -18
  63. package/lib/commands/hook.js +0 -25
  64. package/lib/commands/multi.d.ts +0 -5
  65. package/lib/commands/multi.js +0 -11
  66. package/lib/commands/plugin.d.ts +0 -5
  67. package/lib/commands/plugin.js +0 -11
  68. package/lib/commands/single.d.ts +0 -5
  69. package/lib/commands/single.js +0 -11
  70. package/lib/generators/app.js +0 -459
  71. package/lib/generators/command.d.ts +0 -15
  72. package/lib/generators/command.js +0 -51
  73. package/lib/generators/hook.d.ts +0 -14
  74. package/lib/generators/hook.js +0 -51
  75. package/templates/LICENSE.mit +0 -21
  76. package/templates/README.md.ejs +0 -21
  77. package/templates/appveyor.yml.ejs +0 -33
  78. package/templates/base/src/index.js +0 -1
  79. package/templates/base/src/index.ts +0 -1
  80. package/templates/base/test/index.test.js +0 -8
  81. package/templates/base/test/index.test.ts +0 -9
  82. package/templates/bin/run +0 -5
  83. package/templates/bin/run.cmd +0 -3
  84. package/templates/circle.yml.ejs +0 -65
  85. package/templates/editorconfig +0 -11
  86. package/templates/eslintrc +0 -7
  87. package/templates/eslintrc.typescript +0 -10
  88. package/templates/multi/src/index.js +0 -1
  89. package/templates/multi/src/index.ts +0 -1
  90. package/templates/plugin/bin/run +0 -4
  91. package/templates/plugin/src/index.ts +0 -1
  92. package/templates/scripts/setup_git +0 -12
  93. package/templates/single/bin/run.js +0 -4
  94. package/templates/single/bin/run.ts +0 -13
  95. package/templates/src/command.js.ejs +0 -27
  96. package/templates/src/command.ts.ejs +0 -46
  97. package/templates/src/hook.js.ejs +0 -3
  98. package/templates/src/hook.ts.ejs +0 -7
  99. package/templates/test/command.test.js.ejs +0 -28
  100. package/templates/test/command.test.ts.ejs +0 -29
  101. package/templates/test/hook.test.js.ejs +0 -9
  102. package/templates/test/hook.test.ts.ejs +0 -9
  103. package/templates/test/mocha.opts +0 -4
  104. package/templates/test/tsconfig.json +0 -9
  105. package/templates/travis.yml.ejs +0 -14
  106. package/templates/tsconfig.json +0 -15
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const errors_1 = require("@oclif/errors");
3
+ exports.fetchNodeBinary = void 0;
4
+ const core_1 = require("@oclif/core");
4
5
  const path = require("path");
5
6
  const qq = require("qqjs");
6
7
  const log_1 = require("../log");
@@ -10,7 +11,7 @@ async function checkFor7Zip() {
10
11
  }
11
12
  catch (error) {
12
13
  if (error.code === 127)
13
- errors_1.error('install 7-zip to package windows tarball');
14
+ core_1.Errors.error('install 7-zip to package windows tarball');
14
15
  else
15
16
  throw error;
16
17
  }
@@ -23,7 +24,6 @@ async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {
23
24
  let url = `https://nodejs.org/dist/v${nodeVersion}/${nodeBase}.tar.xz`;
24
25
  if (platform === 'win32') {
25
26
  await checkFor7Zip();
26
- // eslint-disable-next-line require-atomic-updates
27
27
  nodeBase = `node-v${nodeVersion}-win-${arch}`;
28
28
  tarball = path.join(tmp, 'node', `${nodeBase}.7z`);
29
29
  url = `https://nodejs.org/dist/v${nodeVersion}/${nodeBase}.7z`;
@@ -33,7 +33,7 @@ async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {
33
33
  if (platform === 'win32')
34
34
  cache += '.exe';
35
35
  const download = async () => {
36
- log_1.log(`downloading ${nodeBase}`);
36
+ (0, log_1.log)(`downloading ${nodeBase}`);
37
37
  const shasums = path.join(tmp, 'cache', nodeVersion, 'SHASUMS256.txt.asc');
38
38
  if (!await qq.exists(shasums)) {
39
39
  await qq.download(`https://nodejs.org/dist/v${nodeVersion}/SHASUMS256.txt.asc`, shasums);
@@ -44,7 +44,7 @@ async function fetchNodeBinary({ nodeVersion, output, platform, arch, tmp }) {
44
44
  await qq.x(`grep ${path.basename(tarball)} ${shasums} | shasum -a 256 -c -`, { cwd: basedir });
45
45
  };
46
46
  const extract = async () => {
47
- log_1.log(`extracting ${nodeBase}`);
47
+ (0, log_1.log)(`extracting ${nodeBase}`);
48
48
  const nodeTmp = path.join(tmp, 'node');
49
49
  await qq.rm([nodeTmp, nodeBase]);
50
50
  await qq.mkdirp(nodeTmp);
@@ -1,7 +1,7 @@
1
- import * as Config from '@oclif/config';
1
+ import { Interfaces } from '@oclif/core';
2
2
  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
- export declare function templateShortKey(type: keyof Config.PJSON.S3.Templates | 'macos' | 'win32' | 'deb', ext?: '.tar.gz' | '.tar.xz' | Config.IConfig.s3Key.Options, options?: Config.IConfig.s3Key.Options): string;
6
- export declare function debArch(arch: Config.ArchTypes): "amd64" | "i386" | "armel";
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;
7
7
  export declare function debVersion(buildConfig: TarballConfig): string;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.debVersion = exports.debArch = exports.templateShortKey = exports.channelAWSDir = exports.commitAWSDir = void 0;
3
4
  const path = require("path");
4
5
  function commitAWSDir(version, sha, s3Config) {
5
6
  let s3SubDir = s3Config.folder || '';
@@ -19,7 +20,9 @@ exports.channelAWSDir = channelAWSDir;
19
20
  // When this pkg starts using oclif/core
20
21
  // refactor this key name lookup
21
22
  // helper to oclif/core
22
- function templateShortKey(type, ext, options = { root: '.' }) {
23
+ function templateShortKey(type, ext,
24
+ // eslint-disable-next-line unicorn/no-object-as-default-parameter
25
+ options = { root: '.' }) {
23
26
  if (typeof ext === 'object')
24
27
  options = Object.assign(options, ext);
25
28
  else if (ext)
@@ -48,7 +51,7 @@ function debArch(arch) {
48
51
  }
49
52
  exports.debArch = debArch;
50
53
  function debVersion(buildConfig) {
51
- return `${buildConfig.version.split('-')[0]}.${buildConfig.gitSha}-1`;
54
+ return `${buildConfig.config.version.split('-')[0]}.${buildConfig.gitSha}-1`;
52
55
  // see debian_revision: https://www.debian.org/doc/debian-policy/ch-controlfields.html
53
56
  }
54
57
  exports.debVersion = debVersion;
package/lib/util.js CHANGED
@@ -1,23 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sortVersionsObjectByKeysDesc = exports.template = exports.sortBy = exports.compact = exports.uniqBy = exports.castArray = void 0;
3
4
  const _ = require("lodash");
4
- function compare(a, b) {
5
- a = a === undefined ? 0 : a;
6
- b = b === undefined ? 0 : b;
7
- if (Array.isArray(a) && Array.isArray(b)) {
8
- if (a.length === 0 && b.length === 0)
9
- return 0;
10
- const diff = compare(a[0], b[0]);
11
- if (diff !== 0)
12
- return diff;
13
- return compare(a.slice(1), b.slice(1));
14
- }
15
- if (a < b)
16
- return -1;
17
- if (a > b)
18
- return 1;
19
- return 0;
20
- }
21
5
  function castArray(input) {
22
6
  if (input === undefined)
23
7
  return [];
@@ -27,7 +11,7 @@ exports.castArray = castArray;
27
11
  function uniqBy(arr, fn) {
28
12
  return arr.filter((a, i) => {
29
13
  const aVal = fn(a);
30
- return !arr.some((b, j) => j > i && fn(b) === aVal);
14
+ return !arr.find((b, j) => j > i && fn(b) === aVal);
31
15
  });
32
16
  }
33
17
  exports.uniqBy = uniqBy;
@@ -36,11 +20,30 @@ function compact(a) {
36
20
  }
37
21
  exports.compact = compact;
38
22
  function sortBy(arr, fn) {
23
+ function compare(a, b) {
24
+ a = a === undefined ? 0 : a;
25
+ b = b === undefined ? 0 : b;
26
+ if (Array.isArray(a) && Array.isArray(b)) {
27
+ if (a.length === 0 && b.length === 0)
28
+ return 0;
29
+ const diff = compare(a[0], b[0]);
30
+ if (diff !== 0)
31
+ return diff;
32
+ return compare(a.slice(1), b.slice(1));
33
+ }
34
+ if (a < b)
35
+ return -1;
36
+ if (a > b)
37
+ return 1;
38
+ return 0;
39
+ }
39
40
  return arr.sort((a, b) => compare(fn(a), fn(b)));
40
41
  }
41
42
  exports.sortBy = sortBy;
42
- exports.template = (context) => (t) => _.template(t || '')(context);
43
- exports.sortVersionsObjectByKeysDesc = (input) => {
43
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
44
+ const template = (context) => (t) => _.template(t || '')(context);
45
+ exports.template = template;
46
+ const sortVersionsObjectByKeysDesc = (input) => {
44
47
  const keys = Reflect.ownKeys(input).sort((a, b) => {
45
48
  const splitA = a.split('.').map(part => Number.parseInt(part, 10));
46
49
  const splitB = b.split('.').map(part => Number.parseInt(part, 10));
@@ -67,3 +70,4 @@ exports.sortVersionsObjectByKeysDesc = (input) => {
67
70
  }
68
71
  return result;
69
72
  };
73
+ exports.sortVersionsObjectByKeysDesc = sortVersionsObjectByKeysDesc;
@@ -1,10 +1,8 @@
1
+ import { BuildConfig } from './tarballs';
1
2
  export declare const appendToIndex: (input: {
2
3
  version: string;
3
4
  originalUrl: string;
4
5
  filename: string;
5
6
  maxAge: string;
6
- s3Config: import("@oclif/config").PJSON.S3 & {
7
- folder?: string | undefined;
8
- indexVersionLimit?: number | undefined;
9
- };
7
+ s3Config: BuildConfig['s3Config'];
10
8
  }) => Promise<void>;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.appendToIndex = void 0;
3
4
  const fs = require("fs-extra");
4
5
  const path = require("path");
5
6
  const aws_1 = require("./aws");
@@ -33,7 +34,7 @@ const sortVersionsObjectByKeysDesc = (input, keyLimit) => {
33
34
  return result;
34
35
  };
35
36
  // appends to an existing file (or writes a new one) with the versions in descending order, with an optional limit from the pjson file
36
- exports.appendToIndex = async (input) => {
37
+ const appendToIndex = async (input) => {
37
38
  var _a;
38
39
  const { version, originalUrl, filename, maxAge, s3Config } = input;
39
40
  // these checks are both nice for users AND helpful for TS
@@ -67,3 +68,4 @@ exports.appendToIndex = async (input) => {
67
68
  // cleans up local fs
68
69
  await fs.remove(jsonFileName);
69
70
  };
71
+ exports.appendToIndex = appendToIndex;
package/package.json CHANGED
@@ -1,68 +1,68 @@
1
1
  {
2
2
  "name": "oclif",
3
3
  "description": "oclif: create your own CLI",
4
- "version": "2.0.0",
5
- "author": "Jeff Dickey @jdxcode",
4
+ "version": "2.0.1",
5
+ "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run"
8
8
  },
9
9
  "bugs": "https://github.com/oclif/oclif/issues",
10
10
  "dependencies": {
11
- "@oclif/command": "^1.8.6",
12
- "@oclif/config": "^1.17.1",
13
- "@oclif/errors": "^1.3.5",
11
+ "@oclif/core": "1.0.10",
14
12
  "@oclif/fixpack": "^2.3.0",
15
- "@oclif/plugin-help": "^3.2.9",
16
- "@oclif/plugin-not-found": "^1.2.2",
17
- "@oclif/plugin-warn-if-update-available": "^1.7.3",
18
- "cli-ux": "^5.6.4",
13
+ "@oclif/plugin-help": "5.1.9",
14
+ "@oclif/plugin-not-found": "^2.2.2",
15
+ "@oclif/plugin-warn-if-update-available": "^2.0.2",
16
+ "cli-ux": "6.0.6",
19
17
  "debug": "^4.1.1",
20
18
  "find-yarn-workspace-root": "^2.0.0",
21
19
  "fs-extra": "^8.1",
22
20
  "github-slugger": "^1.2.1",
23
- "lodash": "^4.17.21",
21
+ "lodash": "^4.17.11",
24
22
  "normalize-package-data": "^3.0.0",
25
23
  "nps-utils": "^1.7.0",
26
24
  "qqjs": "^0.3.10",
25
+ "semver": "^7.3.5",
27
26
  "sort-pjson": "^1.0.3",
28
27
  "tslib": "^2.0.0",
29
- "yeoman-environment": "^2.10.3",
30
- "yeoman-generator": "3.2.0",
28
+ "yeoman-environment": "^2.3.4",
29
+ "yeoman-generator": "3",
31
30
  "yosay": "^2.0.2"
32
31
  },
33
32
  "devDependencies": {
34
- "@oclif/dev-cli": "^1.26.5",
35
- "@oclif/plugin-legacy": "^1.2.2",
36
- "@oclif/test": "^1.2.8",
37
- "@types/chai": "^4.1.7",
33
+ "@oclif/plugin-legacy": "^1.2.5",
34
+ "@oclif/test": "^2.0.2",
35
+ "@types/chai": "^4.3.0",
38
36
  "@types/execa": "^0.9.0",
39
37
  "@types/fs-extra": "^9.0",
40
38
  "@types/lodash": "^4.14.121",
39
+ "@types/lodash.template": "^4.4.6",
41
40
  "@types/mocha": "^8.0.0",
42
- "@types/node": "^14.0.14",
41
+ "@types/node": "^14.18.0",
43
42
  "@types/read-pkg": "^5.1.0",
43
+ "@types/semver": "^7.3.9",
44
44
  "@types/shelljs": "^0.8.3",
45
45
  "@types/supports-color": "^7.2.0",
46
46
  "@types/write-json-file": "^3.2.1",
47
- "@types/yeoman-environment": "^2.10.5",
47
+ "@types/yeoman-environment": "^2.10.2",
48
48
  "@types/yosay": "^0.0.29",
49
- "aws-sdk": "^2.443.0",
49
+ "aws-sdk": "^2.1044.0",
50
50
  "chai": "^4.2.0",
51
51
  "conventional-changelog-cli": "^2.0.17",
52
52
  "eslint": "^7.3.2",
53
53
  "eslint-config-oclif": "^4.0.0",
54
54
  "eslint-config-oclif-typescript": "^1.0.2",
55
- "execa": "^0.10.0",
55
+ "execa": "^0.11.0",
56
56
  "fancy-test": "^1.4.10",
57
57
  "globby": "^11.0.1",
58
- "mocha": "^8.2.1",
58
+ "mocha": "^9.1.3",
59
59
  "npm-run-path": "^4.0.1",
60
60
  "nps": "^5.9.3",
61
61
  "shelljs": "^0.8.3",
62
62
  "shx": "^0.3.3",
63
63
  "tmp": "^0.2.1",
64
64
  "ts-node": "^9.0.0",
65
- "typescript": "3.8.3"
65
+ "typescript": "4.4.3"
66
66
  },
67
67
  "engines": {
68
68
  "node": ">=12.0.0"
@@ -116,16 +116,16 @@
116
116
  },
117
117
  "repository": "oclif/oclif",
118
118
  "scripts": {
119
- "build": "rm -rf lib && tsc",
119
+ "build": "shx rm -rf lib && tsc",
120
120
  "devcli:lint": "eslint . --ext .ts --config .eslintrc",
121
121
  "devcli:test": "mocha --forbid-only \"test/*.test.ts\"",
122
122
  "devcli": "yarn build --noEmit && yarn run devcli:test && yarn run devcli:lint",
123
123
  "lint": "nps lint",
124
- "postpack": "rm .oclif.manifest.json",
124
+ "postpack": "shx rm .oclif.manifest.json",
125
125
  "posttest": "yarn run lint",
126
- "prepack": "rm -rf lib && tsc && oclif-dev manifest",
127
- "version": "oclif-dev readme && git add README.md",
128
- "test": "nps test"
126
+ "prepack": "shx rm -rf lib && tsc && bin/dev manifest .",
127
+ "test": "nps test",
128
+ "version": "bin/dev readme && git add README.md"
129
129
  },
130
130
  "publishConfig": {
131
131
  "registry": "https://registry.npmjs.org"
@@ -1,12 +0,0 @@
1
- import { flags } from '@oclif/command';
2
- import Base from './command-base';
3
- export default abstract class AppCommand extends Base {
4
- static flags: flags.Input<any>;
5
- static args: {
6
- name: string;
7
- required: boolean;
8
- description: string;
9
- }[];
10
- abstract type: string;
11
- run(): Promise<void>;
12
- }
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
4
- const command_base_1 = require("./command-base");
5
- class AppCommand extends command_base_1.default {
6
- async run() {
7
- const { flags, args } = this.parse(AppCommand);
8
- const options = flags.options ? flags.options.split(',') : [];
9
- await super.generate('app', {
10
- type: this.type,
11
- path: args.path,
12
- options,
13
- defaults: flags.defaults,
14
- force: flags.force,
15
- });
16
- }
17
- }
18
- exports.default = AppCommand;
19
- AppCommand.flags = {
20
- defaults: command_1.flags.boolean({ description: 'use defaults for every setting' }),
21
- options: command_1.flags.string({ description: '(yarn|typescript|eslint|mocha)' }),
22
- force: command_1.flags.boolean({ description: 'overwrite existing files' }),
23
- };
24
- AppCommand.args = [
25
- { name: 'path', required: false, description: 'path to project, defaults to current directory' },
26
- ];
@@ -1,5 +0,0 @@
1
- import AppCommand from '../app-command';
2
- export default class extends AppCommand {
3
- static hidden: boolean;
4
- type: string;
5
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const app_command_1 = require("../app-command");
4
- class default_1 extends app_command_1.default {
5
- constructor() {
6
- super(...arguments);
7
- this.type = 'base';
8
- }
9
- }
10
- exports.default = default_1;
11
- default_1.hidden = true;
@@ -1,17 +0,0 @@
1
- import { flags } from '@oclif/command';
2
- import Base from '../command-base';
3
- export interface Options {
4
- name: string;
5
- defaults?: boolean;
6
- force?: boolean;
7
- }
8
- export default abstract class AppCommand extends Base {
9
- static description: string;
10
- static flags: flags.Input<any>;
11
- static args: {
12
- name: string;
13
- description: string;
14
- required: boolean;
15
- }[];
16
- run(): Promise<void>;
17
- }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
4
- const command_base_1 = require("../command-base");
5
- class AppCommand extends command_base_1.default {
6
- async run() {
7
- const { flags, args } = this.parse(AppCommand);
8
- await super.generate('command', {
9
- name: args.name,
10
- defaults: flags.defaults,
11
- force: flags.force,
12
- });
13
- }
14
- }
15
- exports.default = AppCommand;
16
- AppCommand.description = 'add a command to an existing CLI or plugin';
17
- AppCommand.flags = {
18
- defaults: command_1.flags.boolean({ description: 'use defaults for every setting' }),
19
- force: command_1.flags.boolean({ description: 'overwrite existing files' }),
20
- };
21
- AppCommand.args = [
22
- { name: 'name', description: 'name of command', required: true },
23
- ];
@@ -1,18 +0,0 @@
1
- import { flags } from '@oclif/command';
2
- import Base from '../command-base';
3
- export interface Options {
4
- name: string;
5
- defaults?: boolean;
6
- force?: boolean;
7
- event: string;
8
- }
9
- export default abstract class HookCommand extends Base {
10
- static description: string;
11
- static flags: flags.Input<any>;
12
- static args: {
13
- name: string;
14
- description: string;
15
- required: boolean;
16
- }[];
17
- run(): Promise<void>;
18
- }
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const command_1 = require("@oclif/command");
4
- const command_base_1 = require("../command-base");
5
- class HookCommand extends command_base_1.default {
6
- async run() {
7
- const { flags, args } = this.parse(HookCommand);
8
- await super.generate('hook', {
9
- name: args.name,
10
- event: flags.event,
11
- defaults: flags.defaults,
12
- force: flags.force,
13
- });
14
- }
15
- }
16
- exports.default = HookCommand;
17
- HookCommand.description = 'add a hook to an existing CLI or plugin';
18
- HookCommand.flags = {
19
- defaults: command_1.flags.boolean({ description: 'use defaults for every setting' }),
20
- force: command_1.flags.boolean({ description: 'overwrite existing files' }),
21
- event: command_1.flags.string({ description: 'event to run hook on', default: 'init' }),
22
- };
23
- HookCommand.args = [
24
- { name: 'name', description: 'name of hook (snake_case)', required: true },
25
- ];
@@ -1,5 +0,0 @@
1
- import AppCommand from '../app-command';
2
- export default class extends AppCommand {
3
- static description: string;
4
- type: string;
5
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const app_command_1 = require("../app-command");
4
- class default_1 extends app_command_1.default {
5
- constructor() {
6
- super(...arguments);
7
- this.type = 'multi';
8
- }
9
- }
10
- exports.default = default_1;
11
- default_1.description = 'generate a new multi-command CLI';
@@ -1,5 +0,0 @@
1
- import AppCommand from '../app-command';
2
- export default class extends AppCommand {
3
- static description: string;
4
- type: string;
5
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const app_command_1 = require("../app-command");
4
- class default_1 extends app_command_1.default {
5
- constructor() {
6
- super(...arguments);
7
- this.type = 'plugin';
8
- }
9
- }
10
- exports.default = default_1;
11
- default_1.description = 'create a new CLI plugin';
@@ -1,5 +0,0 @@
1
- import AppCommand from '../app-command';
2
- export default class extends AppCommand {
3
- static description: string;
4
- type: string;
5
- }
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const app_command_1 = require("../app-command");
4
- class default_1 extends app_command_1.default {
5
- constructor() {
6
- super(...arguments);
7
- this.type = 'single';
8
- }
9
- }
10
- exports.default = default_1;
11
- default_1.description = 'generate a new single-command CLI';