Skip to content

Commit c51aaab

Browse files
authored
Merge pull request #7388 from Shane-Donlon/fix-windowsdocs.dev
Fix: Windows Docs.dev script
2 parents a8a1d13 + d6b66d9 commit c51aaab

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
"cli.qwik": "pnpm build.cli && node packages/qwik/qwik-cli.cjs",
228228
"cli.validate": "tsx --require ./scripts/runBefore.ts scripts/validate-cli.ts",
229229
"deps": "corepack pnpm upgrade -i -r --latest && syncpack fix-mismatches && corepack pnpm dedupe",
230-
"docs.dev": "cd packages/docs && pnpm build.repl-sw && pnpm dev",
230+
"docs.dev": "pnpm -C packages/docs build.repl-sw && pnpm -C packages/docs dev",
231231
"docs.preview": "cd packages/docs && pnpm preview",
232232
"docs.sync": "tsx --require ./scripts/runBefore.ts scripts/docs_sync/index.ts && pnpm fmt",
233233
"eslint.update": "tsx --require ./scripts/runBefore.ts scripts/eslint-docs.ts",

packages/docs/check-qwik-build.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
11
// verify that ../qwik/dist/core.d.ts exists or run `pnpm run build.core` in the root directory
22
// Also make sure that the repl-sw.js file is present, for dev mode
33
// we need it for development and for the REPL
4-
import fs from 'fs';
5-
import path from 'path';
6-
import { spawnSync } from 'child_process';
74

8-
const __dirname = path.dirname(new URL(import.meta.url).pathname);
5+
import fs from 'node:fs';
6+
import path from 'node:path';
7+
import { spawnSync } from 'node:child_process';
8+
9+
let __dirname = path.dirname(new URL(import.meta.url).pathname);
10+
const isWindows = process.platform === 'win32';
11+
if (isWindows && __dirname.startsWith('/')) {
12+
// in Windows __dirname starts with a / causing errors
13+
// before
14+
// /C:/Users/{location stuff}/qwik/packages/docs
15+
__dirname = __dirname.substring(1);
16+
// after
17+
// C:/Users/{location stuff}/qwik/packages/docs
18+
}
919
const qwikPkgDir = path.join(__dirname, '..', 'qwik', 'dist');
1020

1121
if (!fs.existsSync(path.join(qwikPkgDir, 'core.d.ts'))) {

packages/docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"codesandbox.sync": "tsx codesandbox.sync.ts",
7676
"contributors": "tsx contributors.ts",
7777
"deploy": "wrangler pages publish ./dist",
78-
"dev": "concurrently \"tsx check-qwik-build.ts\" \"vite --mode ssr --open\"",
78+
"dev": "tsx check-qwik-build.ts && vite --mode ssr --open",
7979
"dev.debug": "node --inspect-brk ../../node_modules/vite/bin/vite.js --mode ssr --force",
8080
"prebuild.core": "tsx check-qwik-build.ts",
8181
"preview": "qwik build preview && vite preview --open",

packages/eslint-plugin-qwik/qwik.unit.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,13 @@ interface InvalidTestCase extends TestCase {
4242
}
4343
await (async function setupEsLintRuleTesters() {
4444
// list './test' directory content and set up one RuleTester per directory
45-
const testDir = join(dirname(new URL(import.meta.url).pathname), './tests');
45+
let testDir = join(dirname(new URL(import.meta.url).pathname), './tests');
46+
const isWindows = process.platform === 'win32';
47+
if (isWindows && testDir.startsWith('\\')) {
48+
// in Windows testDir starts with a \ causing errors
49+
testDir = testDir.substring(1);
50+
}
51+
4652
const ruleNames = await readdir(testDir);
4753
for (const ruleName of ruleNames) {
4854
const rule = rules[ruleName];

0 commit comments

Comments
 (0)