-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Pull Request resolved: #42776 Changelog: [Internal] set all monorepo packages (including react-native) to one version and update all inter-dependencies (including the template) Reviewed By: huntie Differential Revision: D53251917 fbshipit-source-id: 95330ca66dcb7234a3f09752ecc3ed9087ced4bf
- Loading branch information
1 parent
6a8a28b
commit ebc2831
Showing
11 changed files
with
335 additions
and
23 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
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
12 changes: 12 additions & 0 deletions
12
scripts/releases/set-version/__tests__/__fixtures__/packages/monorepo-pkg-a/package.json
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,12 @@ | ||
{ | ||
"name": "@monorepo/pkg-a", | ||
"version": "0.0.1", | ||
"description": "@monorepo/pkg-a", | ||
"dependencies": { | ||
"@monorepo/pkg-b": "0.0.1", | ||
"@monorepo/other": "0.0.1" | ||
}, | ||
"devDependencies": { | ||
"@monorepo/pkg-c": "0.0.1" | ||
} | ||
} |
10 changes: 10 additions & 0 deletions
10
scripts/releases/set-version/__tests__/__fixtures__/packages/monorepo-pkg-b/package.json
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 @@ | ||
{ | ||
"name": "@monorepo/pkg-b", | ||
"version": "0.0.2", | ||
"description": "@monorepo/pkg-b", | ||
"dependencies": { | ||
"@monorepo/pkg-c": "0.0.1", | ||
"metro-config": "^0.80.3", | ||
"metro-runtime": "^0.80.3" | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
scripts/releases/set-version/__tests__/__fixtures__/packages/monorepo-pkg-c/package.json
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,9 @@ | ||
{ | ||
"name": "@monorepo/pkg-c", | ||
"version": "0.0.3", | ||
"description": "@monorepo/pkg-c", | ||
"dependencies": { | ||
"metro-config": "^0.80.3", | ||
"metro-runtime": "^0.80.3" | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
scripts/releases/set-version/__tests__/__fixtures__/packages/react-native/package.json
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,12 @@ | ||
{ | ||
"name": "react-native", | ||
"version": "0.0.0", | ||
"description": "fake react native package", | ||
"dependencies": { | ||
"@monorepo/pkg-a": "0.0.1", | ||
"@monorepo/pkg-b": "0.0.1", | ||
"@monorepo/pkg-c": "0.0.1", | ||
"metro-config": "^0.80.3", | ||
"metro-runtime": "^0.80.3" | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...s/releases/set-version/__tests__/__fixtures__/packages/react-native/template/package.json
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 @@ | ||
{ | ||
"name": "react-native-test-template", | ||
"version": "0.0.1", | ||
"private": true, | ||
"dependencies": { | ||
"react": "18.2.0", | ||
"react-native": "0.0.0" | ||
}, | ||
"devDependencies": { | ||
"@monorepo/pkg-a": "0.0.1", | ||
"@monorepo/pkg-c": "0.0.0", | ||
"@types/react": "^18.2.6", | ||
"@types/react-test-renderer": "^18.0.0" | ||
} | ||
} |
79 changes: 79 additions & 0 deletions
79
scripts/releases/set-version/__tests__/__snapshots__/set-version-test.js.snap
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,79 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`setVersion updates all public packages to version: monorepo-pkg-a 1`] = ` | ||
"{ | ||
\\"name\\": \\"@monorepo/pkg-a\\", | ||
\\"version\\": \\"0.80.0\\", | ||
\\"description\\": \\"@monorepo/pkg-a\\", | ||
\\"dependencies\\": { | ||
\\"@monorepo/pkg-b\\": \\"0.80.0\\", | ||
\\"@monorepo/other\\": \\"0.0.1\\" | ||
}, | ||
\\"devDependencies\\": { | ||
\\"@monorepo/pkg-c\\": \\"0.80.0\\" | ||
} | ||
} | ||
" | ||
`; | ||
|
||
exports[`setVersion updates all public packages to version: monorepo-pkg-b 1`] = ` | ||
"{ | ||
\\"name\\": \\"@monorepo/pkg-b\\", | ||
\\"version\\": \\"0.80.0\\", | ||
\\"description\\": \\"@monorepo/pkg-b\\", | ||
\\"dependencies\\": { | ||
\\"@monorepo/pkg-c\\": \\"0.80.0\\", | ||
\\"metro-config\\": \\"^0.80.3\\", | ||
\\"metro-runtime\\": \\"^0.80.3\\" | ||
} | ||
} | ||
" | ||
`; | ||
|
||
exports[`setVersion updates all public packages to version: monorepo-pkg-c 1`] = ` | ||
"{ | ||
\\"name\\": \\"@monorepo/pkg-c\\", | ||
\\"version\\": \\"0.80.0\\", | ||
\\"description\\": \\"@monorepo/pkg-c\\", | ||
\\"dependencies\\": { | ||
\\"metro-config\\": \\"^0.80.3\\", | ||
\\"metro-runtime\\": \\"^0.80.3\\" | ||
} | ||
} | ||
" | ||
`; | ||
|
||
exports[`setVersion updates all public packages to version: react-native 1`] = ` | ||
"{ | ||
\\"name\\": \\"react-native\\", | ||
\\"version\\": \\"0.80.0\\", | ||
\\"description\\": \\"fake react native package\\", | ||
\\"dependencies\\": { | ||
\\"@monorepo/pkg-a\\": \\"0.80.0\\", | ||
\\"@monorepo/pkg-b\\": \\"0.80.0\\", | ||
\\"@monorepo/pkg-c\\": \\"0.80.0\\", | ||
\\"metro-config\\": \\"^0.80.3\\", | ||
\\"metro-runtime\\": \\"^0.80.3\\" | ||
} | ||
} | ||
" | ||
`; | ||
|
||
exports[`setVersion updates all public packages to version: template 1`] = ` | ||
"{ | ||
\\"name\\": \\"react-native-test-template\\", | ||
\\"version\\": \\"0.0.1\\", | ||
\\"private\\": true, | ||
\\"dependencies\\": { | ||
\\"react\\": \\"18.2.0\\", | ||
\\"react-native\\": \\"0.80.0\\" | ||
}, | ||
\\"devDependencies\\": { | ||
\\"@monorepo/pkg-a\\": \\"0.80.0\\", | ||
\\"@monorepo/pkg-c\\": \\"0.80.0\\", | ||
\\"@types/react\\": \\"^18.2.6\\", | ||
\\"@types/react-test-renderer\\": \\"^18.0.0\\" | ||
} | ||
} | ||
" | ||
`; |
46 changes: 46 additions & 0 deletions
46
scripts/releases/set-version/__tests__/set-version-test.js
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,46 @@ | ||
/** | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @flow | ||
* @format | ||
*/ | ||
|
||
const setVersion = require('../index'); | ||
const path = require('path'); | ||
|
||
describe('setVersion', () => { | ||
beforeAll(() => { | ||
jest.mock('path', () => { | ||
// $FlowIgnore[underconstrained-implicit-instantiation] | ||
const originalPath = jest.requireActual('path'); | ||
return { | ||
...originalPath, | ||
dirname: () => originalPath.join(__dirname, '__fixtures__/two/levels'), | ||
}; | ||
}); | ||
|
||
jest.mock('fs', () => { | ||
// $FlowIgnore[underconstrained-implicit-instantiation] | ||
const originalFs = jest.requireActual('fs'); | ||
|
||
return { | ||
...originalFs, | ||
writeFileSync: (packagePath, content) => { | ||
expect(content).toMatchSnapshot( | ||
path.basename(path.join(packagePath, '..')), | ||
); | ||
}, | ||
}; | ||
}); | ||
}); | ||
test('updates all public packages to version', () => { | ||
setVersion('0.80.0'); | ||
}); | ||
afterAll(() => { | ||
jest.unmock('path'); | ||
jest.unmock('fs'); | ||
}); | ||
}); |
Oops, something went wrong.