<repo_name>inventorjs/inventor-cli-legacy<file_sep>/skeletons/default/server/app/http/Kernel.js
/**
 * http 应用核心
 *
 * @author : sunkeysun
 */

import HttpKernel from 'inventor'

export default class Kernel extends HttpKernel {
}
<file_sep>/skeletons/default/bin/start-pm2.sh
#!/bin/bash

project_name="project"
base_path="/data/release/$project_name"
target_file="$base_path/package-lock.json"
md5_file="$base_path/.package-lock.json.md5"

cd "$base_path"

if [ ! -f "$md5_file" ]; then
    touch "$md5_file"
fi

pre_md5=`cat "$md5_file"`
cur_md5=`md5sum "$target_file" | awk '{print $1}'`

if [ "$pre_md5" != "$cur_md5" ]; then
    npm install --production
fi

if [ $? -eq 0 ]; then
    printf "$cur_md5" > "$md5_file"

    pm2 startOrGracefulReload --only $project_name
fi
<file_sep>/skeletons/default/shared/common/App.jsx
/**
 * 通用模块入口
 *
 * @author : sunkeysun
 */

import React, { Component, Fragment } from 'react'
import { hot } from 'react-hot-loader'
import { renderRoutes } from 'react-router-config'

@hot(module)
export default class Com extends Component {
    componentDidMount() {
        console.log('mount')
    }

    handleClick() {
        alert('xxxo')
    }
    render() {
        console.log(this.props)
        return (
            <Fragment>
                <div onClick={ this.handleClick.bind(this) }>co3xx</div>
                { renderRoutes(this.props.route.routes) }
            </Fragment>
        )
    }
}
<file_sep>/skeletons/default/ecosystem.config.js
/**
 * pm2 配置文件
 *
 * @author: sunkeysun
 */

const DEPLOY_ENV = 'production'

module.exports = {
    apps: [
        {
            name: 'project',
            cwd: '/data/release/project',
            script: 'build/server/startup/app.js',
            interpreter: 'node',
            exec_mode: 'cluster',
            instances: -1,
            autorestart: true,
            watch: false,
            max_memory_restart: '4G',
            merge_logs: true,
            output: 'logs/pm2-project-info.log',
            error: 'logs/pm2-project-error.log',
            env: {
                NODE_ENV: DEPLOY_ENV,
                SERVER_PORT: 9199,
            },
        },
        {
            name: 'project-local',
            script: 'server/startup/app.js',
            interpreter: 'babel-node',
            autorestart: true,
            watch: ['server/'],
            max_memory_restart: '4G',
            env: {
                NODE_ENV: 'local',
                BABEL_ENV: 'server',
                SERVER_PORT: 9199,
                LOCALHOST: '127.0.0.1',
                WEB_PORT: 9099,
            },
        },
    ],
}
<file_sep>/skeletons/default/bin/build-web.sh
#! /bin/bash

export NODE_ENV=production
export BABEL_ENV=web

BUILD_MODULES=''

