Compare commits

..
61 Commits
Author SHA1 Message Date
Mateus Andrade 76c70cf207 Merge pull request #59 from react-native-community/fix/default-readme
Fix suggested usage for RN >= 0.60
2019-09-10 10:02:44 -03:00
Radek Czemerys d727d3c7e6 Fix suggested usage for RN >= 0.60 2019-09-10 11:18:53 +02:00
Emin Khateeb eae5bed476 Merge pull request #55 from react-native-community/orta-patch-1
Update App.tsx to correspond to def typed updates
2019-08-12 14:18:15 +02:00
Orta 94c175664a Update App.tsx 2019-08-01 16:04:53 -04:00
Emin Khateeb 98c6517801 Merge pull request #51 from react-native-community/dependency-updates
updated dependencies
2019-07-16 08:02:41 +02:00
Emin Khateeb 9e832e69c6 updated dependencies 2019-07-16 08:01:57 +02:00
Emin Khateeb 93b8ef0173 Merge pull request #49 from sijad/patch-1
add hermes engine notice
2019-07-16 07:45:07 +02:00
Sajjad Hashemian 604fce0372 add hermes engine notice 2019-07-15 18:35:41 +04:30
Emin Khateeb 56a7a57654 Merge pull request #43 from jmparsons/pods-ignore
Updated pods fix.
2019-07-08 21:31:36 +02:00
Jonathan Parsons b009ff628d Updated pods fix. 2019-07-08 15:28:25 -04:00
Emin Khateeb f770415db3 Merge pull request #41 from sambokai/patch-1
Add Pods folder to .gitignore
2019-07-08 19:06:47 +02:00
Sam Bokai 88a5fc6ad6 Add Pods folder to .gitignore 2019-07-07 23:07:20 +02:00
Emin Khateeb 049943c7bd trying different approach for conditional deployments 2019-07-05 09:01:45 +02:00
Emin Khateeb 990f52d702 removed note again as it's not yet working 2019-07-05 08:52:52 +02:00
Emin Khateeb 76e0acdb31 added usage guide for new cli version 2019-07-05 08:38:41 +02:00
Emin Khateeb 7947ef1d36 added note about different cli versions 2019-07-05 08:30:13 +02:00
Emin Khateeb de9d3f0804 updated travis config to support cli v2 2019-07-05 08:22:34 +02:00
Emin Khateeb 0ab55f4385 moved branch option 2019-07-05 08:06:18 +02:00
Emin Khateeb 0b54ba54c6 updated start screen 2019-07-05 08:00:16 +02:00
Emin Khateeb 9d2f745914 now building only master 2019-07-05 07:49:59 +02:00
Emin Khateeb 651d111624 fixed readme build status link 2019-06-17 11:19:00 +02:00
Emin Khateeb cbe99e2b0f refactored readme 2019-06-17 11:17:40 +02:00
Emin Khateeb fdcc07aa80 upgraded nested dependency (npm audit fix) 2019-06-05 08:56:28 +02:00
Emin Khateeb 2376f89dcc Merge pull request #36 from italomlp/master
Add link for migrate instructions from existing project
2019-03-18 09:04:01 +01:00
Italo Menezes 5706e87500 links/add link for migrate instructions from existing project 2019-03-15 09:41:29 -03:00
Emin Khateeb 12ed73a490 Merge pull request #33 from emin93/fix-yarn-post-install
Fixed Yarn Post Install issue
2019-03-12 21:53:39 +01:00
Emin Khateeb 5635eb9106 fixed issue that caused the post setup script to crash if a file is not present 2019-03-12 21:47:54 +01:00
Emin Khateeb 5a8cf6bbe6 Merge pull request #31 from emin93/react-native-0.59
React Native 0.59 support
2019-03-12 18:24:30 +01:00
Emin Khateeb 8e588cf4b5 Merge branch 'react-native-0.59' of github.com:emin93/react-native-template-typescript into react-native-0.59 2019-03-12 18:21:23 +01:00
Emin Khateeb 5ce07d7e6c minor space addition to prevent comparison issues 2019-03-12 18:21:11 +01:00
Emin Khateeb 33cc106144 Added jest config to ts excludes 2019-03-07 13:19:46 +01:00
Emin Khateeb add36b1f30 Merge pull request #30 from emin93/master
Merge pull request #29 from tallpants/patch-1
2019-03-07 13:18:34 +01:00
Emin Khateeb 2c6b757051 Merge pull request #29 from tallpants/patch-1
Add metro.config.js to tsconfig excluded files
2019-03-07 13:15:34 +01:00
Adithya Reddy 65ac7f1bbf Add metro.config.js to tsconfig excluded files
In the latest RC of React Native (0.59.0-rc.3) a `metro.config.js` file is created with the following content:

