Skip to content

Commit

Permalink
feat(core): install packages after migrations have run and dependenci…
Browse files Browse the repository at this point in the history
…es haven been modified (#10415)
  • Loading branch information
leosvelperez committed May 27, 2022
1 parent 9d0d0f2 commit 7aec02e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/nx/src/command-line/migrate.ts
Expand Up @@ -941,6 +941,8 @@ async function runMigrations(
(shouldCreateCommits ? ', with each applied in a dedicated commit' : '')
);

const depsBeforeMigrations = getStringifiedPackageJsonDeps(root);

const migrations: {
package: string;
name: string;
Expand Down Expand Up @@ -988,11 +990,24 @@ async function runMigrations(
logger.info(`---------------------------------------------------------`);
}

const depsAfterMigrations = getStringifiedPackageJsonDeps(root);
if (depsBeforeMigrations !== depsAfterMigrations) {
runInstall();
}

logger.info(
`NX Successfully finished running migrations from '${opts.runMigrations}'`
);
}

function getStringifiedPackageJsonDeps(root: string): string {
const { dependencies, devDependencies } = readJsonFile<PackageJson>(
join(root, 'package.json')
);

return JSON.stringify([dependencies, devDependencies]);
}

function commitChangesIfAny(commitMessage: string): {
sha: string | null;
reasonForNoCommit: string | null;
Expand Down

1 comment on commit 7aec02e

@vercel
Copy link

@vercel vercel bot commented on 7aec02e May 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

nx-dev – ./

nx-five.vercel.app
nx-dev-git-master-nrwl.vercel.app
nx-dev-nrwl.vercel.app
nx.dev

Please sign in to comment.