myt/myvc-init.js

21 lines
523 B
JavaScript
Raw Normal View History

2020-12-02 07:35:26 +00:00
2020-12-04 16:30:26 +00:00
const MyVC = require('./myvc');
2020-12-02 07:35:26 +00:00
const fs = require('fs-extra');
class Init {
async run(myvc, opts) {
const templateDir = `${__dirname}/template`;
const templates = await fs.readdir(templateDir);
for (let template of templates) {
const dst = `${opts.workspace}/${template}`;
if (!await fs.pathExists(dst))
await fs.copy(`${templateDir}/${template}`, dst);
}
}
}
module.exports = Init;
if (require.main === module)
new MyVC().run(Init);