mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-07 15:08:24 +00:00
Fix matrix-js-sdk linking on Windows (#33491)
* Fix matrix-js-sdk linking on Windows * Linting
This commit is contained in:
@@ -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
|
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`
|
Switch to the `apps/web` directory: `cd apps/web`
|
||||||
|
|
||||||
Configure the app by copying `config.sample.json` to `config.json` and
|
Configure the app by copying `config.sample.json` to `config.json` and
|
||||||
@@ -57,6 +59,8 @@ pnpm install
|
|||||||
pnpm start
|
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:
|
Wait a few seconds for the initial build to finish; you should see something like:
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|||||||
+20
-10
@@ -32,21 +32,31 @@ try {
|
|||||||
const dependencyPath = join(nodeModulesPath, dependency);
|
const dependencyPath = join(nodeModulesPath, dependency);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const stat = await fs.stat(dependencyPath);
|
try {
|
||||||
if (stat.isSymbolicLink()) {
|
const stat = await fs.lstat(dependencyPath);
|
||||||
const linkPath = await fs.readlink(dependencyPath);
|
console.log(`Existing is ${stat.isSymbolicLink() ? "symlink" : "directory"}`);
|
||||||
if (linkPath === path) {
|
if (stat.isSymbolicLink()) {
|
||||||
// already done
|
const linkPath = await fs.readlink(dependencyPath);
|
||||||
continue;
|
if (linkPath === path) {
|
||||||
|
// already done
|
||||||
|
continue;
|
||||||
|
} else {
|
||||||
|
await fs.unlink(dependencyPath);
|
||||||
|
}
|
||||||
} else {
|
} 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}`);
|
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 pkgJson = await fs.readFile(join(path, "package.json"), "utf-8");
|
||||||
const pkgManager = JSON.parse(pkgJson)["packageManager"]?.split("@").at(0) ?? "yarn";
|
const pkgManager = JSON.parse(pkgJson)["packageManager"]?.split("@").at(0) ?? "yarn";
|
||||||
|
|||||||
Reference in New Issue
Block a user