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

Updated notifier breaks maizzle build in monorepos. #198

Closed
joshmanders opened this issue Apr 1, 2023 · 14 comments · Fixed by #200 or #240
Closed

Updated notifier breaks maizzle build in monorepos. #198

joshmanders opened this issue Apr 1, 2023 · 14 comments · Fixed by #200 or #240
Labels
bug Something isn't working

Comments

@joshmanders
Copy link
Contributor

I've had no issues before but haven't updated in a while, being as we're still on v4 I just wholesale updated from 4.0.2 to 4.4.4 and now maizzle build --bin .... breaks because updateNotifier doesn't take the --bin flag into consideration, it still looks for ./node_modules which doesn't exist in many monorepos.

Looks like this issue was brought in here: 847d7f3

@cossssmin cossssmin added the bug Something isn't working label Apr 3, 2023
@joshmanders
Copy link
Contributor Author

joshmanders commented Apr 6, 2023

@cossssmin any input on this? I can submit a PR adding the try catch back... Also you could use require.resolve('@maizzle/framework/package.json') and that will use the internal module resolver to find the package the same way require('@maizzle/framework') would. This finding it in monorepos.

This is currently blocking me in production as I can't run my build scripts without editing the index.js file directly.

@cossssmin
Copy link
Member

Hey Josh, sorry for the delay, busy times... Yes, please open a PR and we take it from there, thank you!

@joshmanders
Copy link
Contributor Author

@cossssmin

Hey Josh, sorry for the delay, busy times... Yes, please open a PR and we take it from there, thank you!

No worries, big fan of maizzle, thank you for what you've already done. I've opened a PR #200

@cossssmin
Copy link
Member

Thanks Josh, released 1.5.3: https://github.com/maizzle/cli/releases/tag/v1.5.3

@cossssmin
Copy link
Member

Sorry need to reopen this and revert the change, it's breaking Maizzle right now...

@cossssmin cossssmin reopened this Apr 6, 2023
@cossssmin
Copy link
Member

Error stack ref:

node:internal/modules/cjs/loader:995
  const err = new Error(message);
              ^

Error: Cannot find module '@maizzle/framework/src'
Require stack:
- F:\DEV\open-source\maizzle\cli\src\index.js
- F:\DEV\open-source\maizzle\cli\bin\maizzle
    at Module._resolveFilename (node:internal/modules/cjs/loader:995:15)
    at Function.resolve (node:internal/modules/cjs/helpers:109:19)
    at Command.<anonymous> (F:\DEV\open-source\maizzle\cli\src\index.js:47:42)
    at Command.listener [as _actionHandler] (F:\DEV\open-source\maizzle\cli\node_modules\commander\lib\command.js:482:17)
    at F:\DEV\open-source\maizzle\cli\node_modules\commander\lib\command.js:1283:65
    at Command._chainOrCall (F:\DEV\open-source\maizzle\cli\node_modules\commander\lib\command.js:1177:12)
    at Command._parseCommand (F:\DEV\open-source\maizzle\cli\node_modules\commander\lib\command.js:1283:27)
    at F:\DEV\open-source\maizzle\cli\node_modules\commander\lib\command.js:1081:27
    at Command._chainOrCall (F:\DEV\open-source\maizzle\cli\node_modules\commander\lib\command.js:1177:12)
    at Command._dispatchSubcommand (F:\DEV\open-source\maizzle\cli\node_modules\commander\lib\command.js:1077:23) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'F:\\DEV\\open-source\\maizzle\\cli\\src\\index.js',
    'F:\\DEV\\open-source\\maizzle\\cli\\bin\\maizzle'
  ]
}

@cossssmin
Copy link
Member

This is an issue when running the Maizzle CLI globally.

So if you have installed it with npm install -g @maizzle/cli and run maizzle build in the project root, you'll get an error similar to the one above; Node can't resolve the framework location because it has no way of knowing where it is in a 'global' context.

Running the NPM scripts, like npm run build, works fine because Node can resolve @maizzle/framework inside your project.

You can pin @maizzle/cli to 1.5.3 but for now I have reverted it until we find a solution.

Most probably we'll need a try/catch and fall back to the old way, but I'm open to suggestions :)

@joshmanders
Copy link
Contributor Author

This is an issue when running the Maizzle CLI globally.

So if you have installed it with npm install -g @maizzle/cli and run maizzle build in the project root, you'll get an error similar to the one above; Node can't resolve the framework location because it has no way of knowing where it is in a 'global' context.

Running the NPM scripts, like npm run build, works fine because Node can resolve @maizzle/framework inside your project.

You can pin @maizzle/cli to 1.5.3 but for now I have reverted it until we find a solution.

Most probably we'll need a try/catch and fall back to the old way, but I'm open to suggestions :)

Oh interesting, I haven't ran a cli from global scope in a long time. I'll see if I can come up with a solution but for now pin to 1.5.3.

@cossssmin
Copy link
Member

Hi @joshmanders, can you try the v1.5.5-01 prerelease and see how that works for you? Tagged it under next in NPM as well, so you can also get it with npm i @maizzle/cli@next.

Used resolve-cwd to try and resolve the framework executable from the current directory, should work fine now.

@joshmanders
Copy link
Contributor Author

Hi @joshmanders, can you try the v1.5.5-01 prerelease and see how that works for you? Tagged it under next in NPM as well, so you can also get it with npm i @maizzle/cli@next.

Used resolve-cwd to try and resolve the framework executable from the current directory, should work fine now.

Yes I will try it later this afternoon when I get back to my desk and report back. Thank you!

@joshmanders
Copy link
Contributor Author

@cossssmin works perfectly!

@cossssmin
Copy link
Member

Sweet!

Will release it next week since I’ll be away for Easter here 👍

@joshmanders
Copy link
Contributor Author

I can stay on the old version that worked until you release so no worries. Have a happy easter!

@cossssmin
Copy link
Member

Published v1.5.5, give it a try and let me know how it goes 👍

https://github.com/maizzle/cli/releases/tag/v1.5.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
2 participants