bug(nx-betterer): no such file or directory, open 'workspace.json'
markgoho opened this issue · comments
// setup.ts
const plainWorkspaceJson = readJsonFile<{ projects: Record<string, string | any> }>('workspace.json');
this line appears to be looking for workspace.json
at the root of the project and results in the following error:
Error: ENOENT: no such file or directory, open 'workspace.json'
at readFileSync (node:fs:453:20)
at readJsonFile (/Users/mgoho/Documents/GitHub/xxx/node_modules/nx/src/utils/fileutils.js:17:43)
at setupNxBetterer (/Users/mgoho/Documents/GitHub/xxx/packages/nx-betterer/src/lib/setup.ts:9:44)
at nxBettererPreset (/Users/mgoho/Documents/GitHub/xxx/packages/nx-betterer/src/lib/nx-betterer.ts:13:36)
at Object.<anonymous> (/Users/mgoho/Documents/GitHub/xxx/.betterer.ts:4:21)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module.m._compile (/Users/mgoho/Documents/GitHub/xxx/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Object.require.extensions.<computed> [as .ts] (/Users/mgoho/Documents/GitHub/xxx/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1207:32)
commenting out the offending line in the transpiled module does allow the process to continue, e.g.
function setupNxBetterer() {
// const plainWorkspaceJson = (0, devkit_1.readJsonFile)('workspace.json'); <-- removed
const workspaceJson = (0, project_graph_1.readCachedProjectGraph)();
const workspaceProjects = Object.entries(workspaceJson.nodes)
.filter(([, node]) => !node.name.startsWith('npm:') && node.type !== 'e2e')
.map(([, node]) => node);
const tsConfigBase = (0, devkit_1.readJsonFile)('tsconfig.base.json');
return {
// plainWorkspaceJson, <--- removed return
workspaceJson,
workspaceProjects,
tsConfigBase,
};
}
after having done this, of course, all other tests that use this plainWorkspaceJson
reference fail