Skip to content

Commit 6192935

Browse files
authored
Corrected the addon file locations for TypeScript projects (#90)
* bugfix: Replaced .js with .ts in publicEntrypoints() * chore: Updated fixtures * chore: Added fixtures (hello-world) to test addon-test-support * bugfix: Created the barrel file for test-support --------- Co-authored-by: ijlee2 <[email protected]>
1 parent b03f3eb commit 6192935

File tree

151 files changed

+2025
-39
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

151 files changed

+2025
-39
lines changed

src/blueprints/ember-addon/__addonLocation__/rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
// up your addon's public API. Also make sure your package.json#exports
2121
// is aligned to the config here.
2222
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
23-
addon.publicEntrypoints(['**/*.js', 'index.js'<% if (options.packages.addon.hasGlint) {%>, 'template-registry.js'<% } %>]),
23+
<% if (options.packages.addon.hasTypeScript) { %>addon.publicEntrypoints(['**/*.js', 'index.ts'<% if (options.packages.addon.hasGlint) {%>, 'template-registry.ts'<% } %>]),<% } else { %>addon.publicEntrypoints(['**/*.js', 'index.js']),<% } %>
2424

2525
// These are the modules that should get reexported into the traditional
2626
// "app" tree. Things in here should also be in publicEntrypoints above, but

src/steps/move-addon-files.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,19 @@ function moveAddonFolder(options: Options): void {
2525
function moveAddonTestSupportFolder(options: Options): void {
2626
const { locations, projectRoot } = options;
2727

28-
const filePaths = findFiles('addon-test-support/**/*', {
28+
let filePaths = findFiles('addon-test-support/index.{js,ts}', {
29+
projectRoot,
30+
});
31+
32+
if (filePaths.length === 1) {
33+
const oldPath = filePaths[0]!;
34+
const newPath = `${locations.addon}/src/test-support${oldPath.endsWith('.ts') ? '.ts' : 'js'}`;
35+
36+
moveFiles(new Map([[oldPath, newPath]]), options);
37+
}
38+
39+
filePaths = findFiles('addon-test-support/**/*', {
40+
ignoreList: ['addon-test-support/index.{js,ts}'],
2941
projectRoot,
3042
});
3143

tests/fixtures/ember-container-query-customizations/input/tests/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function setupApplicationTest(
3434
// This is also a good place to call test setup functions coming
3535
// from other addons:
3636
//
37-
// setupIntl(hooks); // ember-intl
37+
// setupIntl(hooks, 'en-us'); // ember-intl
3838
// setupMirage(hooks); // ember-cli-mirage
3939
}
4040

tests/fixtures/ember-container-query-customizations/output/demo-app/tests/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function setupApplicationTest(
3434
// This is also a good place to call test setup functions coming
3535
// from other addons:
3636
//
37-
// setupIntl(hooks); // ember-intl
37+
// setupIntl(hooks, 'en-us'); // ember-intl
3838
// setupMirage(hooks); // ember-cli-mirage
3939
}
4040

tests/fixtures/ember-container-query-customizations/output/packages/ember-container-query/rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
// up your addon's public API. Also make sure your package.json#exports
2121
// is aligned to the config here.
2222
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
23-
addon.publicEntrypoints(['**/*.js', 'index.js', 'template-registry.js']),
23+
addon.publicEntrypoints(['**/*.js', 'index.ts', 'template-registry.ts']),
2424

2525
// These are the modules that should get reexported into the traditional
2626
// "app" tree. Things in here should also be in publicEntrypoints above, but

tests/fixtures/ember-container-query-glint/input/tests/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function setupApplicationTest(
3434
// This is also a good place to call test setup functions coming
3535
// from other addons:
3636
//
37-
// setupIntl(hooks); // ember-intl
37+
// setupIntl(hooks, 'en-us'); // ember-intl
3838
// setupMirage(hooks); // ember-cli-mirage
3939
}
4040

tests/fixtures/ember-container-query-glint/output/ember-container-query/rollup.config.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ export default {
2020
// up your addon's public API. Also make sure your package.json#exports
2121
// is aligned to the config here.
2222
// See https://github.com/embroider-build/embroider/blob/main/docs/v2-faq.md#how-can-i-define-the-public-exports-of-my-addon
23-
addon.publicEntrypoints(['**/*.js', 'index.js', 'template-registry.js']),
23+
addon.publicEntrypoints(['**/*.js', 'index.ts', 'template-registry.ts']),
2424

2525
// These are the modules that should get reexported into the traditional
2626
// "app" tree. Things in here should also be in publicEntrypoints above, but

tests/fixtures/ember-container-query-glint/output/test-app/tests/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function setupApplicationTest(
3434
// This is also a good place to call test setup functions coming
3535
// from other addons:
3636
//
37-
// setupIntl(hooks); // ember-intl
37+
// setupIntl(hooks, 'en-us'); // ember-intl
3838
// setupMirage(hooks); // ember-cli-mirage
3939
}
4040

tests/fixtures/ember-container-query-javascript/input/tests/helpers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function setupApplicationTest(hooks, options) {
2626
// This is also a good place to call test setup functions coming
2727
// from other addons:
2828
//
29-
// setupIntl(hooks); // ember-intl
29+
// setupIntl(hooks, 'en-us'); // ember-intl
3030
// setupMirage(hooks); // ember-cli-mirage
3131
}
3232

tests/fixtures/ember-container-query-javascript/output/test-app/tests/helpers/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function setupApplicationTest(hooks, options) {
2626
// This is also a good place to call test setup functions coming
2727
// from other addons:
2828
//
29-
// setupIntl(hooks); // ember-intl
29+
// setupIntl(hooks, 'en-us'); // ember-intl
3030
// setupMirage(hooks); // ember-cli-mirage
3131
}
3232

0 commit comments

Comments
 (0)