oclif 4.4.11 → 4.4.13-dev.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,6 +1,8 @@
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");
5
+ const node_path_1 = require("node:path");
4
6
  const command_base_1 = require("./../../command-base");
5
7
  class GenerateHook extends command_base_1.default {
6
8
  static args = {
@@ -13,10 +15,13 @@ class GenerateHook extends command_base_1.default {
13
15
  };
14
16
  async run() {
15
17
  const { args, flags } = await this.parse(GenerateHook);
18
+ const tsConfigPath = (0, node_path_1.resolve)(process.cwd(), 'tsconfig.json');
19
+ const tsConfig = await fs.readJSON(tsConfigPath).catch(() => ({}));
16
20
  await super.generate('hook', {
17
21
  event: flags.event,
18
22
  force: flags.force,
19
23
  name: args.name,
24
+ outDir: tsConfig.compilerOptions?.outDir ?? 'dist',
20
25
  });
21
26
  }
22
27
  }
@@ -211,7 +211,13 @@ USAGE
211
211
  * fetches the path to a command
212
212
  */
213
213
  commandPath(plugin, c) {
214
- const commandsDir = plugin.pjson.oclif.commands;
214
+ const strategy = typeof plugin.pjson.oclif?.commands === 'string' ? 'pattern' : plugin.pjson.oclif?.commands?.strategy;
215
+ // if the strategy is explicit, we can't determine the path so return undefined
216
+ if (strategy === 'explicit')
217
+ return;
218
+ const commandsDir = typeof plugin.pjson.oclif?.commands === 'string'
219
+ ? plugin.pjson.oclif?.commands
220
+ : plugin.pjson.oclif?.commands?.target;
215
221
  if (!commandsDir)
216
222
  return;
217
223
  const hasTypescript = plugin.pjson.devDependencies?.typescript || plugin.pjson.dependencies?.typescript;
@@ -3,6 +3,7 @@ import * as Generator from 'yeoman-generator';
3
3
  import { GeneratorOptions } from '../types';
4
4
  export interface Options extends GeneratorOptions {
5
5
  event: string;
6
+ outDir: string;
6
7
  }
7
8
  export default class Hook extends Generator {
8
9
  options: Options;
@@ -27,7 +27,7 @@ class Hook extends Generator {
27
27
  this.pjson.oclif = this.pjson.oclif || {};
28
28
  this.pjson.oclif.hooks = this.pjson.oclif.hooks || {};
29
29
  const hooks = this.pjson.oclif.hooks;
30
- const p = `./dist/hooks/${this.options.event}/${this.options.name}`;
30
+ const p = `./${this.options.outDir}/hooks/${this.options.event}/${this.options.name}`;
31
31
  if (hooks[this.options.event]) {
32
32
  hooks[this.options.event] = (0, util_1.castArray)(hooks[this.options.event]);
33
33
  hooks[this.options.event] = [...hooks[this.options.event], p];
@@ -737,5 +737,5 @@
737
737
  ]
738
738
  }
739
739
  },
740
- "version": "4.4.11"
740
+ "version": "4.4.13-dev.0"
741
741
  }
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.4.11",
4
+ "version": "4.4.13-dev.0",
5
5
  "author": "Salesforce",
6
6
  "bin": {
7
7
  "oclif": "bin/run.js"
@@ -10,7 +10,7 @@
10
10
  "dependencies": {
11
11
  "@aws-sdk/client-cloudfront": "^3.511.0",
12
12
  "@aws-sdk/client-s3": "^3.504.0",
13
- "@oclif/core": "^3.19.1",
13
+ "@oclif/core": "3.19.2-dev.0",
14
14
  "@oclif/plugin-help": "^6.0.12",
15
15
  "@oclif/plugin-not-found": "^3.0.10",
16
16
  "@oclif/plugin-warn-if-update-available": "^3.0.9",
@@ -50,8 +50,8 @@
50
50
  "eslint-config-oclif": "^5.0.0",
51
51
  "eslint-config-oclif-typescript": "^3.0.44",
52
52
  "eslint-config-prettier": "^9.0.0",
53
- "fancy-test": "^3.0.10",
54
53
  "eslint-plugin-perfectionist": "^2.1.0",
54
+ "fancy-test": "^3.0.10",
55
55
  "globby": "^11.1.0",
56
56
  "husky": "^8.0.3",
57
57
  "lint-staged": "^14.0.1",
@@ -64,6 +64,9 @@
64
64
  "ts-node": "^10.7.0",
65
65
  "typescript": "^5"
66
66
  },
67
+ "resolutions": {
68
+ "@oclif/core": "3.19.2-dev.0"
69
+ },
67
70
  "engines": {
68
71
  "node": ">=18.0.0"
69
72
  },