(build)import wireit build tool

This commit is contained in:
wangchangqi 2022-12-09 10:43:31 +08:00
parent db7c1bddb5
commit 8ca9a14ea1
3 changed files with 53 additions and 5 deletions

2
.gitignore vendored
View File

@ -33,3 +33,5 @@ src/lib/**/*.d.ts
src/lib/**/*.js
src/lib/**/*.js.map
*.tsbuildinfo
.wireit

View File

@ -11,7 +11,10 @@
],
"scripts": {
"dev": "vite",
"build": "yarn run esbuild:ts && yarn run build:ts && yarn build:widgets",
"build": "wireit",
"build-ts-modules": "wireit",
"build-ts-with-config": "wireit",
"build-ts-widgets": "wireit",
"build:ts": "yarn tsc --build tsconfig-all.json",
"build:vite": "vite build && yarn build:widgets",
"build:widgets": "node ./tasks/build-widgets.js",
@ -20,6 +23,48 @@
"format:prettier": "prettier \"**/*.{cjs,html,js,json,md,ts}\" --write",
"postinstall": "husky install"
},
"wireit": {
"build": {
"dependencies": [
"../:install-dep",
"build-ts-modules",
"build-ts-with-config",
"build-ts-widgets"
]
},
"build-ts-modules": {
"command": "node tasks/esbuild-packages.js",
"files": [
"tasks/esbuild-packages.js",
"src/components/**.ts",
"src/lib/**.ts"
],
"output": [
"src/js/components/**.js",
"src/js/lib/**.js",
"src/js/widgets/**.js"
]
},
"build-ts-with-config": {
"command": "yarn tsc --build tsconfig-all.json",
"files": [
"src/**/*.ts"
],
"output": [
"src/**/*.js"
]
},
"build-ts-widgets": {
"command": "node ./tasks/build-widgets.js",
"files": [
"tasks/build-widgets.js",
"src/widgets/**.ts"
],
"output": [
"js/widgets/**.js"
]
}
},
"lint-staged": {
"*.{cjs,html,js,json,md,ts}": [
"prettier --write",
@ -37,7 +82,8 @@
"prettier": "^2.7.1",
"tslib": "^2.4.0",
"typescript": "^4.8.3",
"vite": "^3.0.0"
"vite": "^3.0.0",
"wireit": "^0.9.1"
},
"workspaces": [
"src/components/*",

View File

@ -19,8 +19,8 @@ export const buildPackage = async (paths) => {
export const watchFiles = async () => {
const files = await fg([
'./src/components/**/!(*.d).ts',
'./src/lib/**/!(*.d).ts',
'src/components/**/!(*.d).ts',
'src/lib/**/!(*.d).ts',
'src/widgets/*.ts',
'src/widgets/**/*.ts',
])