create-antd-layout 1.0.0 → 1.0.1
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/index.js +7 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -62,6 +62,7 @@ program
|
|
|
62
62
|
.version("1.0.0")
|
|
63
63
|
.argument("<project-directory>", 'Project directory name')
|
|
64
64
|
.action(async (projectDir) => {
|
|
65
|
+
const projectName = path_1.default.basename(projectDir);
|
|
65
66
|
const targetDir = path_1.default.resolve(process.cwd(), projectDir);
|
|
66
67
|
if (fs_extra_1.default.existsSync(targetDir)) {
|
|
67
68
|
console.error(chalk_1.default.red(`❌ Directory '${projectDir}' already exists.`));
|
|
@@ -92,6 +93,12 @@ program
|
|
|
92
93
|
console.error(err);
|
|
93
94
|
process.exit(1);
|
|
94
95
|
}
|
|
96
|
+
const pkgPath = path_1.default.join(targetDir, 'package.json');
|
|
97
|
+
if (fs_extra_1.default.existsSync(pkgPath)) {
|
|
98
|
+
const pkg = await fs_extra_1.default.readJSON(pkgPath);
|
|
99
|
+
pkg.name = projectName;
|
|
100
|
+
await fs_extra_1.default.writeJSON(pkgPath, pkg, { spaces: 2 });
|
|
101
|
+
}
|
|
95
102
|
const detected = await detectPackageManager();
|
|
96
103
|
const pmAnswer = await inquirer_1.default.prompt([
|
|
97
104
|
{
|