Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: 优化sdk打包命令 #339

Merged
merged 1 commit into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.DS_Store
node_modules
/dist
dist

# local env files
.env.local
Expand Down
11 changes: 6 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@
"version": "1.0.0",
"description": "a template project for vue3, ViewUIPlus, TypeScript and Vite.",
"scripts": {
"serve": "npm run dev",
"preinstall": "npx only-allow pnpm",
"serve": "pnpm dev",
"dev": "vite serve",
"dev:staging": "vite serve --mode=staging",
"dev:prod": "vite serve --mode=production",
"build": "vite build",
"build:sdk": "vite build --config viteSDK.config.ts",
"build:sdk": "pnpm -C packages/core build",
"build:staging": "vite build --mode=staging",
"preview": "npm run build && vite preview",
"preview:staging": "npm run build:staging && vite preview --mode=staging",
"preview": "pnpm build && vite preview",
"preview:staging": "pnpm build:staging && vite preview --mode=staging",
"prepare": "husky install"
},
"dependencies": {
Expand Down Expand Up @@ -72,4 +73,4 @@
"prettier --write"
]
}
}
}
4 changes: 2 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"main": "index.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"build": "vite build"
},
"dependencies": {
"events": "^3.3.0",
Expand All @@ -17,4 +17,4 @@
"keywords": [],
"author": "",
"license": "ISC"
}
}
8 changes: 5 additions & 3 deletions viteSDK.config.ts → packages/core/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,23 @@
* @version:
* @Author: June
* @Date: 2023-04-24 00:25:39
* @LastEditors: 秦少卫
* @LastEditTime: 2024-03-17 13:46:56
* @LastEditors: June [email protected]
* @LastEditTime: 2024-04-18 10:14:25
*/
import { defineConfig } from 'vite';
import eslintPlugin from 'vite-plugin-eslint'; //导入包
import { resolve } from 'path';

const config = () => {
return {
base: './',
build: {
lib: {
entry: resolve(__dirname, './packages/core/index.ts'),
entry: resolve(__dirname, './index.ts'),
name: 'Kuaitu',
fileName: 'index',
},
outDir: resolve(__dirname, '../../dist'),
},
plugins: [
// 增加下面的配置项,这样在运行时就能检查eslint规范
Expand Down
Loading