Skip to content

Commit

Permalink
fix: docs build
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
wmertens committed Jan 21, 2024
1 parent 7d45737 commit 0fe893d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/docs/check-qwik-build.ts
Original file line number Diff line number Diff line change
@@ -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',
});
}
1 change: 1 addition & 0 deletions packages/docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"packageManager": "[email protected]",
"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",
Expand Down
3 changes: 3 additions & 0 deletions packages/docs/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ export default defineConfig(async () => {
}
defaultHandler(level, log);
},
output: {
assetFileNames: 'assets/[hash].[ext]',
},
},
},
clearScreen: false,
Expand Down
2 changes: 2 additions & 0 deletions packages/qwik/build/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// re-export to make TS happy when not using nodenext import resolution
export * from '../dist/build';
3 changes: 2 additions & 1 deletion tsconfig-docs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"extends": "./tsconfig.json",
"include": ["packages/docs"]
"include": ["packages/docs"],
"exclude": ["packages/docs/dist"]
}

0 comments on commit 0fe893d

Please sign in to comment.