Skip to content

Commit

Permalink
refactor: move the qwik insights module in its own build
Browse files Browse the repository at this point in the history
this speeds up `pnpm build --qwik --dev` by a lot
  • Loading branch information
wmertens committed Jan 19, 2025
1 parent 4c26e1e commit 8afe833
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 9 deletions.
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,20 +172,20 @@
"build.clean": "rm -rf packages/qwik/dist/ && rm -rf packages/qwik-router/lib/ && rm -rf packages/docs/dist/ && rm -rf packages/insights/dist/",
"build.cli": "tsx --require ./scripts/runBefore.ts scripts/index.ts --cli --dev",
"build.cli.prod": "tsx --require ./scripts/runBefore.ts scripts/index.ts --cli",
"build.core": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --qwikrouter --api --platform-binding",
"build.core": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwik --insights --qwikrouter --api --platform-binding",
"build.eslint": "tsx --require ./scripts/runBefore.ts scripts/index.ts --eslint",
"build.full": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding --wasm",
"build.local": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding-wasm-copy",
"build.only_javascript": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api",
"build.full": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --insights --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding --wasm",
"build.local": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --tsc-docs --qwik --insights --supabaseauthhelpers --api --eslint --qwikrouter --qwikworker --qwikreact --cli --platform-binding-wasm-copy",
"build.only_javascript": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwik --api",
"build.packages.docs": "pnpm -C ./packages/docs/ run build",
"build.packages.insights": "pnpm -C ./packages/insights/ run build",
"build.platform": "tsx --require ./scripts/runBefore.ts scripts/index.ts --platform-binding",
"build.platform.copy": "tsx --require ./scripts/runBefore.ts scripts/index.ts --platform-binding-wasm-copy",
"build.qwik-router": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwikrouter",
"build.validate": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api --eslint --qwikrouter --platform-binding --wasm --validate",
"build.vite": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --build --api --qwikrouter --eslint --platform-binding-wasm-copy",
"build.validate": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwik --api --eslint --qwikrouter --platform-binding --wasm --validate",
"build.vite": "tsx --require ./scripts/runBefore.ts scripts/index.ts --tsc --qwik --insights --api --qwikrouter --eslint --platform-binding-wasm-copy",
"build.wasm": "tsx --require ./scripts/runBefore.ts scripts/index.ts --wasm",
"build.watch": "tsx --require ./scripts/runBefore.ts scripts/index.ts --build --qwikrouter --watch --dev --platform-binding",
"build.watch": "tsx --require ./scripts/runBefore.ts scripts/index.ts --qwik --qwikrouter --watch --dev --platform-binding",
"change": "changeset",
"cli": "pnpm build.cli && node packages/create-qwik/dist/create-qwik.cjs && tsx --require ./scripts/runBefore.ts scripts/validate-cli.ts --copy-local-qwik-dist",
"cli.qwik": "pnpm build.cli && node packages/qwik/dist/qwik-cli.cjs",
Expand Down
4 changes: 3 additions & 1 deletion scripts/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,15 @@ export async function build(config: BuildConfig) {
submoduleBuild(config),
submoduleTesting(config),
submoduleCli(config),
submoduleInsights(config),
]);

// server bundling must happen after the results from the others
// because it inlines the qwik loader and prefetch scripts
await Promise.all([submoduleServer(config), submoduleOptimizer(config)]);
}
if (config.insights) {
await submoduleInsights(config);
}

if (config.api || (!config.dev && config.qwik)) {
rmSync(join(config.rootDir, 'dist-dev', 'api'), { recursive: true, force: true });
Expand Down
2 changes: 1 addition & 1 deletion scripts/submodule-insights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async function buildComponents(config: BuildConfig) {
cwd: config.srcQwikDir,
});
if (result.failed) {
panic(`tsc failed`);
panic(`insights build failed`);
}
}

Expand Down
1 change: 1 addition & 0 deletions scripts/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const booleanOptions = [
'dryRun',
'eslint',
'esmNode',
'insights',
'platformBinding',
'platformBindingWasmCopy',
'prepareRelease',
Expand Down

0 comments on commit 8afe833

Please sign in to comment.