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"
|
node-version: "22"
|
||||||
registry-url: "https://registry.npmjs.org"
|
registry-url: "https://registry.npmjs.org"
|
||||||
|
|
||||||
# Code is not minified and bundled anymore
|
- name: Build
|
||||||
#- name: Build
|
run: bun run build
|
||||||
# run: bun run build
|
|
||||||
|
|
||||||
- name: Change version in package.json to ${{ github.event.inputs.version }}, defaulting to the truncated commit hash
|
- 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'
|
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 dts from "bun-plugin-dts";
|
||||||
import ora from "ora";
|
import ora from "ora";
|
||||||
|
|
||||||
|
const entrypoints = {
|
||||||
|
federation: ["index.ts", "schemas.ts", "requester.ts"],
|
||||||
|
client: ["index.ts", "types.ts"],
|
||||||
|
};
|
||||||
|
|
||||||
for (const pkg of ["federation", "client"]) {
|
for (const pkg of ["federation", "client"]) {
|
||||||
const subSpinner = ora(`Building ${pkg} module`).start();
|
const subSpinner = ora(`Building ${pkg} module`).start();
|
||||||
|
|
||||||
await Bun.build({
|
await Bun.build({
|
||||||
entrypoints: [`${pkg}/index.ts`],
|
entrypoints: entrypoints[pkg as "federation" | "client"].map(
|
||||||
|
(entrypoint) => `${pkg}/${entrypoint}`,
|
||||||
|
),
|
||||||
outdir: `${pkg}/dist`,
|
outdir: `${pkg}/dist`,
|
||||||
format: "esm",
|
format: "esm",
|
||||||
minify: true,
|
minify: true,
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,14 @@
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./index.ts",
|
"import": "./dist/index.js",
|
||||||
"default": "./index.ts"
|
"default": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
},
|
},
|
||||||
"./types": {
|
"./types": {
|
||||||
"import": "./types.ts",
|
"import": "./dist/types.js",
|
||||||
"default": "./types.ts"
|
"default": "./dist/types.js",
|
||||||
|
"types": "./dist/types.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
|
|
|
||||||
|
|
@ -39,16 +39,19 @@
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": "./index.ts",
|
"import": "./dist/index.js",
|
||||||
"default": "./index.ts"
|
"default": "./dist/index.js",
|
||||||
|
"types": "./dist/index.d.ts"
|
||||||
},
|
},
|
||||||
"./requester": {
|
"./requester": {
|
||||||
"import": "./requester.ts",
|
"import": "./dist/requester.js",
|
||||||
"default": "./requester.ts"
|
"default": "./dist/requester.js",
|
||||||
|
"types": "./dist/requester.d.ts"
|
||||||
},
|
},
|
||||||
"./types": {
|
"./types": {
|
||||||
"import": "./schemas.ts",
|
"import": "./dist/schema.js",
|
||||||
"default": "./schemas.ts"
|
"default": "./dist/schema.js",
|
||||||
|
"types": "./dist/schema.d.ts"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"funding": {
|
"funding": {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue