Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sfdx texei:picklist:unrestrict working only on /force-app/main/default/objects #134

Open
nabondance opened this issue Sep 15, 2023 · 1 comment

Comments

@nabondance
Copy link
Contributor

Hello,

When running sfdx texei:picklist:unrestrict it crash if the project tree isn't the default one:

├── force-app
│   └── main
│       └── default
│           ├── classes
│           ├── objects
│           │   └── Account
│           │       └── fields
│           │           └── picklistOk__c.field-meta.xml
│           └── triggers

When working with packages, the project tree looks like that and it doesn't work:

├── package1
│   └── main
│       └── default
│           ├── classes
│           ├── objects
│           │   └── Account
│           │       └── fields
│           │           └── picklist1__c.field-meta.xml
│           └── triggers
├── package2
│   └── main
│       └── default
│           ├── classes
│           ├── objects
│           │   └── Account
│           │       └── fields
│           │           └── picklist2__c.field-meta.xml
│           └── triggers

Command:

sfdx texei:picklist:unrestrict --json

Error message:

{
  "status": 1,
  "name": "Error",
  "message": "ENOENT: no such file or directory, scandir '/Users/username/Git/BasicSfdx/force-app/main/default/objects'",
  "exitCode": 1,
  "commandName": "Unrestrict",
  "stack": "Error: ENOENT: no such file or directory, scandir '/Users/username/Git/BasicSfdx/force-app/main/default/objects'\nOuter stack:\n    at SfdxError.wrap (/Users/username/Git/Salesforce/node_modules/texei-sfdx-plugin/node_modules/@salesforce/core/lib/sfdxError.js:171:27)\n    at Unrestrict.catch (/Users/username/Git/Salesforce/node_modules/texei-sfdx-plugin/node_modules/@salesforce/command/lib/sfdxCommand.js:248:67)\n    at async Unrestrict._run (/Users/username/Git/Salesforce/node_modules/texei-sfdx-plugin/node_modules/@salesforce/command/lib/sfdxCommand.js:85:13)\n    at async Config.runCommand (/Users/username/Git/BasicSfdx/node_modules/sfdx-cli/node_modules/@oclif/core/lib/config/config.js:329:25)\n    at async run (/Users/username/Git/BasicSfdx/node_modules/sfdx-cli/node_modules/@oclif/core/lib/main.js:89:16)",
  "warnings": []
}

Because sfdx texei:picklist:unrestrict doesn't work, sfdx texei:picklist:restrict cannot work because we don't have the generated json.

versions:
node: 20.5.1
npm: 9.8.0
sfdx-cli 7.209.6
texei-sfdx-plugin 1.17.3

@nabondance
Copy link
Contributor Author

nabondance commented Sep 21, 2023

Possible fix:
The path joining is hardcoded:

const filesPath = path.join(process.cwd(), 'force-app', 'main', 'default', 'objects');

It should be globbing objects with something like **/objects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant