forked from nrwl/nx
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(nextjs): remove outdated packages
The features should be available by default closed nrwl#11882
- Loading branch information
1 parent
8d35eda
commit 7aeed36
Showing
9 changed files
with
87 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
...es/react/src/migrations/update-16-1-0-remove-package/update-16-1-0-remove-package.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { Tree, readJson, updateJson } from '@nx/devkit'; | ||
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports'; | ||
import removePackage from './update-16-1-0-remove-package'; | ||
|
||
describe('update-16-1-0-remove-package', () => { | ||
let tree: Tree; | ||
beforeEach(() => { | ||
tree = createTreeWithEmptyWorkspace(); | ||
|
||
updateJson(tree, 'package.json', (json) => { | ||
json.devDependencies['react-test-renderer'] = '18.2.0'; | ||
return json; | ||
}); | ||
}); | ||
|
||
it('should remove react-test-renderer from package.json', async () => { | ||
await removePackage(tree); | ||
|
||
expect( | ||
readJson(tree, 'package.json').devDependencies['react-test-renderer'] | ||
).not.toBeDefined(); | ||
}); | ||
}); |
10 changes: 10 additions & 0 deletions
10
packages/react/src/migrations/update-16-1-0-remove-package/update-16-1-0-remove-package.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { | ||
Tree, | ||
formatFiles, | ||
removeDependenciesFromPackageJson, | ||
} from '@nx/devkit'; | ||
|
||
export default async function removePackage(tree: Tree): Promise<void> { | ||
removeDependenciesFromPackageJson(tree, [], ['react-test-renderer']); | ||
await formatFiles(tree); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...es/web/src/migrations/update-16-1-0-remove-packages/update-16-1-0-remove-packages.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { Tree, readJson, updateJson } from '@nx/devkit'; | ||
import { createTreeWithEmptyWorkspace } from 'nx/src/devkit-testing-exports'; | ||
import removePackages from './update-16-1-0-remove-packages'; | ||
|
||
describe('update-16-1-0-remove-packages', () => { | ||
let tree: Tree; | ||
beforeEach(() => { | ||
tree = createTreeWithEmptyWorkspace(); | ||
|
||
updateJson(tree, 'package.json', (json) => { | ||
json.dependencies['core-js'] = '3.6.5'; | ||
json.dependencies['regenerator-runtime'] = '0.13.7'; | ||
return json; | ||
}); | ||
}); | ||
|
||
it('should remove core-js & regenerator-runtime packages', async () => { | ||
await removePackages(tree); | ||
|
||
expect( | ||
readJson(tree, 'package.json').dependencies['core-js'] | ||
).not.toBeDefined(); | ||
expect( | ||
readJson(tree, 'package.json').dependencies['regenerator-runtime'] | ||
).not.toBeDefined(); | ||
}); | ||
}); |
15 changes: 15 additions & 0 deletions
15
packages/web/src/migrations/update-16-1-0-remove-packages/update-16-1-0-remove-packages.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { | ||
Tree, | ||
formatFiles, | ||
removeDependenciesFromPackageJson, | ||
} from '@nx/devkit'; | ||
|
||
export default async function removePackages(tree: Tree): Promise<void> { | ||
removeDependenciesFromPackageJson( | ||
tree, | ||
['core-js', 'regenerator-runtime'], | ||
[] | ||
); | ||
|
||
await formatFiles(tree); | ||
} |