Make `yarn` and `yarn jest react-native-codegen` works on Windows with git (#34854)

Summary:
A few fixings to make `yarn jest react-native-doegen` works on Windows:

- ~~Add a `.gitignore` file to tell git not to track generated/temporary files.~~
- There is no `rm` on Windows, change it to `rimraf`.

I have been using it in the last 3 months and it works perfectly on Windows, otherwise I could not even build the code in my laptop.

## Changelog

[General] [Changed] - Make `yarn` and `yarn jest react-native-codegen` works on Windows with git

Pull Request resolved: https://github.com/facebook/react-native/pull/34854

Test Plan: `yarn jest react-native-codegen` passed

Reviewed By: cortinico

Differential Revision: D40059524

Pulled By: cortinico

fbshipit-source-id: e3cde2506c7d18c2b580099257637b90f4cb328c
This commit is contained in:
Zihan Chen (MSFT) 2022-10-07 08:04:02 -07:00 коммит произвёл Facebook GitHub Bot
Родитель 370bbd705b
Коммит c4f9556f7e
2 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -10,7 +10,7 @@
},
"scripts": {
"build": "yarn clean && node scripts/build.js --verbose",
"clean": "rm -rf lib",
"clean": "rimraf lib",
"prepare": "yarn run build"
},
"license": "MIT",
@ -38,6 +38,7 @@
"invariant": "^2.2.4",
"micromatch": "^4.0.4",
"mkdirp": "^0.5.1",
"prettier": "^2.4.1"
"prettier": "^2.4.1",
"rimraf": "^3.0.2"
}
}

Просмотреть файл

@ -19,6 +19,7 @@ describe('RNCodegen.generate', () => {
beforeEach(() => {
jest.resetModules();
});
it('when type `all`, with default paths', () => {
jest.mock('fs', () => ({
existsSync: location => {