Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
371438e4e2 | ||
|
|
3c0fb203c8 | ||
|
|
be099fa8ce | ||
|
|
ad5174f050 | ||
|
|
e55051bb09 | ||
|
|
da099611c2 | ||
|
|
6052e12972 | ||
|
|
5c7ed69e2b | ||
|
|
afb35e18bc | ||
|
|
0cb1761f5b | ||
|
|
e48a1e4354 | ||
|
|
d1cc0b9707 | ||
|
|
df0149ac5f |
No files matched your search
+1
-56
@@ -1,57 +1,2 @@
|
||||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
project.xcworkspace
|
||||
|
||||
# Android/IntelliJ
|
||||
#
|
||||
build/
|
||||
.idea
|
||||
.gradle
|
||||
local.properties
|
||||
*.iml
|
||||
|
||||
# Visual Studio Code
|
||||
#
|
||||
.vscode/
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# BUCK
|
||||
buck-out/
|
||||
\.buckd/
|
||||
*.keystore
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/
|
||||
|
||||
*/fastlane/report.xml
|
||||
*/fastlane/Preview.html
|
||||
*/fastlane/screenshots
|
||||
.vscode/
|
||||
@@ -8,8 +8,6 @@ Clean and minimalist React Native template for a quick start with TypeScript.
|
||||
|
||||
- Seamlessly integrated into the React Native CLI! :sparkles:
|
||||
- Consistent with the default React Native template
|
||||
- React Native TypeScript Transformer included
|
||||
- Unit testing in TypeScript with TS Jest
|
||||
- Always latest dependencies :raised_hands:
|
||||
|
||||
## :arrow_forward: Quick Start
|
||||
@@ -20,12 +18,14 @@ react-native init MyApp --template typescript && node MyApp/setup.js
|
||||
|
||||
## :question: FAQ
|
||||
|
||||
### What's included in this template?
|
||||
### Why this template when React Native 0.57+ supports TypeScript out of the box?
|
||||
|
||||
Actually, when React Native 0.57 was announced, I planned to stop maintenance on this template. But after further evaluation, there's still quite a lot of manual work to do (add type definitions for React & React Native, create a `.tsconfig` for type checking, etc.) to properly set up a React Native 0.57+ TypeScript project. And that's where this template comes in and does that work for you. :raised_hands:
|
||||
|
||||
### What additional dependencies are included in this template?
|
||||
|
||||
- [TypeScript](https://github.com/Microsoft/TypeScript)
|
||||
- [React Native TypeScript Transformer](https://github.com/ds300/react-native-typescript-transformer)
|
||||
- [Type definitions for React & React Native](https://github.com/DefinitelyTyped/DefinitelyTyped)
|
||||
- [TS Jest](https://github.com/kulshekhar/ts-jest)
|
||||
|
||||
This template always uses the latest versions of the dependencies at the time when the `react-native init` command is being executed. This means you don't have to worry about old versions.
|
||||
|
||||
@@ -35,6 +35,10 @@ Lots of :heart: and credits to the owners and maintainers of those packages.
|
||||
|
||||
It deletes obsolete files like the `.flowconfig` and the `setup.js` itself after the setup.
|
||||
|
||||
### How to do type checking?
|
||||
|
||||
`npm run tsc`
|
||||
|
||||
### Does debugging work?
|
||||
|
||||
Yes it does.
|
||||
@@ -45,6 +49,7 @@ Yes it does.
|
||||
|
||||
- ["Using React Native with TypeScript just became simple" on Medium](https://medium.com/@emin93/react-native-typescript-b965059109d3)
|
||||
- ["24 tips for React Native you probably want to know" on Albert Gao's blog](http://albertgao.xyz/2018/05/30/24-tips-for-react-native-you-probably-want-to-know/#9-For-Typescript)
|
||||
- ["3 Easy Steps to Set Up React Native with TypeScript, Jest and Enzyme" on Medium by Jan Hesters](https://medium.com/@jan.hesters/3-easy-steps-to-set-up-react-native-with-typescript-jest-and-enzyme-592ca042262f)
|
||||
|
||||
## :computer: Contributing
|
||||
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
# OSX
|
||||
#
|
||||
.DS_Store
|
||||
|
||||
# Xcode
|
||||
#
|
||||
build/
|
||||
*.pbxuser
|
||||
!default.pbxuser
|
||||
*.mode1v3
|
||||
!default.mode1v3
|
||||
*.mode2v3
|
||||
!default.mode2v3
|
||||
*.perspectivev3
|
||||
!default.perspectivev3
|
||||
xcuserdata
|
||||
*.xccheckout
|
||||
*.moved-aside
|
||||
DerivedData
|
||||
*.hmap
|
||||
*.ipa
|
||||
*.xcuserstate
|
||||
project.xcworkspace
|
||||
|
||||
# Android/IntelliJ
|
||||
#
|
||||
build/
|
||||
.idea
|
||||
.gradle
|
||||
local.properties
|
||||
*.iml
|
||||
|
||||
# Visual Studio Code
|
||||
#
|
||||
.vscode/
|
||||
|
||||
# node.js
|
||||
#
|
||||
node_modules/
|
||||
npm-debug.log
|
||||
yarn-error.log
|
||||
|
||||
# BUCK
|
||||
buck-out/
|
||||
\.buckd/
|
||||
*.keystore
|
||||
|
||||
# fastlane
|
||||
#
|
||||
# It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
|
||||
# screenshots whenever they are needed.
|
||||
# For more information about the recommended setup visit:
|
||||
# https://docs.fastlane.tools/best-practices/source-control/
|
||||
|
||||
*/fastlane/report.xml
|
||||
*/fastlane/Preview.html
|
||||
*/fastlane/screenshots
|
||||
|
||||
# Bundle artifact
|
||||
*.jsbundle
|
||||
@@ -3,7 +3,5 @@
|
||||
"@types/react-native": "latest",
|
||||
"@types/react-test-renderer": "latest",
|
||||
"@types/react": "latest",
|
||||
"react-native-typescript-transformer": "latest",
|
||||
"ts-jest": "latest",
|
||||
"typescript": "latest"
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{
|
||||
"transform": {
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"jsx",
|
||||
"json",
|
||||
"node"
|
||||
],
|
||||
"modulePaths": ["<rootDir>"]
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
getTransformModulePath() {
|
||||
return require.resolve('react-native-typescript-transformer');
|
||||
},
|
||||
getSourceExts() {
|
||||
return ['ts', 'tsx'];
|
||||
},
|
||||
};
|
||||
@@ -2,20 +2,18 @@ const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
const packageJson = require('./package.json')
|
||||
const jestConfig = require('./jest.json')
|
||||
|
||||
const deleteFile = (fileName) => fs.unlinkSync(path.join(__dirname, fileName))
|
||||
const deleteFile = fileName => fs.unlinkSync(path.join(__dirname, fileName))
|
||||
const writeFile = (fileName, data) => fs.writeFileSync(path.join(__dirname, fileName), data)
|
||||
|
||||
console.log('🔄 Setting up...')
|
||||
|
||||
packageJson.jest = Object.assign(packageJson.jest, jestConfig)
|
||||
packageJson.scripts.tsc = 'tsc'
|
||||
|
||||
writeFile('package.json', JSON.stringify(packageJson, null, 2))
|
||||
|
||||
deleteFile('.flowconfig')
|
||||
deleteFile('App.js')
|
||||
deleteFile('devDependencies.json')
|
||||
deleteFile('jest.json')
|
||||
deleteFile('LICENSE')
|
||||
deleteFile('README.md')
|
||||
deleteFile('setup.js')
|
||||
|
||||
+5
-4
@@ -1,14 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"isolatedModules": true,
|
||||
"jsx": "react-native",
|
||||
"lib": ["es6"],
|
||||
"module": "es6",
|
||||
"moduleResolution": "node",
|
||||
"noEmit": true,
|
||||
"noImplicitAny": true,
|
||||
"target": "es6"
|
||||
"strict": true,
|
||||
"target": "esnext"
|
||||
},
|
||||
"exclude": ["node_modules"]
|
||||
"exclude": ["node_modules", "babel.config.js"]
|
||||
}
|
||||
Reference in new issue
Block a user