From 41f499f2d03a434d38bd10bd3bc9fc1df1306211 Mon Sep 17 00:00:00 2001 From: Emlyn Rice Date: Fri, 27 Oct 2023 15:16:38 +0800 Subject: [PATCH] Fix package process --- .changeset/modern-tips-tell.md | 6 ++++++ libs/code-generator/project.json | 5 ++++- libs/code-generator/tsconfig.json | 2 +- libs/nx-plugin/package.json | 13 +++++++++++-- libs/nx-plugin/project.json | 7 +++++-- pnpm-lock.yaml | 2 +- 6 files changed, 28 insertions(+), 7 deletions(-) create mode 100644 .changeset/modern-tips-tell.md diff --git a/.changeset/modern-tips-tell.md b/.changeset/modern-tips-tell.md new file mode 100644 index 00000000..184b9f46 --- /dev/null +++ b/.changeset/modern-tips-tell.md @@ -0,0 +1,6 @@ +--- +'@featureboard/code-generator': patch +'@featureboard/nx-plugin': patch +--- + +Fix package process diff --git a/libs/code-generator/project.json b/libs/code-generator/project.json index 674c53d2..52f16ea7 100644 --- a/libs/code-generator/project.json +++ b/libs/code-generator/project.json @@ -18,7 +18,10 @@ "executor": "nx:run-commands", "options": { "commands": [ - "tsup src/index.ts -d dist --sourcemap --format esm,cjs --dts --tsconfig tsconfig.build.json" + "tsup src/index.ts -d dist --sourcemap --format esm --legacy-output", + "tsup src/index.ts -d dist/legacycjs --sourcemap --format cjs --legacy-output", + "tsup src/index.ts -d dist --sourcemap --format esm,cjs", + "tsc --emitDeclarationOnly --declaration --outDir dist" ], "cwd": "libs/code-generator", "parallel": false diff --git a/libs/code-generator/tsconfig.json b/libs/code-generator/tsconfig.json index d8afbbaf..ebea81aa 100644 --- a/libs/code-generator/tsconfig.json +++ b/libs/code-generator/tsconfig.json @@ -1,7 +1,7 @@ { "extends": "../../tsconfig.settings.json", "compilerOptions": { - "outDir": "./tsc-out", + "outDir": "./dist", "rootDir": "./src", "types": [ "node", diff --git a/libs/nx-plugin/package.json b/libs/nx-plugin/package.json index b5c30f34..11604845 100644 --- a/libs/nx-plugin/package.json +++ b/libs/nx-plugin/package.json @@ -24,7 +24,16 @@ "prompts": "^2.4.2" }, "publishConfig": { - "main": "dist/index.js", - "types": "dist/index.d.ts" + "main": "dist/legacycjs/index.js", + "module": "dist/esm/index.js", + "types": "dist/index.d.ts", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js", + "default": "./dist/index.cjs" + } + } } } diff --git a/libs/nx-plugin/project.json b/libs/nx-plugin/project.json index af67c4ba..36ae952f 100644 --- a/libs/nx-plugin/project.json +++ b/libs/nx-plugin/project.json @@ -8,12 +8,15 @@ "executor": "nx:run-commands", "options": { "commands": [ - "tsup src/index.ts -d dist --sourcemap --format cjs --legacy-output", + "tsup src/index.ts -d dist --sourcemap --format esm --legacy-output --external @featureboard/code-generator", + "tsup src/index.ts -d dist/legacycjs --sourcemap --format cjs --legacy-output --external @featureboard/code-generator", + "tsup src/index.ts -d dist --sourcemap --format esm,cjs --external @featureboard/code-generator", "tsc --emitDeclarationOnly --declaration --outDir dist" ], "cwd": "libs/nx-plugin", "parallel": false - } + }, + "dependsOn": ["^package"] }, "lint": { "executor": "@nx/eslint:lint", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca5b149a..4b37fc01 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -6631,7 +6631,7 @@ packages: fs.realpath: 1.0.0 inflight: 1.0.6 inherits: 2.0.4 - minimatch: 3.0.5 + minimatch: 3.1.2 once: 1.4.0 path-is-absolute: 1.0.1