if [ $# != 0 ]; then
    for MODULE in $*
        do
            if [ ! $BUILD_MODULES ]; then
                BUILD_MODULES="$MODULE"
            else
                BUILD_MODULES="$BUILD_MODULES&${MODULE}"
            fi
        done
fi

export BUILD_MODULES

webpack-cli --config webpack/webpack.config.js


export BABEL_ENV=server

if [ $# != 0 ]; then
    for MODULE in $*
        do
            babel "shared/${MODULE}" -d "build/shared/${MODULE}" -D
        done
else
    babel shared -d build/shared -D
fi
<file_sep>/skeletons/default/docker-compose.yml
version: '3'
services:
    project:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        working_dir: ${PROJECT_VOLUME}
        network_mode: host
        restart: on-failure
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
            - ${LOG_PATH}:${LOG_VOLUME}
            - ${TMP_PATH}:${TMP_VOLUME}
        environment:
            - NODE_ENV=${DEPLOY_ENV}
            - SERVER_PORT=${SERVER_PORT}
        command: sh -c "node build/server/startup/app.js >> ${LOG_VOLUME}/<-project->-error.log 2>&1"
    node:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        working_dir: ${PROJECT_VOLUME}
        network_mode: host
        build:
            context: .
            dockerfile: Dockerfile
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
    local-server:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        build:
            context: .
            dockerfile: Dockerfile
        working_dir: ${PROJECT_VOLUME}
        network_mode: bridge
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
        ports:
            - ${SERVER_PORT}:${SERVER_PORT}
        environment:
            - NODE_ENV=local
            - BABEL_DISABLE_CACHE=1
            - BABEL_ENV=server
            - SERVER_PORT=${SERVER_PORT}
        command: sh -c "nodemon -e js,jsx,scss --delay 300ms --exec babel-node server/startup/app.js"
    local-web:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        build:
            context: .
            dockerfile: Dockerfile
        working_dir: ${PROJECT_VOLUME}
        network_mode: bridge
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
        ports:
            - ${WEB_PORT}:${WEB_PORT}
        environment:
            - NODE_ENV=local
            - BABEL_ENV=web
            - SERVER_PORT=${SERVER_PORT}
            - WEB_PORT=${WEB_PORT}
        command: sh -c "babel-node webpack/devServer.js"
    local-node:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        working_dir: ${PROJECT_VOLUME}
        network_mode: bridge
        build:
            context: .
            dockerfile: Dockerfile
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
    build-web:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        working_dir: ${PROJECT_VOLUME}
        build:
            context: .
            dockerfile: Dockerfile
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
        environment:
            - NODE_ENV=production
            - BABEL_ENV=web
        command: sh -c "webpack --config webpack/webpack.config.babel.js && BABEL_ENV=server babel shared -d build/shared -D"
    build-server:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        working_dir: ${PROJECT_VOLUME}
        build:
            context: .
            dockerfile: Dockerfile
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
        environment:
            - NODE_ENV=production
            - BABEL_ENV=server
        command: sh -c "babel server -d build/server -D"
    build-webpack:
        image: "${IMAGE_NAME}:${IMAGE_TAG}"
        working_dir: ${PROJECT_VOLUME}
        build:
            context: .
            dockerfile: Dockerfile
        volumes:
            - ${PWD}:${PROJECT_VOLUME}
        environment:
            - NODE_ENV=production
            - BABEL_ENV=server
        command: sh -c "babel webpack -d build/webpack -D"
<file_sep>/skeletons/default/build/shared/app/index/text.js
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = undefined;

var _redux = require('./redux');

var _redux2 = _interopRequireDefault(_redux);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

exports.default = _redux2.default;<file_sep>/skeletons/default/shared/app/index/redux/index.js
/**
 * 模块入口
 *
 * @author sunkeysun
 */

export default {
    a: 1
}
<file_sep>/skeletons/default/webpack/config/module.js
/**
 * webpack 打包配置
 *
 * @author : sunkeysun
 */

import path from 'path'

export const app = {
    common: {
        name: '通用应用模块',
    },
    index: {
        name: '首页应用模块',
    },
}

export const common = {
    name: '内部公用代码模块',
    expose: {
        Index: {
            name: '#shared/common',
            entry: path.resolve(__dirname, '../../shared/common'),
        },
    },
}

export const vendor = {
    name: '第三方库模块',
    expose: {
        React: 'react',
        ReactDOM: 'react-dom',
        _: 'lodash',
        InventorWeb: 'inventor/web',
        InventorShared: 'inventor/shared',
    },
}
<file_sep>/skeletons/default/server/config/redis.js
/**
 * redis配置文件
 *
 * @author : sunkeysun
 */

export default {
    mode: null,    // cluster | single
    servers: [
        {
            host: '127.0.0.1',
            port: 6379,
            db: 2,
        },
    ],
}
<file_sep>/skeletons/default/server/config/log.js
/**
 * 日志配置文件
 *
 * @author : sunkeysun
 */

import path from 'path'

const logPath = path.resolve(__dirname, '../../logs')

export default {
    mode: 'console',   // console | single | dateFile | levelDateFile | levelDirDateFile
    logPath: logPath,
    pattern: 'yyyyMMdd.log'
}
<file_sep>/skeletons/default/build/shared/app/common/components/Error.js
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 错误展示组件
 *
 * $author : sunkeysun
 */

var styles = {
    'errorWrapper': 'index__errorWrapper',
    'errorDetail': 'index__errorDetail'
};

var _default = function (_Component) {
    (0, _inherits3.default)(_default, _Component);

    function _default() {
        (0, _classCallCheck3.default)(this, _default);
        return (0, _possibleConstructorReturn3.default)(this, (_default.__proto__ || Object.getPrototypeOf(_default)).apply(this, arguments));
    }

    (0, _createClass3.default)(_default, [{
        key: 'render',
        value: function render() {
            var _props = this.props,
                code = _props.code,
                _props$msg = _props.msg,
                msg = _props$msg === undefined ? '' : _props$msg,
                _props$detail = _props.detail,
                detail = _props$detail === undefined ? '' : _props$detail;


            return _react2.default.createElement(
                'div',
                { className: styles.errorWrapper },
                _react2.default.createElement(
                    'p',
                    null,
                    code
                ),
                _react2.default.createElement(
                    'p',
                    null,
                    msg
                ),
                _react2.default.createElement('p', { className: styles.errorDetail, dangerouslySetInnerHTML: { __html: detail } })
            );
        }
    }]);
    return _default;
}(_react.Component);

exports.default = _default;<file_sep>/skeletons/default/build/shared/apps/index/App.js
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _dec, _class; /**
                   * 应用入口
                   *
                   * @author : sunkeysun
                   */

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _reactHotLoader = require('react-hot-loader');

var _text = require('./text');

var _text2 = _interopRequireDefault(_text);

var _common = require('../../common');

var common = _interopRequireWildcard(_common);

function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var App = (_dec = (0, _reactHotLoader.hot)(module), _dec(_class = function (_Component) {
    (0, _inherits3.default)(App, _Component);

    function App() {
        (0, _classCallCheck3.default)(this, App);
        return (0, _possibleConstructorReturn3.default)(this, (App.__proto__ || Object.getPrototypeOf(App)).apply(this, arguments));
    }

    (0, _createClass3.default)(App, [{
        key: 'handleClick',
        value: function handleClick() {
            console.log(common);
            alert(1);
        }
    }, {
        key: 'render',
        value: function render() {
            var style = {
                width: 500,
                height: 200,
                lineHeight: '200px',
                color: '#666',
                background: '#eee',
                textAlign: 'center',
                fontSize: 40,
                border: '1px solid #ccc',
                position: 'absolute',
                top: '50%',
                left: '50%',
                marginLeft: -250,
                marginTop: -100
            };
            return _react2.default.createElement(
                'div',
                { style: style, onClick: this.handleClick.bind(this) },
                'Welcome, Inventor!'
            );
        }
    }]);
    return App;
}(_react.Component)) || _class);
exports.default = App;<file_sep>/skeletons/default/server/config/app.js
/**
 * 应用配置
 *
 * @author : sunkeysun
 */

import webpackConfig from '#webpack/config/common'

const localWeb = webpackConfig.debug.localWeb

export default {
    ssr: true,
    keys: [ 'example' ],
    server: {
        host: '0.0.0.0',
        port: _.get(process.env, 'SERVER_PORT', 9199),
    },
    timeout: 60000,
    noHash: true,
    webHost: `http://${localWeb.host}:${localWeb.port}`,
}
<file_sep>/skeletons/default/build/shared/app/index/store/index.js
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _Common = require('./Common');

var _Common2 = _interopRequireDefault(_Common);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Store = function Store() {
    var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck3.default)(this, Store);

    this.common = new _Common2.default(initialState.common);
};

exports.default = Store;<file_sep>/skeletons/default/shared/app/index/store/Common.js
import { observable } from 'mobx'

export default class Common {
    @observable staffname = ''

    constructor(initialState={}) {
        this.staffname = initialState.staffname
    }

    addName(char) {
        this.staffname += char
    }
}
<file_sep>/skeletons/default/server/app/http/controllers/index/Index.js
/**
 * 站点入口控制器
 *
 * @author : sunkeysun
 */

import Controller from '../Controller'

export default class IndexController extends Controller {
    async index() {
        this.response.renderApp('index', { common: { staffname: 'sunkeysun' } })
    }
}
<file_sep>/skeletons/default/server/config/request.js
/**
 * 请求全局配置
 *
 * @author: sunkeysun
 */

export default {
    log: true,
    config: {
        timeout: 10 * 1000,
    },
}
<file_sep>/skeletons/default/shared/app/index/store/index.js
import Common from './Common'

export default class Store {
    constructor(initialState={}) {
        this.common = new Common(initialState.common)
    }
}
<file_sep>/skeletons/default/shared/app/common/containers/Error.jsx
/**
 * 错误容器
 *
 * $author : sunkeysun
 */

import React, { Component, Fragment } from 'react'
import ErrorComponent from '../components/Error'

export default class extends Component {
    _getMsg(code) {
        switch(code) {
            case 403:
                return 'Forbidden'
            case 404:
                return 'Not Found'
            case 500:
                return 'Internal Server Error'
        }
    }

    render() {
        const { code, detail='' } = this.props

        const msg = this._getMsg(code)

        return (
            <Fragment>
                <ErrorComponent code={ code } msg={ msg } detail={ detail } />
            </Fragment>
        )
    }
}
<file_sep>/skeletons/default/shared/app/common/store/states/Common.js
export default class Common {
    staffname = ''

    constructor(initialState={}) {
        this.staffname = initialState.staffname
    }
}
<file_sep>/skeletons/default/build/shared/apps/common/containers/Error.js
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');

var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);

