├── .gitignore ├── LICENSE ├── README.md ├── bin └── react.js ├── blueprints ├── app │ ├── files │ │ ├── .babelrc │ │ ├── _gitignore │ │ ├── app │ │ │ ├── components │ │ │ │ └── app.jsx │ │ │ ├── index.jsx │ │ │ ├── static │ │ │ │ └── index.html │ │ │ ├── styles │ │ │ │ ├── components │ │ │ │ │ └── .gitkeep │ │ │ │ └── main.scss │ │ │ └── tests │ │ │ │ ├── components │ │ │ │ └── App.jsx │ │ │ │ ├── setup.js │ │ │ │ └── views │ │ │ │ └── index.jade │ │ ├── package.json │ │ └── react-cli-build.js │ └── index.js └── component │ ├── files │ └── app │ │ ├── .DS_Store │ │ ├── components │ │ └── __name__.jsx │ │ ├── styles │ │ └── components │ │ │ └── __name__.scss │ │ └── tests │ │ └── components │ │ └── __name__.jsx │ └── index.js ├── lib ├── broccoli │ └── react-app.js ├── cli │ ├── cli.js │ └── index.js ├── commands │ ├── build.js │ ├── generate.js │ ├── help.js │ ├── init.js │ ├── new.js │ ├── serve.js │ ├── test.js │ └── unknown.js ├── models │ ├── blueprint.js │ ├── builder.js │ ├── command.js │ ├── project.js │ ├── task.js │ ├── tester.js │ └── watcher.js ├── tasks │ ├── build.js │ ├── change-working-directory.js │ ├── create-directory.js │ ├── install-blueprint.js │ ├── server.js │ ├── shell-command.js │ └── test.js └── utils │ ├── get-caller-file.js │ ├── lookup-command.js │ └── require-as-hash.js └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | 3 | # Logs 4 | logs 5 | *.log 6 | 7 | # Runtime data 8 | pids 9 | *.pid 10 | *.seed 11 | 12 | # Directory for instrumented libs generated by jscoverage/JSCover 13 | lib-cov 14 | 15 | # Coverage directory used by tools like istanbul 16 | coverage 17 | 18 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 19 | .grunt 20 | 21 | # node-waf configuration 22 | .lock-wscript 23 | 24 | # Compiled binary addons (http://nodejs.org/api/addons.html) 25 | build/Release 26 | 27 | # Dependency directory 28 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git 29 | node_modules 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 AdRoll, Inc. 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 all 13 | 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 THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-cli 2 | 3 | A Command Line Interface for React Web Applications. Based on Ember CLI (https://github.com/ember-cli/ember-cli). 4 | 5 | ## Usage 6 | 7 | ### Prerequisites 8 | 9 | Node v4.x (or greater) and npm 3.x. 10 | 11 | ### Installation 12 | 13 | Currently, there's no `npm` package so to install, you have to clone the repository locally: 14 | 15 | `git clone https://github.com/reactcli/react-cli.git && cd react-cli && npm install && npm link` 16 | 17 | ### Usage 18 | 19 | Once installed, creating a new React project is simple. If you already have an empty directory for your project, you can run: 20 | 21 | `react init` 22 | 23 | Or, if you need to create a new folder along with your project: 24 | 25 | `react new your-project-title` 26 | 27 | Once you have your project created, the fun can begin. Currently, `react-cli` supports a very limited set of commands. As we get through the Todo items, this list will grow: 28 | 29 | * `react help ` - Shows the `react-cli` help for the given command. If none is supplied, all help will be shown. 30 | 31 | * `react build` - Builds the application and puts the output in the `dist` folder of your project. 32 | 33 | * `react serve` - Serves the application using the development server and listens for changes using LiveReload. 34 | 35 | * `react generate ` - Generates new assets for the `type` of item specified. (see `help` for more details) 36 | 37 | ## Contributing 38 | 39 | There's nothing complicated yet. Just clone the repo, `npm install && npm link`, and start hacking! 40 | 41 | ### Todos 42 | 43 | - [x] `react test` support. 44 | - [x] Test generation for components 45 | - [x] Test execution 46 | - [x] Support for testing in the browser 47 | - [ ] `addon` support 48 | - [ ] Clean up the output 49 | - [ ] Update, rather than stack, output per task 50 | - [ ] Show Broccoli output table 51 | - [ ] Better error display 52 | - [ ] Per-project Blueprint Customization 53 | - [ ] Project Configuration 54 | - [ ] ES5 vs. ES6 generation 55 | - [ ] Server port 56 | - [ ] Project structure (flat vs. pods-ish)? 57 | -------------------------------------------------------------------------------- /bin/react.js: -------------------------------------------------------------------------------- 1 | #! /usr/bin/env node --harmony 2 | 'use strict'; 3 | 4 | let cli = require('../lib/cli'), 5 | resolve = require('resolve'), 6 | exit = require('exit'); 7 | 8 | process.title = 'react'; 9 | 10 | resolve('react-cli', { 11 | basedir: process.cwd() 12 | }, (error, localCli) => { 13 | let cli; 14 | 15 | if (error) { 16 | cli = require('../lib/cli'); 17 | } else { 18 | cli = require(localCli); 19 | } 20 | }); 21 | 22 | cli({ 23 | args: process.argv.slice(2) 24 | }); 25 | -------------------------------------------------------------------------------- /blueprints/app/files/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ "react", "es2015" ] 3 | } -------------------------------------------------------------------------------- /blueprints/app/files/_gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | bower_packages 3 | dist 4 | tmp 5 | -------------------------------------------------------------------------------- /blueprints/app/files/app/components/app.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | 3 | export default class App extends React.Component { 4 | render() { 5 | return ( 6 |

