Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove /// <reference types='ember-sources/types #283

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
);
},
},
],
};
Loading
Loading