Skip to content

Commit

Permalink
fix: remove empty d.ts-modules from builded package
Browse files Browse the repository at this point in the history
  • Loading branch information
uid11 committed Nov 5, 2023
1 parent 820ef16 commit a1d8e97
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,11 @@
"postbuild": "npm run build:rename && npm run build:remove && npm run build:copy && npm run build:esm && npm run build:init",
"prebuild:rename": "mkdir --parents ./build/node_modules",
"build:rename": "mv ./build/src ./build/node_modules/e2ed",
"build:remove": "find ./build/node_modules/e2ed/types/ -wholename *.js -exec rm {} \\;",
"build:remove": "npm run build:remove:empty-d-ts && npm run build:remove:types-js",
"build:remove:empty-d-ts": "find ./build/node_modules/e2ed/ -name *.d.ts -size 11c -exec rm {} \\;",
"build:remove:types-js": "find ./build/node_modules/e2ed/types/ -name *.js -exec rm {} \\;",
"postbuild:remove": "touch ./build/node_modules/e2ed/types/index.js",
"build:copy": "npm run build:copy:bin && npm run build:copy:scripts && npm run build:copy:meta && npm run build:copy:example && npm run build:copy:tsconfig",
"prebuild:copy:bin": "rm -r ./build/node_modules/e2ed/bin/*.d.ts",
"build:copy:bin": "cp ./bin/dockerEntrypoint.sh ./build/node_modules/e2ed/bin",
"postbuild:copy:bin": "npm run make:executable build/node_modules/e2ed/bin/init.js build/node_modules/e2ed/bin/localEntrypoint.js build/node_modules/e2ed/bin/runE2edInDockerEnvironment.js",
"build:copy:scripts": "cp ./build/scripts/*.js ./build",
Expand Down
6 changes: 6 additions & 0 deletions src/types/extends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,9 @@ declare module 'testcafe-without-typecheck' {
}
}
}

/**
* We add export so that the `d.ts`-module from this file does not remain empty
* after build and was not removed (since TypeScript will leave a `reference` to it).
*/
export type ModuleShouldNotBeEmpty = 0;

0 comments on commit a1d8e97

Please sign in to comment.