Skip to content

Commit

Permalink
feat: use new generator for midway-init
Browse files Browse the repository at this point in the history
  • Loading branch information
czy88840616 committed Nov 1, 2019
1 parent 12d8841 commit 634b748
Show file tree
Hide file tree
Showing 440 changed files with 143 additions and 20,775 deletions.
25 changes: 10 additions & 15 deletions packages/midway-init/bin/midway-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,11 @@

'use strict';

const co = require('co');
const childProcess = require('child_process');
const { Confirm } = require('enquirer');
const Command = require('..');
const pkgInfo = require('../package.json');

const options = {
name: 'midway-init',
pkgInfo,
};

co(function* () {
(async () => {
const args = process.argv.slice(2);

if (isInternal()) {
Expand All @@ -23,19 +16,21 @@ co(function* () {
initial: false,
default: '[Y(es)|N(o)]',
});
const isContinue = yield prompt.run();
const isContinue = await prompt.run();

if (!isContinue) {
return;
}
}

const cmd = new Command(Object.assign({}, options));
yield cmd.run(process.cwd(), args);
}).catch(err => {
console.error(err.stack);
process.exit(1);
});
try {
const cmd = new Command();
await cmd.run(process.cwd(), args);
} catch (err) {
console.error(err.stack);
process.exit(1);
}
})();

// 判断是否处于内网环境
function isInternal() {
Expand Down
26 changes: 26 additions & 0 deletions packages/midway-init/boilerplate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"midway-ts": {
"package": "midway-boilerplate-typescript",
"description": "Simple midway application boilerplate by ts.",
"name": "midway standard typescript template",
"author": "midwayJs"
},
"midway-demo": {
"package": "midway-boilerplate-demo",
"description": "Simple example boilerplate for find bug or submit to midway-examples.",
"name": "midway mini example template",
"author": "midwayJs"
},
"midway-ts-strict": {
"package": "midway-boilerplate-ts-strict",
"description": "Simple midway application boilerplate by ts with ng style and strict eslint rules.",
"name": "midway strict typescript template",
"author": "tw93"
},
"midway-ts-ant-design-pro": {
"package": "midway-boilerplate-ts-antd",
"description": "A front-end and back-end separation project includes midway(ts) and ant-design-pro.",
"name": "midway typescript and ant-design-pro template",
"author": "waitingsong"
}
}
22 changes: 0 additions & 22 deletions packages/midway-init/boilerplate/boilerplate.json

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

15 changes: 0 additions & 15 deletions packages/midway-init/boilerplate/midway-demo-boilerplate/index.js

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 634b748

Please sign in to comment.