aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md2
-rw-r--r--docs/contributing/submit-a-pull-request.md2
-rw-r--r--docs/guide/index.md6
-rw-r--r--package.json14
-rw-r--r--test/require.spec.cts4
-rw-r--r--tsup.config.ts4
6 files changed, 14 insertions, 18 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 6ed2806b..1a06d7aa 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -23,7 +23,7 @@ This is a shorthand for running the following scripts in order:
- `pnpm run format` - runs [prettify](https://github.com/prettier/prettier) to format code
- `pnpm run lint` - runs [ESLint](https://github.com/eslint/eslint) to enforce project code standards
- `pnpm run build:clean` - removes artifacts from previous builds
-- `pnpm run build:code` - builds the code, both CommonJS and ESM versions
+- `pnpm run build:code` - builds the code
- `pnpm run test:update-snapshots` - runs all tests, and updates any snapshots if needed
- `pnpm run ts-check` - checks that there are no TypeScript errors in any files
diff --git a/docs/contributing/submit-a-pull-request.md b/docs/contributing/submit-a-pull-request.md
index df8f4cdf..949151e5 100644
--- a/docs/contributing/submit-a-pull-request.md
+++ b/docs/contributing/submit-a-pull-request.md
@@ -45,7 +45,7 @@ It is a shorthand for running the following scripts in order:
- `pnpm run format` - runs [prettier](https://github.com/prettier/prettier) to format code
- `pnpm run lint` - runs [ESLint](https://github.com/eslint/eslint) to enforce project code standards
- `pnpm run build:clean` - removes artifacts from previous builds
-- `pnpm run build:code` - builds the code, both CommonJS and ESM versions
+- `pnpm run build:code` - builds the code
- `pnpm run test:update-snapshots` - runs all tests with [vitest](https://github.com/vitest-dev/vitest), and updates any snapshots if needed
- `pnpm run ts-check` - checks that there are no TypeScript errors in any files
diff --git a/docs/guide/index.md b/docs/guide/index.md
index ef0d6117..46b41fbc 100644
--- a/docs/guide/index.md
+++ b/docs/guide/index.md
@@ -15,7 +15,11 @@ This documentation only covers the JavaScript implementation of Faker.
## Environments
-You can run Faker in the browser, or in Node.js. Faker v9.0 requires Node.js version 18 or above. Both ESM and CommonJS imports are available.
+You can run Faker in the browser, or in Node.js. Faker v10.0 requires Node.js version 20 or above.
+
+::: tip Note
+When using CJS, you need to use at least Node.js v20.19. See https://nodejs.org/api/modules.html#loading-ecmascript-modules-using-require
+:::
## Installation
diff --git a/package.json b/package.json
index 661fdadd..75e6f2a4 100644
--- a/package.json
+++ b/package.json
@@ -67,20 +67,12 @@
"type": "module",
"exports": {
".": {
- "require": {
- "types": "./dist/index.d.cts",
- "default": "./dist/index.cjs"
- },
"default": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
}
},
"./locale/*": {
- "require": {
- "types": "./dist/locale/*.d.cts",
- "default": "./dist/locale/*.cjs"
- },
"default": {
"types": "./dist/locale/*.d.ts",
"default": "./dist/locale/*.js"
@@ -88,7 +80,7 @@
},
"./package.json": "./package.json"
},
- "main": "dist/index.cjs",
+ "main": "dist/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"typesVersions": {
@@ -145,8 +137,8 @@
},
"packageManager": "[email protected]",
"engines": {
- "node": ">=18.0.0",
- "npm": ">=9.0.0"
+ "node": ">=20.19",
+ "npm": ">=10"
},
"pnpm": {
"ignoredBuiltDependencies": [
diff --git a/test/require.spec.cts b/test/require.spec.cts
index 80f708d9..c4e0d133 100644
--- a/test/require.spec.cts
+++ b/test/require.spec.cts
@@ -1,5 +1,5 @@
const { describe, expect, it, vi } = await import('vitest');
-const { allLocales, SimpleFaker } = require('../dist/index.cjs');
+const { allLocales, SimpleFaker } = require('../dist/index.js');
describe('require (cjs)', () => {
describe.each(
@@ -9,7 +9,7 @@ describe('require (cjs)', () => {
)
)('locale imports', (locale) => {
it(`should be possible to directly require('@faker-js/faker/locale/${locale}')`, () => {
- const { faker } = require(`../dist/locale/${locale}.cjs`);
+ const { faker } = require(`../dist/locale/${locale}.js`);
expect(faker).toBeDefined();
expect(faker.string.alpha()).toBeTypeOf('string');
diff --git a/tsup.config.ts b/tsup.config.ts
index 214eb718..bf4c259f 100644
--- a/tsup.config.ts
+++ b/tsup.config.ts
@@ -8,8 +8,8 @@ export default defineConfig({
],
outDir: 'dist',
clean: true,
- format: ['esm', 'cjs'],
- target: ['es2022', 'node18'],
+ format: 'esm',
+ target: ['es2023', 'node20.11'],
dts: true,
minify: true,
sourcemap: false,