Skip to content

Commit 43da0e5

Browse files
committed
👷 Review build and pre-publish command
1 parent f3401b0 commit 43da0e5

File tree

2 files changed

+26
-18
lines changed

2 files changed

+26
-18
lines changed

package.json

+10-12
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,25 @@
33
"version": "0.0.1",
44
"description": "An agnostic, dependence free, state management library",
55
"type": "module",
6-
"files": [
7-
"dist"
8-
],
9-
"module": "dist/tstorex.js",
10-
"main": "dist/tstorex.cjs",
6+
"module": "index.js",
7+
"main": "index.cjs",
118
"exports": {
129
"./package.json": "./package.json",
1310
".": {
14-
"types": "./dist/types/index.d.ts",
15-
"import": "./dist/tstorex.js",
16-
"require": "./dist/tstorex.cjs"
11+
"types": "./index.d.ts",
12+
"import": "./index.js",
13+
"require": "./index.cjs"
1714
},
1815
"./recipes": {
19-
"types": "./dist/types/recipes/index.d.ts",
20-
"import": "./dist/recipes.js",
21-
"require": "./dist/recipes.cjs"
16+
"types": "./recipes.d.ts",
17+
"import": "./recipes.js",
18+
"require": "./recipes.cjs"
2219
}
2320
},
2421
"scripts": {
2522
"test": "vitest --watch=false",
26-
"build": "rm -rf dist && tsc && vite build && tsc -p tsconfig.dts.json"
23+
"build": "rm -rf dist && tsc && vite build && cp package.json README.md LICENSE dist/",
24+
"pre-publish": "pnpm run test && pnpm run build && cd dist && pnpm pack"
2725
},
2826
"keywords": [
2927
"state",

vite.config.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1-
import { defineConfig } from 'vite'
1+
import { defineConfig as defineViteConfig } from 'vite'
2+
import { defineConfig as defineVitestConfig, mergeConfig } from 'vitest/config'
3+
import dts from 'vite-plugin-dts'
24

3-
export default defineConfig({
5+
const viteConf = defineViteConfig({
46
build: {
57
lib: {
6-
entry: 'src/index.ts',
7-
name: 'tstorex',
8-
formats: ["cjs", "es", "umd"]
8+
entry: {
9+
index: 'src/index.ts',
10+
recipes: 'src/recipes/index.ts',
11+
},
12+
formats: ["cjs", "es"]
913
},
1014
sourcemap: true,
1115
},
16+
plugins: [dts({ rollupTypes: true })],
17+
})
18+
19+
const vitestConf = defineVitestConfig({
1220
test: {
1321
coverage:{
1422
enabled: true,
@@ -18,4 +26,6 @@ export default defineConfig({
1826
reporter:["html-spa"],
1927
}
2028
}
21-
})
29+
})
30+
31+
export default mergeConfig(viteConf, vitestConf)

0 commit comments

Comments
 (0)