Files
sui-data-sync/tools/bin/find-project-root
Zitao Xiong a07d262277 add dev
2024-05-23 18:10:25 +08:00

25 lines
468 B
JavaScript
Executable File

#!/usr/bin/env node
const { createProjectGraphAsync } = require('@nx/devkit');
async function run() {
const graph = await createProjectGraphAsync();
const [, , name] = process.argv;
const project = graph.nodes[name];
if (project == null) {
throw new Error(`Project ${name} not found`);
} else {
console.log(project.data.root);
}
}
run()
.then(() => {
process.exit(0);
})
.catch(e => {
console.error(e);
process.exit(1);
});