Oak-Digital / types-4-strapi-2

Automate the creation of typescript interfaces for your strapi 4 projects
MIT License
24 stars 4 forks source link

pascal-case isn't declared in dependencies #25

Closed exploids closed 1 year ago

exploids commented 1 year ago

It looks like pascal-case is used in this module, but not declared in the dependencies. This is in theory not allowed when using npm (although npm allows it) and Yarn 3 (with PnP) throws the following error:

/project-directory/.pnp.cjs:23499
      Error.captureStackTrace(firstError);
            ^

Error: @oak-digital/types-4-strapi-2 tried to access pascal-case, but it isn't declared in its dependencies; this makes the require call ambiguous and unsound.

Required package: pascal-case
Required by: @oak-digital/types-4-strapi-2@npm:0.5.4 (via /project-directory/.yarn/cache/@oak-digital-types-4-strapi-2-npm-0.5.4-3c62e81210-f8c7673a72.zip/node_modules/@oak-digital/types-4-strapi-2/lib/program/)

Require stack:
- /project-directory/.yarn/cache/@oak-digital-types-4-strapi-2-npm-0.5.4-3c62e81210-f8c7673a72.zip/node_modules/@oak-digital/types-4-strapi-2/lib/program/InterfaceManager.js
- /project-directory/.yarn/cache/@oak-digital-types-4-strapi-2-npm-0.5.4-3c62e81210-f8c7673a72.zip/node_modules/@oak-digital/types-4-strapi-2/lib/index.js
- /project-directory/.yarn/cache/@oak-digital-types-4-strapi-2-npm-0.5.4-3c62e81210-f8c7673a72.zip/node_modules/@oak-digital/types-4-strapi-2/bin/index.js
    at require$$0.Module._resolveFilename (/project-directory/.pnp.cjs:23499:13)
    at require$$0.Module._load (/project-directory/.pnp.cjs:23349:42)
    at Module.require (node:internal/modules/cjs/loader:1105:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at Object.<anonymous> (/project-directory/.yarn/cache/@oak-digital-types-4-strapi-2-npm-0.5.4-3c62e81210-f8c7673a72.zip/node_modules/@oak-digital/types-4-strapi-2/lib/program/InterfaceManager.js:70:21)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at require$$0.Module._extensions..js (/project-directory/.pnp.cjs:23543:33)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at require$$0.Module._load (/project-directory/.pnp.cjs:23380:14)

Node.js v18.13.0

This should be easily fixable by adding pascal-case to the package dependencies.

Alexnortung commented 1 year ago

Thanks for reporting this. I think that it is weird that it has worked fine this far. We do actually use change-case which contains the pascalCase function, so it might just be swapping the dependencies.

I have also thought about writing some tests to find all these small bugs, but I haven't had the time.

Edit: Ahh, I think I know why it worked, since it is a dependency of change-case, it could found by yarn. However it should definitely still be changed.

Alexnortung commented 1 year ago

This should be fixed in the latest patch v0.5.5.

Please reopen this issue if you are still experiencing this issue