Skip to content

Commit

Permalink
fix: handle non-string oclif.commands (#1295)
Browse files Browse the repository at this point in the history
* fix: handle non-string oclif.commands

* fix: resolution for dev oclif/core

* chore(release): 4.4.13-dev.0 [skip ci]

* chore: bump oclif/core

* chore: regen yarn.lock

* chore(release): 4.4.13-dev.1 [skip ci]

* chore: update deps

---------

Co-authored-by: svc-cli-bot <Svc_cli_bot@salesforce.com>
  • Loading branch information
mdonnalley and svc-cli-bot committed Mar 4, 2024
1 parent 2d69157 commit 30f24dd
Show file tree
Hide file tree
Showing 3 changed files with 739 additions and 1,057 deletions.
16 changes: 7 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "oclif",
"description": "oclif: create your own CLI",
"version": "4.4.21",
"version": "4.4.13-dev.1",
"author": "Salesforce",
"bin": {
"oclif": "bin/run.js"
Expand All @@ -10,7 +10,7 @@
"dependencies": {
"@aws-sdk/client-cloudfront": "^3.525.0",
"@aws-sdk/client-s3": "^3.515.0",
"@oclif/core": "^3.19.2",
"@oclif/core": "^3.21.0",
"@oclif/plugin-help": "^6.0.14",
"@oclif/plugin-not-found": "^3.0.10",
"@oclif/plugin-warn-if-update-available": "^3.0.12",
Expand All @@ -29,7 +29,7 @@
"yeoman-generator": "^5.8.0"
},
"devDependencies": {
"@commitlint/config-conventional": "^17.7.0",
"@commitlint/config-conventional": "^18",
"@oclif/plugin-legacy": "^2.0.7",
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^3.1.13",
Expand All @@ -45,17 +45,15 @@
"@types/shelljs": "^0.8.11",
"@types/yeoman-generator": "^5.2.11",
"chai": "^4.4.1",
"commitlint": "^17.7.2",
"conventional-changelog-cli": "^2.2.2",
"commitlint": "^18",
"eslint": "^8.57.0",
"eslint-config-oclif": "^5.0.2",
"eslint-config-oclif": "^5.0.4",
"eslint-config-oclif-typescript": "^3.0.48",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-perfectionist": "^2.1.0",
"fancy-test": "^3.0.11",
"globby": "^11.1.0",
"husky": "^8.0.3",
"lint-staged": "^14.0.1",
"husky": "^9",
"lint-staged": "^15",
"lodash.clonedeep": "^4.5.0",
"mocha": "^10.3.0",
"nyc": "^15.1.0",
Expand Down
12 changes: 11 additions & 1 deletion src/commands/readme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,17 @@ USAGE
* fetches the path to a command
*/
private commandPath(plugin: Interfaces.Plugin, c: Command.Cached): string | undefined {
const commandsDir = plugin.pjson.oclif.commands
const strategy =
typeof plugin.pjson.oclif?.commands === 'string' ? 'pattern' : plugin.pjson.oclif?.commands?.strategy

// if the strategy is explicit, we can't determine the path so return undefined
if (strategy === 'explicit') return

const commandsDir =
typeof plugin.pjson.oclif?.commands === 'string'
? plugin.pjson.oclif?.commands
: plugin.pjson.oclif?.commands?.target

if (!commandsDir) return
const hasTypescript = plugin.pjson.devDependencies?.typescript || plugin.pjson.dependencies?.typescript
let p = path.join(plugin.root, commandsDir, ...c.id.split(':'))
Expand Down
Loading

0 comments on commit 30f24dd

Please sign in to comment.