diff --git a/developer_guide.md b/developer_guide.md index 260ae64961..ab5231779e 100644 --- a/developer_guide.md +++ b/developer_guide.md @@ -45,6 +45,8 @@ Set up your local development link by creating a `.link-config` file with conten matrix-js-sdk=/path/to/matrix-js-sdk ``` +**Note for Windows users**: Your link config path might need escaping. For example, `matrix-js-sdk=C:\\path\\to\\matrix-js-sdk`. + Switch to the `apps/web` directory: `cd apps/web` Configure the app by copying `config.sample.json` to `config.json` and @@ -57,6 +59,8 @@ pnpm install pnpm start ``` +**Note for Windows users**: `pnpm start` needs to be run from a terminal with bash/shell support. + Wait a few seconds for the initial build to finish; you should see something like: ``` diff --git a/scripts/pnpm-link.ts b/scripts/pnpm-link.ts index 756494a183..e3f753704b 100755 --- a/scripts/pnpm-link.ts +++ b/scripts/pnpm-link.ts @@ -32,21 +32,31 @@ try { const dependencyPath = join(nodeModulesPath, dependency); try { - const stat = await fs.stat(dependencyPath); - if (stat.isSymbolicLink()) { - const linkPath = await fs.readlink(dependencyPath); - if (linkPath === path) { - // already done - continue; + try { + const stat = await fs.lstat(dependencyPath); + console.log(`Existing is ${stat.isSymbolicLink() ? "symlink" : "directory"}`); + if (stat.isSymbolicLink()) { + const linkPath = await fs.readlink(dependencyPath); + if (linkPath === path) { + // already done + continue; + } else { + await fs.unlink(dependencyPath); + } } else { - await fs.unlink(dependencyPath); + await fs.rm(dependencyPath, { recursive: true }); + } + } catch (e: any) { + // fs.lstat throws ENOENT if the path doesn't exist (on Windows) + if (e.code === "ENOENT") { + console.log("Received ENOENT error on dependency path - assuming it doesn't exist"); + } else { + throw e; } - } else { - await fs.rm(dependencyPath, { recursive: true }); } console.log(`Linking ${dependency} to ${path}`); - await fs.symlink(path, dependencyPath); + await fs.symlink(path, dependencyPath, "junction"); // use a junction type to avoid EPERM errors on Windows const pkgJson = await fs.readFile(join(path, "package.json"), "utf-8"); const pkgManager = JSON.parse(pkgJson)["packageManager"]?.split("@").at(0) ?? "yarn";