Build system refactoring
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -16,8 +16,8 @@ local lint_step = {
|
|||||||
|
|
||||||
local build_step = {
|
local build_step = {
|
||||||
name: "build",
|
name: "build",
|
||||||
image: bun_image,
|
image: node_image,
|
||||||
commands: ["bun run build"],
|
commands: ["npm run build"],
|
||||||
};
|
};
|
||||||
|
|
||||||
local pack_step = {
|
local pack_step = {
|
||||||
|
|||||||
19
package.json
19
package.json
@@ -11,8 +11,8 @@
|
|||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
"import": {
|
"import": {
|
||||||
"types": "./dist/lib.d.mts",
|
"types": "./dist/lib.d.ts",
|
||||||
"default": "./dist/lib.mjs"
|
"default": "./dist/lib.js"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"types": "./dist/lib.d.cts",
|
"types": "./dist/lib.d.cts",
|
||||||
@@ -21,17 +21,17 @@
|
|||||||
},
|
},
|
||||||
"./schema": {
|
"./schema": {
|
||||||
"import": {
|
"import": {
|
||||||
"types": "./dist/schema.d.mts",
|
"types": "./dist/schema/lib.d.ts",
|
||||||
"default": "./dist/schema.mjs"
|
"default": "./dist/schema/lib.js"
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"types": "./dist/schema.d.cts",
|
"types": "./dist/schema/lib.d.cts",
|
||||||
"default": "./dist/schema.cjs"
|
"default": "./dist/schema/lib.cjs"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "rollup -c rollup.config.ts",
|
"build": "tsup",
|
||||||
"lint:tsc": "tsc --noEmit",
|
"lint:tsc": "tsc --noEmit",
|
||||||
"clean:cache": "rm -f tsconfig.tsbuildinfo",
|
"clean:cache": "rm -f tsconfig.tsbuildinfo",
|
||||||
"clean:dist": "rm -rf dist",
|
"clean:dist": "rm -rf dist",
|
||||||
@@ -47,15 +47,10 @@
|
|||||||
"zod": "^3.22.4"
|
"zod": "^3.22.4"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^15.2.3",
|
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"bun-types": "latest",
|
"bun-types": "latest",
|
||||||
"npm-check-updates": "^16.14.17",
|
"npm-check-updates": "^16.14.17",
|
||||||
"npm-sort": "^0.0.4",
|
"npm-sort": "^0.0.4",
|
||||||
"rollup": "^4.13.0",
|
|
||||||
"rollup-plugin-cleanup": "^3.2.1",
|
|
||||||
"rollup-plugin-ts": "^3.4.5",
|
|
||||||
"ts-functional-pipe": "^3.1.2",
|
|
||||||
"tsup": "^8.0.2",
|
"tsup": "^8.0.2",
|
||||||
"tsx": "^4.7.1",
|
"tsx": "^4.7.1",
|
||||||
"typescript": "^5.4.3"
|
"typescript": "^5.4.3"
|
||||||
|
|||||||
@@ -1,43 +0,0 @@
|
|||||||
import { nodeResolve } from "@rollup/plugin-node-resolve"
|
|
||||||
import { defineConfig } from "rollup"
|
|
||||||
import cleanup from "rollup-plugin-cleanup"
|
|
||||||
import ts from "rollup-plugin-ts"
|
|
||||||
import pkg from "./package.json" assert { type: "json" }
|
|
||||||
|
|
||||||
|
|
||||||
export const createBundleConfig = (
|
|
||||||
input: string,
|
|
||||||
name: keyof typeof pkg.exports,
|
|
||||||
) =>
|
|
||||||
defineConfig({
|
|
||||||
input,
|
|
||||||
|
|
||||||
output: [
|
|
||||||
{
|
|
||||||
file: pkg.exports[name].import.default,
|
|
||||||
format: "esm",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
file: pkg.exports[name].require.default,
|
|
||||||
format: "cjs",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
|
|
||||||
external: id => !/^[./]/.test(id),
|
|
||||||
|
|
||||||
plugins: [
|
|
||||||
nodeResolve(),
|
|
||||||
ts(),
|
|
||||||
|
|
||||||
cleanup({
|
|
||||||
comments: "jsdoc",
|
|
||||||
extensions: ["ts"],
|
|
||||||
}),
|
|
||||||
],
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
export default [
|
|
||||||
createBundleConfig("src/lib.ts", "."),
|
|
||||||
createBundleConfig("src/schema/lib.ts", "./schema"),
|
|
||||||
]
|
|
||||||
11
tsup.config.ts
Normal file
11
tsup.config.ts
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { defineConfig } from "tsup"
|
||||||
|
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
entry: ["src/lib.ts", "src/schema/lib.ts"],
|
||||||
|
format: ["esm", "cjs"],
|
||||||
|
dts: true,
|
||||||
|
splitting: false,
|
||||||
|
sourcemap: true,
|
||||||
|
clean: true,
|
||||||
|
})
|
||||||
Reference in New Issue
Block a user