Steven Silvester пре 5 година
родитељ
комит
b65b0ea7c8
2 измењених фајлова са 15 додато и 9 уклоњено
  1. 3 2
      buildutils/src/ensure-repo.ts
  2. 12 7
      buildutils/src/utils.ts

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

@@ -232,7 +232,7 @@ export async function ensureIntegrity(): Promise<boolean> {
   // Get the package graph.
   const graph = utils.getPackageGraph();
 
-  // Gather all of our package data.
+  // Gather all of our package data and other metadata.
   paths.forEach(pkgPath => {
     // Read in the package.json.
     let data: any;
@@ -243,7 +243,7 @@ export async function ensureIntegrity(): Promise<boolean> {
       return;
     }
 
-    pkgData[data.name] = graph.getNodeData(data.name);
+    pkgData[data.name] = data;
     pkgPaths[data.name] = pkgPath;
     pkgNames[pkgPath] = data.name;
     locals[data.name] = pkgPath;
@@ -268,6 +268,7 @@ export async function ensureIntegrity(): Promise<boolean> {
         return;
       }
       const depData = graph.getNodeData(depName);
+      console.log('hi', depName);
       if (depData.style) {
         cssData[depName] = [pkgData[depName].style];
       }

+ 12 - 7
buildutils/src/utils.ts

@@ -186,8 +186,8 @@ export function run(
 }
 
 /**
- * Get a graph that has all of the package data for the local packages and thier
- * first order depencies.
+ * Get a graph that has all of the package data for the local packages and their
+ * first order dependencies.
  */
 export function getPackageGraph(): DepGraph<Dict<any>> {
   // Create a shared dependency graph.
@@ -197,6 +197,11 @@ export function getPackageGraph(): DepGraph<Dict<any>> {
   const paths = getLernaPaths();
   const locals: Dict<string> = {};
 
+  // These two are not part of the workspaces but should be
+  // considered part of the dependency graph.
+  paths.push('./jupyterlab/tests/mock_packages/extension');
+  paths.push('./jupyterlab/tests/mock_packages/mimeextension');
+
   // Gather all of our package data.
   paths.forEach(pkgPath => {
     // Read in the package.json.
@@ -213,17 +218,17 @@ export function getPackageGraph(): DepGraph<Dict<any>> {
 
   const recurseDeps = (data: any) => {
     const deps: Dict<Array<string>> = data.dependencies || {};
-    graph.addNode(data.name);
+    graph.addNode(data.name, data);
     Object.keys(deps).forEach(depName => {
       const hadNode = graph.hasNode(depName);
-      graph.addNode(depName);
-      graph.addDependency(data.name, depName);
       // Get external deps if needed.
       let depData = locals[depName];
       if (!(depName in locals)) {
         depData = require(`${depName}/package.json`);
       }
-      // Only recursive if we haven't yet recursed and this is a local pkg.
+      graph.addNode(depName, depData);
+      graph.addDependency(data.name, depName);
+      // Only recurse if we haven't yet recursed and this is a local pkg.
       if (!hadNode && !(depName in locals)) {
         recurseDeps(depData);
       }
@@ -232,7 +237,7 @@ export function getPackageGraph(): DepGraph<Dict<any>> {
 
   // Build up a dependency graph from all our local packages.
   Object.keys(locals).forEach(name => {
-    recurseDeps(name);
+    recurseDeps(locals[name]);
   });
 
   return graph;