Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12ed73a490 | ||
|
|
5635eb9106 | ||
|
|
5a8cf6bbe6 | ||
|
|
8e588cf4b5 | ||
|
|
5ce07d7e6c | ||
|
|
33cc106144 | ||
|
|
add36b1f30 | ||
|
|
2c6b757051 | ||
|
|
65ac7f1bbf | ||
|
|
c9184ffc06 | ||
|
|
1bed694429 | ||
|
|
e2b4039a30 | ||
|
|
f8369603f4 | ||
|
|
2433c22b3d | ||
|
|
a332cb68f4 | ||
|
|
ffc9af3595 | ||
|
|
ea456ca75d | ||
|
|
100447b7d5 | ||
|
|
4fc8174c3f | ||
|
|
ffcf32376d | ||
|
|
9e7a6483bb | ||
|
|
44e7ad381c | ||
|
|
9da8429132 | ||
|
|
371438e4e2 | ||
|
|
3c0fb203c8 |
No files matched your search
@@ -48,4 +48,4 @@ const styles = StyleSheet.create({
|
|||||||
color: '#333333',
|
color: '#333333',
|
||||||
marginBottom: 5,
|
marginBottom: 5,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
+1
-7
@@ -1,8 +1,6 @@
|
|||||||
# Contributing
|
# Contributing
|
||||||
|
|
||||||
Cool, I'm glad you decided to contribute to React Native Template TypeScript.
|
Contributing to this project should be as easy and transparent as possible.
|
||||||
|
|
||||||
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.
|
|
||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
@@ -15,7 +13,3 @@ We use [GitHub Flow](https://guides.github.com/introduction/flow/), so all code
|
|||||||
## License
|
## License
|
||||||
|
|
||||||
By contributing, you agree that your contributions will be licensed under the [MIT License](https://choosealicense.com/licenses/mit/).
|
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,6 +1,6 @@
|
|||||||
MIT License
|
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
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
@@ -13,15 +13,11 @@ Clean and minimalist React Native template for a quick start with TypeScript.
|
|||||||
## :arrow_forward: Quick Start
|
## :arrow_forward: Quick Start
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
react-native init MyApp --template typescript && node MyApp/setup.js
|
react-native init MyApp --template typescript
|
||||||
```
|
```
|
||||||
|
|
||||||
## :question: FAQ
|
## :question: FAQ
|
||||||
|
|
||||||
### 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?
|
### What additional dependencies are included in this template?
|
||||||
|
|
||||||
- [TypeScript](https://github.com/Microsoft/TypeScript)
|
- [TypeScript](https://github.com/Microsoft/TypeScript)
|
||||||
@@ -31,19 +27,15 @@ This template always uses the latest versions of the dependencies at the time wh
|
|||||||
|
|
||||||
Lots of :heart: and credits to the owners and maintainers of those packages.
|
Lots of :heart: and credits to the owners and maintainers of those packages.
|
||||||
|
|
||||||
### Why the setup script?
|
### Does debugging work?
|
||||||
|
|
||||||
It deletes obsolete files like the `.flowconfig` and the `setup.js` itself after the setup.
|
Yes it does. :tada:
|
||||||
|
|
||||||
|
[](https://medium.com/@emin93/react-native-typescript-b965059109d3)
|
||||||
|
|
||||||
### How to do type checking?
|
### How to do type checking?
|
||||||
|
|
||||||
`npm run tsc`
|
`npx tsc`
|
||||||
|
|
||||||
### Does debugging work?
|
|
||||||
|
|
||||||
Yes it does.
|
|
||||||
|
|
||||||
[](https://medium.com/@emin93/react-native-typescript-b965059109d3)
|
|
||||||
|
|
||||||
## :globe_with_meridians: Links
|
## :globe_with_meridians: Links
|
||||||
|
|
||||||
|
|||||||
@@ -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 />);
|
||||||
|
});
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
module.exports = {
|
||||||
|
preset: 'react-native',
|
||||||
|
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
|
||||||
|
}
|
||||||
Generated
+361
-614
File diff suppressed because it is too large.
Load diff
+3
-2
@@ -4,7 +4,8 @@
|
|||||||
"description": "Clean and minimalist React Native template for a quick start with TypeScript.",
|
"description": "Clean and minimalist React Native template for a quick start with TypeScript.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "standard setup.js",
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -24,6 +25,6 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/emin93/react-native-template-typescript#readme",
|
"homepage": "https://github.com/emin93/react-native-template-typescript#readme",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"standard": "11.0.1"
|
"standard": "12.0.1"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,21 +1,25 @@
|
|||||||
const fs = require('fs')
|
const fs = require('fs')
|
||||||
const path = require('path')
|
const path = require('path')
|
||||||
|
|
||||||
const packageJson = require('./package.json')
|
if (fs.existsSync(path.join(__dirname, '.travis.yml'))) {
|
||||||
|
process.exit()
|
||||||
|
}
|
||||||
|
|
||||||
const deleteFile = fileName => fs.unlinkSync(path.join(__dirname, fileName))
|
const projectFilesToDelete = ['.flowconfig', 'App.js', '__tests__/App-test.js']
|
||||||
const writeFile = (fileName, data) => fs.writeFileSync(path.join(__dirname, fileName), data)
|
|
||||||
|
|
||||||
console.log('🔄 Setting up...')
|
const templateFilesToDelete = ['setup.js', 'README.md', 'LICENSE']
|
||||||
|
|
||||||
packageJson.scripts.tsc = 'tsc'
|
const deleteFile = filePath => {
|
||||||
|
if (!fs.existsSync(filePath)) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
writeFile('package.json', JSON.stringify(packageJson, null, 2))
|
fs.unlinkSync(filePath)
|
||||||
|
}
|
||||||
|
|
||||||
deleteFile('.flowconfig')
|
const projectPath = path.join(__dirname, '..', '..')
|
||||||
deleteFile('App.js')
|
const deleteProjectFile = fileName => deleteFile(path.join(projectPath, fileName))
|
||||||
deleteFile('LICENSE')
|
const deleteTemplateFile = fileName => deleteFile(path.join(__dirname, fileName))
|
||||||
deleteFile('README.md')
|
|
||||||
deleteFile('setup.js')
|
|
||||||
|
|
||||||
console.log(`✅ Setup completed!`)
|
projectFilesToDelete.forEach(deleteProjectFile)
|
||||||
|
templateFilesToDelete.forEach(deleteTemplateFile)
|
||||||
+2
-2
@@ -4,12 +4,12 @@
|
|||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"esModuleInterop": true,
|
"esModuleInterop": true,
|
||||||
"isolatedModules": true,
|
"isolatedModules": true,
|
||||||
"jsx": "react-native",
|
"jsx": "react",
|
||||||
"lib": ["es6"],
|
"lib": ["es6"],
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"noEmit": true,
|
"noEmit": true,
|
||||||
"strict": true,
|
"strict": true,
|
||||||
"target": "esnext"
|
"target": "esnext"
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules"]
|
"exclude": ["node_modules", "babel.config.js", "metro.config.js", "jest.config.js"]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user