From c4f9556f7e98454e2061ca7e121099ebbbddd4c9 Mon Sep 17 00:00:00 2001 From: "Zihan Chen (MSFT)" <53799235+ZihanChen-MSFT@users.noreply.github.com> Date: Fri, 7 Oct 2022 08:04:02 -0700 Subject: [PATCH] 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 --- packages/react-native-codegen/package.json | 5 +++-- .../src/generators/__tests__/RNCodegen-test.js | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/react-native-codegen/package.json b/packages/react-native-codegen/package.json index caddea91693e01..99bb30580ae3bb 100644 --- a/packages/react-native-codegen/package.json +++ b/packages/react-native-codegen/package.json @@ -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" } } diff --git a/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js b/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js index 864a0b06491967..44a70349ab2ec9 100644 --- a/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js +++ b/packages/react-native-codegen/src/generators/__tests__/RNCodegen-test.js @@ -19,6 +19,7 @@ describe('RNCodegen.generate', () => { beforeEach(() => { jest.resetModules(); }); + it('when type `all`, with default paths', () => { jest.mock('fs', () => ({ existsSync: location => {