create-aya
Version:
创建aya框架的脚手架
33 lines (27 loc) • 852 B
JavaScript
const { exec } = require('child_process');
const path = require("path");
const mainPath = process.cwd();
const templateGitRepository = 'git@github.com:zaishuo8/aya-template-demo.git';
function execSync(cmd) {
return new Promise((resolve, reject) => {
exec(cmd, (err, stdout, stderr) => {
if (err) reject(err);
if (stderr) resolve(stderr);
resolve(stdout);
});
});
}
function main() {
execSync(`git clone ${templateGitRepository} ${mainPath}`).then(stdout => {
console.log(stdout);
return execSync(`rm -rf ${path.join(mainPath, '.git')}`);
}).then(stdout => {
console.log(stdout);
console.log('创建 aya 成功!');
}).catch(e => {
console.error(e);
console.error('创建 aya 失败!');
})
}
main();