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:
Wout Mertens
2024-01-21 22:26:59 +01:00
parent 7d45737a06
commit 0fe893db4d
5 changed files with 25 additions and 1 deletions

View 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',
});
}

View File

@@ -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",

View File

@@ -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
View File

@@ -0,0 +1,2 @@
// re-export to make TS happy when not using nodenext import resolution
export * from '../dist/build';

View File

@@ -1,4 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["packages/docs"]
"include": ["packages/docs"],
"exclude": ["packages/docs/dist"]
}