Skip to content

Commit 0fe893d

Browse files
committed
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.
1 parent 7d45737 commit 0fe893d

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

packages/docs/check-qwik-build.ts

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// verify that ../qwik/dist/core.d.ts exists or run `pnpm run build.core` in the root directory
2+
// we need it for development and for the REPL
3+
import fs from 'fs';
4+
import path from 'path';
5+
import { spawnSync } from 'child_process';
6+
7+
const coreDtsPath = path.join(__dirname, '../qwik/dist/core.d.ts');
8+
if (!fs.existsSync(coreDtsPath)) {
9+
console.warn(
10+
`Missing ${coreDtsPath}. Running 'pnpm run build.core' in the root directory to generate it.`
11+
);
12+
// now run `pnpm run build.core` in the root directory
13+
spawnSync('pnpm', ['run', 'build.core'], {
14+
cwd: path.join(__dirname, '../..'),
15+
stdio: 'inherit',
16+
});
17+
}

packages/docs/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
"packageManager": "[email protected]",
6464
"private": true,
6565
"scripts": {
66+
"prebuild": "tsm check-qwik-build.ts",
6667
"build": "qwik build",
6768
"build.client": "vite build",
6869
"build.preview": "vite build --ssr src/entry.preview.tsx",

packages/docs/vite.config.ts

+3
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ export default defineConfig(async () => {
145145
}
146146
defaultHandler(level, log);
147147
},
148+
output: {
149+
assetFileNames: 'assets/[hash].[ext]',
150+
},
148151
},
149152
},
150153
clearScreen: false,

packages/qwik/build/index.d.ts

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

tsconfig-docs.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"extends": "./tsconfig.json",
3-
"include": ["packages/docs"]
3+
"include": ["packages/docs"],
4+
"exclude": ["packages/docs/dist"]
45
}

0 commit comments

Comments
 (0)