From 003397e913f131844148ff8ce70efe44243f24b5 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 18 Dec 2023 11:36:20 -0500 Subject: [PATCH 1/2] Update dependencies in the addon's package.json --- files/__addonLocation__/package.json | 85 ++++++++++++++-------------- 1 file changed, 43 insertions(+), 42 deletions(-) diff --git a/files/__addonLocation__/package.json b/files/__addonLocation__/package.json index 05e87be8..a81736c0 100644 --- a/files/__addonLocation__/package.json +++ b/files/__addonLocation__/package.json @@ -33,55 +33,56 @@ "prepack": "rollup --config" }, "dependencies": { - "@embroider/addon-shim": "^1.0.0", + "@embroider/addon-shim": "^1.8.7", "decorator-transforms": "^1.0.1" }, "devDependencies": { - "@babel/core": "^7.17.0", - <% if (typescript) { %>"@babel/plugin-transform-typescript": "^7.22.15"<% } else { %>"@babel/eslint-parser": "^7.19.1"<% } %>, + "@babel/core": "^7.23.6", + <% if (typescript) { %>"@babel/plugin-transform-typescript": "^7.23.6"<% } else { %>"@babel/eslint-parser": "^7.23.3"<% } %>, "@babel/runtime": "^7.17.0", "@embroider/addon-dev": "^4.1.0",<% if (typescript) { %> - "@glint/core": "^1.2.0", - "@glint/environment-ember-loose": "^1.2.0", - "@glint/environment-ember-template-imports": "^1.2.0", - "@glint/template": "^1.2.0", - "@tsconfig/ember": "^2.0.0", - "@types/ember": "^4.0.4", - "@types/ember__object": "^4.0.6", - "@types/ember__owner": "^4.0.4", - "@types/ember__service": "^4.0.3", - "@types/ember__controller": "^4.0.5", + "@glint/core": "^1.2.1", + "@glint/environment-ember-loose": "^1.2.1", + "@glint/environment-ember-template-imports": "^1.2.1", + "@glint/template": "^1.2.1", + "@tsconfig/ember": "^3.0.2", + "@types/ember": "^4.0.10", + "@types/ember__object": "^4.0.11", + "@types/ember__destroyable": "^4.0.4", + "@types/ember__owner": "^4.0.8", + "@types/ember__service": "^4.0.8", + "@types/ember__controller": "^4.0.11", "@types/ember__string": "^3.16.3", - "@types/ember__template": "^4.0.2", - "@types/ember__polyfills": "^4.0.2", - "@types/ember__utils": "^4.0.3", - "@types/ember__runloop": "^4.0.3", - "@types/ember__debug": "^4.0.4", - "@types/ember__engine": "^4.0.5", - "@types/ember__application": "^4.0.6", - "@types/ember__test": "^4.0.2", - "@types/ember__array": "^4.0.4", - "@types/ember__error": "^4.0.3", - "@types/ember__component": "^4.0.14", - "@types/ember__modifier": "^4.0.6", - "@types/ember__helper": "^4.0.3", - "@types/ember__routing": "^4.0.13", - "@typescript-eslint/eslint-plugin": "^6.7.2", - "@typescript-eslint/parser": "^6.7.2",<% } %> - "@rollup/plugin-babel": "^6.0.3", - "babel-plugin-ember-template-compilation": "^2.2.0", - "concurrently": "^8.0.1", - "ember-template-lint": "^5.11.2", - "eslint": "^8.33.0", - "eslint-config-prettier": "^9.0.0", - "eslint-plugin-ember": "^11.11.1", - "eslint-plugin-n": "^16.0.0", - "eslint-plugin-prettier": "^5.0.0", - "prettier": "^3.0.3", + "@types/ember__template": "^4.0.5", + "@types/ember__polyfills": "^4.0.5", + "@types/ember__utils": "^4.0.6", + "@types/ember__runloop": "^4.0.8", + "@types/ember__debug": "^4.0.7", + "@types/ember__engine": "^4.0.10", + "@types/ember__application": "^4.0.10", + "@types/ember__test": "^4.0.5", + "@types/ember__array": "^4.0.9", + "@types/ember__error": "^4.0.5", + "@types/ember__component": "^4.0.21", + "@types/ember__modifier": "^4.0.8", + "@types/ember__helper": "^4.0.5", + "@types/ember__routing": "^4.0.19", + "@typescript-eslint/eslint-plugin": "^6.14.0", + "@typescript-eslint/parser": "^6.14.0",<% } %> + "@rollup/plugin-babel": "^6.0.4", + "babel-plugin-ember-template-compilation": "^2.2.1", + "concurrently": "^8.2.2", + "ember-template-lint": "^5.13.0", + "eslint": "^8.56.0", + "eslint-config-prettier": "^9.1.0", + "eslint-plugin-ember": "^11.12.0", + "eslint-plugin-n": "^16.4.0", + "eslint-plugin-prettier": "^5.0.1", + "prettier": "^3.1.1", "prettier-plugin-ember-template-tag": "^1.1.0", - "rollup": "^3.21.8"<% if (!isExistingMonorepo) { %>, - "rollup-plugin-copy": "^3.4.0"<% } %><% if (typescript) { %>, - "typescript": "^5.0.4"<% } %> + "rollup": "^4.9.1"<% if (!isExistingMonorepo) { %>, + "rollup-plugin-copy": "^3.5.0"<% } %><% if (typescript) { %>, + "typescript": "^5.3.3"<% } %> }, "publishConfig": { "registry": "https://registry.npmjs.org" From 8d5627ad908ea66e22d967726e66cb58ced5a9de Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Mon, 18 Dec 2023 12:06:04 -0500 Subject: [PATCH 2/2] Fix TypeScripts tests and remove flaky approach to asserting file presence --- tests/helpers/utils.ts | 40 -------------------- tests/smoke-tests/--typescript.test.ts | 52 +++++++++++++------------- 2 files changed, 25 insertions(+), 67 deletions(-) diff --git a/tests/helpers/utils.ts b/tests/helpers/utils.ts index 81fcefb6..b73a3387 100644 --- a/tests/helpers/utils.ts +++ b/tests/helpers/utils.ts @@ -22,46 +22,6 @@ export async function createTmp() { return tmpDirPath; } -const ROLLUP_HASH = /[a-f0-9]{8}/ - -/** -* Filters out rollup-hashes from a list of files. -* -* When there are private files, rollup will add some -* hash to the emitted file path, -* such as: -* template-only-ab2e7769.js.map -* -* These hashes have predictable length, so we can have -* a fairly narrow matcher to remove them. -*/ -export function withoutHashes(names: string[]) { - return names.filter(name => !ROLLUP_HASH.test(name)); -} - -/** -* Filters out a list of files, keeping only the rollup-emitted hashed files -* -* When there are private files, rollup will add some -* hash to the emitted file path, -* such as: -* template-only-ab2e7769.js.map -* -* These hashes have predictable length, so we can have -* a fairly narrow matcher to remove them. -* This a -*/ -export function hashesOnly(names: string[]) { - return names.filter(name => ROLLUP_HASH.test(name)); -} - -export function splitHashedFiles(names: string[]) { - return { - hashed: hashesOnly(names), - unhashed: withoutHashes(names), - }; -} - /** * Abstraction for install, as the blueprint supports multiple package managers */ diff --git a/tests/smoke-tests/--typescript.test.ts b/tests/smoke-tests/--typescript.test.ts index e75479d9..323797fc 100644 --- a/tests/smoke-tests/--typescript.test.ts +++ b/tests/smoke-tests/--typescript.test.ts @@ -7,7 +7,6 @@ import { AddonHelper, assertGeneratedCorrectly, dirContents, - splitHashedFiles, SUPPORTED_PACKAGE_MANAGERS, } from '../helpers.js'; @@ -76,34 +75,33 @@ for (let packageManager of SUPPORTED_PACKAGE_MANAGERS) { expect(buildResult.exitCode).toEqual(0); - let distContents = splitHashedFiles(await dirContents(distDir)); + let distContents = await dirContents(distDir); let declarationsContents = await dirContents(declarationsDir); - expect(distContents.unhashed).to.deep.equal([ - '_app_', - 'components', - 'index.js', - 'index.js.map', - 'services', - 'template-registry.js', - 'template-registry.js.map', - ]); - - expect(distContents.hashed.length).toBe(2); - expect( - distContents.hashed - .filter((file) => file.includes('template-only')) - .map((file) => file.split('.js')[1]), - ).to.deep.equal(['', '.map'], 'the template-only (private) component is emitted with a source map'); - - expect(declarationsContents).to.deep.equal([ - 'components', - 'index.d.ts', - 'index.d.ts.map', - 'services', - 'template-registry.d.ts', - 'template-registry.d.ts.map', - ]); + expect(distContents).toMatchInlineSnapshot(` + [ + "_app_", + "components", + "index.js", + "index.js.map", + "services", + "template-only-dYTzhOEA.js", + "template-only-dYTzhOEA.js.map", + "template-registry.js", + "template-registry.js.map", + ] + `); + + expect(declarationsContents).toMatchInlineSnapshot(` + [ + "components", + "index.d.ts", + "index.d.ts.map", + "services", + "template-registry.d.ts", + "template-registry.d.ts.map", + ] + `); let testResult = await helper.run('test');