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

[legacy-framework] Fix broken cli when using npm where global blitz version used instead of local #705

Merged
merged 5 commits into from
Jun 20, 2020

Conversation

flybayer
Copy link
Member

What are the changes and their implications?

This fixes a bug where blitz -vV will return debug: global when run inside a blitz project. This means it's using the globally installed blitz package.

This also was causing the following error when running blitz generate:

✕ Error generating __modelIdParam__/edit.tsx
✕ Error: Couldn't resolve parser "babel-ts"

So I also added a try/catch around prettier in the generator to ensure that a prettier failure doesn't block file generation.

Checklist

  • Tests added for changes
  • PR submitted to blitzjs.com for any user facing changes

@@ -14,7 +14,8 @@ console.log(

let usageType: "local" | "monorepo" | "global" | "global-linked"

const localCLIPkgPath = path.resolve(process.cwd(), "node_modules", "@blitzjs/cli")
const localCLIPkgPath1 = path.resolve(process.cwd(), "node_modules", "@blitzjs/cli")
const localCLIPkgPath2 = path.resolve(process.cwd(), "node_modules/blitz/node_modules/@blitzjs/cli")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual path of the local installed module can be one of these two paths.

@flybayer flybayer merged commit 11e8268 into canary Jun 20, 2020
@flybayer flybayer deleted the fix-npm branch June 20, 2020 08:00
@dillondotzip dillondotzip changed the title Fix broken cli when using npm where global blitz version used instead of local [legacy-framework] Fix broken cli when using npm where global blitz version used instead of local Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant