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

Fix superfluous triple-slash declarations #565

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: wyvox/action@v1
- uses: wyvox/action@v1.1.5
with:
pnpm-args: --frozen-lockfile

Expand All @@ -36,7 +36,7 @@ jobs:
browser: [chrome, firefox]

steps:
- uses: wyvox/action@v1
- uses: wyvox/action@v1.1.5
with:
pnpm-args: --frozen-lockfile

Expand All @@ -54,7 +54,7 @@ jobs:
browser: [chrome, firefox]

steps:
- uses: wyvox/action@v1
- uses: wyvox/action@v1.1.5
with:
pnpm-args: --frozen-lockfile

Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
allow-failure: true

steps:
- uses: wyvox/action@v1
- uses: wyvox/action@v1.1.5
with:
pnpm-args: --frozen-lockfile

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
name: Deploy
runs-on: ubuntu-latest
steps:
- uses: wyvox/action@v1
- uses: wyvox/action@v1.1.5
with:
pnpm-args: --frozen-lockfile

Expand Down
33 changes: 18 additions & 15 deletions packages/ember-concurrency/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@
"version": "4.0.0",
"description": "Improved concurrency/async primitives for Ember.js",
"scripts": {
"build": "concurrently 'npm:build:*'",
"build:js": "rollup --config",
"build:types": "glint --declaration && cp src/index.d.ts declarations/index.d.ts",
"build": "rollup --config",
"lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
"lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
"lint:hbs": "ember-template-lint .",
Expand All @@ -15,20 +13,28 @@
"lint:prettier": "prettier . --cache --check",
"lint:prettier:fix": "prettier . --write",
"lint:types": "glint",
"start": "concurrently 'npm:start:*'",
"start:js": "rollup --config --watch --no-watch.clearScreen",
"start:types": "glint --declaration --watch",
"start": "rollup --config --watch --no-watch.clearScreen",
"test": "echo 'Addon does not have tests, run tests in test-app'",
"prepare": "pnpm build"
},
"pnpm": {
"overrides": {
"@babel/plugin-transform-typescript": "^7.23.6"
}
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.12.13",
"@babel/types": "^7.12.13",
"decorator-transforms": "^1.0.1",
"@embroider/addon-shim": "^1.8.7",
"execa": "^8.0.1",
"fix-bad-declaration-output": "^1.0.2"
},
"peerDependencies": {
"ember-source": "^3.28.0 || ^4.0.0 || >=5.0.0",
"@glimmer/tracking": "^1.1.2",
"@glint/template": ">= 1.0.0"
},
"engines": {
"node": "16.* || >= 18"
},
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/plugin-proposal-class-properties": "^7.18.6",
Expand All @@ -55,6 +61,9 @@
"rollup-plugin-copy": "^3.5.0",
"typescript": "^5.3.3"
},
"engines": {
"node": "16.* || >= 18"
},
"files": [
"addon-main.cjs",
"dist",
Expand Down Expand Up @@ -95,12 +104,6 @@
"doc": "doc",
"test": "tests"
},
"dependencies": {
"@babel/helper-plugin-utils": "^7.12.13",
"@babel/types": "^7.12.13",
"decorator-transforms": "^1.0.1",
"@embroider/addon-shim": "^1.8.7"
},
"ember": {
"version": 2,
"app-js": "./app"
Expand Down
34 changes: 34 additions & 0 deletions packages/ember-concurrency/rollup.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import babel from "@rollup/plugin-babel";
import copy from "rollup-plugin-copy";
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 @@ -51,5 +53,37 @@ export default {
{ src: "../../LICENSE.md", dest: "." },
],
}),

{
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" });

/**
* Copy our homegrown index.d.ts over to declarations;
* NOTE: I _think_ `glint --declaration` should already be doing this, possible bug?
*/
console.log("Overwriting declarations/index.d.ts with our own");
await execaCommand(`cp ./src/index.d.ts declarations/index.d.ts`, { 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