fix(react-native): fix tsc app (#18124)

This commit is contained in:
Emily Xiong 2023-07-19 11:27:43 -04:00 committed by GitHub
parent 2c1d4bac96
commit 48d4927068
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 39 additions and 15 deletions

View File

@ -2,6 +2,7 @@ import {
checkFilesExist, checkFilesExist,
cleanupProject, cleanupProject,
expectTestsPass, expectTestsPass,
getPackageManagerCommand,
killPorts, killPorts,
newProject, newProject,
promisifiedTreeKill, promisifiedTreeKill,
@ -9,6 +10,7 @@ import {
readResolvedConfiguration, readResolvedConfiguration,
runCLI, runCLI,
runCLIAsync, runCLIAsync,
runCommand,
runCommandUntil, runCommandUntil,
uniq, uniq,
updateFile, updateFile,
@ -129,4 +131,19 @@ describe('expo', () => {
checkFilesExist(`dist/libs/${libName}/src/index.d.ts`); checkFilesExist(`dist/libs/${libName}/src/index.d.ts`);
}).not.toThrow(); }).not.toThrow();
}); });
it('should tsc app', async () => {
expect(() => {
const pmc = getPackageManagerCommand();
runCommand(
`${pmc.runUninstalledPackage} tsc -p apps/${appName}/tsconfig.app.json`
);
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();
});
}); });

View File

@ -194,4 +194,21 @@ describe('react native', () => {
}, },
}); });
}); });
it('should tsc app', async () => {
expect(() => {
const pmc = getPackageManagerCommand();
runCommand(
`${pmc.runUninstalledPackage} tsc -p apps/${appName}/tsconfig.app.json`
);
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();
});
}); });

View File

@ -4,6 +4,7 @@
"outDir": "<%= offsetFromRoot %>dist/out-tsc", "outDir": "<%= offsetFromRoot %>dist/out-tsc",
"types": ["node"] "types": ["node"]
}, },
"files": ["<%= offsetFromRoot %>node_modules/@nx/expo/typings/svg.d.ts"],
"exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.spec.tsx", "test-setup.ts"], "exclude": ["jest.config.ts", "**/*.spec.ts", "**/*.spec.tsx", "test-setup.ts"],
"include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"] "include": ["**/*.ts", "**/*.tsx", "**/*.js", "**/*.jsx"]
} }

View File

@ -8,19 +8,13 @@
"skipLibCheck": true, "skipLibCheck": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"strict": true, "strict": true,
"composite": true,
"declaration": true "declaration": true
}, },
"files": [ "files": [],
"../../node_modules/@nx/expo/typings/svg.d.ts"
],
"include": [], "include": [],
"references": [ "references": [
{ {
"path": "./tsconfig.app.json" "path": "./tsconfig.app.json"
} }
],
"exclude": [
"node_modules"
] ]
} }

View File

@ -356,7 +356,7 @@ export const App = () => {
<View style={[styles.listItem, styles.marginBottomMd]}> <View style={[styles.listItem, styles.marginBottomMd]}>
<Svg width={48} height={48} viewBox="0 0 120 120" stroke="currentColor" fill="transparent"> <Svg width={48} height={48} viewBox="0 0 120 120" stroke="currentColor" fill="transparent">
<Path strokeWidth="2" d="M23 3.75V6.5c-3.036 0-5.5 2.464-5.5 5.5s-2.464 5.5-5.5 5.5-5.5 2.464-5.5 5.5H3.75C2.232 23 1 21.768 1 20.25V3.75C1 2.232 2.232 1 3.75 1h16.5C21.768 1 23 2.232 23 3.75Z" /> <Path strokeWidth="2" d="M23 3.75V6.5c-3.036 0-5.5 2.464-5.5 5.5s-2.464 5.5-5.5 5.5-5.5 2.464-5.5 5.5H3.75C2.232 23 1 21.768 1 20.25V3.75C1 2.232 2.232 1 3.75 1h16.5C21.768 1 23 2.232 23 3.75Z" />
<Path strokewidth="2" d="M23 6v14.1667C23 21.7307 21.7307 23 20.1667 23H6c0-3.128 2.53867-5.6667 5.6667-5.6667 3.128 0 5.6666-2.5386 5.6666-5.6666C17.3333 8.53867 19.872 6 23 6Z" /> <Path strokeWidth="2" d="M23 6v14.1667C23 21.7307 21.7307 23 20.1667 23H6c0-3.128 2.53867-5.6667 5.6667-5.6667 3.128 0 5.6666-2.5386 5.6666-5.6666C17.3333 8.53867 19.872 6 23 6Z" />
</Svg> </Svg>
<View style={styles.listItemTextContainer}> <View style={styles.listItemTextContainer}>
<Text <Text

View File

@ -4,6 +4,7 @@
"outDir": "<%= offsetFromRoot %>dist/out-tsc", "outDir": "<%= offsetFromRoot %>dist/out-tsc",
"types": ["node"] "types": ["node"]
}, },
"files": ["<%= offsetFromRoot %>node_modules/@nx/react-native/typings/svg.d.ts"],
"exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.spec.tsx", "test-setup.ts"], "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.spec.tsx", "test-setup.ts"],
"include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"] "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.js", "src/**/*.jsx"]
} }

View File

@ -7,19 +7,13 @@
"moduleResolution": "node", "moduleResolution": "node",
"skipLibCheck": true, "skipLibCheck": true,
"resolveJsonModule": true, "resolveJsonModule": true,
"composite": true,
"declaration": true "declaration": true
}, },
"files": [ "files": [],
"../../node_modules/@nx/react-native/typings/svg.d.ts"
],
"include": [], "include": [],
"references": [ "references": [
{ {
"path": "./tsconfig.app.json" "path": "./tsconfig.app.json"
} }
],
"exclude": [
"node_modules"
] ]
} }