From 0a1423a732eee9d6ba7398653d10af3e79cea0fc Mon Sep 17 00:00:00 2001 From: Jason Jean Date: Fri, 10 Aug 2018 16:24:30 -0400 Subject: [PATCH] fix(schematics): support migrating projects with root != name from 1.7 --- .../legacy-migrations/20180515-switch-to-nx6.ts | 2 +- .../migrations/update-6-0-0/update-6-0-0.ts | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/packages/schematics/migrations/legacy-migrations/20180515-switch-to-nx6.ts b/packages/schematics/migrations/legacy-migrations/20180515-switch-to-nx6.ts index b1d0b460532fd..6c6489ee89313 100644 --- a/packages/schematics/migrations/legacy-migrations/20180515-switch-to-nx6.ts +++ b/packages/schematics/migrations/legacy-migrations/20180515-switch-to-nx6.ts @@ -16,7 +16,7 @@ export default { } updateJsonFile('package.json', json => { - json.devDependencies['@angular/cli'] = '6.0.1'; + json.devDependencies['@angular/cli'] = '6.1.2'; }); updateJsonFile('package.json', json => { diff --git a/packages/schematics/migrations/update-6-0-0/update-6-0-0.ts b/packages/schematics/migrations/update-6-0-0/update-6-0-0.ts index d0b75645b61bf..49a88c70403da 100644 --- a/packages/schematics/migrations/update-6-0-0/update-6-0-0.ts +++ b/packages/schematics/migrations/update-6-0-0/update-6-0-0.ts @@ -287,6 +287,7 @@ function moveE2eTests(host: Tree, context: SchematicContext) { if (p.projectType === 'application' && !p.architect.e2e) { renameSync(`${p.root}/e2e`, `${p.root}-e2e/src`, err => { if (!err) { + context.logger.info(`Moved ${p.root}/e2e to ${p.root}-e2e/src`); return; } @@ -333,6 +334,10 @@ function patchLibIndexFiles(host: Tree, context: SchematicContext) { } renameSync(`${p.root}/lib`, `${p.sourceRoot}/lib`, err => { // This should never error + context.logger.info(`Moved ${p.sourceRoot} to ${p.sourceRoot}/lib`); + context.logger.warn( + 'Deep imports may have been affected. Always try to import from the index of the lib.' + ); }); }); const npmScope = readJsonInTree(host, 'nx.json').npmScope; @@ -582,8 +587,6 @@ const updateAngularJson = updateJsonInTree('angular.json', json => { switch (type) { case 'application': - project.root = `apps/${key}`; - project.sourceRoot = `apps/${key}/src`; project.prefix = prefix; project.architect.build.options.tsConfig = `${ @@ -622,8 +625,6 @@ const updateAngularJson = updateJsonInTree('angular.json', json => { break; case 'library': - project.root = `libs/${key}`; - project.sourceRoot = `libs/${key}/src`; project.prefix = prefix; project.projectType = 'library'; @@ -653,8 +654,8 @@ const updateAngularJson = updateJsonInTree('angular.json', json => { if (appProject.projectType === 'library') { break; } - project.root = `apps/${key}`; - project.sourceRoot = `apps/${key}/src`; + project.root = `${appProject.root}-e2e`; + project.sourceRoot = `${project.root}/src`; project.prefix = prefix; project.architect.e2e.options.protractorConfig = `${