diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 20d45909..1e6f137b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,10 +25,7 @@ jobs: with: bun-version: latest - run: bun i --frozen-lockfile - - name: copy files - run: | - cp LICENSE $PACKAGE_DIR - - run: bun run publish --allow-dirty + - run: bun run publish working-directory: ${{env.PACKAGE_DIR}} release: diff --git a/packages/unplugin-typia/.gitignore b/packages/unplugin-typia/.gitignore new file mode 100644 index 00000000..9396613d --- /dev/null +++ b/packages/unplugin-typia/.gitignore @@ -0,0 +1,2 @@ +/jsr.json +/LICENSE diff --git a/packages/unplugin-typia/jsr.json b/packages/unplugin-typia/jsr.json deleted file mode 100644 index 1ec28052..00000000 --- a/packages/unplugin-typia/jsr.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "name": "@ryoppippi/unplugin-typia", - "version": "0.0.0", - "exports": { - ".": "./src/index.ts", - "./api": "./src/api.ts", - "./vite": "./src/vite.ts", - "./webpack": "./src/webpack.ts", - "./rollup": "./src/rollup.ts", - "./esbuild": "./src/esbuild.ts", - "./next": "./src/next.ts", - "./rolldown": "./src/rolldown.ts", - "./farm": "./src/farm.ts", - "./rspack": "./src/rspack.ts", - "./bun": "./src/bun.ts", - "./package.json": "./package.json" - }, - "publish": { - "include": [ - "src", - "package.json", - "jsr.json", - "README.md", - "LICENSE" - ] - } -} diff --git a/packages/unplugin-typia/package.json b/packages/unplugin-typia/package.json index 34acead1..7fcbb4e9 100644 --- a/packages/unplugin-typia/package.json +++ b/packages/unplugin-typia/package.json @@ -12,81 +12,35 @@ "rollup", "transform" ], + "files": [ + "src", + "package.json", + "jsr.json", + "README.md", + "LICENSE" + ], "exports": { - ".": { - "import": "./src/index.ts" - }, - "./api": { - "import": "./src/api.ts" - }, - "./vite": { - "import": "./src/vite.ts" - }, - "./webpack": { - "import": "./src/webpack.ts" - }, - "./rollup": { - "import": "./src/rollup.ts" - }, - "./esbuild": { - "import": "./src/esbuild.ts" - }, - "./next": { - "import": "./src/next.ts" - }, - "./rolldown": { - "import": "./src/rolldown.ts" - }, - "./farm": { - "import": "./src/farm.ts" - }, - "./rspack": { - "import": "./src/rspack.ts" - }, - "./bun": { - "import": "./src/bun.ts" - }, + ".": "./src/index.ts", + "./api": "./src/api.ts", + "./vite": "./src/vite.ts", + "./webpack": "./src/webpack.ts", + "./rollup": "./src/rollup.ts", + "./esbuild": "./src/esbuild.ts", + "./next": "./src/next.ts", + "./rolldown": "./src/rolldown.ts", + "./farm": "./src/farm.ts", + "./rspack": "./src/rspack.ts", + "./bun": "./src/bun.ts", "./package.json": "./package.json" }, - "files": [ - "dist" - ], "scripts": { "lint": "nr check && eslint --cache .", "format": "eslint --cache --fix .", "test": "nr check && bun test ./test/*.ts", "check": "nr tsc --noEmit", - "publish": "nlx jsr publish" - }, - "peerDependencies": { - "esbuild": "*", - "rollup": "^3", - "svelte": "^3 || ^4 || ^5", - "vite": ">=3.2.10", - "webpack": "^4 || ^5" - }, - "peerDependenciesMeta": { - "@nuxt/kit": { - "optional": true - }, - "@nuxt/schema": { - "optional": true - }, - "esbuild": { - "optional": true - }, - "rollup": { - "optional": true - }, - "svelte": { - "optional": true - }, - "vite": { - "optional": true - }, - "webpack": { - "optional": true - } + "publish": "nr publish:prepare && nlx jsr publish --allow-dirty", + "publish:prepare": "bun run ./scripts/gen_jsr_json.ts && bun run --shell bun publish:copy_license", + "publish:copy_license": "cp ../../LICENSE ." }, "dependencies": { "@rollup/pluginutils": "^5.1.0", diff --git a/packages/unplugin-typia/scripts/gen_jsr_json.ts b/packages/unplugin-typia/scripts/gen_jsr_json.ts new file mode 100644 index 00000000..24a20eac --- /dev/null +++ b/packages/unplugin-typia/scripts/gen_jsr_json.ts @@ -0,0 +1,20 @@ +import { join } from 'node:path'; +import { + exports, + files, + name, + version, +} from '../package.json'; + +const jsrJSON = { + version, + name, + exports, + publish: { + include: files, + }, +} as const; + +const exportJSRPath = join(import.meta.dirname, '../jsr.json'); + +await Bun.write(exportJSRPath, JSON.stringify(jsrJSON, null, '\t'));