Compare commits

...
17 Commits
Author SHA1 Message Date
Emin Khateeb 100447b7d5 Added no-git-tag-version param 2019-02-07 21:44:52 +01:00
Emin Khateeb 4fc8174c3f Now using tag from CI 2019-02-07 21:42:45 +01:00
Emin Khateeb ffcf32376d Removed git reset step 2019-02-07 21:35:24 +01:00
Emin Khateeb 9e7a6483bb Upgraded standard 2019-02-07 21:24:49 +01:00
Emin Khateeb 44e7ad381c Merge pull request #27 from emin93/ts-jest
Added ts-jest
2019-02-07 21:21:48 +01:00
Emin Khateeb 9da8429132 Added ts-jest 2019-02-07 21:17:30 +01:00
Emin Khateeb 371438e4e2 Merge pull request #25 from malord/master
Add babel.config.js to TypeScript excludes
2019-02-04 12:03:52 +01:00
Mark Lord 3c0fb203c8 Fix for babel.config.js:1:1 - error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided. 2019-02-04 10:16:51 +00:00
Emin Khateeb be099fa8ce Slight Readme wording change 2019-01-30 12:46:28 +01:00
Emin Khateeb ad5174f050 Update README.md 2018-09-17 13:45:18 +02:00
Emin Khateeb e55051bb09 optimized tsconfig for type checking only 2018-09-12 16:14:48 +02:00
Emin Khateeb da099611c2 added compatibility with rn 0.57+ 2018-09-12 16:09:55 +02:00
Emin Khateeb 6052e12972 Update README.md 2018-09-12 15:26:34 +02:00
Emin Khateeb 5c7ed69e2b Update README.md 2018-09-12 15:22:05 +02:00
Emin Khateeb afb35e18bc Update README.md 2018-09-12 15:09:24 +02:00
Emin Khateeb 0cb1761f5b Update README.md
added info about native typescript support in 0.57
2018-08-28 14:36:58 +02:00
Emin Khateeb e48a1e4354 prepared compatibility with RN 0.57 2018-08-17 14:51:51 +02:00
9 changed files with 399 additions and 646 deletions

No files matched your search

+11 -5
View File
@@ -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
+14
View File
@@ -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 />);
});
-1
View File
@@ -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"
}
+1 -8
View File
@@ -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>"]
}
+361 -614
View File
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -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"
}
}
-8
View File
@@ -1,8 +0,0 @@
module.exports = {
getTransformModulePath() {
return require.resolve('react-native-typescript-transformer');
},
getSourceExts() {
return ['ts', 'tsx'];
},
};
+4 -3
View File
@@ -4,18 +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('jest.json')
deleteFile('__tests__/App.js')
deleteFile('LICENSE')
deleteFile('README.md')
deleteFile('setup.js')
+6 -5
View File
@@ -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"]
}