@nx-dotnet/utils
Version:
This library was generated with [Nx](https://nx.dev).
22 lines • 986 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.readDependenciesFromNxDepGraph = readDependenciesFromNxDepGraph;
const devkit_1 = require("@nx/devkit");
const child_process_1 = require("child_process");
const promises_1 = require("fs/promises");
const path_1 = require("path");
async function readDependenciesFromNxDepGraph(workspaceRoot, project) {
const depGraphFile = (0, path_1.join)('tmp', 'dep-graph.json');
(0, child_process_1.execSync)(`npx nx graph --file ${depGraphFile}`, {
cwd: workspaceRoot,
stdio: 'inherit',
windowsHide: true,
});
const absolutePath = (0, path_1.join)(workspaceRoot, depGraphFile);
const { graph } = await (0, devkit_1.readJsonFile)(absolutePath);
await (0, promises_1.unlink)(absolutePath);
const deps = graph.dependencies[project];
console.log('[E2E]: Found dependencies', deps);
return new Set(deps.map((x) => x.target));
}
//# sourceMappingURL=nx.js.map