Skip to content

Commit

Permalink
refactor: replace shell with node for type fixup (#486)
Browse files Browse the repository at this point in the history
  • Loading branch information
wkillerud authored Jul 12, 2024
1 parent db7d511 commit 96bee00
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
run: npm run lint

- name: npm types
if: runner.os != 'Windows' # because of ./fixup.sh
run: npm run types

- name: npm test
Expand Down
19 changes: 19 additions & 0 deletions fixup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import fs from 'node:fs';
import path from 'node:path';

let module = path.join(process.cwd(), 'types', 'layout.d.ts');

fs.writeFileSync(
module,
/* ts */ `
declare global {
namespace Express {
export interface Response {
podiumSend(fragment: string, ...args: unknown[]): Response;
}
}
}
${fs.readFileSync(module, 'utf-8')}`,
'utf-8',
);
12 changes: 0 additions & 12 deletions fixup.sh

This file was deleted.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
"test:unit": "tap --disable-coverage --allow-empty-coverage",
"test:types": "tsc --project tsconfig.test.json",
"test:snapshots": "tap --snapshot --disable-coverage --allow-empty-coverage",
"types": "tsc --declaration --emitDeclarationOnly && ./fixup.sh"
"types": "run-s types:tsc types:fixup",
"types:tsc": "tsc --declaration --emitDeclarationOnly",
"types:fixup": "node ./fixup.js"
},
"dependencies": {
"@metrics/client": "2.5.2",
Expand Down

0 comments on commit 96bee00

Please sign in to comment.