Skip to content

Commit

Permalink
fix(init): remove useless await and add @types/react-native (#376)
Browse files Browse the repository at this point in the history
* fix(init): remove useless await and add @types/react-native to be able to tsc again

* fix(init): re-gen lock

---------

Co-authored-by: jeremydolle <[email protected]>
  • Loading branch information
JeremyDolle and JeremyDolle authored Aug 25, 2023
1 parent e5d6d89 commit 2b54a81
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7,217 deletions.
7 changes: 4 additions & 3 deletions template/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,12 @@
"@react-navigation/devtools": "^6.0.19",
"@testing-library/jest-native": "^5.4.2",
"@testing-library/react-native": "^12.1.2",
"@tsconfig/react-native": "^3.0.0",
"@types/jest": "^29.4.0",
"@types/metro-config": "^0.76.3",
"@types/node": "^18.14.1",
"@tsconfig/react-native": "^3.0.0",
"@types/react": "^18.0.24",
"@types/react-native": "^0.72.2",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.2.1",
"babel-plugin-inline-dotenv": "^1.7.0",
Expand All @@ -54,10 +55,10 @@
"jest": "^29.2.1",
"metro-react-native-babel-preset": "0.76.5",
"prettier": "^2.4.1",
"react-test-renderer": "18.2.0",
"react-native-flipper": "^0.202.0",
"react-test-renderer": "18.2.0",
"redux-flipper": "^2.0.2",
"typescript": "4.8.4"
"typescript": "5.2.2"
},
"engines": {
"node": ">=16"
Expand Down
21 changes: 9 additions & 12 deletions template/plugins/compile-js/plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,23 @@ module.exports = {
console.log('\n');

console.log('📦 Loading the build tool...');
await execSync('yarn add -D typescript', { stdio: 'pipe' });
execSync('yarn add -D typescript');

console.log('🧱 Building the javascript source...');
await execSync(
execSync(
'npx tsc --jsx react-native --module ESNext -t esnext --outDir js --noEmit false',
{ stdio: 'pipe' },
);

console.log('🖼️ Copying assets...');
await execSync('cp -R src/theme/assets js/src/theme/assets', {
stdio: 'pipe',
});
execSync('cp -R src/theme/assets js/src/theme/assets');

console.log('♻️ Replacing source...');
await execSync('rm -rf src', { stdio: 'pipe' });
await execSync('cp -R js/src ./src', { stdio: 'pipe' });
await execSync('rm -rf js', { stdio: 'pipe' });
execSync('rm -rf src', { stdio: 'pipe' });
execSync('cp -R js/src ./src', { stdio: 'pipe' });
execSync('rm -rf js', { stdio: 'pipe' });

console.log('💣 Removing typescript dependencies source...');
await execSync(
execSync(
'yarn remove ' +
'@tsconfig/react-native ' +
'@types/jest ' +
Expand All @@ -38,8 +35,8 @@ module.exports = {
);

console.log('🌀 Removing types ...');
await execSync('rm -rf @types', { stdio: 'pipe' });
await execSync('rm tsconfig.json', { stdio: 'pipe' });
execSync('rm -rf @types', { stdio: 'pipe' });
execSync('rm tsconfig.json', { stdio: 'pipe' });
}
resolve();
});
Expand Down
2 changes: 1 addition & 1 deletion template/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"@types",
"./node_modules/@types"
],
"baseUrl": "..",
"baseUrl": "./",
"paths": {
"@/*": ["./src/*"],
"types/*": ["./@types/*"]
Expand Down
Loading

0 comments on commit 2b54a81

Please sign in to comment.