Skip to content

Commit 6b8e7d6

Browse files
committed
Remove /// <reference types='ember-sources/types
1 parent e5b62da commit 6b8e7d6

3 files changed

Lines changed: 432 additions & 6 deletions

File tree

addon/package.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,14 @@
4646
],
4747
"repository": "https://github.com/ember-cli/ember-page-title",
4848
"scripts": {
49-
"build": "concurrently 'npm:build:*'",
50-
"build:js": "rollup --config",
51-
"build:types": "glint --declaration",
49+
"build": "rollup --config",
5250
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
5351
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
5452
"lint:js": "eslint . --cache",
5553
"lint:js:fix": "eslint . --fix",
5654
"lint:types": "glint --declaration",
5755
"prepack": "rollup --config",
58-
"start": "concurrently 'npm:start:*'",
59-
"start:js": "rollup --config --watch --no-watch.clearScreen",
60-
"start:types": "glint --declaration --watch"
56+
"start": "rollup --config --watch --no-watch.clearScreen"
6157
},
6258
"dependencies": {
6359
"@embroider/addon-shim": "^1.8.7",
@@ -90,6 +86,8 @@
9086
"eslint-plugin-jsonc": "^2.11.2",
9187
"eslint-plugin-node": "^11.1.0",
9288
"eslint-plugin-prettier": "^5.1.2",
89+
"execa": "^8.0.1",
90+
"fix-bad-declaration-output": "^1.0.1",
9391
"npm-run-all": "^4.1.5",
9492
"prettier": "^3.1.1",
9593
"rollup": "^4.9.1",

addon/rollup.config.mjs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { babel } from '@rollup/plugin-babel';
22
import { Addon } from '@embroider/addon-dev/rollup';
3+
import { execaCommand } from 'execa';
34

45
const addon = new Addon({
56
srcDir: 'src',
@@ -41,5 +42,31 @@ export default {
4142

4243
// Remove leftover build artifacts when starting a new build.
4344
addon.clean(),
45+
46+
{
47+
name: 'fix-bad-declaration-output',
48+
closeBundle: async () => {
49+
/**
50+
* Generate the types (these include /// <reference types="ember-source/types"
51+
* but our consumers may not be using those, or have a new enough ember-source that provides them.
52+
*/
53+
console.log('Building types');
54+
await execaCommand(`pnpm glint --declaration`, { stdio: 'inherit' });
55+
/**
56+
* https://github.com/microsoft/TypeScript/issues/56571#
57+
* README: https://github.com/NullVoxPopuli/fix-bad-declaration-output
58+
*/
59+
console.log('Fixing types');
60+
await execaCommand(
61+
`pnpm fix-bad-declaration-output declarations/**/*.d.ts`,
62+
{
63+
stdio: 'inherit',
64+
},
65+
);
66+
console.log(
67+
'⚠️ Dangerously (but neededly) fixed bad declaration output from typescript',
68+
);
69+
},
70+
},
4471
],
4572
};

0 commit comments

Comments
 (0)