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

Does not build on windows #41

Closed
Yaro77 opened this issue Oct 16, 2023 · 9 comments · Fixed by #44
Closed

Does not build on windows #41

Yaro77 opened this issue Oct 16, 2023 · 9 comments · Fixed by #44

Comments

@Yaro77
Copy link

Yaro77 commented Oct 16, 2023

  • Component or Package Name: cli
  • Component or Package Version: 1.1.0
  • @jsxp-email/cli Version?: 1.1.0
  • Operating System (or Browser): Windows 11
  • Node Version: 18.14.2
  • Link to reproduction (⚠️ read below): Brand new project on Windows, created with npm create jsx-email, no need for reproduction.

Expected Behavior

Build works on Windows

Actual Behavior

It doesn't

Additional Information

Can't create PR now
Build command uses globby, which returns empty arrays on windows paths. You should use globby([slash(join(temp, "*.js")]) everywhere in CLI.
Thanks

@shellscape
Copy link
Owner

no need for reproduction

Sorry, but that's not true. If you're not willing to help demonstrate the issue, I'm afraid there's nothing we can do to help.

None of the current maintainers are Windows users, so I'd recommend using WSL for the time being.

@bhuynhdev
Copy link
Contributor

bhuynhdev commented Oct 29, 2023

Hi, just want to let the team know that I am experiencing the same issue in Windows. The Development server works fine, but when I run pnpm run build, it says found 0 files, even though my templates folder contains one file "jsx-email-starter". This is for a brand-new project just created using the cli (version 1.1.0).

email build ./templates

Found 0 files:

Starting build...

Build complete. Files written to: ...

I understand that none of the current maintainers are Windows users, so I am just communicating here to raise some awareness to the issue. Will try to make a PR if possible

@shellscape
Copy link
Owner

A PR would be great. Appreciate the additional info. This issue is more than likely the result of the older version of globby that we're using at the moment. I still don't know what exact fix the OP was referencing, but it probably has to do with path normalization.

@bhuynhdev
Copy link
Contributor

bhuynhdev commented Oct 29, 2023

I dug around for a bit, and per this issue sindresorhus/globby#179, it seems that the glob pattern must only contain forward slashes, but the path functions on Windows return backslashes.

Therefore, I replaced globby([glob]) with globby([glob.replace(/\\/g, '/')]) in the build function, and then globby([path.join(outDir, '*.js').replace(/\\/g, '/')]) in the compile function. The CLI now successfully detected the files and build and output correct HTML. I did run into "cannot find modules react/jsx-runtime" but solved it by running pnpm add react

I am trying to make a PR but the steps in the CONTRIBUTING.md doc seems to not work on both my Windows and my WSL. I have Nodejs 18.18.2, and have ran pnpm boostrap successfully. But when I run moon run repo:build.packages, I got error

Error: project_graph::unknown_project

  × No project has been configured with the name or alias jsx-email.

@shellscape
Copy link
Owner

Thanks for the heads up, I'll get the doc updated. In place of jsx-email use repo for moon commands.

@shellscape
Copy link
Owner

Also here's rollup's path normalization routine that's very proven, for reference https://github.com/rollup/plugins/blob/master/packages/pluginutils/src/normalizePath.ts#L5

@shellscape
Copy link
Owner

Attempted to setup a workflow matrix so we could use github actions to try and debug, but unfortunately there's an issue between pnpm and vue-demi that needs to be resolved before things will work correctly pnpm/pnpm#6696 (comment)

@bhuynhdev
Copy link
Contributor

bhuynhdev commented Oct 29, 2023

Oh it was my bad, as I didn't name my folder jsx-email (Moon tried to decipher the project name from folder name). I renamed the folder name correctly and am now using WSL (since the command rm -rf doesn't work on Windows), but ran into Cannot find module '@jsx-email/render' error after running moon repo:build.packages.

Never mind, I solved this by running moon run repo:build.critical before moon run repo:build.packages, and then moon run repo:build.last after; everything seem to have built successfully

Successfully created #44 after confirming that moon run repo:lint and moon run repo:test.packages work successfully (repo:lint actually has errors about Unable to resolve path to module '@jsx-email/all' in the apps/demo/emails/... .tsx files, but I don't think that was my fault)

@shellscape
Copy link
Owner

Thanks for working through that. We'll get that doc updated 👍

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

Successfully merging a pull request may close this issue.

3 participants