Parcourir la source

Ensure relative paths in devmode use '/'

Ensure forward slashes are used on Windows in integrity script.
Vidar Tonaas Fauske il y a 5 ans
Parent
commit
df50235358
2 fichiers modifiés avec 15 ajouts et 1 suppressions
  1. 3 1
      buildutils/src/ensure-repo.ts
  2. 12 0
      buildutils/src/utils.ts

+ 3 - 1
buildutils/src/ensure-repo.ts

@@ -219,7 +219,9 @@ function ensureJupyterlab(): string[] {
     }
 
     // watch all src, build, and test files in the Jupyterlab project
-    let relativePath = `../${path.relative(basePath, pkgPath)}`;
+    let relativePath = utils.ensureUnixPathSep(
+      path.join('..', path.relative(basePath, pkgPath))
+    );
     corePackage.jupyterlab.linkedPackages[data.name] = relativePath;
   });
 

+ 12 - 0
buildutils/src/utils.ts

@@ -8,6 +8,8 @@ import coreutils = require('@phosphor/coreutils');
 
 type Dict<T> = { [key: string]: T };
 
+const backSlash = /\\/g;
+
 /**
  * Get all of the lerna package paths.
  */
@@ -262,3 +264,13 @@ function requirePackage(parentModule: string, module: string) {
   });
   return require(requirePath);
 }
+
+/**
+ * Ensure the given path uses '/' as path separator.
+ */
+export function ensureUnixPathSep(source: string) {
+  if (path.sep === '/') {
+    return source;
+  }
+  return source.replace(backSlash, '/');
+}