Compare commits

..
6 Commits
Author SHA1 Message Date
Emin Khateeb 57233a492b fixed issue with new deployment 2018-04-24 21:25:57 +02:00
Emin Khateeb b8f4b89aca now caching node modules 2018-04-24 21:18:36 +02:00
Emin Khateeb 80e970bda8 added standardjs to lint the setup.js and now using consistently 2 spaces indent 2018-04-24 21:14:46 +02:00
Emin Khateeb dc432eea2d Update App.tsx
removed unnecessary semicolon
2018-04-20 11:34:35 +02:00
Emin Khateeb 8c5248b2b3 Merge pull request #15 from emin93/emin93-patch-1
Update README.md
2018-04-10 15:29:42 +02:00
Emin Khateeb 11fa0420ed Update README.md
added link to vs code debugging fix
2018-04-10 15:29:12 +02:00
10 changed files with 2020 additions and 111 deletions

No files matched your search

+3 -1
View File
@@ -1,7 +1,9 @@
language: node_js
node_js:
- "node"
install: true
cache:
directories:
- "node_modules"
deploy:
on:
tags: true
+1 -1
View File
@@ -21,7 +21,7 @@ const instructions = Platform.select({
'Shake or press menu button for dev menu',
});
interface Props {};
interface Props {}
export default class App extends Component<Props> {
render() {
return (
+4
View File
@@ -43,6 +43,10 @@ The React Native CLI supports automatic installation of production dependencies
The React Native CLI will do everything just as without a template and afterwards overwrite the files with the ones from this template. This means you don't have to worry about incompatibility issues with later React Native upgrades.
### Does debugging work too?
Yes it does. Some users reported that they got an error about relative paths when they tried to debug inside Visual Studio Code. In this case check out the [fix by Mo Mac](https://medium.com/@nocnoc/great-work-f0b5ef365ca6).
## :globe_with_meridians: Links
- ["Using React Native with TypeScript just became simple" on Medium](https://medium.com/@emin93/react-native-typescript-b965059109d3)
+7 -7
View File
@@ -1,9 +1,9 @@
[
"@types/jest",
"@types/react",
"@types/react-native",
"@types/react-test-renderer",
"react-native-typescript-transformer",
"ts-jest",
"typescript"
"@types/jest",
"@types/react",
"@types/react-native",
"@types/react-test-renderer",
"react-native-typescript-transformer",
"ts-jest",
"typescript"
]
+13 -13
View File
@@ -1,15 +1,15 @@
{
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"modulePaths": ["<rootDir>"]
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
],
"modulePaths": ["<rootDir>"]
}
+1899
View File
File diff suppressed because it is too large. Load diff
+27 -23
View File
@@ -1,25 +1,29 @@
{
"name": "react-native-template-typescript",
"version": "0.0.1",
"description": "Clean and minimalist React Native template for a quick start with TypeScript.",
"scripts": {
"prepublishOnly": "npm --no-git-tag-version version from-git"
},
"repository": {
"type": "git",
"url": "git+https://github.com/emin93/react-native-template-typescript.git"
},
"keywords": [
"react-native",
"typescript",
"jest",
"template",
"boilerplate"
],
"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"
"name": "react-native-template-typescript",
"version": "0.0.1",
"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"
},
"repository": {
"type": "git",
"url": "git+https://github.com/emin93/react-native-template-typescript.git"
},
"keywords": [
"react-native",
"typescript",
"jest",
"template",
"boilerplate"
],
"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",
"devDependencies": {
"standard": "11.0.1"
}
}
+7 -7
View File
@@ -1,8 +1,8 @@
module.exports = {
getTransformModulePath() {
return require.resolve('react-native-typescript-transformer');
},
getSourceExts() {
return ['ts', 'tsx'];
}
}
getTransformModulePath() {
return require.resolve('react-native-typescript-transformer');
},
getSourceExts() {
return ['ts', 'tsx'];
},
};
+47 -47
View File
@@ -1,56 +1,56 @@
const fs = require('fs');
const path = require('path');
const { execSync } = require('child_process');
const fs = require('fs')
const path = require('path')
const {execSync} = require('child_process')
const packageJson = require('./package.json');
const jestConfig = require('./jest.json');
const devDependencies = require('./devDependencies.json');
const packageJson = require('./package.json')
const jestConfig = require('./jest.json')
const devDependencies = require('./devDependencies.json')
const deleteFile = (fileName) => {
const filePath = path.join(process.cwd(), fileName);
const filePath = path.join(process.cwd(), fileName)
if (!fs.existsSync(filePath)) {
return;
}
if (!fs.existsSync(filePath)) {
return
}
fs.unlinkSync(filePath);
};
const writeFile = (fileName, data) => fs.writeFileSync(path.join(process.cwd(), fileName), data);
fs.unlinkSync(filePath)
}
const writeFile = (fileName, data) => fs.writeFileSync(path.join(process.cwd(), fileName), data)
const isYarnAvailable = () => {
try {
execSync('yarn --version', { stdio: 'ignore' });
return true;
} catch (exc) {
return false;
}
};
const packageManager = isYarnAvailable() ? 'yarn' : 'npm';
const execOptions = { stdio: 'inherit' };
console.log('🔄 Please wait...\n');
packageJson.scripts.start = `${packageJson.scripts.start} --config ../../../../rn-cli.config.js`;
packageJson.jest = Object.assign(packageJson.jest, jestConfig);
writeFile('package.json', JSON.stringify(packageJson, null, 2));
console.log(`📦 Installing dependencies with ${packageManager}...\n`);
switch (packageManager) {
case 'yarn':
execSync(`yarn add ${devDependencies.join(' ')} --dev --exact`, execOptions);
break;
default:
execSync(`npm i ${devDependencies.join(' ')} --save-dev --save-exact`, execOptions);
try {
execSync('yarn --version', {stdio: 'ignore'})
return true
} catch (exc) {
return false
}
}
deleteFile('App.js');
deleteFile('__tests__/App.js');
deleteFile('.flowconfig');
deleteFile('devDependencies.json');
deleteFile('jest.json');
deleteFile('README.md');
deleteFile('LICENSE');
deleteFile('setup.js');
const packageManager = isYarnAvailable() ? 'yarn' : 'npm'
const execOptions = {stdio: 'inherit'}
console.log(`\n✅ Setup completed! You can now start with: ${packageManager} start\n`);
console.log('🔄 Please wait...\n')
packageJson.scripts.start = `${packageJson.scripts.start} --config ../../../../rn-cli.config.js`
packageJson.jest = Object.assign(packageJson.jest, jestConfig)
writeFile('package.json', JSON.stringify(packageJson, null, 2))
console.log(`📦 Installing dependencies with ${packageManager}...\n`)
switch (packageManager) {
case 'yarn':
execSync(`yarn add ${devDependencies.join(' ')} --dev --exact`, execOptions)
break
default:
execSync(`npm i ${devDependencies.join(' ')} --save-dev --save-exact`, execOptions)
}
deleteFile('App.js')
deleteFile('__tests__/App.js')
deleteFile('.flowconfig')
deleteFile('devDependencies.json')
deleteFile('jest.json')
deleteFile('README.md')
deleteFile('LICENSE')
deleteFile('setup.js')
console.log(`\n✅ Setup completed! You can now start with: ${packageManager} start\n`)
+12 -12
View File
@@ -1,14 +1,14 @@
{
"compilerOptions": {
"target": "es2015",
"jsx": "react",
"noEmit": true,
"moduleResolution": "node",
"noImplicitAny": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"exclude": [
"node_modules"
]
"compilerOptions": {
"target": "es2015",
"jsx": "react",
"noEmit": true,
"moduleResolution": "node",
"noImplicitAny": true,
"allowSyntheticDefaultImports": true,
"esModuleInterop": true
},
"exclude": [
"node_modules"
]
}