Skip to content

Commit

Permalink
fix(core): update migration generators missing calls to format files (#…
Browse files Browse the repository at this point in the history
…27082)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

<!-- If this is a particularly complex change or feature addition, you
can request a dedicated Nx release for this pull request branch. Mention
someone from the Nx team or the `@nrwl/nx-pipelines-reviewers` and they
will confirm if the PR warrants its own release for testing purposes,
and generate it for you if appropriate. -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #25122
  • Loading branch information
leosvelperez authored Jul 24, 2024
1 parent e474b59 commit 8afd3ea
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
} from '../../generators/utils/project-configuration';
import { Tree } from '../../generators/tree';
import { updateJson } from '../../generators/utils/json';
import { formatChangedFilesWithPrettierIfAvailable } from '../../generators/internal-utils/format-changed-files-with-prettier-if-available';

export default async function (tree: Tree) {
updateJson(tree, 'package.json', (json) => {
Expand All @@ -28,4 +29,6 @@ export default async function (tree: Tree) {
}
}
updateNxJson(tree, nxJson);

await formatChangedFilesWithPrettierIfAvailable(tree);
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { createTreeWithEmptyWorkspace } from '../../generators/testing-utils/cre
import migrate from './disable-crystal-for-existing-workspaces';

describe('disable crystal for existing workspaces', () => {
it('should add flag to nx.json', () => {
it('should add flag to nx.json', async () => {
const tree = createTreeWithEmptyWorkspace();
migrate(tree);
await migrate(tree);
expect(tree.read('nx.json', 'utf-8')).toMatchInlineSnapshot(`
"{
"affected": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { readNxJson, updateNxJson } from '../../generators/utils/nx-json';
import { Tree } from '../../generators/tree';
import { formatChangedFilesWithPrettierIfAvailable } from '../../generators/internal-utils/format-changed-files-with-prettier-if-available';

export default function migrate(tree: Tree) {
export default async function migrate(tree: Tree) {
const nxJson = readNxJson(tree);
nxJson.useInferencePlugins = false;
updateNxJson(tree, nxJson);

await formatChangedFilesWithPrettierIfAvailable(tree);
}

0 comments on commit 8afd3ea

Please sign in to comment.