Skip to content

Commit

Permalink
chore: ensure all exported files have a consistent filename (#12329)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB committed Feb 9, 2022
1 parent b4d373e commit f6c809b
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 8 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -10,6 +10,8 @@
### Chore & Maintenance

- `[*]` [**BREAKING**] Drop support for Node v10 and v15 and target first LTS `16.13.0` ([#12220](https://github.com/facebook/jest/pull/12220))
- `[@jest/core]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))
- `[jest]` Use `index.ts` instead of `jest.ts` as main export ([#12329](https://github.com/facebook/jest/pull/12329))

### Performance

Expand Down
8 changes: 4 additions & 4 deletions packages/jest-core/package.json
Expand Up @@ -2,12 +2,12 @@
"name": "@jest/core",
"description": "Delightful JavaScript Testing.",
"version": "27.5.1",
"main": "./build/jest.js",
"types": "./build/jest.d.ts",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/jest.d.ts",
"default": "./build/jest.js"
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json"
},
Expand Down
File renamed without changes.
8 changes: 4 additions & 4 deletions packages/jest/package.json
Expand Up @@ -2,12 +2,12 @@
"name": "jest",
"description": "Delightful JavaScript Testing.",
"version": "27.5.1",
"main": "./build/jest.js",
"types": "./build/jest.d.ts",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/jest.d.ts",
"default": "./build/jest.js"
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json",
"./bin/jest": "./bin/jest.js"
Expand Down
File renamed without changes.
19 changes: 19 additions & 0 deletions scripts/buildUtils.js
Expand Up @@ -74,6 +74,25 @@ module.exports.getPackages = function getPackages() {
`Package "${pkg.name}" does not export correct files`,
);

if (pkg.types) {
assert.strictEqual(
pkg.main,
'./build/index.js',
`Package "${pkg.name}" should have "./build/index.js" as main`,
);
assert.strictEqual(
pkg.types,
'./build/index.d.ts',
`Package "${pkg.name}" should have "./build/index.d.ts" as types`,
);
} else {
assert.strictEqual(
pkg.main,
'./index.js',
`Package "${pkg.name}" should have "./index.js" as main`,
);
}

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

0 comments on commit f6c809b

Please sign in to comment.