var _inherits2 = require('babel-runtime/helpers/inherits');

var _inherits3 = _interopRequireDefault(_inherits2);

var _react = require('react');

var _react2 = _interopRequireDefault(_react);

var _Error = require('../components/Error');

var _Error2 = _interopRequireDefault(_Error);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * 错误容器
 *
 * $author : sunkeysun
 */

var _default = function (_Component) {
    (0, _inherits3.default)(_default, _Component);

    function _default() {
        (0, _classCallCheck3.default)(this, _default);
        return (0, _possibleConstructorReturn3.default)(this, (_default.__proto__ || Object.getPrototypeOf(_default)).apply(this, arguments));
    }

    (0, _createClass3.default)(_default, [{
        key: '_getMsg',
        value: function _getMsg(code) {
            switch (code) {
                case 403:
                    return 'Forbidden';
                case 404:
                    return 'Not Found';
                case 500:
                    return 'Internal Server Error';
            }
        }
    }, {
        key: 'render',
        value: function render() {
            var _props = this.props,
                code = _props.code,
                _props$detail = _props.detail,
                detail = _props$detail === undefined ? '' : _props$detail;


            var msg = this._getMsg(code);

            return _react2.default.createElement(
                _react.Fragment,
                null,
                _react2.default.createElement(_Error2.default, { code: code, msg: msg, detail: detail })
            );
        }
    }]);
    return _default;
}(_react.Component);