__name__ says Hello World!

7 | ); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /blueprints/app/files/app/index.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { render } from 'react-dom'; 3 | import App from './components/app'; 4 | 5 | render( 6 | , 7 | document.getElementById('app') 8 | ); 9 | -------------------------------------------------------------------------------- /blueprints/app/files/app/static/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Test 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /blueprints/app/files/app/styles/components/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactcli/react-cli/bb5a8ee80c4ef6200842263605158dfb13249c5c/blueprints/app/files/app/styles/components/.gitkeep -------------------------------------------------------------------------------- /blueprints/app/files/app/styles/main.scss: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/reactcli/react-cli/bb5a8ee80c4ef6200842263605158dfb13249c5c/blueprints/app/files/app/styles/main.scss -------------------------------------------------------------------------------- /blueprints/app/files/app/tests/components/App.jsx: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | var React = require('react'), 4 | TestUtils = require('react-addons-test-utils'), 5 | expect = require('chai').expect, 6 | App = require('../../components/App').default; 7 | 8 | describe('App', function() { 9 | describe('#render()', function() { 10 | it('should succeed', function() { 11 | let component = TestUtils.renderIntoDocument( 12 | 13 | ); 14 | 15 | expect(component).to.not.be.undefined; 16 | }); 17 | }); 18 | }); -------------------------------------------------------------------------------- /blueprints/app/files/app/tests/setup.js: -------------------------------------------------------------------------------- 1 | var jsdom = require('jsdom'); 2 | 3 | // A super simple DOM ready for React to render into 4 | // Store this DOM and the window in global scope ready for React to access 5 | global.document = jsdom.jsdom(''); 6 | global.window = document.defaultView; 7 | global.navigator = window.navigator; -------------------------------------------------------------------------------- /blueprints/app/files/app/tests/views/index.jade: -------------------------------------------------------------------------------- 1 | html 2 | head 3 | title React CLI Tests 4 | link(rel='stylesheet', href='mocha/mocha.css') 5 | body 6 | div(id='mocha') 7 | script(type='text/javascript', src='https://cdn.rawgit.com/jquery/jquery/2.1.4/dist/jquery.min.js') 8 | script(type='text/javascript', src='/mocha/mocha.js') 9 | script(type='text/javascript', src='/chai/chai.js') 10 | script(type='text/javascript') 11 | mocha.setup('bdd') 12 | script(type='text/javascript', src='/scripts/vendor.js') 13 | script(type='text/javascript', src='/scripts/test.js') 14 | script(type='text/javascript') 15 | mocha.run() 16 | script(type='text/javascript') 17 | document.write( 18 | '