prismicio / prismic-ts-codegen

A Prismic model-to-TypeScript-type generator.
Apache License 2.0
18 stars 6 forks source link

Terminal error while running npx commands (from `meow` dependency) #44

Closed andre-lergier closed 1 year ago

andre-lergier commented 1 year ago

After updating to the lastest version I can no longer run npx prismic-ts-codegen. If I try to build the types the following error appears:

➜ npx prismic-ts-codegen init
file:///Users/andrelergier/Developer/test/node_modules/meow/source/options.js:52
        throw new Error(errorMessages.join('\n'));
              ^

Error: The option `alias` has been renamed to `shortFlag`. The following flags need to be updated: `--config`
    at validateOptions (file:///Users/andrelergier/Developer/test/node_modules/meow/source/options.js:52:9)
    at buildOptions (file:///Users/andrelergier/Developer/test/node_modules/meow/source/options.js:87:2)
    at meow (file:///Users/andrelergier/Developer/test/node_modules/meow/source/index.js:91:24)
    at file:///Users/andrelergier/Developer/test/node_modules/prismic-ts-codegen/dist/cli.js:12:13
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

Node.js v18.16.0

Versions

Reproduction

I reproduced the issue with creating a new repository and following the steps described in the readme.

As soon as I run the following command the error already appears as well:

npx prismic-ts-codegen init
Additional Details
`package.json`-File: ```json { "name": "slice-library", "version": "0.1.0", "main": "index.ts", "types": "index.ts", "scripts": { "lint": "eslint \"**/*.ts*\"", "build": "npx prismic-ts-codegen && npm run lint" }, "dependencies": { "@prismicio/client": "^7.0.0", "@prismicio/react": "^2.5.2", "next": "^13.4.0", "ui": "*" }, "devDependencies": { "@types/node": "18.16.0", "@types/react": "18.2.0", "@types/react-dom": "18.2.0", "eslint": "8.39.0", "eslint-config-custom": "*", "prismic-ts-codegen": "^0.1.7", "react": "^18.2.0", "react-dom": "^18.2.0", "tsconfig": "*", "typescript": "5.0.4" } } ```

Has this anything to do with the newest version or the update to @prismicio/client v7?

Thank you for your support.

andre-lergier commented 1 year ago

I just saw your new 0.1.8 release. πŸ™‚ The error still appears in my repository...

"prismic-ts-codegen": "^0.1.8"
angeloashmore commented 1 year ago

Hey @andre-lergier, sorry for the trouble!

Could you try the latest release, v0.1.9?

We don't have proper tests for the CLI yet, which unfortunately resulted in some faulty releases.


For context, yes, this is related to the updates required for @prismicio/client v7.

If you are on @prismicio/client v7 and the latest version of prismic-ts-codegen, you should be able to use types from @prismicio/client instead of @prismicio/types.

andre-lergier commented 1 year ago

Hi @angeloashmore

Thank you for the quick release - you saved my day! Now it works again...