create-packer 1.20.0 → 1.20.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.gitignore +1 -0
- package/bin/createTemp.js +4 -4
- package/package.json +1 -1
- package/template/cli/src/createTemp.ts +4 -4
package/.gitignore
CHANGED
package/bin/createTemp.js
CHANGED
|
@@ -12,7 +12,7 @@ const fs_1 = require("fs");
|
|
|
12
12
|
const cwd = process.cwd();
|
|
13
13
|
const command = utils_1.onGenCommand();
|
|
14
14
|
const excludes = ['node_modules', 'yarn-error.log', 'dist'];
|
|
15
|
-
const tempRoot = path.join(__dirname, '
|
|
15
|
+
const tempRoot = path.join(__dirname, '../template');
|
|
16
16
|
const tempInfoList = utils_1.genTemplateInfoList(tempRoot);
|
|
17
17
|
function copyTempFile(tempPath, output) {
|
|
18
18
|
fsExtra.readdirSync(tempPath).map(name => {
|
|
@@ -37,7 +37,7 @@ async function createTemp(dirname) {
|
|
|
37
37
|
choices: tempInfoList.map(o => o.name)
|
|
38
38
|
}
|
|
39
39
|
]);
|
|
40
|
-
|
|
40
|
+
let tempInfo = tempInfoList.find(o => o.name === answer.temp);
|
|
41
41
|
if (tempInfo.children) {
|
|
42
42
|
answer = await inquirer.prompt([
|
|
43
43
|
{
|
|
@@ -47,6 +47,7 @@ async function createTemp(dirname) {
|
|
|
47
47
|
choices: tempInfo.children.map(o => o.name)
|
|
48
48
|
}
|
|
49
49
|
]);
|
|
50
|
+
tempInfo = tempInfo.children.find(o => o.name === answer.temp);
|
|
50
51
|
}
|
|
51
52
|
const creating = ora(chalk.yellow('Creating...\n')).start();
|
|
52
53
|
const output = path.join(cwd, isCurrent ? '' : dirname);
|
|
@@ -56,8 +57,7 @@ async function createTemp(dirname) {
|
|
|
56
57
|
if (!isCurrent) {
|
|
57
58
|
fsExtra.mkdirSync(output);
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
copyTempFile(tempPath, output);
|
|
60
|
+
copyTempFile(tempInfo.src, output);
|
|
61
61
|
createTempEnd(output);
|
|
62
62
|
creating.succeed();
|
|
63
63
|
}
|
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@ import { existsSync } from 'fs'
|
|
|
10
10
|
const cwd = process.cwd()
|
|
11
11
|
const command = onGenCommand()
|
|
12
12
|
const excludes = ['node_modules', 'yarn-error.log', 'dist']
|
|
13
|
-
const tempRoot = path.join(__dirname, '
|
|
13
|
+
const tempRoot = path.join(__dirname, '../template')
|
|
14
14
|
const tempInfoList = genTemplateInfoList(tempRoot)
|
|
15
15
|
|
|
16
16
|
function copyTempFile(tempPath, output) {
|
|
@@ -37,7 +37,7 @@ export async function createTemp(dirname: string) {
|
|
|
37
37
|
choices: tempInfoList.map(o => o.name)
|
|
38
38
|
}
|
|
39
39
|
])
|
|
40
|
-
|
|
40
|
+
let tempInfo = tempInfoList.find(o => o.name === answer.temp)
|
|
41
41
|
if (tempInfo.children) {
|
|
42
42
|
answer = await inquirer.prompt([
|
|
43
43
|
{
|
|
@@ -47,6 +47,7 @@ export async function createTemp(dirname: string) {
|
|
|
47
47
|
choices: tempInfo.children.map(o => o.name)
|
|
48
48
|
}
|
|
49
49
|
])
|
|
50
|
+
tempInfo = tempInfo.children.find(o => o.name === answer.temp)
|
|
50
51
|
}
|
|
51
52
|
const creating = ora(chalk.yellow('Creating...\n')).start()
|
|
52
53
|
const output = path.join(cwd, isCurrent ? '' : dirname)
|
|
@@ -56,8 +57,7 @@ export async function createTemp(dirname: string) {
|
|
|
56
57
|
if (!isCurrent) {
|
|
57
58
|
fsExtra.mkdirSync(output)
|
|
58
59
|
}
|
|
59
|
-
|
|
60
|
-
copyTempFile(tempPath, output)
|
|
60
|
+
copyTempFile(tempInfo.src, output)
|
|
61
61
|
createTempEnd(output)
|
|
62
62
|
creating.succeed()
|
|
63
63
|
}
|