Nonviolent Pigeon Manifestation

    rc-server

    3.3.5 • Public • Published

    rc-server

    development server for react component

    NPM version gemnasium deps node version npm download

    Feature

    • support jsx
    • support autoprefixer
    • support mocha-phantomjs
    • support travis
    • support coveralls.io
    • support react js module render as html
    • support load commonjs file into browser and run

    Usage

    file structure

    - .travis.yml
    - examples
     - index.html
     - index.js
    - lib
     - Component.js
    - index.js
    - tests
      - index-spec.js
    - package.json
    

    Suggest using https://github.com/react-component/generator-rc

    index.js

    /** @jsx React.DOM */
    var Component = require('./lib/Component');
    module.exports = <Component />

    Component.js

    /** @jsx React.DOM */
    var React = require('react');
    var Component = React.createClass({
        // TODO
        render: function(){
            return <div></div>;
        };
    });
    module.exports = Component;

    .travis.yml

    language: node_js
    node_js:
    - 0.11
    before_script:
    - npm start &
    - npm install mocha-phantomjs -g
    - phantomjs --version
    script:
    - npm test
    - npm run browser-test
    - npm run browser-test-cover
    

    package.json

    {
        "devDependencies": {
            "rc-server": "^1.0.0"
        },
        "config": {
            "port": 8001
        },
        "scripts": {
            "start": "node --harmony node_modules/.bin/rc-server",
            "browser-test": "mocha-phantomjs http://localhost:$npm_package_config_port/tests/runner.html",
            "browser-test-cover": "mocha-phantomjs -R node_modules/rc-server/node_modules/node-jscover/lib/reporters/mocha/console http://localhost:$npm_package_config_port/tests/runner.html?coverage"
     
        }
    }

    index-spec.js

    var expect = require('expect.js');
    var React = require('react');
    var Component = require('../');
     
    describe('it', function(){
        it('works', function(){
            var component = (<Component/><a></a></Component>);
            expect(component).to.be(component);
        });
    });

    index.html

    placeholder
    

    remove backslash!

    Suggest using https://github.com/react-component/generator-rc

    start server

    npm install
    npm start
    

    Install

    npm i rc-server

    DownloadsWeekly Downloads

    62

    Version

    3.3.5

    License

    none

    Last publish

    Collaborators

    • yiminghe