1 | 'use strict';
|
2 |
|
3 | const path = require('path');
|
4 | const fs = require('fs-extra');
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | function 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 |
|
14 | function 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 |
|
24 | function renameIgnoreFile() {
|
25 | fs.renameSync(`${process.cwd()}/.npmignore`, `${process.cwd()}/.gitignore`);
|
26 | }
|
27 |
|
28 | module.exports = {
|
29 | copyTemplate,
|
30 | createProject,
|
31 | renameIgnoreFile
|
32 | };
|