Skip to content
This repository has been archived by the owner on Jan 29, 2023. It is now read-only.

Errors publishing freshly scaffolded plug-in #98

Open
keirbowden opened this issue Nov 18, 2021 · 5 comments
Open

Errors publishing freshly scaffolded plug-in #98

keirbowden opened this issue Nov 18, 2021 · 5 comments

Comments

@keirbowden
Copy link

Summary

I'm seeing errors when running npm publish on a freshly scaffolded plug-in. All I've done is create the plug-in and check that hello:org runs as expected, but I think the prepack script is erroring when the typescript is compiled.

Steps To Reproduce:

  1. Scaffold a new plug-in as detailed in the developer guide
  2. Check that hello:org works - bin/run hello:org <username>
  3. Execute npm publish to compile and publish the plug-in

Expected result

Plug-in should publish without errors

Actual result

> [email protected] prepack .
> rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme

node_modules/@oclif/parser/lib/index.d.ts:16:60 - error TS2344: Type 'TArgs' does not satisfy the constraint 'any[]'.
  Type '{ [name: string]: string; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 29 more.

16 }>(argv: string[], options: Input<TFlags>): Output<TFlags, TArgs>;
                                                              ~~~~~

node_modules/@oclif/command/lib/command.d.ts:69:70 - error TS2344: Type 'A' does not satisfy the constraint 'any[]'.
  Type '{ [name: string]: any; }' is missing the following properties from type 'any[]': length, pop, push, concat, and 29 more.

69     }>(options?: Parser.Input<F>, argv?: string[]): Parser.Output<F, A>;
                                                                        ~

src/commands/hello/org.ts:86:39 - error TS2339: Property 'file' does not exist on type 'any[]'.

86     if (this.flags.force && this.args.file) {
                                         ~~~~

src/commands/hello/org.ts:87:62 - error TS2339: Property 'file' does not exist on type 'any[]'.

87       this.ux.log(`You input --force and a file: ${this.args.file as string}`);
                                                                ~~~~


Found 4 errors.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] prepack: `rm -rf lib && tsc -b && oclif-dev manifest && oclif-dev readme`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] prepack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Additional information

Feel free to attach a screenshot.

SFDX CLI Version: sfdx-cli/7.126.0 darwin-x64 node-v16.13.0

OS and version: MacOS Monterey 12.0.1

@uip-robot-zz
Copy link

Git2Gus App is installed but the .git2gus/config.json doesn't exist.

@nkadis
Copy link

nkadis commented Nov 19, 2021

I had the exact same issues and ended up bumping all packages to their latest versions, except for globby (that was throwing a different error if upgraded). I'm not sure exactly which packages were the culprits, but upgrading @types/jsforce to the latest version surely got rid of most of them. As of writing this, here are the latest versions for every package:

"dependencies": {
    "@oclif/command": "^1.8.3",
    "@oclif/config": "^1.17.1",
    "@oclif/errors": "^1.3.5",
    "@salesforce/command": "^4.1.5",
    "@salesforce/core": "^2.29.0",
    "tslib": "^2.3.1"
  },
  "devDependencies": {
    "@oclif/dev-cli": "^1.26.0",
    "@oclif/plugin-help": "^3.2.5",
    "@oclif/test": "^1.2.8",
    "@salesforce/dev-config": "^2.1.2",
    "@salesforce/dev-scripts": "^0.9.18",
    "@salesforce/prettier-config": "^0.0.2",
    "@salesforce/ts-sinon": "^1.3.21",
    "@types/chai": "^4.2.22",
    "@types/jsforce": "^1.9.35",
    "@types/mocha": "^9.0.0",
    "@typescript-eslint/eslint-plugin": "^5.4.0",
    "@typescript-eslint/parser": "^5.4.0",
    "chai": "^4.3.4",
    "eslint": "^8.2.0",
    "eslint-config-oclif": "^4.0.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-config-salesforce": "^0.1.6",
    "eslint-config-salesforce-typescript": "^0.2.8",
    "eslint-plugin-header": "^3.1.1",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jsdoc": "^37.0.3",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-typescript": "^0.14.0",
    "globby": "^11",
    "husky": "^7.0.4",
    "mocha": "^9.1.3",
    "nyc": "^15.1.0",
    "prettier": "^2.4.1",
    "pretty-quick": "^3.1.2",
    "sinon": "^12.0.1",
    "ts-node": "^10.4.0",
    "typescript": "^4.5.2"
  },

@FabienTaillon
Copy link

Bumping versions worked for me too, except that the -h flag isn't working anymore (whereas the --help flag does).
Getting the following error while running sfdx hello:org -h:

Could not load a help class, consider installing the @oclif/help package, failed with message:
Cannot find module '@oclif/help'

Is that working for you ?

@keirbowden
Copy link
Author

I just tried with the latest cli and standard plug-ins. After scaffolding but before touching the dependencies, all the hello:org commands work, including -h and --help. Prepack fails with :

node_modules/@salesforce/command/lib/sfdxCommand.d.ts:63:21 - error TS2315: Type 'OutputArgs' is not generic.

63     protected args: OutputArgs<any>;
                       ~~~~~~~~~~~~~~~

After updating all the dependencies with the version in the earlier comment, all the hello:org commands still work and the prepack command succeeds.

@FabienTaillon
Copy link

Thank you. Following your post I published a new version of our plugin and everything works fine, whereas locally it doesn't. Definitely something with my local setup.

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

No branches or pull requests

4 participants