```js
/**
 * Metro configuration for React Native
 * https://github.com/facebook/react-native
 *
 * @format
 */

module.exports = {
  transformer: {
    getTransformOptions: async () => ({
      transform: {
        experimentalImportSupport: false,
        inlineRequires: false,
      },
    }),
  },
};
```

When you run `tsc`, it fails with this error:

```
metro.config.js:8:1 - error TS1208: Cannot compile namespaces when the '--isolatedModules' flag is provided.

8 module.exports = {
  ~~~~~~


Found 1 error.
```

This PR fixes that error by excluding the `metro.config.js` file just like we did for `babel.config.js`.
2019-03-07 11:55:54 +05:30
Emin Khateeb c9184ffc06 added check if package is being installed as a dependency 2019-03-05 12:53:12 +01:00
Emin Khateeb 1bed694429 updated contributing document 2019-03-05 12:36:55 +01:00
Emin Khateeb e2b4039a30 updated license year 2019-03-05 12:34:22 +01:00
Emin Khateeb f8369603f4 reverted package version 2019-03-05 12:23:03 +01:00
Emin Khateeb 2433c22b3d prepared for RN 0.59 release 2019-03-05 12:20:25 +01:00
Emin Khateeb a332cb68f4 Merge pull request #28 from emin93/new-cli-post-install
Prepared automatic execution of the post install script
2019-03-05 10:59:28 +01:00
Emin Khateeb ffc9af3595 Prepared automatic execution of the post install script 2019-02-21 13:31:38 +01:00
Emin Khateeb ea456ca75d Now removing the jest.json as well after setup 2019-02-07 21:52:44 +01:00
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
Emin Khateeb d1cc0b9707 added template gitignore 2018-07-05 11:19:33 +02:00
Emin Khateeb df0149ac5f Update and rename .gitignore to _gitignore 2018-07-05 11:17:28 +02:00
16 changed files with 986 additions and 1012 deletions

No files matched your search

