create-packer 1.8.3 → 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/bin/index.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const createTemp_1 = require("./clis/createTemp");
5
5
  const commander_1 = require("commander");
6
6
  commander_1.program
7
- .option('-c, --create [dirname]', 'Create project.', (dirname = '') => {
7
+ .option('-c, --create <dirname>', 'Create project.', dirname => {
8
8
  return createTemp_1.createTemp(dirname);
9
9
  })
10
10
  .parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-packer",
3
- "version": "1.8.3",
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>",