fix: docs build
- ensure that qwik was built first - ignore dist when running tsc - fake-export qwik/build for types during development - put assets under /assets in the build for cleanliness, the bundled js files go in there too.
This commit is contained in:
17
packages/docs/check-qwik-build.ts
Normal file
17
packages/docs/check-qwik-build.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
// verify that ../qwik/dist/core.d.ts exists or run `pnpm run build.core` in the root directory
|
||||
// we need it for development and for the REPL
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
import { spawnSync } from 'child_process';
|
||||
|
||||
const coreDtsPath = path.join(__dirname, '../qwik/dist/core.d.ts');
|
||||
if (!fs.existsSync(coreDtsPath)) {
|
||||
console.warn(
|
||||
`Missing ${coreDtsPath}. Running 'pnpm run build.core' in the root directory to generate it.`
|
||||
);
|
||||
// now run `pnpm run build.core` in the root directory
|
||||
spawnSync('pnpm', ['run', 'build.core'], {
|
||||
cwd: path.join(__dirname, '../..'),
|
||||
stdio: 'inherit',
|
||||
});
|
||||
}
|
||||
@@ -63,6 +63,7 @@
|
||||
"packageManager": "pnpm@8.14.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"prebuild": "tsm check-qwik-build.ts",
|
||||
"build": "qwik build",
|
||||
"build.client": "vite build",
|
||||
"build.preview": "vite build --ssr src/entry.preview.tsx",
|
||||
|
||||
@@ -145,6 +145,9 @@ export default defineConfig(async () => {
|
||||
}
|
||||
defaultHandler(level, log);
|
||||
},
|
||||
output: {
|
||||
assetFileNames: 'assets/[hash].[ext]',
|
||||
},
|
||||
},
|
||||
},
|
||||
clearScreen: false,
|
||||
|
||||
2
packages/qwik/build/index.d.ts
vendored
Normal file
2
packages/qwik/build/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// re-export to make TS happy when not using nodenext import resolution
|
||||
export * from '../dist/build';
|
||||
@@ -1,4 +1,5 @@
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"include": ["packages/docs"]
|
||||
"include": ["packages/docs"],
|
||||
"exclude": ["packages/docs/dist"]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user