UNPKG

736 BJavaScriptView Raw
1'use strict';
2
3const path = require('path');
4const fs = require('fs-extra');
5
6/**
7 * @description copy the template
8 */
9function copyTemplate(templatePath) {
10 fs.copySync(path.resolve('node_modules', '@my-dish/template-common', 'template'), '.');
11 fs.copySync(path.resolve('node_modules', templatePath, 'template'), '.');
12}
13
14function createProject(project) {
15 const currentPath = process.cwd();
16 const projectPath = path.resolve(currentPath, project);
17
18 fs.mkdirsSync(projectPath);
19
20 return projectPath;
21}
22
23// rename .npmignore to .gitignore
24function renameIgnoreFile() {
25 fs.renameSync(`${process.cwd()}/.npmignore`, `${process.cwd()}/.gitignore`);
26}
27
28module.exports = {
29 copyTemplate,
30 createProject,
31 renameIgnoreFile
32};