Skip to content

Commit 86e90ce

Browse files
authored
👷 Move build chain to ESM
Superseed #4592
1 parent e129bb3 commit 86e90ce

File tree

6 files changed

+19
-19
lines changed

6 files changed

+19
-19
lines changed

packages/fast-check/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Here are the minimal requirements to use fast-check properly without any polyfil
118118

119119
| fast-check | node | ECMAScript version | _TypeScript (optional)_ |
120120
| ---------- | ------------------- | ------------------ | ----------------------- |
121-
| **4.x** |10.5.0 | ES2020 | ≥5.0 |
121+
| **4.x** |12.17.0 | ES2020 | ≥5.0 |
122122
| **3.x** | ≥8<sup>(1)</sup> | ES2017 | ≥4.1<sup>(2)</sup> |
123123
| **2.x** | ≥8<sup>(1)</sup> | ES2017 | ≥3.2<sup>(3)</sup> |
124124
| **1.x** | ≥0.12<sup>(1)</sup> | ES3 | ≥3.0<sup>(3)</sup> |
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "commonjs"
3+
}

packages/fast-check/package.esm-template.json

-3
This file was deleted.

packages/fast-check/package.json

+10-10
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,22 @@
22
"name": "fast-check",
33
"version": "3.23.2",
44
"description": "Property based testing framework for JavaScript (like QuickCheck)",
5-
"type": "commonjs",
5+
"type": "module",
66
"main": "lib/fast-check.js",
77
"exports": {
88
"./package.json": "./package.json",
99
".": {
1010
"require": {
11-
"types": "./lib/types/fast-check.d.ts",
12-
"default": "./lib/fast-check.js"
11+
"types": "./lib/cjs/types/fast-check.d.ts",
12+
"default": "./lib/cjs/fast-check.js"
1313
},
1414
"import": {
15-
"types": "./lib/esm/types/fast-check.d.ts",
16-
"default": "./lib/esm/fast-check.js"
15+
"types": "./lib/types/fast-check.d.ts",
16+
"default": "./lib/fast-check.js"
1717
}
1818
}
1919
},
20-
"module": "lib/esm/fast-check.js",
20+
"module": "lib/fast-check.js",
2121
"types": "lib/types/fast-check.d.ts",
2222
"files": [
2323
"lib",
@@ -28,15 +28,15 @@
2828
"scripts": {
2929
"build": "yarn build:publish-cjs && yarn build:publish-esm && yarn build:publish-types && node postbuild/main.mjs",
3030
"build-ci": "cross-env EXPECT_GITHUB_SHA=true yarn build",
31-
"build:publish-types": "tsc -p tsconfig.publish.types.json && tsc -p tsconfig.publish.types.json --outDir lib/esm/types",
32-
"build:publish-cjs": "tsc -p tsconfig.publish.json",
33-
"build:publish-esm": "tsc -p tsconfig.publish.json --module es2015 --moduleResolution node --outDir lib/esm && cp package.esm-template.json lib/esm/package.json",
31+
"build:publish-types": "tsc -p tsconfig.publish.types.json && tsc -p tsconfig.publish.types.json --outDir lib/cjs/types",
32+
"build:publish-cjs": "tsc -p tsconfig.publish.json --outDir lib/cjs && cp package.cjs-template.json lib/cjs/package.json",
33+
"build:publish-esm": "tsc -p tsconfig.publish.json --module es2015 --moduleResolution node",
3434
"typecheck": "tsc --noEmit",
3535
"test": "vitest --config vitest.unit.config.mjs",
3636
"e2e": "vitest --config vitest.e2e.config.mjs",
3737
"update:documentation": "cross-env UPDATE_CODE_SNIPPETS=true vitest --config vitest.documentation.config.mjs",
3838
"test-bundle": "node test-bundle/run.cjs && node test-bundle/run.mjs && node test-bundle/run-advanced.cjs",
39-
"test-legacy-bundle": "nvs add 10.5 && $(nvs which 10.5) test-bundle/run.cjs && $(nvs which 10.5) test-bundle/run-advanced.cjs",
39+
"test-legacy-bundle": "nvs add 12.17 && $(nvs which 12.17) test-bundle/run.cjs && $(nvs which 12.17) test-bundle/run-advanced.cjs",
4040
"docs": "api-extractor run --local && rm docs/fast-check.api.json && typedoc --out docs src/fast-check-default.ts && node postbuild/main.mjs",
4141
"docs-ci": "cross-env EXPECT_GITHUB_SHA=true yarn docs",
4242
"docs:serve": "yarn dlx serve docs/"

packages/fast-check/postbuild/main.mjs

+4-4
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fs.readFile(path.join(__dirname, '../package.json'), (err, data) => {
3636
const packageVersion = JSON.parse(data.toString()).version;
3737

3838
const commonJsReplacement = replaceInFileSync({
39-
files: 'lib/fast-check-default.js',
39+
files: 'lib/cjs/fast-check-default.js',
4040
from: [/__PACKAGE_TYPE__/g, /__PACKAGE_VERSION__/g, /__COMMIT_HASH__/g],
4141
to: ['commonjs', packageVersion, commitHash],
4242
});
@@ -45,7 +45,7 @@ fs.readFile(path.join(__dirname, '../package.json'), (err, data) => {
4545
}
4646

4747
const moduleReplacement = replaceInFileSync({
48-
files: 'lib/esm/fast-check-default.js',
48+
files: 'lib/fast-check-default.js',
4949
from: [/__PACKAGE_TYPE__/g, /__PACKAGE_VERSION__/g, /__COMMIT_HASH__/g],
5050
to: ['module', packageVersion, commitHash],
5151
});
@@ -54,7 +54,7 @@ fs.readFile(path.join(__dirname, '../package.json'), (err, data) => {
5454
}
5555

5656
const dTsReplacement = replaceInFileSync({
57-
files: 'lib/types/fast-check-default.d.ts',
57+
files: 'lib/cjs/types/fast-check-default.d.ts',
5858
from: [/__PACKAGE_VERSION__/g, /__COMMIT_HASH__/g],
5959
to: [packageVersion, commitHash],
6060
});
@@ -63,7 +63,7 @@ fs.readFile(path.join(__dirname, '../package.json'), (err, data) => {
6363
}
6464

6565
const dTsReplacement2 = replaceInFileSync({
66-
files: 'lib/esm/types/fast-check-default.d.ts',
66+
files: 'lib/types/fast-check-default.d.ts',
6767
from: [/__PACKAGE_VERSION__/g, /__COMMIT_HASH__/g],
6868
to: [packageVersion, commitHash],
6969
});

website/docs/migration/from-3.x-to-4.x.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Simple migration guide to fast-check v4 starting from fast-check v3
1111

1212
| Name | New requirement | Previous requirement |
1313
| ------------------------ | --------------- | -------------------- |
14-
| Node |10.5.0 | ≥8 |
14+
| Node |12.17.0 | ≥8 |
1515
| ECMAScript specification | ES2020 | ES2017 |
1616
| TypeScript _(optional)_ | ≥5.0 | ≥4.1 |
1717

0 commit comments

Comments
 (0)