fix(angular): handle different workspace version and format when falling back to the angular cli (#8993)

This commit is contained in:
Leosvel Pérez Espinosa 2022-02-16 17:54:44 +00:00 committed by GitHub
parent a86f5d8b1c
commit 1cae869ff0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -103,6 +103,7 @@ export function initLocal(workspace: Workspace) {
}) })
); );
} else { } else {
require('@nrwl/tao/src/compat/compat');
loadCli(workspace, '@angular/cli/lib/init.js'); loadCli(workspace, '@angular/cli/lib/init.js');
} }
} }

View File

@ -58,12 +58,12 @@ if (!patched) {
`@angular-devkit/core/src/workspace/json/reader`, `@angular-devkit/core/src/workspace/json/reader`,
]); ]);
const originalReadJsonWorkspace = readJsonUtils.readJsonWorkspace; const originalReadJsonWorkspace = readJsonUtils.readJsonWorkspace;
readJsonUtils.readJsonWorkspace = ( readJsonUtils.readJsonWorkspace = async (
path, path,
host: { readFile: (p) => Promise<string> } host: { readFile: (p) => Promise<string> }
) => { ) => {
try { try {
return originalReadJsonWorkspace(path, host); return await originalReadJsonWorkspace(path, host);
} catch { } catch {
logger.debug( logger.debug(
'[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic' '[NX] Angular devkit readJsonWorkspace fell back to Nx workspaces logic'