diff --git a/.gitignore b/.gitignore index 575d094..53cbc8b 100644 --- a/.gitignore +++ b/.gitignore @@ -32,4 +32,6 @@ src/widgets/**/*.js src/lib/**/*.d.ts src/lib/**/*.js src/lib/**/*.js.map -*.tsbuildinfo \ No newline at end of file +*.tsbuildinfo + +.wireit \ No newline at end of file diff --git a/package.json b/package.json index e519104..f35e545 100644 --- a/package.json +++ b/package.json @@ -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/*", diff --git a/tasks/esbuild-packages.js b/tasks/esbuild-packages.js index 5a66ef1..b652a3e 100644 --- a/tasks/esbuild-packages.js +++ b/tasks/esbuild-packages.js @@ -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', ])