Skip to content

Commit

Permalink
Merge pull request #283 from ember-cli/remove-triple-slash-references
Browse files Browse the repository at this point in the history
Remove /// <reference types='ember-sources/types
  • Loading branch information
NullVoxPopuli committed Jan 23, 2024
2 parents e5b62da + 27bced6 commit 539cb48
Show file tree
Hide file tree
Showing 3 changed files with 377 additions and 6 deletions.
10 changes: 4 additions & 6 deletions addon/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,18 +46,14 @@
],
"repository": "https://github.com/ember-cli/ember-page-title",
"scripts": {
"build": "concurrently 'npm:build:*'",
"build:js": "rollup --config",
"build:types": "glint --declaration",
"build": "rollup --config",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
"lint:js": "eslint . --cache",
"lint:js:fix": "eslint . --fix",
"lint:types": "glint --declaration",
"prepack": "rollup --config",
"start": "concurrently 'npm:start:*'",
"start:js": "rollup --config --watch --no-watch.clearScreen",
"start:types": "glint --declaration --watch"
"start": "rollup --config --watch --no-watch.clearScreen"
},
"dependencies": {
"@embroider/addon-shim": "^1.8.7",
Expand Down Expand Up @@ -90,6 +86,8 @@
"eslint-plugin-jsonc": "^2.11.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^5.1.2",
"execa": "^8.0.1",
"fix-bad-declaration-output": "^1.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^3.1.1",
"rollup": "^4.9.1",
Expand Down
26 changes: 26 additions & 0 deletions addon/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { babel } from '@rollup/plugin-babel';
import { Addon } from '@embroider/addon-dev/rollup';
import { execaCommand } from 'execa';
import { fixBadDeclarationOutput } from 'fix-bad-declaration-output';

const addon = new Addon({
srcDir: 'src',
Expand Down Expand Up @@ -41,5 +43,29 @@ export default {

// Remove leftover build artifacts when starting a new build.
addon.clean(),

{
name: 'fix-bad-declaration-output',
closeBundle: async () => {
/**
* Generate the types (these include /// <reference types="ember-source/types"
* but our consumers may not be using those, or have a new enough ember-source that provides them.
*/
console.log('Building types');
await execaCommand(`pnpm glint --declaration`, { stdio: 'inherit' });
/**
* https://github.com/microsoft/TypeScript/issues/56571#
* README: https://github.com/NullVoxPopuli/fix-bad-declaration-output
*/
console.log('Fixing types');
await fixBadDeclarationOutput('declarations/**/*.d.ts', [
'TypeScript#56571',
'Glint#628',
]);
console.log(
'⚠️ Dangerously (but neededly) fixed bad declaration output from typescript',
);
},
},
],
};

0 comments on commit 539cb48

Please sign in to comment.