Skip to content

Commit 338af34

Browse files
committed
Build process
1 parent 3a5b45f commit 338af34

File tree

4 files changed

+45
-44
lines changed

4 files changed

+45
-44
lines changed

build.ts

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
const ESM = await Bun.build({
2+
entrypoints: ["./src/core/index.ts", "./src/react/index.tsx"],
3+
outdir: "./dist/esm",
4+
target: "browser",
5+
format: "esm",
6+
external: ["react"],
7+
sourcemap: "linked",
8+
minify: true
9+
});
10+
11+
const CJS = await Bun.build({
12+
entrypoints: ["./src/core/index.ts", "./src/react/index.tsx"],
13+
outdir: "./dist/cjs",
14+
target: "browser",
15+
format: "cjs",
16+
external: ["react"],
17+
sourcemap: "linked",
18+
minify: true
19+
});
20+
21+
if (!ESM.success || !CJS.success) {
22+
console.error("Build failed");
23+
for (const message of [...ESM.logs, ...CJS.logs]) {
24+
// Bun will pretty print the message object
25+
console.error(message);
26+
}
27+
}
28+
29+
export { }

bunfig.toml

Lines changed: 0 additions & 2 deletions
This file was deleted.

package.json

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,20 @@
3838
},
3939
"exports": {
4040
".": {
41-
"require": "./dist/core/index.js",
42-
"import": "./dist/core/index.esm.js",
43-
"types": "./dist/core/index.d.ts"
41+
"require": "./dist/cjs/core/index.js",
42+
"import": "./dist/esm/core/index.js",
43+
"types": "./dist/types/index.d.ts"
4444
},
4545
"./react": {
46-
"require": "./dist/react/index.js",
47-
"import": "./dist/react/index.esm.js",
48-
"types": "./dist/react/index.d.ts"
46+
"require": "./dist/cjs/react/index.js",
47+
"import": "./dist/esm/react/index.js",
48+
"types": "./dist/types/index.d.ts"
4949
}
5050
},
5151
"scripts": {
52-
"test": "jest",
53-
"build": "tsc"
52+
"build:library": "bun ./build.ts",
53+
"build:types": "bunx tsc",
54+
"build": "bun build:library && bun build:types && cp -R ./src/types/* ./dist/types"
5455
},
5556
"type": "module",
5657
"types": "dist/core/index.d.ts"

tsconfig.json

Lines changed: 7 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,19 @@
11
{
22
"compilerOptions": {
3-
"outDir": "dist",
4-
"rootDir": "src",
3+
"outDir": "dist/types",
4+
"emitDeclarationOnly": true,
55
"declaration": true,
6-
"declarationDir": "dist",
7-
"emitDeclarationOnly": false,
8-
"target": "ES6",
6+
"target": "esnext",
97
"module": "esnext",
108
"moduleResolution": "Bundler",
119
"strict": true,
1210
"esModuleInterop": true,
1311
"jsx": "react-jsx",
1412
"sourceMap": true,
1513
"allowJs": false,
14+
"skipLibCheck": true
1615
},
17-
"include": [
18-
"src/core/index.tsx",
19-
"src/react/index.tsx",
20-
"src/types/index.d.ts",
21-
"__tests__/**/*.tsx"
22-
],
23-
"exclude": [
24-
"node_modules",
25-
"dist",
26-
"__tests__"
27-
],
28-
"types": [
29-
"node",
30-
"jest",
31-
"@testing-library/jest-dom",
32-
"@testing-library/jest-dom/jest-globals"
33-
],
34-
"paths": {
35-
"@/src/*": ["./src/*"],
36-
"simple-shader/core": [
37-
"src/core/index.ts"
38-
],
39-
"simple-shader/react": [
40-
"src/react/index.ts"
41-
],
42-
// "simple-shader/vue": [
43-
// "src/vue/index.ts"
44-
// ]
45-
}
16+
"include": [ "src/**/*" ],
17+
"exclude": [ "node_modules", "dist" ],
18+
"types": [ "node" ]
4619
}

0 commit comments

Comments
 (0)