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

Allow NPM use for install/build #179

Merged
merged 1 commit into from
Jan 5, 2024
Merged

Conversation

ksol
Copy link
Contributor

@ksol ksol commented Dec 5, 2023

Fixes partly #176.

At my company, we're moving away from yarn as it does not bring a lot of value in our use cases and we'd rather stick with the defaults, but this gem assumes/requires yarn.

This PR falls back on npm for installing packages + running the build script in bun/yarn is not present.

This PR does not (yet) add npm support for the generators (Procfile.dev, etc) however; should I add it here and take inspiration from the Bun PR ?

@ksol ksol force-pushed the feat/task-npm-support branch 2 times, most recently from 6048b4f to 50a90c9 Compare December 5, 2023 15:08
@ksol
Copy link
Contributor Author

ksol commented Dec 6, 2023

As a proof of concept, I tried to add bun/npm/yarn support to the generators in a separate branch. It seems working as intended, but as there is no specs... Can't be sure. It can be checked at main...ksol:jsbundling-rails:feat/task-npm-support-2

@dhh dhh merged commit e7881e9 into rails:main Jan 5, 2024
@ksol ksol deleted the feat/task-npm-support branch January 5, 2024 14:27
@zavan
Copy link

zavan commented Feb 25, 2024

If anyone got here trying to make --watch work, this is what I got for esbuild and tailwind:

package.json:

  "scripts": {
    "build": "esbuild app/javascript/*.* --bundle --sourcemap --format=esm --outdir=app/assets/builds --public-path=/assets",
    "build:css": "tailwindcss -i ./app/assets/stylesheets/application.tailwind.css -o ./app/assets/builds/application.css --minify"
  },

Procfile.dev

web: bin/rails server
js: npm run build -- --watch
css: npm run build:css -- --watch

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 this pull request may close these issues.

None yet

3 participants