Skip to content

Commit 891f124

Browse files
authored
feat(vue-hooks): add hooks package packaging logic (#2866)
1 parent f4fcf7a commit 891f124

File tree

4 files changed

+69
-3
lines changed

4 files changed

+69
-3
lines changed

packages/vue-hooks/package.json

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,23 @@
66
"license": "ISC",
77
"keywords": [],
88
"main": "index.ts",
9-
"module": "index.ts",
109
"scripts": {
11-
"test": "echo \"Error: no test specified\" && exit 1"
10+
"build": "vite build",
11+
"pub": "pnpm publish --no-git-checks --access=public",
12+
"test": "vitest"
1213
},
1314
"publishConfig": {
14-
"access": "public"
15+
"access": "public",
16+
"main": "dist/index.js"
1517
},
1618
"dependencies": {
1719
"@floating-ui/dom": "^1.6.9",
1820
"@opentiny/utils": "workspace:~"
21+
},
22+
"devDependencies": {
23+
"typescript": "catalog:",
24+
"vite": "catalog:",
25+
"vite-plugin-dts": "~4.3.0",
26+
"vitest": "catalog:"
1927
}
2028
}

packages/vue-hooks/tsconfig.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"compilerOptions": {
3+
"target": "ES2020",
4+
"useDefineForClassFields": true,
5+
"module": "ESNext",
6+
"lib": ["ES2020", "DOM", "DOM.Iterable"],
7+
"skipLibCheck": true,
8+
9+
/* Bundler mode */
10+
"moduleResolution": "bundler",
11+
"allowImportingTsExtensions": true,
12+
"resolveJsonModule": true,
13+
"isolatedModules": true,
14+
"noEmit": true,
15+
"jsx": "preserve",
16+
17+
/* Linting */
18+
"strict": true,
19+
"noUnusedLocals": true,
20+
"noUnusedParameters": true,
21+
"noFallthroughCasesInSwitch": true
22+
},
23+
"include": ["src/**/*.ts", "src/**/*.tsx", "index.ts"],
24+
"references": [{ "path": "./tsconfig.node.json" }]
25+
}

packages/vue-hooks/tsconfig.node.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"compilerOptions": {
3+
"composite": true,
4+
"skipLibCheck": true,
5+
"module": "ESNext",
6+
"moduleResolution": "bundler",
7+
"allowSyntheticDefaultImports": true
8+
},
9+
"include": ["vite.config.ts"]
10+
}

packages/vue-hooks/vite.config.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { defineConfig } from 'vite'
2+
import dts from 'vite-plugin-dts'
3+
4+
// https://vitejs.dev/config/
5+
export default defineConfig({
6+
plugins: [dts()],
7+
build: {
8+
lib: {
9+
entry: ['index.ts']
10+
},
11+
rollupOptions: {
12+
external: [/@opentiny/, /@floating-ui/],
13+
input: ['index.ts'],
14+
output: [
15+
{
16+
format: 'es',
17+
entryFileNames: '[name].js',
18+
preserveModules: true
19+
}
20+
]
21+
}
22+
}
23+
})

0 commit comments

Comments
 (0)