create-packer 1.8.1 → 1.8.4

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.
@@ -2,4 +2,4 @@ export interface tempInfoType {
2
2
  name: string;
3
3
  src: string;
4
4
  }
5
- export declare function createTemp(dirname?: string): Promise<void>;
5
+ export declare function createTemp(dirname: string): Promise<void>;
@@ -33,6 +33,7 @@ function createTempEnd(output) {
33
33
  });
34
34
  }
35
35
  async function createTemp(dirname) {
36
+ const isCurrent = dirname === '.';
36
37
  const { temp } = await inquirer.prompt([
37
38
  {
38
39
  type: 'list',
@@ -42,11 +43,11 @@ async function createTemp(dirname) {
42
43
  }
43
44
  ]);
44
45
  const creating = ora(chalk.yellow('Creating...\n')).start();
45
- const output = path.join(cwd, dirname);
46
- if (dirname && fs.existsSync(output)) {
46
+ const output = path.join(cwd, isCurrent ? '' : dirname);
47
+ if (!isCurrent && fs.existsSync(output)) {
47
48
  return console.log(chalk.red(`${dirname} already exists!`));
48
49
  }
49
- if (dirname) {
50
+ if (!isCurrent) {
50
51
  fsExtra.mkdirSync(output);
51
52
  }
52
53
  const tempPath = path.join(tempRoot, temp);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.8.1",
3
+ "version": "1.8.4",
4
4
  "main": "index.js",
5
5
  "repository": "https://github.com/kevily/create-packer",
6
6
  "author": "1k <bug_zero@163.com>",