Skip to content

A platform for community discussion. Free, open, simple.

DEV: Auto `yarn install` root package in development (#23276)

David Taylor887772db6bcc
diff --git a/bin/ember-cli b/bin/ember-cli
index d1c480085cc..ee9e46ea0be 100755
--- a/bin/ember-cli
+++ b/bin/ember-cli
@@ -56,7 +56,8 @@ if !args.include?("test") && !args.include?("build") && !args.include?("--proxy"
args << PROXY
end
-exit 1 if !system "yarn -s install --cwd #{YARN_DIR}"
+# Running yarn install in the root directory will also run it for YARN_DIR via a post-install hook
+exit 1 if !system "yarn", "-s", "install", "--cwd", RAILS_ROOT
yarn_env = {}
if ARGV.include?("--forward-host")
diff --git a/package.json b/package.json
index 4896228d156..895f58d4293 100644
--- a/package.json
+++ b/package.json
@@ -56,7 +56,7 @@
"lttf:ignore": "lint-to-the-future ignore",
"lttf:output": "lint-to-the-future output -o ./lint-progress/",
"lint-progress": "yarn lttf:output && npx html-pages ./lint-progress --no-cache",
- "postinstall": "yarn --cwd app/assets/javascripts $(node -e 'if(JSON.parse(process.env.npm_config_argv).original.includes(`--frozen-lockfile`)){console.log(`--frozen-lockfile`)}')"
+ "postinstall": "yarn --cwd app/assets/javascripts $(node -e 'const argv = JSON.parse(process.env.npm_config_argv).original; const passthrough = [`--frozen-lockfile`, `-s`].filter(arg => argv.includes(arg)); console.log(passthrough.join(` `));')"
},
"engines": {
"node": "16.* || >= 18",