Repository: ember-cli/ember-cli
Pull request #10661 (2025-03-08 08:58:48)

[ENHANCEMENT] Update `ember-try` to v4 in blueprints


Patch:
diff --git a/blueprints/addon/additional-package.json b/blueprints/addon/additional-package.json
index 1f87e1979..505e52578 100644
--- a/blueprints/addon/additional-package.json
+++ b/blueprints/addon/additional-package.json
@@ -1,14 +1,12 @@
 {
-  "keywords": [
-    "ember-addon"
-  ],
+  "keywords": ["ember-addon"],
   "scripts": {
     "test:ember-compatibility": "ember try:each"
   },
   "devDependencies": {
     "@embroider/test-setup": "^4.0.0",
     "ember-source-channel-url": "^3.0.0",
-    "ember-try": "^3.0.0"
+    "ember-try": "^4.0.0"
   },
   "peerDependencies": {
     "ember-source": ">= 4.0.0"
diff --git a/blueprints/addon/files/addon-config/ember-try.js b/blueprints/addon/files/config/ember-try.js
similarity index 91%
rename from blueprints/addon/files/addon-config/ember-try.js
rename to blueprints/addon/files/config/ember-try.js
index 990503b6a..8fa937865 100644
--- a/blueprints/addon/files/addon-config/ember-try.js
+++ b/blueprints/addon/files/config/ember-try.js
@@ -5,9 +5,8 @@ const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');
 
 module.exports = async function () {
   return {
-    <% if (pnpm) { %>usePnpm: true,
-    <% } else if (yarn) { %>useYarn: true,
-    <% } %>scenarios: [
+    packageManager: '<%= packageManager %>',
+    scenarios: [
       {
         name: 'ember-lts-5.8',
         npm: {
diff --git a/blueprints/addon/files/npmignore b/blueprints/addon/files/npmignore
index c72b518a3..5f42c582c 100644
--- a/blueprints/addon/files/npmignore
+++ b/blueprints/addon/files/npmignore
@@ -26,10 +26,3 @@
 /yarn-error.log
 /yarn.lock
 .gitkeep
-
-# ember-try
-/.node_modules.ember-try/
-/npm-shrinkwrap.json.ember-try
-/package.json.ember-try
-/package-lock.json.ember-try
-/yarn.lock.ember-try
diff --git a/blueprints/addon/index.js b/blueprints/addon/index.js
index 48292a8fb..601eea333 100644
--- a/blueprints/addon/index.js
+++ b/blueprints/addon/index.js
@@ -283,8 +283,6 @@ module.exports = {
     '^config.*': 'tests/dummy/:path',
     '^public.*': 'tests/dummy/:path',
 
-    '^addon-config/ember-try.js': 'tests/dummy/config/ember-try.js',
-
     '^npmignore': '.npmignore',
   },
 
diff --git a/blueprints/app/files/.prettierignore b/blueprints/app/files/.prettierignore
index 52ddaa1f5..d7ab45945 100644
--- a/blueprints/app/files/.prettierignore
+++ b/blueprints/app/files/.prettierignore
@@ -11,6 +11,3 @@
 /pnpm-lock.yaml
 ember-cli-update.json
 *.html
-
-# ember-try
-/.node_modules.ember-try/
diff --git a/blueprints/app/files/.stylelintignore b/blueprints/app/files/.stylelintignore
index a0cf71cbd..fc178a0b9 100644
--- a/blueprints/app/files/.stylelintignore
+++ b/blueprints/app/files/.stylelintignore
@@ -3,6 +3,3 @@
 
 # compiled output
 /dist/
-
-# addons
-/.node_modules.ember-try/
diff --git a/blueprints/app/files/gitignore b/blueprints/app/files/gitignore
index 71ad79d02..f0dde6db9 100644
--- a/blueprints/app/files/gitignore
+++ b/blueprints/app/files/gitignore
@@ -14,12 +14,5 @@
 /testem.log
 /yarn-error.log
 
-# ember-try
-/.node_modules.ember-try/
-/npm-shrinkwrap.json.ember-try
-/package.json.ember-try
-/package-lock.json.ember-try
-/yarn.lock.ember-try
-
 # broccoli-debug
 /DEBUG/


Test patch:
diff --git a/tests/fixtures/addon/defaults/package.json b/tests/fixtures/addon/defaults/package.json
index 3552e19f3..4bfa0098d 100644
--- a/tests/fixtures/addon/defaults/package.json
+++ b/tests/fixtures/addon/defaults/package.json
@@ -62,7 +62,7 @@
     "ember-source": "~6.3.0-beta.1",
     "ember-source-channel-url": "^3.0.0",
     "ember-template-lint": "^6.1.0",
-    "ember-try": "^3.0.0",
+    "ember-try": "^4.0.0",
     "eslint": "^9.19.0",
     "eslint-config-prettier": "^9.1.0",
     "eslint-plugin-ember": "^12.5.0",
diff --git a/tests/fixtures/addon/defaults/tests/dummy/config/ember-try.js b/tests/fixtures/addon/defaults/tests/dummy/config/ember-try.js
index 9ab993a3e..386764ddb 100644
--- a/tests/fixtures/addon/defaults/tests/dummy/config/ember-try.js
+++ b/tests/fixtures/addon/defaults/tests/dummy/config/ember-try.js
@@ -5,6 +5,7 @@ const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');
 
 module.exports = async function () {
   return {
+    packageManager: 'npm',
     scenarios: [
       {
         name: 'ember-lts-5.8',
diff --git a/tests/fixtures/addon/pnpm/package.json b/tests/fixtures/addon/pnpm/package.json
index 8b7815a54..833c5ae3b 100644
--- a/tests/fixtures/addon/pnpm/package.json
+++ b/tests/fixtures/addon/pnpm/package.json
@@ -62,7 +62,7 @@
     "ember-source": "~6.3.0-beta.1",
     "ember-source-channel-url": "^3.0.0",
     "ember-template-lint": "^6.1.0",
-    "ember-try": "^3.0.0",
+    "ember-try": "^4.0.0",
     "ember-welcome-page": "^7.0.2",
     "eslint": "^9.19.0",
     "eslint-config-prettier": "^9.1.0",
diff --git a/tests/fixtures/addon/pnpm/tests/dummy/config/ember-try.js b/tests/fixtures/addon/pnpm/tests/dummy/config/ember-try.js
index 764bfbbac..048588386 100644
--- a/tests/fixtures/addon/pnpm/tests/dummy/config/ember-try.js
+++ b/tests/fixtures/addon/pnpm/tests/dummy/config/ember-try.js
@@ -5,7 +5,7 @@ const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');
 
 module.exports = async function () {
   return {
-    usePnpm: true,
+    packageManager: 'pnpm',
     scenarios: [
       {
         name: 'ember-lts-5.8',
diff --git a/tests/fixtures/addon/typescript/package.json b/tests/fixtures/addon/typescript/package.json
index 3bd27a303..d5c104ed2 100644
--- a/tests/fixtures/addon/typescript/package.json
+++ b/tests/fixtures/addon/typescript/package.json
@@ -87,7 +87,7 @@
     "ember-source": "~6.3.0-beta.1",
     "ember-source-channel-url": "^3.0.0",
     "ember-template-lint": "^6.1.0",
-    "ember-try": "^3.0.0",
+    "ember-try": "^4.0.0",
     "eslint": "^9.19.0",
     "eslint-config-prettier": "^9.1.0",
     "eslint-plugin-ember": "^12.5.0",
diff --git a/tests/fixtures/addon/yarn/package.json b/tests/fixtures/addon/yarn/package.json
index 9751c8bee..462f2c529 100644
--- a/tests/fixtures/addon/yarn/package.json
+++ b/tests/fixtures/addon/yarn/package.json
@@ -62,7 +62,7 @@
     "ember-source": "~6.3.0-beta.1",
     "ember-source-channel-url": "^3.0.0",
     "ember-template-lint": "^6.1.0",
-    "ember-try": "^3.0.0",
+    "ember-try": "^4.0.0",
     "ember-welcome-page": "^7.0.2",
     "eslint": "^9.19.0",
     "eslint-config-prettier": "^9.1.0",
diff --git a/tests/fixtures/addon/yarn/tests/dummy/config/ember-try.js b/tests/fixtures/addon/yarn/tests/dummy/config/ember-try.js
index f3e3fe880..5eb47a046 100644
--- a/tests/fixtures/addon/yarn/tests/dummy/config/ember-try.js
+++ b/tests/fixtures/addon/yarn/tests/dummy/config/ember-try.js
@@ -5,7 +5,7 @@ const { embroiderSafe, embroiderOptimized } = require('@embroider/test-setup');
 
 module.exports = async function () {
   return {
-    useYarn: true,
+    packageManager: 'yarn',
     scenarios: [
       {
         name: 'ember-lts-5.8',