ESM Migration for rdf-utils and dataset

main
Jackson Morgan 4 months ago
parent 8aa5e72dab
commit 13d10c7f5f
  1. 21
      jest.config.js
  2. 1
      packages/dataset/jest.config.cjs
  3. 7
      packages/dataset/package.json
  4. 7
      packages/dataset/tsconfig.cjs.json
  5. 8
      packages/dataset/tsconfig.esm.json
  6. 1
      packages/rdf-utils/jest.config.cjs
  7. 5
      packages/rdf-utils/tsconfig.cjs.json
  8. 6
      packages/rdf-utils/tsconfig.esm.json
  9. 25
      tsconfig.base.json
  10. 3
      tsconfig.cjs.json
  11. 8
      tsconfig.esm.json
  12. 1
      tsconfig.json

@ -1,20 +1,29 @@
// eslint-disable-next-line @typescript-eslint/no-var-requires // jest.config.js
const path = require("path"); const path = require("path");
const monorepoRoot = path.resolve(__dirname); const monorepoRoot = path.resolve(__dirname);
module.exports = { module.exports = {
preset: "ts-jest/presets/default-esm", preset: "ts-jest/presets/js-with-ts",
extensionsToTreatAsEsm: [".ts"], testEnvironment: "node",
moduleNameMapper: { moduleNameMapper: {
"^(\\.{1,2}/.*)\\.js$": "$1", "^(\\.{1,2}/.*)\\.js$": "$1",
[`^@ldo/(.*)$`]: `${monorepoRoot}/packages/$1/src/index.ts`, "^@ldo/(.*)$": `${monorepoRoot}/packages/$1/src/index.ts`,
}, },
testEnvironment: "node",
coveragePathIgnorePatterns: [ coveragePathIgnorePatterns: [
"/node_modules/", "/node_modules/",
"/dist/", "/dist/",
"/coverage/", "/coverage/",
"/test/", "/test/",
], ],
globals: {}, transform: {
"^.+\\.ts$": [
"ts-jest",
{
tsconfig: "<rootDir>/tsconfig.cjs.json",
},
],
},
testPathIgnorePatterns: ["/node_modules/", "/dist/"],
transformIgnorePatterns: ["/node_modules/", "/dist/"],
modulePathIgnorePatterns: ["/dist/"],
}; };

@ -9,4 +9,5 @@ module.exports = {
"!src/**/*.d.ts", "!src/**/*.d.ts",
// "!src/index.ts", // Optional, if index.ts only re-exports // "!src/index.ts", // Optional, if index.ts only re-exports
], ],
modulePathIgnorePatterns: ["<rootDir>/dist/"],
}; };

@ -15,9 +15,10 @@
"./package.json": "./package.json" "./package.json": "./package.json"
}, },
"scripts": { "scripts": {
"build": "rimraf dist && tsc --project tsconfig.esm.json && tsc --project tsconfig.cjs.json", "build": "rimraf dist && npm run build:cjs && npm run build:esm",
"watch": "tsc --watch", "build:cjs": "tsc --project tsconfig.cjs.json",
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest --coverage", "build:esm": "tsc --project tsconfig.esm.json",
"test": "jest --coverage",
"example:extendedDataset": "ts-node ./example/extendedDatasetExample.ts", "example:extendedDataset": "ts-node ./example/extendedDatasetExample.ts",
"example:loadData": "ts-node ./example/loadDataExample.ts", "example:loadData": "ts-node ./example/loadDataExample.ts",
"prepublishOnly": "npm run test && npm run build", "prepublishOnly": "npm run test && npm run build",

@ -1,9 +1,10 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.cjs.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/cjs" "outDir": "./dist/cjs",
"rootDir": "./src"
}, },
"include": [ "include": [
"./src" "src"
] ]
} }

@ -1,9 +1,11 @@
{ {
"extends": "../../tsconfig.base.json", "extends": "../../tsconfig.esm.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/esm" "outDir": "./dist/esm",
"rootDir": "./src",
"declarationDir": "./dist/types"
}, },
"include": [ "include": [
"./src" "src"
] ]
} }

@ -3,4 +3,5 @@ const sharedConfig = require("../../jest.config.js");
module.exports = { module.exports = {
...sharedConfig, ...sharedConfig,
rootDir: "./", rootDir: "./",
modulePathIgnorePatterns: ["<rootDir>/dist/"],
}; };

@ -1,9 +1,10 @@
{ {
"extends": "../../tsconfig.cjs.json", "extends": "../../tsconfig.cjs.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/cjs" "outDir": "./dist/cjs",
"rootDir": "./src"
}, },
"include": [ "include": [
"./src" "src"
] ]
} }

@ -1,9 +1,11 @@
{ {
"extends": "../../tsconfig.esm.json", "extends": "../../tsconfig.esm.json",
"compilerOptions": { "compilerOptions": {
"outDir": "./dist/esm" "outDir": "./dist/esm",
"rootDir": "./src",
"declarationDir": "./dist/types"
}, },
"include": [ "include": [
"./src" "src"
] ]
} }

@ -1,27 +1,28 @@
{ {
"compilerOptions": { "compilerOptions": {
"target": "ES2021",
"module": "commonjs", "module": "commonjs",
"baseUrl": ".",
"strict": true,
"esModuleInterop": true,
"noImplicitAny": false,
"removeComments": true,
"lib": [ "lib": [
"ES2021" "ES2021"
], ],
"strict": true,
"esModuleInterop": true,
"moduleResolution": "node",
"declaration": true,
"declarationMap": true,
"sourceMap": true,
"emitDecoratorMetadata": true, "emitDecoratorMetadata": true,
"experimentalDecorators": true, "experimentalDecorators": true,
"target": "ES2021",
"sourceMap": true,
"jsx": "react-jsx",
"noErrorTruncation": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"noEmit": false "noImplicitAny": false,
"skipLibCheck": true,
"jsx": "react-jsx"
}, },
"exclude": [ "exclude": [
"node_modules", "node_modules",
"**/*.spec.ts",
"**/dist", "**/dist",
"**/coverage" "**/coverage",
"**/*.test.ts",
"**/*.spec.ts"
] ]
} }

@ -2,7 +2,8 @@
"extends": "./tsconfig.base.json", "extends": "./tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"module": "CommonJS", "module": "CommonJS",
"moduleResolution": "node",
"declaration": false, "declaration": false,
"declarationMap": false, "declarationMap": false
} }
} }

@ -3,14 +3,8 @@
"compilerOptions": { "compilerOptions": {
"module": "NodeNext", "module": "NodeNext",
"moduleResolution": "nodenext", "moduleResolution": "nodenext",
"composite": true,
"declaration": true, "declaration": true,
"declarationMap": true, "declarationMap": true,
"isolatedModules": true, "isolatedModules": true
"paths": {
"@ldo/*": [
"packages/*/src"
]
}
} }
} }

@ -1,6 +1,7 @@
{ {
"extends": "./tsconfig.base.json", "extends": "./tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"baseUrl": ".",
"paths": { "paths": {
"@ldo/*": [ "@ldo/*": [
"packages/*/src" "packages/*/src"

Loading…
Cancel
Save