├── .editorconfig ├── .gitattributes ├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── generators └── app │ ├── index.js │ └── templates │ ├── .babelrc │ ├── App │ └── View │ │ └── App.js │ ├── index.android.js │ ├── index.ios.js │ ├── index.web.js │ └── web │ ├── src │ └── index.html │ └── webpack.config.dev.js ├── gulpfile.js ├── package.json ├── templates ├── .babelrc ├── App │ └── View │ │ └── App.js ├── index.android.js ├── index.ios.js ├── index.web.js └── web │ ├── src │ └── index.html │ └── webpack.config.dev.js └── test └── app.js /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | charset = utf-8 7 | trim_trailing_whitespace = true 8 | insert_final_newline = true 9 | 10 | [*.md] 11 | trim_trailing_whitespace = false 12 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | coverage 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - v6 4 | - v5 5 | - v4 6 | - '0.12' 7 | - '0.10' 8 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Sam S Lee 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # generator-react-native-web 2 | > React Native for iOS, Android and WEB ! 3 | 4 | ## Installation 5 | 6 | First, install [Yeoman](http://yeoman.io) and generator-react-native-web using [npm](https://www.npmjs.com/) (we assume you have pre-installed [node.js](https://nodejs.org/)). 7 | 8 | ```bash 9 | npm install -g yo 10 | npm install -g generator-react-native-web 11 | ``` 12 | 13 | Then generate your new project: 14 | 15 | ```bash 16 | yo react-native-web 17 | ``` 18 | 19 | 20 | 21 | ## Start ! 22 | 23 | After installation complete, you can run these command to start this environment ! 24 | 25 | ```bash 26 | # For Mobile 27 | react-native start 28 | 29 | # For Web 30 | npm run web 31 | # open http://localhost:3000 to see the page 32 | ``` 33 | 34 | 35 | 36 | ## License 37 | 38 | MIT © [Sam S Lee]() 39 | 40 | 41 | [npm-image]: https://badge.fury.io/js/generator-react-native-web.svg 42 | [npm-url]: https://npmjs.org/package/generator-react-native-web 43 | [travis-image]: https://travis-ci.org/leeabc/generator-react-native-web.svg?branch=master 44 | [travis-url]: https://travis-ci.org/leeabc/generator-react-native-web 45 | [daviddm-image]: https://david-dm.org/leeabc/generator-react-native-web.svg?theme=shields.io 46 | [daviddm-url]: https://david-dm.org/leeabc/generator-react-native-web 47 | -------------------------------------------------------------------------------- /generators/app/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var yeoman = require('yeoman-generator'); 3 | var chalk = require('chalk'); 4 | var yosay = require('yosay'); 5 | const path = require('path'); 6 | 7 | module.exports = yeoman.Base.extend({ 8 | initializing: function(){ 9 | this.props = {}; 10 | }, 11 | 12 | prompting: function () { 13 | this.log("\n"+ 14 | "\n"+chalk.red('██████╗ ███████╗ █████╗ ██████╗████████╗ ███╗ ██╗ █████╗ ████████╗██╗██╗ ██╗███████╗ ██╗ ██╗███████╗██████╗ ')+ 15 | "\n"+chalk.red('██╔══██╗██╔════╝██╔══██╗██╔════╝╚══██╔══╝ ████╗ ██║██╔══██╗╚══██╔══╝██║██║ ██║██╔════╝ ██║ ██║██╔════╝██╔══██╗')+ 16 | "\n"+chalk.red('██████╔╝█████╗ ███████║██║ ██║ ██╔██╗ ██║███████║ ██║ ██║██║ ██║█████╗ ██║ █╗ ██║█████╗ ██████╔╝')+ 17 | "\n"+chalk.red('██╔══██╗██╔══╝ ██╔══██║██║ ██║ ██║╚██╗██║██╔══██║ ██║ ██║╚██╗ ██╔╝██╔══╝ ██║███╗██║██╔══╝ ██╔══██╗')+ 18 | "\n"+chalk.red('██║ ██║███████╗██║ ██║╚██████╗ ██║ ██║ ╚████║██║ ██║ ██║ ██║ ╚████╔╝ ███████╗ ╚███╔███╔╝███████╗██████╔╝')+ 19 | "\n"+chalk.red('╚═╝ ╚═╝╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═╝ ╚═╝ ╚═══╝ ╚══════╝ ╚══╝╚══╝ ╚══════╝╚═════╝ ')+ 20 | "\n" 21 | ); 22 | 23 | // Start Propmts 24 | var prompts = [{ 25 | type: 'input', 26 | name: 'name', 27 | message: 'Application Name: ', 28 | default: path.basename(process.cwd()) 29 | },{ 30 | type: 'input', 31 | name: 'desc', 32 | message: 'Please describe your application', 33 | default: 'A base skeleton template' 34 | },{ 35 | type: 'input', 36 | name: 'author', 37 | message: 'Author:', 38 | default: "" 39 | },{ 40 | type: 'input', 41 | name: 'email', 42 | message: 'Email:', 43 | default: "" 44 | }]; 45 | 46 | return this.prompt(prompts).then(function (props) { 47 | this.props = props; 48 | }.bind(this)); 49 | }, 50 | 51 | configuring: function(){ 52 | }, 53 | 54 | writing: function () { 55 | console.log("React Native Init"); 56 | this.spawnCommandSync('react-native', ['init', this.props.name]); 57 | this.spawnCommandSync('mv', [`${this.destinationPath()}/${this.props.name}/android`,`${this.destinationPath()}/`]); 58 | this.spawnCommandSync('mv', [`${this.destinationPath()}/${this.props.name}/ios`,`${this.destinationPath()}/`]); 59 | this.spawnCommandSync('mv', [`${this.destinationPath()}/${this.props.name}/node_modules`,`${this.destinationPath()}/`]); 60 | //this.spawnCommandSync('mv', [`${this.destinationPath()}/${this.props.name}/package.json`,`${this.destinationPath()}/`]); 61 | this.spawnCommandSync('mv', [`${this.destinationPath()}/${this.props.name}/index.android.js`,`${this.destinationPath()}/`]); 62 | this.spawnCommandSync('mv', [`${this.destinationPath()}/${this.props.name}/index.ios.js`,`${this.destinationPath()}/`]); 63 | //this.spawnCommandSync('rm', ['-Rf',`${this.destinationPath()}/${this.props.name}`]); 64 | 65 | let npmSettings = this.fs.readJSON(`${this.destinationPath()}/${this.props.name}/package.json`); 66 | npmSettings.name = this.props.name; 67 | npmSettings.description = this.props.desc; 68 | npmSettings.author = this.props.author; 69 | npmSettings.email = this.props.email; 70 | 71 | npmSettings.scripts = Object.assign({}, npmSettings.scripts, { 72 | "web": "webpack-dev-server --port 3000 --config web/webpack.config.dev.js --inline --hot --colors" 73 | }); 74 | 75 | npmSettings.dependencies = Object.assign({},npmSettings.dependencies, { 76 | "react": "^15.2.1", 77 | "react-native": "^0.30.0", 78 | "react-native-web": "^0.0.39", 79 | "url-loader": "^0.5.7" 80 | }); 81 | npmSettings.devDependencies = Object.assign({}, npmSettings.devDependencies, { 82 | "babel-core": "^6.9.1", 83 | "babel-loader": "^6.2.4", 84 | "babel-plugin-transform-decorators-legacy": "^1.3.4", 85 | "babel-preset-es2015": "^6.9.0", 86 | "babel-preset-react": "^6.5.0", 87 | "babel-preset-stage-1": "^6.5.0", 88 | "babel-runtime": "^6.9.2", 89 | "webpack": "^1.13.1", 90 | "webpack-dev-server": "^1.14.1" 91 | }); 92 | 93 | // write back to package.json 94 | this.fs.writeJSON(this.destinationPath('package.json'), npmSettings); 95 | 96 | // copy template file to destination path 97 | this.fs.copy(this.sourceRoot(), this.destinationRoot()); 98 | this.fs.copyTpl(`${this.sourceRoot()}/.babelrc`, `${this.destinationPath()}/.babelrc`,{ 99 | "APP_NAME": this.props.name 100 | }); 101 | this.fs.copyTpl(`${this.sourceRoot()}/web/src/index.html`, `${this.destinationPath()}/web/src/index.html`,{ 102 | "APP_NAME": this.props.name 103 | }); 104 | this.fs.copyTpl(`${this.sourceRoot()}/index.ios.js`, `${this.destinationPath()}/index.ios.js`,{ 105 | "APP_NAME": this.props.name 106 | }); 107 | this.fs.copyTpl(`${this.sourceRoot()}/index.android.js`, `${this.destinationPath()}/index.android.js`,{ 108 | "APP_NAME": this.props.name 109 | }); 110 | }, 111 | 112 | install: function () { 113 | this.installDependencies({ 114 | callback: ()=>{ 115 | //Clear files 116 | this.spawnCommandSync('rm', ['-Rf',`${this.destinationPath()}/${this.props.name}`]); 117 | 118 | this.log("\n" 119 | +"\n" + chalk.white('React Native trinity (iOS, Android, Web) basic usage:') 120 | +"\n" + chalk.white('Run iOS/Android:') 121 | +"\n" + chalk.yellow(' react-native start') 122 | +"\n" + chalk.white('Run Web: ') 123 | +"\n" + chalk.yellow(' npm run web') 124 | ); 125 | } 126 | }); 127 | 128 | 129 | }, 130 | 131 | end: function(){ 132 | 133 | } 134 | }); 135 | -------------------------------------------------------------------------------- /generators/app/templates/.babelrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "presets": [ 4 | "react-native" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /generators/app/templates/App/View/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View, 13 | Platform, 14 | } from 'react-native'; 15 | 16 | export class App extends Component { 17 | render() { 18 | return ( 19 | 20 | 21 | Welcome to React Native for {Platform.OS}!!!! 22 | 23 | 24 | To get started, edit index.{Platform.OS}.js YA! 25 | 26 | 27 | Press Cmd+R to reload,{'\n'} 28 | { Platform.OS !== "web"?"Cmd+D or shake for dev menu":"" } 29 | 30 | 31 | ); 32 | } 33 | } 34 | 35 | const styles = StyleSheet.create({ 36 | container: { 37 | flex: 1, 38 | justifyContent: 'center', 39 | alignItems: 'center', 40 | backgroundColor: '#F5FCFF', 41 | }, 42 | welcome: { 43 | fontSize: 20, 44 | textAlign: 'center', 45 | margin: 10, 46 | }, 47 | instructions: { 48 | textAlign: 'center', 49 | color: '#333333', 50 | marginBottom: 5, 51 | }, 52 | }); -------------------------------------------------------------------------------- /generators/app/templates/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import { AppRegistry } from 'react-native'; 8 | import { App } from './App/View/App'; 9 | 10 | AppRegistry.registerComponent('<%=APP_NAME%>', () => App); -------------------------------------------------------------------------------- /generators/app/templates/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import { AppRegistry } from 'react-native'; 8 | import { App } from './App/View/App'; 9 | 10 | AppRegistry.registerComponent('<%=APP_NAME%>', () => App); 11 | -------------------------------------------------------------------------------- /generators/app/templates/index.web.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import { AppRegistry } from 'react-native'; 8 | import { App } from './App/View/App'; 9 | 10 | AppRegistry.registerComponent('App', () => App); 11 | AppRegistry.runApplication('App', { 12 | rootTag: document.getElementById('react-root') 13 | }) 14 | -------------------------------------------------------------------------------- /generators/app/templates/web/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | <%=APP_NAME%> 4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /generators/app/templates/web/webpack.config.dev.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const webpack = require('webpack') 3 | 4 | const DIRECTORY = path.join(__dirname) 5 | 6 | module.exports = { 7 | devServer: { 8 | contentBase: path.join(__dirname, 'src') 9 | }, 10 | entry: [ 11 | path.join(__dirname, '../index.web.js') 12 | ], 13 | module: { 14 | loaders: [ 15 | { 16 | test: /\.js$/, 17 | exclude: /node_modules/, 18 | loader: 'babel-loader', 19 | query: { cacheDirectory: true } 20 | }, 21 | { 22 | test: /\.(gif|jpe?g|png|svg)$/, 23 | loader: 'url-loader', 24 | query: { name: '[name].[hash:16].[ext]' } 25 | } 26 | ] 27 | }, 28 | output: { 29 | filename: 'bundle.js' 30 | }, 31 | plugins: [ 32 | new webpack.DefinePlugin({ 33 | 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development') 34 | }), 35 | new webpack.optimize.DedupePlugin(), 36 | new webpack.optimize.OccurenceOrderPlugin() 37 | ], 38 | resolve: { 39 | alias: { 40 | 'react-native': 'react-native-web' 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /gulpfile.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var path = require('path'); 3 | var gulp = require('gulp'); 4 | var eslint = require('gulp-eslint'); 5 | var excludeGitignore = require('gulp-exclude-gitignore'); 6 | var mocha = require('gulp-mocha'); 7 | var istanbul = require('gulp-istanbul'); 8 | var nsp = require('gulp-nsp'); 9 | var plumber = require('gulp-plumber'); 10 | 11 | gulp.task('static', function () { 12 | return gulp.src('**/*.js') 13 | .pipe(excludeGitignore()) 14 | .pipe(eslint()) 15 | .pipe(eslint.format()) 16 | .pipe(eslint.failAfterError()); 17 | }); 18 | 19 | gulp.task('nsp', function (cb) { 20 | nsp({package: path.resolve('package.json')}, cb); 21 | }); 22 | 23 | gulp.task('pre-test', function () { 24 | return gulp.src('generators/**/*.js') 25 | .pipe(excludeGitignore()) 26 | .pipe(istanbul({ 27 | includeUntested: true 28 | })) 29 | .pipe(istanbul.hookRequire()); 30 | }); 31 | 32 | gulp.task('test', ['pre-test'], function (cb) { 33 | var mochaErr; 34 | 35 | gulp.src('test/**/*.js') 36 | .pipe(plumber()) 37 | .pipe(mocha({reporter: 'spec'})) 38 | .on('error', function (err) { 39 | mochaErr = err; 40 | }) 41 | .pipe(istanbul.writeReports()) 42 | .on('end', function () { 43 | cb(mochaErr); 44 | }); 45 | }); 46 | 47 | gulp.task('watch', function () { 48 | gulp.watch(['generators/**/*.js', 'test/**'], ['test']); 49 | }); 50 | 51 | gulp.task('prepublish', ['nsp']); 52 | gulp.task('default', ['static', 'test']); 53 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "generator-react-native-web", 3 | "version": "0.0.2", 4 | "description": "React Native for iOS, Android and WEB ! one for all !", 5 | "homepage": "", 6 | "author": { 7 | "name": "Sam S Lee", 8 | "email": "lee.orz@gmail.com", 9 | "url": "" 10 | }, 11 | "files": [ 12 | "generators" 13 | ], 14 | "main": "generators/index.js", 15 | "keywords": [ 16 | "yeoman-generator", 17 | "react-native", 18 | "react-native-web", 19 | "react" 20 | ], 21 | "dependencies": { 22 | "yeoman-generator": "^0.23.0", 23 | "chalk": "^1.0.0", 24 | "yosay": "^1.0.0" 25 | }, 26 | "devDependencies": { 27 | "yeoman-test": "^1.0.0", 28 | "yeoman-assert": "^2.0.0", 29 | "eslint": "^2.1.0", 30 | "eslint-config-xo-space": "^0.13.0", 31 | "gulp": "^3.9.0", 32 | "gulp-eslint": "^2.0.0", 33 | "gulp-exclude-gitignore": "^1.0.0", 34 | "gulp-line-ending-corrector": "^1.0.1", 35 | "gulp-istanbul": "^0.10.3", 36 | "gulp-mocha": "^2.0.0", 37 | "gulp-plumber": "^1.0.0", 38 | "gulp-nsp": "^2.1.0" 39 | }, 40 | "eslintConfig": { 41 | "extends": "xo-space", 42 | "env": { 43 | "mocha": true 44 | } 45 | }, 46 | "repository": "leeabc/generator-react-native-web", 47 | "scripts": { 48 | "prepublish": "gulp prepublish", 49 | "test": "gulp" 50 | }, 51 | "license": "MIT" 52 | } 53 | -------------------------------------------------------------------------------- /templates/.babelrc: -------------------------------------------------------------------------------- 1 | 2 | { 3 | "presets": [ 4 | "react-native" 5 | ] 6 | } 7 | -------------------------------------------------------------------------------- /templates/App/View/App.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View 13 | } from 'react-native'; 14 | 15 | export class App extends Component { 16 | render() { 17 | return ( 18 | 19 | 20 | Welcome to React Native!!!! 21 | 22 | 23 | To get started, edit index.ios.js YA! 24 | 25 | 26 | Press Cmd+R to reload,{'\n'} 27 | Cmd+D or shake for dev menu 28 | 29 | 30 | ); 31 | } 32 | } 33 | 34 | const styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); -------------------------------------------------------------------------------- /templates/index.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import React, { Component } from 'react'; 8 | import { 9 | AppRegistry, 10 | StyleSheet, 11 | Text, 12 | View 13 | } from 'react-native'; 14 | 15 | class rnweb extends Component { 16 | render() { 17 | return ( 18 | 19 | 20 | Welcome to React Native! 21 | 22 | 23 | To get started, edit index.android.js 24 | 25 | 26 | Double tap R on your keyboard to reload,{'\n'} 27 | Shake or press menu button for dev menu 28 | 29 | 30 | ); 31 | } 32 | } 33 | 34 | const styles = StyleSheet.create({ 35 | container: { 36 | flex: 1, 37 | justifyContent: 'center', 38 | alignItems: 'center', 39 | backgroundColor: '#F5FCFF', 40 | }, 41 | welcome: { 42 | fontSize: 20, 43 | textAlign: 'center', 44 | margin: 10, 45 | }, 46 | instructions: { 47 | textAlign: 'center', 48 | color: '#333333', 49 | marginBottom: 5, 50 | }, 51 | }); 52 | 53 | AppRegistry.registerComponent('rnweb', () => rnweb); 54 | -------------------------------------------------------------------------------- /templates/index.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import { AppRegistry } from 'react-native'; 8 | import { App } from './App/View/App'; 9 | 10 | AppRegistry.registerComponent('rnweb', () => App); 11 | -------------------------------------------------------------------------------- /templates/index.web.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Sample React Native App 3 | * https://github.com/facebook/react-native 4 | * @flow 5 | */ 6 | 7 | import { AppRegistry } from 'react-native'; 8 | import { App } from './App/View/App'; 9 | 10 | AppRegistry.registerComponent('App', () => App); 11 | AppRegistry.runApplication('App', { 12 | rootTag: document.getElementById('react-root') 13 | }) 14 | -------------------------------------------------------------------------------- /templates/web/src/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | React Native for Web 4 | 5 |
6 | 7 | 8 | -------------------------------------------------------------------------------- /templates/web/webpack.config.dev.js: -------------------------------------------------------------------------------- 1 | const path = require('path') 2 | const webpack = require('webpack') 3 | 4 | const DIRECTORY = path.join(__dirname) 5 | 6 | module.exports = { 7 | devServer: { 8 | contentBase: path.join(__dirname, 'src') 9 | }, 10 | entry: [ 11 | path.join(__dirname, '../index.web.js') 12 | ], 13 | module: { 14 | loaders: [ 15 | { 16 | test: /\.js$/, 17 | exclude: /node_modules/, 18 | loader: 'babel-loader', 19 | query: { cacheDirectory: true } 20 | }, 21 | { 22 | test: /\.(gif|jpe?g|png|svg)$/, 23 | loader: 'url-loader', 24 | query: { name: '[name].[hash:16].[ext]' } 25 | } 26 | ] 27 | }, 28 | output: { 29 | filename: 'bundle.js' 30 | }, 31 | plugins: [ 32 | new webpack.DefinePlugin({ 33 | 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'development') 34 | }), 35 | new webpack.optimize.DedupePlugin(), 36 | new webpack.optimize.OccurenceOrderPlugin() 37 | ], 38 | resolve: { 39 | alias: { 40 | 'react-native': 'react-native-web' 41 | } 42 | } 43 | } 44 | 45 | -------------------------------------------------------------------------------- /test/app.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | var path = require('path'); 3 | var assert = require('yeoman-assert'); 4 | var helpers = require('yeoman-test'); 5 | 6 | describe('generator-react-native-web:app', function () { 7 | before(function () { 8 | return helpers.run(path.join(__dirname, '../generators/app')) 9 | .withPrompts({someAnswer: true}) 10 | .toPromise(); 11 | }); 12 | 13 | it('creates files', function () { 14 | assert.file([ 15 | 'dummyfile.txt' 16 | ]); 17 | }); 18 | }); 19 | --------------------------------------------------------------------------------