create-packer 1.20.1 → 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 CHANGED
@@ -7,6 +7,7 @@
7
7
 
8
8
  # testing
9
9
  coverage/
10
+ __test__
10
11
 
11
12
  # production
12
13
  build/
package/bin/createTemp.js CHANGED
@@ -37,7 +37,7 @@ async function createTemp(dirname) {
37
37
  choices: tempInfoList.map(o => o.name)
38
38
  }
39
39
  ]);
40
- const tempInfo = tempInfoList.find(o => o.name === answer.temp);
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
- const tempPath = path.join(tempRoot, answer.temp);
60
- copyTempFile(tempPath, output);
60
+ copyTempFile(tempInfo.src, output);
61
61
  createTempEnd(output);
62
62
  creating.succeed();
63
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.20.1",
3
+ "version": "1.20.2",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",
@@ -37,7 +37,7 @@ export async function createTemp(dirname: string) {
37
37
  choices: tempInfoList.map(o => o.name)
38
38
  }
39
39
  ])
40
- const tempInfo = tempInfoList.find(o => o.name === answer.temp)
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
- const tempPath = path.join(tempRoot, answer.temp)
60
- copyTempFile(tempPath, output)
60
+ copyTempFile(tempInfo.src, output)
61
61
  createTempEnd(output)
62
62
  creating.succeed()
63
63
  }