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

Possible issue with escaping string at lib/install/bootstrap/install.rb #137

Closed
duduribeiro opened this issue Sep 18, 2023 · 6 comments
Closed

Comments

@duduribeiro
Copy link

I've generated a new Rails 7.1.beta1 app with

rails new test_app -c bootstrap -d postgresql --skip-action-mailbox --skip-action-cable -a propshaft

this ended by generating the following content at package.json file:

{
..
  "scripts": {
  ...
    "watch:css": "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \\\"bun run build:css\\\""
  }
}

this triple \ looks weird for me and I got the following error when running bin/dev

20:56:27 css.1  | [nodemon] failed to start process, ""bun" exec not found

I THINK the desired output result for the package.json should have:

"watch:css": "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \"bun run build:css\""

am I correct? Because when I update with this content, it works fine:

20:57:44 css.1  | [nodemon] starting `bun run build:css`
20:57:44 css.1  | $ bun run build:css:compile && bun run build:css:prefix
20:57:44 css.1  | $ sass ./app/assets/stylesheets/application.bootstrap.scss:./app/assets/builds/application.css --no-source-map --load-path=node_modules
20:57:44 web.1  | DEBUGGER: Debugger can attach via UNIX domain socket (/var/folders/rm/02kb1lcj2n57_vdhhw1g9_tm0000gn/T/ruby-debug-sock-501/ruby-debug-cadu-2573)
20:57:44 web.1  | => Booting Puma
20:57:44 web.1  | => Rails 7.1.0.beta1 application starting in development
20:57:44 web.1  | => Run `bin/rails server --help` for more startup options
20:57:44 web.1  | Puma starting in single mode...
20:57:44 web.1  | * Puma version: 6.3.1 (ruby 3.2.2-p53) ("Mugi No Toki Itaru")
20:57:44 web.1  | *  Min threads: 5
20:57:44 web.1  | *  Max threads: 5
20:57:44 web.1  | *  Environment: development
20:57:44 web.1  | *          PID: 2573
20:57:44 web.1  | * Listening on http://127.0.0.1:3000
20:57:44 web.1  | * Listening on http://[::1]:3000
20:57:44 web.1  | Use Ctrl-C to stop
20:57:44 css.1  | $ postcss ./app/assets/builds/application.css --use=autoprefixer --output=./app/assets/builds/application.css
20:57:45 css.1  | [nodemon] clean exit - waiting for changes before restart

I see this was changed at:
#136

@duduribeiro
Copy link
Author

and I'm with 1.3.3

test_app % cat Gemfile.lock| grep cssbundling
cssbundling-rails (1.3.3)

@floydj
Copy link

floydj commented Nov 22, 2023

Can confirm this. Should #136 be reverted? That seems to focus on the output of the install script, but it means the actual package.json file has the wrong command.

@heyitspaul
Copy link

Was directed here, can confirm this is still an issue. Replacing \\\" with either ' or \" makes the script work.

@skipkayhil
Copy link
Member

Does this only happen when you have bun in your path? I tried generating a new app with rails new --css bootstrap and I get the correct script added to my package.json (I don't have bun):

"watch:css": "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \"yarn build:css\""

@floydj
Copy link

floydj commented Jan 15, 2024

@skipkayhil - I do have bun in my path.

@Peredery
Copy link

Can confirm. Script is not correct, should remove triple "\" from script.

that one works as expected:

"watch:css": "nodemon --watch ./app/assets/stylesheets/ --ext scss --exec \"bun run build:css\""

@dhh dhh closed this as completed in 09d81cb Jan 21, 2024
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

No branches or pull requests

5 participants