@dasidev/dasi-ui 1.0.8 → 1.0.9
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/dasi-cli.cjs +15 -6
- package/package.json +1 -1
package/bin/dasi-cli.cjs
CHANGED
|
@@ -9,7 +9,7 @@ const ora = require('ora');
|
|
|
9
9
|
program
|
|
10
10
|
.name('dasi-ui')
|
|
11
11
|
.description('DASI UI - Complete Admin Template Setup')
|
|
12
|
-
.version('1.0.
|
|
12
|
+
.version('1.0.9');
|
|
13
13
|
|
|
14
14
|
program
|
|
15
15
|
.command('create [project-name]')
|
|
@@ -91,10 +91,19 @@ program
|
|
|
91
91
|
const spinner = ora('Setting up DASI UI Admin Template...').start();
|
|
92
92
|
|
|
93
93
|
try {
|
|
94
|
-
const
|
|
94
|
+
const projectPath = path.join(process.cwd(), projectName);
|
|
95
|
+
|
|
96
|
+
if (fs.existsSync(projectPath)) {
|
|
97
|
+
spinner.fail('Project directory already exists');
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
spinner.text = '📁 Creating project directory...';
|
|
102
|
+
fs.mkdirSync(projectPath, { recursive: true });
|
|
103
|
+
|
|
95
104
|
const templatePath = path.join(__dirname, '../');
|
|
96
105
|
|
|
97
|
-
await fs.copy(templatePath,
|
|
106
|
+
await fs.copy(templatePath, projectPath, {
|
|
98
107
|
filter: (src) => {
|
|
99
108
|
return !src.includes('node_modules') &&
|
|
100
109
|
!src.includes('dist') &&
|
|
@@ -105,7 +114,7 @@ program
|
|
|
105
114
|
});
|
|
106
115
|
|
|
107
116
|
spinner.text = '⚙️ Updating configuration...';
|
|
108
|
-
const packageJsonPath = path.join(
|
|
117
|
+
const packageJsonPath = path.join(projectPath, 'package.json');
|
|
109
118
|
let packageJson = await fs.readJson(packageJsonPath);
|
|
110
119
|
|
|
111
120
|
packageJson.name = answers.projectName;
|
|
@@ -122,8 +131,8 @@ program
|
|
|
122
131
|
VITE_INCLUDE_CHARTS=${answers.includeCharts}
|
|
123
132
|
VITE_INCLUDE_MAPS=${answers.includeMaps}`;
|
|
124
133
|
|
|
125
|
-
await fs.writeFile(path.join(
|
|
126
|
-
await fs.copyFile(path.join(
|
|
134
|
+
await fs.writeFile(path.join(projectPath, '.env.example'), envContent);
|
|
135
|
+
await fs.copyFile(path.join(projectPath, '.env.example'), path.join(projectPath, '.env'));
|
|
127
136
|
|
|
128
137
|
await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
|
|
129
138
|
|