Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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/
|
node_modules/
|
||||||
npm-debug.log
|
.vscode/
|
||||||
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
|
|
||||||
@@ -8,8 +8,6 @@ Clean and minimalist React Native template for a quick start with TypeScript.
|
|||||||
|
|
||||||
- Seamlessly integrated into the React Native CLI! :sparkles:
|
- Seamlessly integrated into the React Native CLI! :sparkles:
|
||||||
- Consistent with the default React Native template
|
- Consistent with the default React Native template
|
||||||
- React Native TypeScript Transformer included
|
|
||||||
- Unit testing in TypeScript with TS Jest
|
|
||||||
- Always latest dependencies :raised_hands:
|
- Always latest dependencies :raised_hands:
|
||||||
|
|
||||||
## :arrow_forward: Quick Start
|
## :arrow_forward: Quick Start
|
||||||
@@ -20,12 +18,14 @@ react-native init MyApp --template typescript && node MyApp/setup.js
|
|||||||
|
|
||||||
## :question: FAQ
|
## :question: FAQ
|
||||||
|
|
||||||
### What's included in this template?
|
### Why this template when React Native 0.57+ supports TypeScript out of the box?
|
||||||
|
|
||||||
|
First of all, I started this template before React Native 0.57 came out. After React Native 0.57 was announced, I planned to stop maintenance on this template. But after further evaluation, there's still some 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)
|
- [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)
|
- [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.
|
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.
|
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?
|
### Does debugging work?
|
||||||
|
|
||||||
Yes it does.
|
Yes it does.
|
||||||
|
|||||||
+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-native": "latest",
|
||||||
"@types/react-test-renderer": "latest",
|
"@types/react-test-renderer": "latest",
|
||||||
"@types/react": "latest",
|
"@types/react": "latest",
|
||||||
"react-native-typescript-transformer": "latest",
|
|
||||||
"ts-jest": "latest",
|
|
||||||
"typescript": "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 path = require('path')
|
||||||
|
|
||||||
const packageJson = require('./package.json')
|
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)
|
const writeFile = (fileName, data) => fs.writeFileSync(path.join(__dirname, fileName), data)
|
||||||
|
|
||||||
console.log('🔄 Setting up...')
|
console.log('🔄 Setting up...')
|
||||||
|
|
||||||
packageJson.jest = Object.assign(packageJson.jest, jestConfig)
|
packageJson.scripts.tsc = 'tsc'
|
||||||
|
|
||||||
writeFile('package.json', JSON.stringify(packageJson, null, 2))
|
writeFile('package.json', JSON.stringify(packageJson, null, 2))
|
||||||
|
|
||||||
deleteFile('.flowconfig')
|
deleteFile('.flowconfig')
|
||||||
deleteFile('App.js')
|
deleteFile('App.js')
|
||||||
deleteFile('devDependencies.json')
|
|
||||||
deleteFile('jest.json')
|
|
||||||
deleteFile('LICENSE')
|
deleteFile('LICENSE')
|
||||||
deleteFile('README.md')
|
deleteFile('README.md')
|
||||||
deleteFile('setup.js')
|
deleteFile('setup.js')
|
||||||
|
|||||||
+4
-3
@@ -1,14 +1,15 @@
|
|||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
|
"isolatedModules": true,
|
||||||
"jsx": "react-native",
|
"jsx": "react-native",
|
||||||
"lib": ["es6"],
|
"lib": ["es6"],
|
||||||
"module": "es6",
|
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"noImplicitAny": true,
|
"strict": true,
|
||||||
"target": "es6"
|
"target": "esnext"
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules"]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user