@dasidev/dasi-ui 1.0.8 → 1.0.10

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.
Files changed (2) hide show
  1. package/bin/dasi-cli.cjs +38 -11
  2. 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.8');
12
+ .version('1.0.10');
13
13
 
14
14
  program
15
15
  .command('create [project-name]')
@@ -91,21 +91,48 @@ program
91
91
  const spinner = ora('Setting up DASI UI Admin Template...').start();
92
92
 
93
93
  try {
94
- const currentPath = process.cwd();
94
+ const projectPath = path.join(process.cwd(), projectName);
95
95
  const templatePath = path.join(__dirname, '../');
96
+
97
+ if (fs.existsSync(projectPath)) {
98
+ spinner.fail('Project directory already exists');
99
+ return;
100
+ }
101
+
102
+ spinner.text = '📁 Creating project directory...';
103
+ fs.mkdirSync(projectPath, { recursive: true });
104
+ console.log(chalk.green(`✅ Directory created: ${projectPath}`));
105
+
106
+ spinner.text = '📋 Copying template files...';
96
107
 
97
- await fs.copy(templatePath, currentPath, {
108
+ const templatePackageJson = path.join(templatePath, 'package.json');
109
+ console.log(chalk.white(` Template package.json exists: ${fs.existsSync(templatePackageJson)}`));
110
+
111
+ await fs.copy(templatePath, projectPath, {
98
112
  filter: (src) => {
99
- return !src.includes('node_modules') &&
100
- !src.includes('dist') &&
101
- !src.includes('.git') &&
102
- !src.includes('package-lock.json') &&
103
- !src.includes('yarn.lock');
113
+ const shouldExclude = src.includes('node_modules') ||
114
+ src.includes('dist') ||
115
+ src.includes('.git') ||
116
+ src.includes('package-lock.json') ||
117
+ src.includes('yarn.lock') ||
118
+ src.includes('.DS_Store');
119
+
120
+ if (!shouldExclude) {
121
+ console.log(chalk.gray(` Copying: ${src}`));
122
+ }
123
+ return !shouldExclude;
104
124
  }
105
125
  });
106
126
 
127
+ const copiedPackageJson = path.join(projectPath, 'package.json');
128
+ console.log(chalk.white(` Copied package.json exists: ${fs.existsSync(copiedPackageJson)}`));
129
+
130
+ if (!fs.existsSync(copiedPackageJson)) {
131
+ throw new Error('Template copy failed - package.json not found');
132
+ }
133
+
107
134
  spinner.text = '⚙️ Updating configuration...';
108
- const packageJsonPath = path.join(currentPath, 'package.json');
135
+ const packageJsonPath = path.join(projectPath, 'package.json');
109
136
  let packageJson = await fs.readJson(packageJsonPath);
110
137
 
111
138
  packageJson.name = answers.projectName;
@@ -122,8 +149,8 @@ program
122
149
  VITE_INCLUDE_CHARTS=${answers.includeCharts}
123
150
  VITE_INCLUDE_MAPS=${answers.includeMaps}`;
124
151
 
125
- await fs.writeFile(path.join(currentPath, '.env.example'), envContent);
126
- await fs.copyFile(path.join(currentPath, '.env.example'), path.join(currentPath, '.env'));
152
+ await fs.writeFile(path.join(projectPath, '.env.example'), envContent);
153
+ await fs.copyFile(path.join(projectPath, '.env.example'), path.join(projectPath, '.env'));
127
154
 
128
155
  await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
129
156
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dasidev/dasi-ui",
3
- "version": "1.0.8",
3
+ "version": "1.0.10",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "dist/index.js",