exports.default = _default;<file_sep>/skeletons/default/web/vendor/__vendor.js
/**
 * vendor 入口
 *
 * @author : sunkeysun
 */

module.exports={
'React': require('react'),
'ReactDOM': require('react-dom')
}
<file_sep>/README.md
# Inventor - Inventor 命令行工具包

### 安装
```
    npm install -g inventor-cli
```

### 创建项目骨架
```
    inventor-cli new project_name
```

{
    "auto_complete": false,
    "color_scheme": "Packages/Theme - Flatland/Flatland Dark.tmTheme",
    "font_face": "monaco",
    "font_size": 16,
    "ignored_packages":
    [
    ],
    "show_encoding": true,
    "theme": "Flatland Dark.sublime-theme",
    "translate_tabs_to_spaces": true,
    "trim_trailing_white_space_on_save": true
}
<file_sep>/bin/inventor.js
#! /usr/bin/env node

/**
 * inventor 命令行入口
 *
 * @author: sunkeysun
 */

const path = require('path')
const fs = require('fs')
const fse = require('fs-extra')
const program = require('commander')
const packageJson = require('../package.json')

program
    .version(packageJson.version)
    .command('new <project>')
    .description('create a inventor [project]')
    .option('-t, --template <template>', 'project skeleton template[default]', 'default')
    .action(function(project, options) {
        const template = options.template
        const templateDir = path.resolve(__dirname, `../templates/${template}`)
        const projectDir = `${process.cwd()}/${project}`
        try {
            if (!!fse.pathExistsSync(projectDir)
            && !!fs.lstatSync(projectDir).isDirectory()) {
                console.error(`Project directory ${project} has exists, can't create project`)
            } else {
                fse.copySync(templateDir, projectDir)
            }
            console.log(`Project ${project} has been created successfully.`)
        } catch (e) {
            console.error(e)
        }
    })

