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.
- package/bin/clis/createTemp.d.ts +1 -1
- package/bin/clis/createTemp.js +4 -3
- package/bin/index.js +1 -1
- package/package.json +1 -1
package/bin/clis/createTemp.d.ts
CHANGED
package/bin/clis/createTemp.js
CHANGED
|
@@ -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 (
|
|
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 (
|
|
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
|
|
7
|
+
.option('-c, --create <dirname>', 'Create project.', dirname => {
|
|
8
8
|
return createTemp_1.createTemp(dirname);
|
|
9
9
|
})
|
|
10
10
|
.parse(process.argv);
|