+1 -56
View File
@@ -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/
+13 -9
View File
@@ -1,13 +1,17 @@
language: node_js
node_js:
- "node"
cache:
directories:
- "node_modules"
deploy:
on:
tags: true
provider: npm
email: "emin@emin.ch"
api_key: "${NPM_TOKEN}"
skip_cleanup: true
- provider: npm
on:
condition: $TRAVIS_BRANCH == "master" && -n $TRAVIS_TAG
email: "emin@emin.ch"
api_key: "${NPM_TOKEN}"
skip_cleanup: true
- provider: npm
on:
condition: $TRAVIS_BRANCH == "master-cli-v2" && -n $TRAVIS_TAG
email: "emin@emin.ch"
api_key: "${NPM_TOKEN}"
skip_cleanup: true
tag: next
+103 -36
View File
@@ -1,51 +1,118 @@
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
*
* Generated with the TypeScript template
* https://github.com/emin93/react-native-template-typescript
*
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import React, {Fragment} from 'react';
import {
SafeAreaView,
StyleSheet,
ScrollView,
View,
Text,
StatusBar,
} from 'react-native';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
import {
Header,
LearnMoreLinks,
Colors,
DebugInstructions,
ReloadInstructions,
} from 'react-native/Libraries/NewAppScreen';
interface Props {}
export default class App extends Component<Props> {
render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.tsx</Text>
<Text style={styles.instructions}>{instructions}</Text>
</View>
);
}
}
const App = () => {
const usingHermes = typeof HermesInternal === 'object' && HermesInternal !== null;
return (
<Fragment>
<StatusBar barStyle="dark-content" />
<SafeAreaView>
<ScrollView
contentInsetAdjustmentBehavior="automatic"
style={styles.scrollView}>
<Header />
{!usingHermes ? null : (
<View style={styles.engine}>
<Text style={styles.footer}>Engine: Hermes</Text>
</View>
)}
<View style={styles.body}>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Step One</Text>
<Text style={styles.sectionDescription}>
Edit <Text style={styles.highlight}>App.tsx</Text> to change this
screen and then come back to see your edits.
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>See Your Changes</Text>
<Text style={styles.sectionDescription}>
<ReloadInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Debug</Text>
<Text style={styles.sectionDescription}>
<DebugInstructions />
</Text>
</View>
<View style={styles.sectionContainer}>
<Text style={styles.sectionTitle}>Learn More</Text>
<Text style={styles.sectionDescription}>
Read the docs to discover what to do next:
</Text>
</View>
<LearnMoreLinks />
</View>
</ScrollView>
</SafeAreaView>
</Fragment>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
scrollView: {
backgroundColor: Colors.lighter,
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
engine: {
position: 'absolute',
right: 0,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
body: {
backgroundColor: Colors.white,
},
sectionContainer: {
marginTop: 32,
paddingHorizontal: 24,
},
sectionTitle: {
fontSize: 24,
fontWeight: '600',
color: Colors.black,
},
sectionDescription: {
marginTop: 8,
fontSize: 18,
fontWeight: '400',
color: Colors.dark,
},
highlight: {
fontWeight: '700',
},
footer: {
color: Colors.dark,
fontSize: 12,
fontWeight: '600',
padding: 4,
paddingRight: 12,
textAlign: 'right',
},
});
export default App;
+3 -7
View File
@@ -1,11 +1,11 @@
# Contributing
Cool, I'm glad you decided to contribute to React Native Template TypeScript.
Don't worry, I won't bother you with thousands of rules. I want to make contributing to this project as easy and transparent as possible.
Contributing to this project should be as easy and transparent as possible.
## Workflow
Right now there are two master branches in order to keep support for the old React Native CLI (for more info, check out the [related issue](https://github.com/react-native-community/react-native-template-typescript/issues/39)).
We use [GitHub Flow](https://guides.github.com/introduction/flow/), so all code changes happen through pull requests.
1. Fork the repository and create your branch from `master`.
@@ -15,7 +15,3 @@ We use [GitHub Flow](https://guides.github.com/introduction/flow/), so all code
## License
By contributing, you agree that your contributions will be licensed under the [MIT License](https://choosealicense.com/licenses/mit/).
## Code style
Currently there is no lint configuration, but you should try to stay consistent with the existing code.
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2018 Emin Khateeb
Copyright (c) 2019 Emin Khateeb
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+30 -39
View File
@@ -1,55 +1,46 @@
# :space_invader: React Native Template TypeScript · [![Build Status](https://travis-ci.org/emin93/react-native-template-typescript.svg?branch=master)](https://travis-ci.org/emin93/react-native-template-typescript)
# :space_invader: React Native Template TypeScript
Clean and minimalist React Native template for a quick start with TypeScript.
<p>
<a href="https://travis-ci.org/react-native-community/react-native-template-typescript">
<img alt="Build Status" src="https://img.shields.io/travis/react-native-community/react-native-template-typescript.svg" target="_blank" />
</a>
<a href="https://github.com/react-native-community/react-native-template-typescript#readme">
<img alt="Documentation" src="https://img.shields.io/badge/documentation-yes-brightgreen.svg" target="_blank" />
</a>
<a href="https://github.com/react-native-community/react-native-template-typescript/graphs/commit-activity">
<img alt="Maintenance" src="https://img.shields.io/badge/Maintained%3F-yes-green.svg" target="_blank" />
</a>
<a href="https://github.com/react-native-community/react-native-template-typescript/blob/master/LICENSE">
<img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-yellow.svg" target="_blank" />
</a>
</p>
[![Header](https://cdn-images-1.medium.com/max/500/1*E9RnPOATuhjuNrlFkv5oSg.jpeg)](https://medium.com/@emin93/react-native-typescript-b965059109d3)
> Clean and minimalist React Native template for a quick start with TypeScript.
## :star: Features
- Seamlessly integrated into the React Native CLI! :sparkles:
- Elegant usage directly within the [React Native CLI](https://github.com/react-native-community/cli)
- Consistent with the default React Native template
- React Native TypeScript Transformer included
- Unit testing in TypeScript with TS Jest
- Always latest dependencies :raised_hands:
- Minimal additional dependencies
## :arrow_forward: Quick Start
## :arrow_forward: Usage
```bash
react-native init MyApp --template typescript && node MyApp/setup.js
### React Native >= 0.60
```sh
npx react-native init MyApp --template react-native-template-typescript@next
```
## :question: FAQ
### React Native <= 0.59
### What's 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.
Lots of :heart: and credits to the owners and maintainers of those packages.
### Why the setup script?
It deletes obsolete files like the `.flowconfig` and the `setup.js` itself after the setup.
### Does debugging work?
Yes it does.
[![Demonstration of working breakpoints in Visual Studio Code](https://cdn-images-1.medium.com/max/1600/1*ZXfzgq1xKz1B3chYy9xE7w.png)](https://medium.com/@emin93/react-native-typescript-b965059109d3)
## :globe_with_meridians: Links
- ["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)
```sh
react-native init MyApp --template typescript
```
## :computer: Contributing
Contributions are very welcome. Please check out the [contributing document](https://github.com/emin93/react-native-template-typescript/blob/master/CONTRIBUTING.md).
Contributions are very welcome. Please check out the [contributing document](CONTRIBUTING.md).
### Donations
## :bookmark: License
I created this project in my spare time because I enjoy coding. Of course you can support me by [buying me a coffee](https://www.paypal.me/emin93) if you wish. :coffee: :relieved:
This project is [MIT](LICENSE) licensed.
+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 />);
});
+63
View File
@@ -0,0 +1,63 @@
# 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
# CocoaPods
/ios/Pods/
-2
View File
@@ -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"
}
+4
View File
@@ -0,0 +1,4 @@
module.exports = {
preset: 'react-native',
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
}
-15
View File
@@ -1,15 +0,0 @@
{
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"modulePaths": ["<rootDir>"]
}
+728 -817
View File
File diff suppressed because it is too large. Load diff
+3 -2
View File
@@ -4,7 +4,8 @@
"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",
"install": "node setup.js"
},
"repository": {
"type": "git",
@@ -24,6 +25,6 @@
},
"homepage": "https://github.com/emin93/react-native-template-typescript#readme",
"devDependencies": {
"standard": "11.0.1"
"standard": "13.0.2"
}
}
-8
View File
@@ -1,8 +0,0 @@
module.exports = {
getTransformModulePath() {
return require.resolve('react-native-typescript-transformer');
},
getSourceExts() {
return ['ts', 'tsx'];
},
};
+17 -15
View File
@@ -1,23 +1,25 @@
const fs = require('fs')
const path = require('path')
const packageJson = require('./package.json')
const jestConfig = require('./jest.json')
if (fs.existsSync(path.join(__dirname, '.travis.yml'))) {
process.exit()
}
const deleteFile = (fileName) => fs.unlinkSync(path.join(__dirname, fileName))
const writeFile = (fileName, data) => fs.writeFileSync(path.join(__dirname, fileName), data)
const projectFilesToDelete = ['.flowconfig', 'App.js', '__tests__/App-test.js']
console.log('🔄 Setting up...')
const templateFilesToDelete = ['setup.js', 'README.md', 'LICENSE']
packageJson.jest = Object.assign(packageJson.jest, jestConfig)
writeFile('package.json', JSON.stringify(packageJson, null, 2))
const deleteFile = filePath => {
if (!fs.existsSync(filePath)) {
return
}
deleteFile('.flowconfig')
deleteFile('App.js')
deleteFile('devDependencies.json')
deleteFile('jest.json')
deleteFile('LICENSE')
deleteFile('README.md')
deleteFile('setup.js')
fs.unlinkSync(filePath)
}
console.log(`✅ Setup completed!`)
const projectPath = path.join(__dirname, '..', '..')
const deleteProjectFile = fileName => deleteFile(path.join(projectPath, fileName))
const deleteTemplateFile = fileName => deleteFile(path.join(__dirname, fileName))
projectFilesToDelete.forEach(deleteProjectFile)
templateFilesToDelete.forEach(deleteTemplateFile)
+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", "metro.config.js", "jest.config.js"]
}