Skip to content

Commit

Permalink
fix: move binary file declaration from runtime to repl (#10925)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Dec 7, 2020
1 parent 09506a3 commit a640584
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Expand Up @@ -51,7 +51,7 @@
- `[jest-haste-map]` [**BREAKING**] Migrate to ESM ([#10875](https://github.com/facebook/jest/pull/10875))
- `[jest-haste-map]` [**BREAKING**] Remove support for deprecated option `ignorePattern` as function ([#10348](https://github.com/facebook/jest/pull/10348))
- `[jest-jasmine2]` [**BREAKING**] Migrate to ESM ([#10906](https://github.com/facebook/jest/pull/10906))
- `[jest-repl, jest-runtime]` [**BREAKING**] Move the `jest-runtime` CLI into `jest-repl` ([#10016](https://github.com/facebook/jest/pull/10016))
- `[jest-repl, jest-runtime]` [**BREAKING**] Move the `jest-runtime` CLI into `jest-repl` ([#10016](https://github.com/facebook/jest/pull/10016) & [#10925](https://github.com/facebook/jest/pull/10925))
- `[jest-resolve]` [**BREAKING**] Migrate to ESM ([#10688](https://github.com/facebook/jest/pull/10688))
- `[jest-resolve-dependencies]` [**BREAKING**] Migrate to ESM ([#10876](https://github.com/facebook/jest/pull/10876))
- `[jest-mock]` [**BREAKING**] Migrate to ESM ([#10887](https://github.com/facebook/jest/pull/10887))
Expand Down
8 changes: 6 additions & 2 deletions packages/jest-repl/package.json
Expand Up @@ -12,7 +12,8 @@
"exports": {
".": "./build/index.js",
"./package.json": "./package.json",
"./bin/jest-repl": "./bin/jest-repl.js"
"./bin/jest-repl": "./bin/jest-repl.js",
"./bin/jest-runtime-cli": "./bin/jest-runtime-cli.js"
},
"dependencies": {
"@jest/console": "^27.0.0-next.0",
Expand All @@ -32,7 +33,10 @@
"@types/yargs": "^15.0.0",
"execa": "^5.0.0"
},
"bin": "./bin/jest-repl.js",
"bin": {
"jest-repl": "./bin/jest-repl.js",
"jest-runtime": "./bin/jest-runtime-cli.js"
},
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
},
Expand Down
4 changes: 1 addition & 3 deletions packages/jest-runtime/package.json
Expand Up @@ -11,8 +11,7 @@
"types": "./build/index.d.ts",
"exports": {
".": "./build/index.js",
"./package.json": "./package.json",
"./bin/jest-runtime": "./bin/jest-runtime.js"
"./package.json": "./package.json"
},
"dependencies": {
"@jest/console": "^27.0.0-next.0",
Expand Down Expand Up @@ -52,7 +51,6 @@
"jest-environment-node": "^27.0.0-next.0",
"jest-snapshot-serializer-raw": "^1.1.0"
},
"bin": "./bin/jest-runtime.js",
"engines": {
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
},
Expand Down
12 changes: 12 additions & 0 deletions scripts/buildUtils.js
Expand Up @@ -55,6 +55,18 @@ module.exports.getPackages = function getPackages() {
},
`Package ${pkg.name} does not export correct files`,
);

if (pkg.bin) {
Object.entries(pkg.bin).forEach(([binName, binPath]) => {
const fullBinPath = path.resolve(packageDir, binPath);

if (!fs.existsSync(fullBinPath)) {
throw new Error(
`Binary in package ${pkg.name} with name "${binName}" at ${binPath} does not exist`,
);
}
});
}
});

return packages;
Expand Down
3 changes: 1 addition & 2 deletions yarn.lock
Expand Up @@ -11988,6 +11988,7 @@ fsevents@^1.2.7:
yargs: ^16.0.3
bin:
jest-repl: ./bin/jest-repl.js
jest-runtime: ./bin/jest-runtime-cli.js
languageName: unknown
linkType: soft

Expand Down Expand Up @@ -12104,8 +12105,6 @@ fsevents@^1.2.7:
slash: ^3.0.0
strip-bom: ^4.0.0
yargs: ^16.0.3
bin:
jest-runtime: ./bin/jest-runtime.js
languageName: unknown
linkType: soft

Expand Down

0 comments on commit a640584

Please sign in to comment.