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

chore: ensure all exported files have a consistent filename #12329

Merged
merged 1 commit into from Feb 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Expand Up @@ -7,6 +7,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