generator-wolmo-bootstrap-rn
Advanced tools
Comparing version 0.0.1 to 0.0.3
@@ -10,2 +10,3 @@ const Generator = require('yeoman-generator'); | ||
const nextSteps = require('./tasks/nextSteps'); | ||
const bundleInstall = require('./tasks/bundleInstall'); | ||
@@ -47,2 +48,8 @@ class ReactNativeBootstrap extends Generator { | ||
}, {}) | ||
}, | ||
{ | ||
type: 'confirm', | ||
name: 'landscape', | ||
message: "Would you like to enable landscape orientation? Psst! You probably don't want this!", | ||
default: false | ||
} | ||
@@ -52,2 +59,14 @@ ]).then(answers => { | ||
this.features = answers.features; | ||
this.features.landscape = answers.landscape; | ||
return this.prompt([ | ||
{ | ||
type: 'input', | ||
name: 'bundleId', | ||
message: 'Enter the bundle id for your ios app', | ||
default: `com.wolox.${this.projectName}` | ||
} | ||
]).then(answer => { | ||
this.bundleId = answer.bundleId; | ||
}); | ||
}); | ||
@@ -69,2 +88,3 @@ } | ||
return Promise.resolve() | ||
.then(() => bundleInstall.bind(this)()) | ||
.then(() => reactNativeLink.bind(this)()) | ||
@@ -71,0 +91,0 @@ .then(() => gitInitialization.bind(this)()); |
module.exports = function baseFilesTemplate() { | ||
// circle.yml | ||
this.fs.copy(this.templatePath('circle.yml'), this.destinationPath(this.projectName, 'circle.yml')); | ||
// README.md | ||
this.fs.copyTpl(this.templatePath('README.ejs'), this.destinationPath(this.projectName, 'README.md'), { | ||
projectName: this.projectName | ||
}); | ||
// pull_request_template.md | ||
this.fs.copy( | ||
this.templatePath('pull_request_template.md'), | ||
this.destinationPath(this.projectName, 'pull_request_template.md') | ||
); | ||
// src/config/api.js | ||
@@ -3,0 +14,0 @@ this.fs.copy( |
@@ -11,2 +11,3 @@ module.exports = function eslintSetup() { | ||
this.fs.copy(this.templatePath('.eslintrc.ejs'), this.destinationPath(this.projectName, '.eslintrc.js')); | ||
this.fs.copy(this.templatePath('.eslintignore'), this.destinationPath(this.projectName, '.eslintignore')); | ||
}; |
@@ -8,3 +8,3 @@ module.exports = function fixBundleIndentifier() { | ||
replaceRegex, | ||
`PRODUCT_BUNDLE_IDENTIFIER = com.${this.projectName};\n\t\t\t\tPRODUCT_NAME = ${this.projectName};` | ||
`PRODUCT_BUNDLE_IDENTIFIER = ${this.bundleId};\n\t\t\t\tPRODUCT_NAME = ${this.projectName};` | ||
); | ||
@@ -11,0 +11,0 @@ this.fs.write(`${this.projectName}/ios/${this.projectName}.xcodeproj/project.pbxproj`, fixedProjectContent); |
@@ -6,3 +6,6 @@ const ora = require('ora'); | ||
const baseFilesTemplate = require('./baseFilesTemplate'); | ||
const iosAppIcons = require('./iosAppIcons'); | ||
const fastlaneFiles = require('./fastlaneFiles'); | ||
const fixBundleIdentifier = require('./fixBundleIdentifier'); | ||
const disableLandscapeOrientation = require('./disableLandscapeOrientation'); | ||
const pushNotificationsFeatureFiles = require('./pushNotificationsFeatureFiles'); | ||
@@ -24,5 +27,16 @@ const loginFeatureFiles = require('./loginFeatureFiles'); | ||
// ---------------- ios app icons ---------------- | ||
iosAppIcons.bind(this)(); | ||
// ---------------- fastlane setup ---------------- | ||
fastlaneFiles.bind(this)(); | ||
// ---------------- fix bundle identifier ---------------- | ||
fixBundleIdentifier.bind(this)(); | ||
if (this.features.landscape) { | ||
// ---------------- disable landscape orientiation for both android and ios ---------------- | ||
disableLandscapeOrientation.bind(this)(); | ||
} | ||
// ---------------- features ---------------- | ||
@@ -29,0 +43,0 @@ if (this.features.pushnotifications) { |
module.exports = function packgeJsonScripts() { | ||
const packageJson = this.fs.readJSON(this.destinationPath(this.projectName, 'package.json')); | ||
packageJson.scripts = packageJson.scripts || {}; | ||
packageJson.scripts.coverage = 'jest --coverage'; | ||
packageJson.scripts.clean = 'rm -rf $TMPDIR/react-* && watchman watch-del-all && npm cache clean'; | ||
packageJson.scripts['clean:android'] = 'cd android/ && ./gradlew clean'; | ||
packageJson.scripts['force-clean'] = | ||
'rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean && npm i'; | ||
packageJson.scripts.coverage = 'jest --coverage'; | ||
packageJson.scripts['android:build'] = 'cd android && ./gradlew assembleRelease'; | ||
'npm run android:clean && rm -rf $TMPDIR/react-* && watchman watch-del-all && rm -rf ios/build && rm -rf node_modules/ && npm cache clean && npm i'; | ||
packageJson.scripts['android:clean'] = 'cd android/ && ./gradlew clean'; | ||
packageJson.scripts['android:build'] = 'cd android && ./gradlew clean && ./gradlew assembleRelease'; | ||
packageJson.scripts['android:install'] = | ||
'cd android && ./gradlew assembleRelease && ./gradlew installRelease'; | ||
'cd android && ./gradlew clean && ./gradlew assembleRelease && ./gradlew installRelease'; | ||
this.fs.writeJSON(this.destinationPath(this.projectName, 'package.json'), packageJson); | ||
}; |
require('colors'); | ||
module.exports = function reactNativeLink() { | ||
module.exports = function nextSteps() { | ||
console.log(`\n ${'NEXT STEPS!'.bold.underline.white} \n`); | ||
@@ -5,0 +5,0 @@ // introduction message |
{ | ||
"name": "generator-wolmo-bootstrap-rn", | ||
"version": "0.0.1", | ||
"version": "0.0.3", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "files": [ |
# Wolmo Bootstrap: React Native | ||
## Important | ||
## Prerequisites | ||
- React native dev environment: https://facebook.github.io/react-native/docs/getting-started.html | ||
- node & npm: https://github.com/creationix/nvm#install-script | ||
- yarn: https://yarnpkg.com/lang/en/docs/install/#alternatives-tab | ||
- ruby (for Fastlane): https://github.com/rbenv/rbenv#installation | ||
## TL;DR | ||
You don't need to clone this repository. Just run the following in your terminal: | ||
```bash | ||
bash <(curl -s https://raw.githubusercontent.com/sbalay/react-native-bootstrap/master/run.sh) | ||
bash <(curl -s https://raw.githubusercontent.com/Wolox/wolmo-bootstrap-react-native/master/run.sh) | ||
``` | ||
## Description | ||
This codebase is meant to be used to kickoff react native projects with Wolox's [tech stack](#tech-stack), [tools](#tooling) and [basic boilerplate](#boilerplate). | ||
The following optional features can be added out of the box to the new projects: | ||
- Login | ||
- Drawer | ||
- Tabs | ||
- Push notifications | ||
### Boilerplate | ||
The boilerplate includes | ||
- [Basic routes configuration for React Navigation](/generators/app/templates/src/screens.ejs) | ||
- [Redux store intialization](/generators/app/templates/src/redux/store.ejs) | ||
- [Reactotron config](/generators/app/templates/src/config/ReactotronConfig.ejs) | ||
- [Basic](/generators/app/templates/src/utils/colors.js) [constants](/generators/app/templates/src/utils/constants.js) | ||
- [Http client config](/generators/app/templates/src/config/api.js) | ||
### Tech Stack | ||
- [React](https://facebook.github.io/react/) | ||
- [React Native](https://facebook.github.io/react-native/) | ||
- [React Navigation](https://reactnavigation.org/) | ||
- [Redux](http://redux.js.org/) | ||
- [Redux Thunk](https://github.com/gaearon/redux-thunk) | ||
- [Seamless Immutable](https://github.com/rtfeldman/seamless-immutable) | ||
- [Apisauce](https://github.com/skellock/apisauce) | ||
- [Reselect](https://github.com/reactjs/reselect) | ||
### Tooling | ||
- [Eslint](http://eslint.org/) | ||
- [Prettier](https://github.com/prettier/prettier) | ||
- [Reactotron](https://github.com/infinitered/reactotron) | ||
## Contributing | ||
1. Fork it | ||
2. Create your feature branch (`git checkout -b my-new-feature`) | ||
3. Commit your changes (`git commit -am 'Add some feature'`) | ||
4. Push to the branch (`git push origin my-new-feature`) | ||
5. Create new Pull Request | ||
## About | ||
This project is maintained by [Sebastian Balay](https://github.com/sbalay) and it was written by [Wolox](http://www.wolox.com.ar). | ||
![Wolox](https://raw.githubusercontent.com/Wolox/press-kit/master/logos/logo_banner.png) | ||
## License | ||
**wolmo-bootstrap-react-native** is available under the MIT [license](LICENSE). | ||
Copyright (c) 2017 Sebastián Balay <sebastian.balay@wolox.com.ar> | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
105633
73
1574
90