Skip to content

Commit

Permalink
fix(schematics): support migrating projects with root != name from 1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and vsavkin committed Aug 20, 2018
1 parent cca6b9f commit 0a1423a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down
13 changes: 7 additions & 6 deletions packages/schematics/migrations/update-6-0-0/update-6-0-0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 = `${
Expand Down Expand Up @@ -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';
Expand Down Expand Up @@ -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 = `${
Expand Down

0 comments on commit 0a1423a

Please sign in to comment.