From d76eb45bad25f309ed3b1a2e49af4a79c5216ec0 Mon Sep 17 00:00:00 2001 From: Emily Xiong Date: Fri, 14 Jul 2023 10:30:44 -0400 Subject: [PATCH] fix(react-native): fix tsc app --- e2e/expo/src/expo.test.ts | 20 +++++++++++++++++++ e2e/react-native/src/react-native.test.ts | 20 +++++++++++++++++++ .../application/files/tsconfig.json.template | 8 +------- .../files/app/src/app/App.tsx.template | 2 +- .../files/app/tsconfig.json.template | 8 +------- 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/e2e/expo/src/expo.test.ts b/e2e/expo/src/expo.test.ts index 139fb29b112fff..b76ed88dd8704b 100644 --- a/e2e/expo/src/expo.test.ts +++ b/e2e/expo/src/expo.test.ts @@ -2,6 +2,7 @@ import { checkFilesExist, cleanupProject, expectTestsPass, + getPackageManagerCommand, killPorts, newProject, promisifiedTreeKill, @@ -9,7 +10,9 @@ import { readResolvedConfiguration, runCLI, runCLIAsync, + runCommand, runCommandUntil, + tmpProjPath, uniq, updateFile, } from '@nx/e2e/utils'; @@ -129,4 +132,21 @@ describe('expo', () => { checkFilesExist(`dist/libs/${libName}/src/index.d.ts`); }).not.toThrow(); }); + + it('should tsc app', async () => { + expect(() => { + const pmc = getPackageManagerCommand(); + runCommand( + `${pmc.runUninstalledPackage} tsc ${appName} -p apps/${appName}/tsconfig.app.json` + ); + runCommand(`ls ${tmpProjPath(`dist/out-tsc/apps/${appName}/src`)}`); + runCommand(`ls ${tmpProjPath(`dist/out-tsc/apps/${appName}/src/app`)}`); + checkFilesExist( + `dist/out-tsc/apps/${appName}/src/app/App.js`, + `dist/out-tsc/apps/${appName}/src/app/App.d.ts`, + `dist/out-tsc/libs/${libName}/src/index.js`, + `dist/out-tsc/libs/${libName}/src/index.d.ts` + ); + }).not.toThrow(); + }); }); diff --git a/e2e/react-native/src/react-native.test.ts b/e2e/react-native/src/react-native.test.ts index cae7ddc61ff0b5..2748be07364edb 100644 --- a/e2e/react-native/src/react-native.test.ts +++ b/e2e/react-native/src/react-native.test.ts @@ -12,6 +12,7 @@ import { runCLIAsync, runCommand, runCommandUntil, + tmpProjPath, uniq, updateFile, } from '@nx/e2e/utils'; @@ -194,4 +195,23 @@ describe('react native', () => { }, }); }); + + it('should tsc app', async () => { + expect(() => { + const pmc = getPackageManagerCommand(); + runCommand( + `${pmc.runUninstalledPackage} tsc ${appName} -p apps/${appName}/tsconfig.app.json` + ); + runCommand(`ls ${tmpProjPath(`dist/out-tsc/apps/${appName}/src`)}`); + runCommand(`ls ${tmpProjPath(`dist/out-tsc/apps/${appName}/src/app`)}`); + checkFilesExist( + `dist/out-tsc/apps/${appName}/src/main.js`, + `dist/out-tsc/apps/${appName}/src/main.d.ts`, + `dist/out-tsc/apps/${appName}/src/app/App.js`, + `dist/out-tsc/apps/${appName}/src/app/App.d.ts`, + `dist/out-tsc/libs/${libName}/src/index.js`, + `dist/out-tsc/libs/${libName}/src/index.d.ts` + ); + }).not.toThrow(); + }); }); diff --git a/packages/expo/src/generators/application/files/tsconfig.json.template b/packages/expo/src/generators/application/files/tsconfig.json.template index db1c7e0b6afab1..55140e5b8c4604 100644 --- a/packages/expo/src/generators/application/files/tsconfig.json.template +++ b/packages/expo/src/generators/application/files/tsconfig.json.template @@ -8,19 +8,13 @@ "skipLibCheck": true, "resolveJsonModule": true, "strict": true, - "composite": true, "declaration": true }, - "files": [ - "../../node_modules/@nx/expo/typings/svg.d.ts" - ], + "files": [], "include": [], "references": [ { "path": "./tsconfig.app.json" } - ], - "exclude": [ - "node_modules" ] } diff --git a/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template b/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template index 09a25022ea33b6..88cb31cf2aad54 100644 --- a/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template +++ b/packages/react-native/src/generators/application/files/app/src/app/App.tsx.template @@ -356,7 +356,7 @@ export const App = () => { - +