build: 优化type check性能
This commit is contained in:
@@ -17,7 +17,7 @@
|
|||||||
"pg:react": "pnpm playground:react",
|
"pg:react": "pnpm playground:react",
|
||||||
"build": "pnpm build:dts && node scripts/build.mjs",
|
"build": "pnpm build:dts && node scripts/build.mjs",
|
||||||
"build:dts": "pnpm --filter \"@tmagic/cli\" build && tsc -p tsconfig.build-browser.json && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build-vue.json && rolldown -c rolldown.dts.config.mjs && rimraf temp",
|
"build:dts": "pnpm --filter \"@tmagic/cli\" build && tsc -p tsconfig.build-browser.json && vue-tsc --declaration --emitDeclarationOnly --project tsconfig.build-vue.json && rolldown -c rolldown.dts.config.mjs && rimraf temp",
|
||||||
"check:type": "tsc --incremental --noEmit -p tsconfig.check.json && vue-tsc --noEmit -p tsconfig.check-vue.json",
|
"check:type": "node scripts/check-type.mjs",
|
||||||
"build:playground": "pnpm --filter \"runtime-vue\" build && pnpm --filter \"tmagic-playground\" build",
|
"build:playground": "pnpm --filter \"runtime-vue\" build && pnpm --filter \"tmagic-playground\" build",
|
||||||
"docs:dev": "vitepress dev docs",
|
"docs:dev": "vitepress dev docs",
|
||||||
"docs:serve": "vitepress serve docs",
|
"docs:serve": "vitepress serve docs",
|
||||||
|
|||||||
22
scripts/check-type.mjs
Normal file
22
scripts/check-type.mjs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import { spawn } from 'node:child_process';
|
||||||
|
|
||||||
|
const commands = [
|
||||||
|
['tsc', ['--incremental', '--noEmit', '-p', 'tsconfig.check.json']],
|
||||||
|
['vue-tsc', ['--incremental', '--noEmit', '-p', 'tsconfig.check-vue.json']],
|
||||||
|
];
|
||||||
|
|
||||||
|
const results = await Promise.allSettled(
|
||||||
|
commands.map(
|
||||||
|
([cmd, args]) =>
|
||||||
|
new Promise((resolve, reject) => {
|
||||||
|
const p = spawn(cmd, args, { stdio: 'inherit', shell: true });
|
||||||
|
p.on('close', (code) => (code === 0 ? resolve() : reject(new Error(`${cmd} exited with code ${code}`))));
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
const failed = results.filter((r) => r.status === 'rejected');
|
||||||
|
if (failed.length > 0) {
|
||||||
|
for (const f of failed) console.error(f.reason?.message);
|
||||||
|
process.exit(1);
|
||||||
|
}
|
||||||
@@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"incremental": true,
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tscheck/check-vue.tsbuildinfo",
|
||||||
|
"sourceMap": false
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"packages/design/src",
|
"packages/design/src",
|
||||||
"packages/editor/src",
|
"packages/editor/src",
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
{
|
{
|
||||||
"extends": "./tsconfig.json",
|
"extends": "./tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"incremental": true,
|
||||||
|
"tsBuildInfoFile": "./node_modules/.cache/tscheck/check.tsbuildinfo",
|
||||||
|
"sourceMap": false
|
||||||
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"packages/core/src",
|
"packages/core/src",
|
||||||
"packages/data-source/src",
|
"packages/data-source/src",
|
||||||
|
|||||||
Reference in New Issue
Block a user