Compare commits

...
10 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
8 changed files with 394 additions and 619 deletions

No files matched your search

+3 -1
View File
@@ -20,12 +20,13 @@ react-native init MyApp --template typescript && node MyApp/setup.js
### 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:
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)
- [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.
@@ -49,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,5 +3,6 @@
"@types/react-native": "latest",
"@types/react-test-renderer": "latest",
"@types/react": "latest",
"ts-jest": "latest",
"typescript": "latest"
}
+8
View File
@@ -0,0 +1,8 @@
{
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"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"
}
}
+3
View File
@@ -2,6 +2,7 @@ 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 writeFile = (fileName, data) => fs.writeFileSync(path.join(__dirname, fileName), data)
@@ -9,11 +10,13 @@ const writeFile = (fileName, data) => fs.writeFileSync(path.join(__dirname, file
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('__tests__/App.js')
deleteFile('LICENSE')
deleteFile('README.md')
deleteFile('setup.js')
+2 -2
View File
@@ -4,12 +4,12 @@
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
"isolatedModules": true,
"jsx": "react-native",
"jsx": "react",
"lib": ["es6"],
"moduleResolution": "node",
"noEmit": true,
"strict": true,
"target": "esnext"
},
"exclude": ["node_modules"]
"exclude": ["node_modules", "babel.config.js"]
}