mirror of
https://github.com/logto-io/logto.git
synced 2024-12-16 20:26:19 -05:00
test: update to native ESM (batch 1)
This commit is contained in:
parent
3db51178a4
commit
1d1e6e3244
15 changed files with 49 additions and 59 deletions
|
@ -25,13 +25,14 @@
|
|||
"precommit": "lint-staged",
|
||||
"prepare:package-json": "node -p \"'export const packageJson = ' + JSON.stringify(require('./package.json'), undefined, 2) + ';'\" > src/package-json.ts",
|
||||
"build": "rimraf lib && pnpm prepare:package-json && tsc -p tsconfig.build.json",
|
||||
"build:test": "rm -rf build/ && tsc -p tsconfig.test.json --sourcemap",
|
||||
"build:test": "rm -rf lib/ && tsc -p tsconfig.test.json --sourcemap",
|
||||
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
|
||||
"start": "node .",
|
||||
"start:dev": "ts-node --files src/index.ts",
|
||||
"start:dev": "pnpm build && node .",
|
||||
"lint": "eslint --ext .ts src",
|
||||
"lint:report": "pnpm lint --format json --output-file report.json",
|
||||
"test": "pnpm build:test && NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test:only": "NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm build:test && pnpm test:only",
|
||||
"test:ci": "pnpm run test",
|
||||
"prepack": "pnpm build"
|
||||
},
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
"types": ["node", "jest"]
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
"jest.*.ts"
|
||||
"src"
|
||||
],
|
||||
"exclude": ["**/alteration-scripts"]
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
"dev": "rm -rf build/ && pnpm run copyfiles && nodemon",
|
||||
"start": "NODE_ENV=production node build/index.js",
|
||||
"test:only": "NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm build:test && pnpm test:only build/",
|
||||
"test": "pnpm build:test && pnpm test:only",
|
||||
"test:ci": "pnpm run test --coverage --silent",
|
||||
"test:report": "codecov -F core"
|
||||
},
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
]
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
"jest.*.ts"
|
||||
"src"
|
||||
]
|
||||
}
|
||||
|
|
10
packages/schemas/jest.config.js
Normal file
10
packages/schemas/jest.config.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const config = {
|
||||
coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'],
|
||||
coverageReporters: ['text-summary', 'lcov'],
|
||||
roots: ['./lib'],
|
||||
moduleNameMapper: {
|
||||
'^(chalk|inquirer)$': '<rootDir>/../shared/lib/esm/module-proxy.js',
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -1,16 +0,0 @@
|
|||
import type { Config } from '@silverhand/jest-config';
|
||||
import { merge } from '@silverhand/jest-config';
|
||||
|
||||
const config: Config.InitialOptions = {
|
||||
...merge({
|
||||
// Will update common config soon
|
||||
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
|
||||
moduleNameMapper: {
|
||||
'^(\\.{1,2}/.*)\\.js$': '$1',
|
||||
},
|
||||
}),
|
||||
// Will update common config soon
|
||||
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -17,15 +17,17 @@
|
|||
"scripts": {
|
||||
"precommit": "lint-staged",
|
||||
"version": "./update-next.sh && git add alterations/",
|
||||
"generate": "rm -rf src/db-entries && ts-node-esm src/gen/index.ts && eslint \"src/db-entries/**\" --fix",
|
||||
"generate": "rm -rf src/db-entries && tsc -p tsconfig.build.gen.json && node lib/src/gen/index.js && eslint \"src/db-entries/**\" --fix",
|
||||
"build:alterations": "rm -rf alterations-js && tsc -p tsconfig.build.alterations.json",
|
||||
"build": "pnpm generate && rm -rf lib/ && tsc -p tsconfig.build.json && pnpm build:alterations",
|
||||
"build:test": "rm -rf lib/ && tsc -p tsconfig.test.json --sourcemap",
|
||||
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
|
||||
"lint": "eslint --ext .ts src",
|
||||
"lint:report": "pnpm lint --format json --output-file report.json",
|
||||
"prepack": "pnpm build",
|
||||
"test": "jest",
|
||||
"test:ci": "jest"
|
||||
"test:only": "NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm build:test && pnpm test:only",
|
||||
"test:ci": "pnpm run test"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^16.13.0 || ^18.12.0"
|
||||
|
@ -33,7 +35,6 @@
|
|||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "1.3.0",
|
||||
"@silverhand/essentials": "^1.3.0",
|
||||
"@silverhand/jest-config": "1.2.2",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@types/jest": "^29.1.2",
|
||||
"@types/lodash.uniq": "^4.5.6",
|
||||
|
@ -47,7 +48,6 @@
|
|||
"pluralize": "^8.0.0",
|
||||
"prettier": "^2.7.1",
|
||||
"slonik": "^30.0.0",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^4.7.4"
|
||||
},
|
||||
"eslintConfig": {
|
||||
|
|
4
packages/schemas/tsconfig.build.gen.json
Normal file
4
packages/schemas/tsconfig.build.gen.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
"extends": "./tsconfig",
|
||||
"include": ["src/gen"]
|
||||
}
|
|
@ -8,7 +8,6 @@
|
|||
},
|
||||
"include": [
|
||||
"src",
|
||||
"alterations",
|
||||
"jest.config.ts"
|
||||
"alterations"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -1,3 +1,8 @@
|
|||
{
|
||||
"extends": "./tsconfig"
|
||||
"extends": "./tsconfig",
|
||||
"compilerOptions": {
|
||||
"isolatedModules": false,
|
||||
"allowJs": true
|
||||
},
|
||||
"include": ["src"]
|
||||
}
|
||||
|
|
10
packages/shared/jest.config.js
Normal file
10
packages/shared/jest.config.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
const config = {
|
||||
coveragePathIgnorePatterns: ['/node_modules/', '/src/__mocks__/'],
|
||||
coverageReporters: ['text-summary', 'lcov'],
|
||||
roots: ['./lib'],
|
||||
moduleNameMapper: {
|
||||
'^(chalk|inquirer)$': '<rootDir>/../shared/lib/esm/module-proxy.js',
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -1,15 +0,0 @@
|
|||
import type { Config } from '@silverhand/jest-config';
|
||||
import { merge } from '@silverhand/jest-config';
|
||||
|
||||
const config: Config.InitialOptions = {
|
||||
...merge({
|
||||
roots: ['./src'],
|
||||
moduleNameMapper: {
|
||||
'^(\\.{1,2}/.*)\\.js$': '$1',
|
||||
},
|
||||
}),
|
||||
// Will update common config soon
|
||||
transformIgnorePatterns: ['node_modules/(?!(.*(nanoid|jose|ky|@logto))/)'],
|
||||
};
|
||||
|
||||
export default config;
|
|
@ -22,16 +22,17 @@
|
|||
"scripts": {
|
||||
"precommit": "lint-staged",
|
||||
"build": "rm -rf lib/ && tsc -p tsconfig.build.json",
|
||||
"build:test": "rm -rf lib/ && tsc -p tsconfig.test.json --sourcemap",
|
||||
"dev": "tsc -p tsconfig.build.json --watch --preserveWatchOutput --incremental",
|
||||
"lint": "eslint --ext .ts src",
|
||||
"lint:report": "pnpm lint --format json --output-file report.json",
|
||||
"prepack": "pnpm build",
|
||||
"test": "jest",
|
||||
"test:ci": "jest"
|
||||
"test:only": "NODE_OPTIONS=--experimental-vm-modules jest",
|
||||
"test": "pnpm build:test && pnpm test:only",
|
||||
"test:ci": "pnpm run test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@silverhand/eslint-config": "1.3.0",
|
||||
"@silverhand/jest-config": "1.2.2",
|
||||
"@silverhand/ts-config": "1.2.1",
|
||||
"@types/jest": "^29.1.2",
|
||||
"@types/node": "^16.0.0",
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
"module": "es2022"
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
"jest.config.ts"
|
||||
"src"
|
||||
]
|
||||
}
|
||||
|
|
|
@ -580,7 +580,6 @@ importers:
|
|||
'@logto/phrases-ui': workspace:*
|
||||
'@silverhand/eslint-config': 1.3.0
|
||||
'@silverhand/essentials': ^1.3.0
|
||||
'@silverhand/jest-config': 1.2.2
|
||||
'@silverhand/ts-config': 1.2.1
|
||||
'@types/jest': ^29.1.2
|
||||
'@types/lodash.uniq': ^4.5.6
|
||||
|
@ -594,7 +593,6 @@ importers:
|
|||
pluralize: ^8.0.0
|
||||
prettier: ^2.7.1
|
||||
slonik: ^30.0.0
|
||||
ts-node: ^10.9.1
|
||||
typescript: ^4.7.4
|
||||
zod: ^3.19.1
|
||||
dependencies:
|
||||
|
@ -607,7 +605,6 @@ importers:
|
|||
devDependencies:
|
||||
'@silverhand/eslint-config': 1.3.0_swk2g7ygmfleszo5c33j4vooni
|
||||
'@silverhand/essentials': 1.3.0
|
||||
'@silverhand/jest-config': 1.2.2_zapogttls25djihwjkusccjjym
|
||||
'@silverhand/ts-config': 1.2.1_typescript@4.7.4
|
||||
'@types/jest': 29.1.2
|
||||
'@types/lodash.uniq': 4.5.6
|
||||
|
@ -615,13 +612,12 @@ importers:
|
|||
'@types/pluralize': 0.0.29
|
||||
camelcase: 7.0.0
|
||||
eslint: 8.21.0
|
||||
jest: 29.1.2_k5ytkvaprncdyzidqqws5bqksq
|
||||
jest: 29.1.2_@types+node@16.11.12
|
||||
lint-staged: 13.0.0
|
||||
lodash.uniq: 4.5.0
|
||||
pluralize: 8.0.0
|
||||
prettier: 2.7.1
|
||||
slonik: 30.1.2
|
||||
ts-node: 10.9.1_ccwudyfw5se7hgalwgkzhn2yp4
|
||||
typescript: 4.7.4
|
||||
|
||||
packages/shared:
|
||||
|
@ -629,7 +625,6 @@ importers:
|
|||
'@logto/schemas': workspace:*
|
||||
'@silverhand/eslint-config': 1.3.0
|
||||
'@silverhand/essentials': ^1.3.0
|
||||
'@silverhand/jest-config': 1.2.2
|
||||
'@silverhand/ts-config': 1.2.1
|
||||
'@types/jest': ^29.1.2
|
||||
'@types/node': ^16.0.0
|
||||
|
@ -649,7 +644,6 @@ importers:
|
|||
slonik: 30.1.2
|
||||
devDependencies:
|
||||
'@silverhand/eslint-config': 1.3.0_swk2g7ygmfleszo5c33j4vooni
|
||||
'@silverhand/jest-config': 1.2.2_zapogttls25djihwjkusccjjym
|
||||
'@silverhand/ts-config': 1.2.1_typescript@4.7.4
|
||||
'@types/jest': 29.1.2
|
||||
'@types/node': 16.11.12
|
||||
|
|
Loading…
Reference in a new issue