-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react): remove outdated packages (#16786)
- Loading branch information
1 parent
83cbba2
commit 4750a1d
Showing
8 changed files
with
87 additions
and
4 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
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); | ||
} |
4750a1d
There was a problem hiding this comment.
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-dev-git-master-nrwl.vercel.app
nx-five.vercel.app
nx.dev
nx-dev-nrwl.vercel.app