2 |
3 |
4 | <%= pascalEntityName %>
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/version.js:
--------------------------------------------------------------------------------
1 | import path from 'path';
2 | import { readJsonSync } from 'fs-extra';
3 | import config from './config';
4 |
5 | const { pkgBasePath } = config;
6 |
7 | export const version = () => {
8 | const pkgPath = path.join(pkgBasePath, '../package.json');
9 | return readJsonSync(pkgPath).version;
10 | };
11 |
--------------------------------------------------------------------------------
/src/util/mixin.js:
--------------------------------------------------------------------------------
1 | // Simple mixin utility that acts like 'extends'
2 | const mixin = (Parent, ...mixins) => {
3 | class Mixed extends Parent {}
4 | for (let mixin of mixins) {
5 | for (let prop in mixin) {
6 | Mixed.prototype[prop] = mixin[prop];
7 | }
8 | }
9 | return Mixed;
10 | };
11 |
12 | export default mixin;
13 |
--------------------------------------------------------------------------------
/src/tasks/webpack-compile.js:
--------------------------------------------------------------------------------
1 | import Task from '../models/task';
2 | import config from '../config';
3 | import { compile } from 'vuex-cli-webpack'
4 |
5 | export default class extends Task {
6 | constructor(environment) {
7 | super(environment);
8 | }
9 |
10 | run(config) {
11 | const logger = this.logger;
12 | logger.writeInfo('正在编译代码...')
13 | compile()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/tasks/webpack-server.js:
--------------------------------------------------------------------------------
1 | import Task from '../models/task';
2 | import config from '../config';
3 | import { server } from 'vuex-cli-webpack'
4 |
5 | export default class extends Task {
6 | constructor(environment) {
7 | super(environment);
8 | }
9 |
10 | run(config) {
11 | const logger = this.logger;
12 | logger.writeInfo('正在启动开发服务器...')
13 | server()
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/cli/vuex-new.js:
--------------------------------------------------------------------------------
1 | import commander from 'commander';
2 | import New from '../sub-commands/new';
3 |
4 | const subCommand = new New();
5 | commander.on('--help', () => {
6 | subCommand.printUserHelp();
7 | });
8 |
9 | commander
10 | .arguments('