program.parse(process.argv)

<file_sep>/skeletons/default/server/app/http/controllers/Controller.js
/**
 * 基础控制器
 *
 * @author : sunkeysun
 */

import { Controller } from 'inventor'

export default class extends Controller {
}
<file_sep>/skeletons/default/Dockerfile
FROM node:8.11.1-alpine
MAINTAINER sunkeysun "<EMAIL>"

USER root
<file_sep>/skeletons/default/shared/app/common/store/index.js
import CommonState from './states/Common'

export default class Store {
    constructor(initialState={}) {
        this.common = new CommonState(initialState.common)
    }

    init(stateName) {
        if (!!stateName && this[stateName]) {
        }
    }
}
<file_sep>/skeletons/default/.env.example
DEPLOY_ENV=production

SERVER_PORT=9199

IMAGE_NAME=project-env
IMAGE_TAG=0.0.1

PROJECT_VOLUME=/data/project
LOG_VOLUME=/data/project_logs
TMP_VOLUME=/data/project_tmp

WEB_PORT=9099
<file_sep>/skeletons/default/server/startup/app.js
/**
 * 启动脚本
 *
 * @author : sunkeysun
 */

import path from 'path'
import Kernel from '#server/app/http/Kernel'

process.on('uncaughtException', (e) => {
    console.error(e)
    process.exit(1)
})

const app = new Kernel(path.resolve(__dirname, '../..'))
app.run()
<file_sep>/skeletons/default/shared/app/index/addon/index.jsx
export { cssList, jsList } from './__build'
<file_sep>/skeletons/default/build/shared/app/index/store/Common.js
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = require('babel-runtime/helpers/createClass');

var _createClass3 = _interopRequireDefault(_createClass2);

var _desc, _value, _class, _descriptor;

var _mobx = require('mobx');

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

function _initDefineProp(target, property, descriptor, context) {
    if (!descriptor) return;
    Object.defineProperty(target, property, {
        enumerable: descriptor.enumerable,
        configurable: descriptor.configurable,
        writable: descriptor.writable,
        value: descriptor.initializer ? descriptor.initializer.call(context) : void 0
    });
}

function _applyDecoratedDescriptor(target, property, decorators, descriptor, context) {
    var desc = {};
    Object['ke' + 'ys'](descriptor).forEach(function (key) {
        desc[key] = descriptor[key];
    });
    desc.enumerable = !!desc.enumerable;
    desc.configurable = !!desc.configurable;

    if ('value' in desc || desc.initializer) {
        desc.writable = true;
    }

    desc = decorators.slice().reverse().reduce(function (desc, decorator) {
        return decorator(target, property, desc) || desc;
    }, desc);

    if (context && desc.initializer !== void 0) {
        desc.value = desc.initializer ? desc.initializer.call(context) : void 0;
        desc.initializer = undefined;
    }

    if (desc.initializer === void 0) {
        Object['define' + 'Property'](target, property, desc);
        desc = null;
    }

    return desc;
}

function _initializerWarningHelper(descriptor, context) {
    throw new Error('Decorating class property failed. Please ensure that transform-class-properties is enabled.');
}

var Common = (_class = function () {
    function Common() {
        var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
        (0, _classCallCheck3.default)(this, Common);

        _initDefineProp(this, 'staffname', _descriptor, this);

        this.staffname = initialState.staffname;
    }

    (0, _createClass3.default)(Common, [{
        key: 'addName',
        value: function addName(char) {
            this.staffname += char;
        }
    }]);
    return Common;
}(), (_descriptor = _applyDecoratedDescriptor(_class.prototype, 'staffname', [_mobx.observable], {
    enumerable: true,
    initializer: function initializer() {
        return '';
    }
})), _class);
exports.default = Common;<file_sep>/skeletons/default/shared/app/index/addon/__build.jsx
export const jsList = [
    
    '/static/app/index/index.85d65a0d0b3ed569fbc9.js',
    
]

