Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c306c4fbf | ||
|
|
ee9d44e70d | ||
|
|
0f5dc1d0f5 | ||
|
|
289a767088 |
No files matched your search
@@ -1 +1,2 @@
|
||||
.travis.yml
|
||||
setup/
|
||||
@@ -17,7 +17,7 @@ node setup.js
|
||||
### What is included in this template?
|
||||
|
||||
- [TypeScript](https://github.com/Microsoft/TypeScript)
|
||||
- [React Native TypeScript Transformer](https://github.com/ds300/react-native-typescript-transformer)
|
||||
- [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)
|
||||
- [TSLint](https://github.com/palantir/tslint)
|
||||
@@ -25,6 +25,8 @@ node setup.js
|
||||
|
||||
This template always uses the latest versions of the dependencies at the time when the setup script (`node setup.js`) 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?
|
||||
|
||||
The React Native CLI supports automatic installation of production dependencies only. Since TypeScript and the other dependencies are dev dependencies, the setup script is being used to install those. It also takes care of obsolete files like the `.flowconfig` and the `setup.js` itself after the setup.
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"react-native-setup-typescript": "*"
|
||||
}
|
||||
+4
-3
@@ -10,10 +10,11 @@
|
||||
"url": "git+https://github.com/emin93/react-native-template-typescript.git"
|
||||
},
|
||||
"keywords": [
|
||||
"react",
|
||||
"native",
|
||||
"template",
|
||||
"react-native",
|
||||
"typescript",
|
||||
"tslint",
|
||||
"jest",
|
||||
"template",
|
||||
"boilerplate"
|
||||
],
|
||||
"author": "Emin Khateeb <emin@emin.ch>",
|
||||
|
||||
@@ -2,20 +2,18 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
const packageJson = require('./package.json');
|
||||
const jestJson = require('./jest.json');
|
||||
const devDependencies = require('./devDependencies.json');
|
||||
const packageJson = require('../../package.json');
|
||||
const jestJson = require('../../jest.json');
|
||||
const devDependencies = require('../../devDependencies.json');
|
||||
|
||||
const deleteFile = (fileName) => fs.unlinkSync(path.join(process.cwd(), fileName));
|
||||
const writeFile = (fileName, data) => fs.writeFileSync(path.join(process.cwd(), fileName), data);
|
||||
const deleteFile = (fileName) => fs.unlinkSync(path.join(process.cwd(), '../../', fileName));
|
||||
const writeFile = (fileName, data) => fs.writeFileSync(path.join(process.cwd(), '../../' fileName), data);
|
||||
|
||||
packageJson.scripts.start = `${packageJson.scripts.start} --config ../../../../rn-cli.config.js`;
|
||||
packageJson.scripts.lint = 'tslint -c tslint.json "src/**/*.{ts,tsx}"';
|
||||
packageJson.jest = Object.assign(packageJson.jest, jestJson);
|
||||
writeFile('package.json', JSON.stringify(packageJson, null, 2));
|
||||
|
||||
execSync(`npm i ${devDependencies.join(' ')} --save-dev --save-exact`);
|
||||
|
||||
deleteFile('App.js');
|
||||
deleteFile('__tests__/App.js');
|
||||
deleteFile('.flowconfig');
|
||||
@@ -23,6 +21,8 @@ deleteFile('devDependencies.json');
|
||||
deleteFile('jest.json');
|
||||
deleteFile('README.md');
|
||||
deleteFile('LICENSE');
|
||||
deleteFile('setup.js');
|
||||
|
||||
console.log('✅ Setup completed! You can now start with: npm start');
|
||||
let commandsToExecute = `cd ../../ && npm i ${devDependencies.join(' ')} --save-dev --save-exact`;
|
||||
commandsToExecute += '&& npm uninstall react-native-setup-typescript --save'
|
||||
|
||||
execSync(commandsToExecute);
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "react-native-setup-typescript",
|
||||
"version": "1.0.1",
|
||||
"description": "Do NOT use this as a standalone package. See: https://www.npmjs.com/package/react-native-template-typescript",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"install": "node index.js"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+ssh://git@github.com/emin93/react-native-template-typescript.git"
|
||||
},
|
||||
"author": "Emin Khateeb <emin@emin.ch>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/emin93/react-native-template-typescript/issues"
|
||||
},
|
||||
"homepage": "https://github.com/emin93/react-native-template-typescript#readme"
|
||||
}
|
||||
Reference in new issue
Block a user