mirror of
https://github.com/versia-pub/api.git
synced 2025-12-06 08:28:19 +01:00
feat(build): 🏗️ Build plain JS for NPM
This commit is contained in:
parent
8a4b246f01
commit
2bf97bc914
5
.github/workflows/publish.yml
vendored
5
.github/workflows/publish.yml
vendored
|
|
@ -53,9 +53,8 @@ jobs:
|
|||
node-version: "22"
|
||||
registry-url: "https://registry.npmjs.org"
|
||||
|
||||
# Code is not minified and bundled anymore
|
||||
#- name: Build
|
||||
# run: bun run build
|
||||
- name: Build
|
||||
run: bun run build
|
||||
|
||||
- name: Change version in package.json to ${{ github.event.inputs.version }}, defaulting to the truncated commit hash
|
||||
run: 'sed -i ''s/"version": ".*"/"version": "${{ github.event.inputs.version }}"/'' package.json ${{ github.event.inputs.package }}/package.json ${{ github.event.inputs.package }}/jsr.jsonc'
|
||||
|
|
|
|||
9
build.ts
9
build.ts
|
|
@ -1,11 +1,18 @@
|
|||
import dts from "bun-plugin-dts";
|
||||
import ora from "ora";
|
||||
|
||||
const entrypoints = {
|
||||
federation: ["index.ts", "schemas.ts", "requester.ts"],
|
||||
client: ["index.ts", "types.ts"],
|
||||
};
|
||||
|
||||
for (const pkg of ["federation", "client"]) {
|
||||
const subSpinner = ora(`Building ${pkg} module`).start();
|
||||
|
||||
await Bun.build({
|
||||
entrypoints: [`${pkg}/index.ts`],
|
||||
entrypoints: entrypoints[pkg as "federation" | "client"].map(
|
||||
(entrypoint) => `${pkg}/${entrypoint}`,
|
||||
),
|
||||
outdir: `${pkg}/dist`,
|
||||
format: "esm",
|
||||
minify: true,
|
||||
|
|
|
|||
|
|
@ -39,12 +39,14 @@
|
|||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./index.ts",
|
||||
"default": "./index.ts"
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./types": {
|
||||
"import": "./types.ts",
|
||||
"default": "./types.ts"
|
||||
"import": "./dist/types.js",
|
||||
"default": "./dist/types.js",
|
||||
"types": "./dist/types.d.ts"
|
||||
}
|
||||
},
|
||||
"funding": {
|
||||
|
|
|
|||
|
|
@ -39,16 +39,19 @@
|
|||
},
|
||||
"exports": {
|
||||
".": {
|
||||
"import": "./index.ts",
|
||||
"default": "./index.ts"
|
||||
"import": "./dist/index.js",
|
||||
"default": "./dist/index.js",
|
||||
"types": "./dist/index.d.ts"
|
||||
},
|
||||
"./requester": {
|
||||
"import": "./requester.ts",
|
||||
"default": "./requester.ts"
|
||||
"import": "./dist/requester.js",
|
||||
"default": "./dist/requester.js",
|
||||
"types": "./dist/requester.d.ts"
|
||||
},
|
||||
"./types": {
|
||||
"import": "./schemas.ts",
|
||||
"default": "./schemas.ts"
|
||||
"import": "./dist/schema.js",
|
||||
"default": "./dist/schema.js",
|
||||
"types": "./dist/schema.d.ts"
|
||||
}
|
||||
},
|
||||
"funding": {
|
||||
|
|
|
|||
Loading…
Reference in a new issue