Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ea456ca75d | ||
|
|
100447b7d5 | ||
|
|
4fc8174c3f | ||
|
|
ffcf32376d | ||
|
|
9e7a6483bb | ||
|
|
44e7ad381c | ||
|
|
9da8429132 | ||
|
|
371438e4e2 | ||
|
|
3c0fb203c8 | ||
|
|
be099fa8ce | ||
|
|
ad5174f050 | ||
|
|
e55051bb09 | ||
|
|
da099611c2 | ||
|
|
6052e12972 | ||
|
|
5c7ed69e2b | ||
|
|
afb35e18bc | ||
|
|
0cb1761f5b | ||
|
|
e48a1e4354 |
No files matched your search
@@ -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,15 @@ 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)
|
||||
- [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 +36,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 +50,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
|
||||
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* @format
|
||||
*/
|
||||
|
||||
import 'react-native';
|
||||
import React from 'react';
|
||||
import App from '../App';
|
||||
|
||||
// Note: test renderer must be required after react-native.
|
||||
import renderer from 'react-test-renderer';
|
||||
|
||||
it('renders correctly', () => {
|
||||
renderer.create(<App />);
|
||||
});
|
||||
@@ -3,7 +3,6 @@
|
||||
"@types/react-native": "latest",
|
||||
"@types/react-test-renderer": "latest",
|
||||
"@types/react": "latest",
|
||||
"react-native-typescript-transformer": "latest",
|
||||
"ts-jest": "latest",
|
||||
"typescript": "latest"
|
||||
}
|
||||
@@ -3,13 +3,6 @@
|
||||
"^.+\\.tsx?$": "ts-jest"
|
||||
},
|
||||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
|
||||
"moduleFileExtensions": [
|
||||
"ts",
|
||||
"tsx",
|
||||
"js",
|
||||
"jsx",
|
||||
"json",
|
||||
"node"
|
||||
],
|
||||
"moduleFileExtensions": ["ts", "tsx", "js", "jsx", "json", "node"],
|
||||
"modulePaths": ["<rootDir>"]
|
||||
}
|
||||
Generated
+361
-614
File diff suppressed because it is too large.
Load diff
+2
-2
@@ -4,7 +4,7 @@
|
||||
"description": "Clean and minimalist React Native template for a quick start with TypeScript.",
|
||||
"scripts": {
|
||||
"test": "standard setup.js",
|
||||
"prepublishOnly": "git reset --hard && npm --no-git-tag-version version from-git"
|
||||
"prepublishOnly": "npm --no-git-tag-version version $TRAVIS_TAG"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -24,6 +24,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/emin93/react-native-template-typescript#readme",
|
||||
"devDependencies": {
|
||||
"standard": "11.0.1"
|
||||
"standard": "12.0.1"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
module.exports = {
|
||||
getTransformModulePath() {
|
||||
return require.resolve('react-native-typescript-transformer');
|
||||
},
|
||||
getSourceExts() {
|
||||
return ['ts', 'tsx'];
|
||||
},
|
||||
};
|
||||
@@ -4,17 +4,19 @@ 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.scripts.tsc = 'tsc'
|
||||
packageJson.jest = Object.assign(packageJson.jest, jestConfig)
|
||||
|
||||
writeFile('package.json', JSON.stringify(packageJson, null, 2))
|
||||
|
||||
deleteFile('.flowconfig')
|
||||
deleteFile('App.js')
|
||||
deleteFile('devDependencies.json')
|
||||
deleteFile('__tests__/App.js')
|
||||
deleteFile('jest.json')
|
||||
deleteFile('LICENSE')
|
||||
deleteFile('README.md')
|
||||
|
||||
+6
-5
@@ -1,14 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"allowSyntheticDefaultImports": true,
|
||||
"esModuleInterop": true,
|
||||
"jsx": "react-native",
|
||||
"isolatedModules": true,
|
||||
"jsx": "react",
|
||||
"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