Skip to content

Commit 539cb48

Browse files
Merge pull request #283 from ember-cli/remove-triple-slash-references
Remove /// <reference types='ember-sources/types
2 parents e5b62da + 27bced6 commit 539cb48

3 files changed

Lines changed: 377 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.2",
9391
"npm-run-all": "^4.1.5",
9492
"prettier": "^3.1.1",
9593
"rollup": "^4.9.1",

addon/rollup.config.mjs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { babel } from '@rollup/plugin-babel';
22
import { Addon } from '@embroider/addon-dev/rollup';
3+
import { execaCommand } from 'execa';
4+
import { fixBadDeclarationOutput } from 'fix-bad-declaration-output';
35

46
const addon = new Addon({
57
srcDir: 'src',
@@ -41,5 +43,29 @@ export default {
4143

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

0 commit comments

Comments
 (0)