|
@@ -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>> {
|
|
export function getPackageGraph(): DepGraph<Dict<any>> {
|
|
// Create a shared dependency graph.
|
|
// Create a shared dependency graph.
|
|
@@ -197,6 +197,11 @@ export function getPackageGraph(): DepGraph<Dict<any>> {
|
|
const paths = getLernaPaths();
|
|
const paths = getLernaPaths();
|
|
const locals: Dict<string> = {};
|
|
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.
|
|
// Gather all of our package data.
|
|
paths.forEach(pkgPath => {
|
|
paths.forEach(pkgPath => {
|
|
// Read in the package.json.
|
|
// Read in the package.json.
|
|
@@ -213,17 +218,17 @@ export function getPackageGraph(): DepGraph<Dict<any>> {
|
|
|
|
|
|
const recurseDeps = (data: any) => {
|
|
const recurseDeps = (data: any) => {
|
|
const deps: Dict<Array<string>> = data.dependencies || {};
|
|
const deps: Dict<Array<string>> = data.dependencies || {};
|
|
- graph.addNode(data.name);
|
|
|
|
|
|
+ graph.addNode(data.name, data);
|
|
Object.keys(deps).forEach(depName => {
|
|
Object.keys(deps).forEach(depName => {
|
|
const hadNode = graph.hasNode(depName);
|
|
const hadNode = graph.hasNode(depName);
|
|
- graph.addNode(depName);
|
|
|
|
- graph.addDependency(data.name, depName);
|
|
|
|
// Get external deps if needed.
|
|
// Get external deps if needed.
|
|
let depData = locals[depName];
|
|
let depData = locals[depName];
|
|
if (!(depName in locals)) {
|
|
if (!(depName in locals)) {
|
|
depData = require(`${depName}/package.json`);
|
|
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)) {
|
|
if (!hadNode && !(depName in locals)) {
|
|
recurseDeps(depData);
|
|
recurseDeps(depData);
|
|
}
|
|
}
|
|
@@ -232,7 +237,7 @@ export function getPackageGraph(): DepGraph<Dict<any>> {
|
|
|
|
|
|
// Build up a dependency graph from all our local packages.
|
|
// Build up a dependency graph from all our local packages.
|
|
Object.keys(locals).forEach(name => {
|
|
Object.keys(locals).forEach(name => {
|
|
- recurseDeps(name);
|
|
|
|
|
|
+ recurseDeps(locals[name]);
|
|
});
|
|
});
|
|
|
|
|
|
return graph;
|
|
return graph;
|