diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 96e2a74..5506394 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,7 @@ jobs: node-version-file: '.nvmrc' - run: | npm ci + npm run build npm run lint npm test diff --git a/package.json b/package.json index cf53d56..6b527c8 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,6 @@ "version": "1.0.2", "description": "An API client library for NetSuite RESTlets.", "type": "module", - "main": "dist/cjs/index.cjs", - "module": "dist/esm/index.js", - "types": "dist/types/index.d.ts", "exports": { "require": "./dist/cjs/index.cjs", "import": "./dist/esm/index.js", @@ -13,7 +10,7 @@ }, "scripts": { "clean": "rm -rf dist", - "build": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json ./tsconfig.types.json && node scripts/rename-cjs.js", + "build": "tsc -b ./tsconfig.cjs.json ./tsconfig.esm.json && node scripts/rename-cjs.js", "build:clean": "npm run clean && npm run build", "lint": "eslint --ignore-pattern dist/", "test": "node --import tsx --test --experimental-test-module-mocks test/**/*test.ts", diff --git a/scripts/rename-cjs.js b/scripts/rename-cjs.js index 5de8f7e..f09b27c 100644 --- a/scripts/rename-cjs.js +++ b/scripts/rename-cjs.js @@ -11,6 +11,9 @@ function renameJsToCjs(dir) { } else if (file.endsWith('.js')) { const newPath = fullPath.replace(/\.js$/, '.cjs') fs.renameSync(fullPath, newPath) + } else if (file.endsWith('.ts')) { + const newPath = fullPath.replace(/\.ts$/, '.cts') + fs.renameSync(fullPath, newPath) } }) } diff --git a/tsconfig.cjs.json b/tsconfig.cjs.json index a4c9f50..a51814c 100644 --- a/tsconfig.cjs.json +++ b/tsconfig.cjs.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./dist/cjs", - "module": "CommonJS" + "module": "CommonJS", + "declaration": true } } diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 2532362..63e9c7e 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -2,6 +2,7 @@ "extends": "./tsconfig.json", "compilerOptions": { "outDir": "./dist/esm", - "module": "ESNext" + "module": "ESNext", + "declaration": true } } diff --git a/tsconfig.types.json b/tsconfig.types.json deleted file mode 100644 index 5f3e8a7..0000000 --- a/tsconfig.types.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "outDir": "./dist/types", - "declaration": true, - "emitDeclarationOnly": true - } -}