export const cssList = [
    
]
<file_sep>/skeletons/default/bin/start-docker.sh
#!/bin/bash

project_name="project"
base_path="/data/release/$project_name"
target_file="$base_path/package-lock.json"
md5_file="$base_path/.package-lock.json.md5"

cd "$base_path"

if [ ! -f "$md5_file" ]; then
    touch "$md5_file"
fi

pre_md5=`cat "$md5_file"`
cur_md5=`md5sum "$target_file" | awk '{print $1}'`

if [ "$pre_md5" != "$cur_md5" ]; then
    docker-compose run --rm node npm install --production
fi

if [ $? -eq 0 ]; then
    printf "$cur_md5" > "$md5_file"

    sleep 1s

    docker-compose stop ${project_name}

    sleep 1s

    docker-compose up -d ${project_name}
fi
<file_sep>/skeletons/default/build/shared/app/index/addon/__build.js
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
var jsList = exports.jsList = ['/static/app/index/index.85d65a0d0b3ed569fbc9.js'];

var cssList = exports.cssList = [];<file_sep>/skeletons/default/web/__entry/common.js
/**
 * 应用入口
 *
 * @author : sunkeysun
 */

import Kernel from 'inventor/web'
import App from '/Volumes/Projects/Github/inventor-cli/templates/default/shared/apps/common/App'
import reducers from '/Volumes/Projects/Github/inventor-cli/templates/default/shared/apps/common/redux'
import webpackConfig from '/Volumes/Projects/Github/inventor-cli/templates/default/webpack/config'
import appConfig from '/Volumes/Projects/Github/inventor-cli/templates/default/shared/common/config/app'

const kernel = new Kernel({ webpackConfig, appConfig, App, reducers })
kernel.run()
<file_sep>/skeletons/default/webpack/config/common.js
/**
 * webpack 通用配置文件
 *
 * $author : sunkeysun
 */

import _ from 'lodash'

const WEB_PORT = _.get(process.env, 'WEB_PORT', 9099)
const SERVER_PORT = _.get(process.env, 'SERVER_PORT', 9199)
const LOCALHOST = _.get(process.env, 'LOCALHOST', '127.0.0.1')

export default {
    debug: {
        localWeb: {
            host: LOCALHOST,
            port: WEB_PORT,
        },
        localServer: {
            host: LOCALHOST,
            port: SERVER_PORT,
        },
        publicPath: `http://${LOCALHOST}:${WEB_PORT}/static`,
    },
    release: {
        publicPath: '/static',
    },
}
<file_sep>/skeletons/default/README.md
# Inventor 初始化项目
<file_sep>/skeletons/default/webpack/devServer.js
/**
 * react 开发服务器
 *
 * $author : sunkeysun
 */

import path from 'path'
import { WebpackDevServer } from 'inventor-dev'
import config from './config/common'

const buildMode = 'debug'
const localServer = config[buildMode].localServer
const localWeb = config[buildMode].localWeb
const basePath = path.resolve(__dirname, '..')
const publicPath = config[buildMode].publicPath

const devServer = new WebpackDevServer({ basePath, publicPath, localServer, localWeb, buildMode })

devServer.run()
<file_sep>/skeletons/default/shared/vendor/addon/__build.jsx
export const jsList = [
    
    '/static/vendor/vendor.434d32d4e62c08a9e5be.js',
    
]

export const cssList = [
    
]
<file_sep>/skeletons/default/build/shared/app/common/store/states/Common.js
'use strict';

Object.defineProperty(exports, "__esModule", {
    value: true
});
exports.default = undefined;

var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

var Common = function Common() {
    var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck3.default)(this, Common);
    this.staffname = '';

    this.staffname = initialState.staffname;
};

exports.default = Common;<file_sep>/skeletons/default/shared/common/index.js
/**
 * 通用模块入口
 *
 * @author : sunkeysun
 */

import App from './App'

export default App
