Skip to content

Commit

Permalink
Downstreamed changes from @embroider/[email protected] (#71)
Browse files Browse the repository at this point in the history
* feature: Replaced Babel plugins with decorator-transforms

* chore: Updated test fixtures

* feature: Updated latestVersions

* chore: Updated test fixtures

* feature: Reconfigured TypeScript and Glint

* chore: Updated test fixtures

---------

Co-authored-by: ijlee2 <[email protected]>
  • Loading branch information
ijlee2 and ijlee2 authored Dec 20, 2023
1 parent 9dbc39e commit 80509eb
Show file tree
Hide file tree
Showing 55 changed files with 291 additions and 220 deletions.
11 changes: 8 additions & 3 deletions src/blueprints/ember-addon/__addonLocation__/babel.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
}
],
<% } %> "@embroider/addon-dev/template-colocation-plugin",
"@babel/plugin-transform-class-static-block",
[
"babel-plugin-ember-template-compilation",
{
"targetFormat": "hbs",
"transforms": []
}
],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-transform-class-properties"
[
"module:decorator-transforms",
{
"runtime": {
"import": "decorator-transforms/runtime"
}
}
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!
<% if (options.packages.addon.hasGlint) { %>
import '@glint/environment-ember-loose';
// import '@glint/environment-ember-template-imports';

declare module '@glint/environment-ember-loose/registry' {
// Remove this once entries have been added! 👇
Expand Down
2 changes: 1 addition & 1 deletion src/steps/update-addon-package-json/update-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function updateDependencies(
dependencies.delete(packageName);
});

const packagesToInstall = ['@embroider/addon-shim'];
const packagesToInstall = ['@embroider/addon-shim', 'decorator-transforms'];

packagesToInstall.forEach((packageName) => {
const version = getVersion(packageName, options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ export function updateDevDependencies(

const packagesToInstall = new Set([
'@babel/core',
'@babel/plugin-proposal-decorators',
'@babel/plugin-transform-class-properties',
'@babel/plugin-transform-class-static-block',
'@babel/runtime',
'@embroider/addon-dev',
'@rollup/plugin-babel',
Expand Down
1 change: 1 addition & 0 deletions src/steps/update-addon-tsconfig-json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ function setCompilerOptions(
compilerOptions.set('allowImportingTsExtensions', true);
compilerOptions.set('allowJs', true);
compilerOptions.set('declarationDir', 'declarations');
compilerOptions.set('rootDir', './src');

if (!packages.addon.hasGlint) {
compilerOptions.set('declaration', true);
Expand Down
24 changes: 11 additions & 13 deletions src/utils/blueprints/get-version.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ import { decideVersion } from '@codemod-utils/blueprints';
import type { Options } from '../../types/index.js';

const latestVersions = new Map([
['@babel/core', '7.23.2'],
['@babel/plugin-proposal-decorators', '7.22.15'],
['@babel/plugin-transform-class-properties', '7.22.5'],
['@babel/plugin-transform-class-static-block', '7.22.11'],
['@babel/plugin-transform-typescript', '7.22.15'],
['@babel/runtime', '7.23.2'],
['@embroider/addon-dev', '4.1.1'],
['@embroider/addon-shim', '1.8.6'],
['@embroider/test-setup', '3.0.2'],
['@babel/core', '7.23.6'],
['@babel/plugin-transform-typescript', '7.23.6'],
['@babel/runtime', '7.23.6'],
['@embroider/addon-dev', '4.1.3'],
['@embroider/addon-shim', '1.8.7'],
['@embroider/test-setup', '3.0.3'],
['@rollup/plugin-babel', '6.0.4'],
['@tsconfig/ember', '3.0.2'],
['@tsconfig/ember', '3.0.3'],
['babel-plugin-ember-template-compilation', '2.2.1'],
['concurrently', '8.2.2'],
['ember-auto-import', '2.6.3'],
['decorator-transforms', '1.0.1'],
['ember-auto-import', '2.7.1'],
['ember-cli-babel', '8.1.0'],
['ember-cli-htmlbars', '6.3.0'],
['rollup', '4.3.0'],
['rollup', '4.9.1'],
['rollup-plugin-copy', '3.5.0'],
['typescript', '5.2.2'],
['typescript', '5.3.3'],
]);

export function getVersion(packageName: string, options: Options): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
}
],
"@embroider/addon-dev/template-colocation-plugin",
"@babel/plugin-transform-class-static-block",
[
"babel-plugin-ember-template-compilation",
{
"targetFormat": "hbs",
"transforms": []
}
],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-transform-class-properties"
[
"module:decorator-transforms",
{
"runtime": {
"import": "decorator-transforms/runtime"
}
}
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,23 @@
}
},
"dependencies": {
"@embroider/addon-shim": "^1.8.6",
"@embroider/addon-shim": "^1.8.7",
"decorator-transforms": "^1.0.1",
"ember-element-helper": "^0.6.1",
"ember-modifier": "^3.2.7",
"ember-resize-observer-service": "^1.1.0",
"ember-test-selectors": "^6.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/plugin-proposal-decorators": "^7.22.15",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-class-static-block": "^7.22.11",
"@babel/plugin-transform-typescript": "^7.22.15",
"@babel/runtime": "^7.23.2",
"@embroider/addon-dev": "^4.1.1",
"@babel/core": "^7.23.6",
"@babel/plugin-transform-typescript": "^7.23.6",
"@babel/runtime": "^7.23.6",
"@embroider/addon-dev": "^4.1.3",
"@rollup/plugin-babel": "^6.0.4",
"@tsconfig/ember": "^2.0.0",
"babel-plugin-ember-template-compilation": "^2.2.1",
"concurrently": "^7.6.0",
"rollup": "^4.3.0",
"rollup": "^4.9.1",
"rollup-plugin-copy": "^3.5.0",
"typescript": "^4.9.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": true,
"declarationDir": "declarations"
"declarationDir": "declarations",
"rootDir": "./src"
},
"include": [
"src/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!

import '@glint/environment-ember-loose';
// import '@glint/environment-ember-template-imports';

declare module '@glint/environment-ember-loose/registry' {
// Remove this once entries have been added! 👇
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
}
],
"@embroider/addon-dev/template-colocation-plugin",
"@babel/plugin-transform-class-static-block",
[
"babel-plugin-ember-template-compilation",
{
"targetFormat": "hbs",
"transforms": []
}
],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-transform-class-properties"
[
"module:decorator-transforms",
{
"runtime": {
"import": "decorator-transforms/runtime"
}
}
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,23 @@
}
},
"dependencies": {
"@embroider/addon-shim": "^1.8.6",
"@embroider/addon-shim": "^1.8.7",
"decorator-transforms": "^1.0.1",
"ember-element-helper": "^0.6.1",
"ember-modifier": "^3.2.7",
"ember-resize-observer-service": "^1.1.0",
"ember-test-selectors": "^6.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/plugin-proposal-decorators": "^7.22.15",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-class-static-block": "^7.22.11",
"@babel/plugin-transform-typescript": "^7.22.15",
"@babel/runtime": "^7.23.2",
"@embroider/addon-dev": "^4.1.1",
"@babel/core": "^7.23.6",
"@babel/plugin-transform-typescript": "^7.23.6",
"@babel/runtime": "^7.23.6",
"@embroider/addon-dev": "^4.1.3",
"@rollup/plugin-babel": "^6.0.4",
"@tsconfig/ember": "^2.0.0",
"babel-plugin-ember-template-compilation": "^2.2.1",
"concurrently": "^7.6.0",
"rollup": "^4.3.0",
"rollup": "^4.9.1",
"rollup-plugin-copy": "^3.5.0",
"typescript": "^4.9.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": true,
"declarationDir": "declarations"
"declarationDir": "declarations",
"rootDir": "./src"
},
"include": [
"src/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!

import '@glint/environment-ember-loose';
// import '@glint/environment-ember-template-imports';

declare module '@glint/environment-ember-loose/registry' {
// Remove this once entries have been added! 👇
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
{
"plugins": [
"@embroider/addon-dev/template-colocation-plugin",
"@babel/plugin-transform-class-static-block",
[
"babel-plugin-ember-template-compilation",
{
"targetFormat": "hbs",
"transforms": []
}
],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-transform-class-properties"
[
"module:decorator-transforms",
{
"runtime": {
"import": "decorator-transforms/runtime"
}
}
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -53,23 +53,21 @@
}
},
"dependencies": {
"@embroider/addon-shim": "^1.8.6",
"@embroider/addon-shim": "^1.8.7",
"decorator-transforms": "^1.0.1",
"ember-element-helper": "^0.6.1",
"ember-modifier": "^3.2.7",
"ember-resize-observer-service": "^1.1.0",
"ember-test-selectors": "^6.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/plugin-proposal-decorators": "^7.20.7",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-class-static-block": "^7.22.11",
"@babel/runtime": "^7.23.2",
"@embroider/addon-dev": "^4.1.1",
"@babel/core": "^7.23.6",
"@babel/runtime": "^7.23.6",
"@embroider/addon-dev": "^4.1.3",
"@rollup/plugin-babel": "^6.0.4",
"babel-plugin-ember-template-compilation": "^2.2.1",
"concurrently": "^7.6.0",
"rollup": "^4.3.0",
"rollup": "^4.9.1",
"rollup-plugin-copy": "^3.5.0"
},
"engines": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
}
],
"@embroider/addon-dev/template-colocation-plugin",
"@babel/plugin-transform-class-static-block",
[
"babel-plugin-ember-template-compilation",
{
"targetFormat": "hbs",
"transforms": []
}
],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-transform-class-properties"
[
"module:decorator-transforms",
{
"runtime": {
"import": "decorator-transforms/runtime"
}
}
]
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -58,25 +58,23 @@
}
},
"dependencies": {
"@embroider/addon-shim": "^1.8.6",
"@embroider/addon-shim": "^1.8.7",
"decorator-transforms": "^1.0.1",
"ember-element-helper": "^0.6.1",
"ember-modifier": "^3.2.7",
"ember-resize-observer-service": "^1.1.0",
"ember-test-selectors": "^6.0.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/plugin-proposal-decorators": "^7.22.15",
"@babel/plugin-transform-class-properties": "^7.22.5",
"@babel/plugin-transform-class-static-block": "^7.22.11",
"@babel/plugin-transform-typescript": "^7.22.15",
"@babel/runtime": "^7.23.2",
"@embroider/addon-dev": "^4.1.1",
"@babel/core": "^7.23.6",
"@babel/plugin-transform-typescript": "^7.23.6",
"@babel/runtime": "^7.23.6",
"@embroider/addon-dev": "^4.1.3",
"@rollup/plugin-babel": "^6.0.4",
"@tsconfig/ember": "^2.0.0",
"babel-plugin-ember-template-compilation": "^2.2.1",
"concurrently": "^7.6.0",
"rollup": "^4.3.0",
"rollup": "^4.9.1",
"rollup-plugin-copy": "^3.5.0",
"typescript": "^4.9.4"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"compilerOptions": {
"allowImportingTsExtensions": true,
"allowJs": true,
"declarationDir": "declarations"
"declarationDir": "declarations",
"rootDir": "./src"
},
"include": [
"src/**/*",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// These will *not* be published as part of your addon, so be careful that your published code does not rely on them!

import '@glint/environment-ember-loose';
// import '@glint/environment-ember-template-imports';

declare module '@glint/environment-ember-loose/registry' {
// Remove this once entries have been added! 👇
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,20 @@
}
],
"@embroider/addon-dev/template-colocation-plugin",
"@babel/plugin-transform-class-static-block",
[
"babel-plugin-ember-template-compilation",
{
"targetFormat": "hbs",
"transforms": []
}
],
["@babel/plugin-proposal-decorators", { "version": "legacy" }],
"@babel/plugin-transform-class-properties"
[
"module:decorator-transforms",
{
"runtime": {
"import": "decorator-transforms/runtime"
}
}
]
]
}
Loading

0 comments on commit 80509eb

Please sign in to comment.