frontend-hamroun 1.0.3 → 1.0.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.
Files changed (2) hide show
  1. package/bin/cli.js +6 -6
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -4,7 +4,7 @@ import { Command } from 'commander';
4
4
  import { createRequire } from 'module';
5
5
  import inquirer from 'inquirer';
6
6
  import chalk from 'chalk';
7
- import { promises as fs } from 'fs';
7
+ import fsExtra from 'fs-extra';
8
8
  import * as path from 'path';
9
9
  import { createSpinner } from 'nanospinner';
10
10
  import { fileURLToPath } from 'url';
@@ -32,7 +32,7 @@ async function createProject(projectName, options) {
32
32
  const targetDir = path.join(process.cwd(), projectName);
33
33
 
34
34
  // Check if directory exists
35
- if (fs.existsSync(targetDir)) {
35
+ if (fsExtra.existsSync(targetDir)) {
36
36
  spinner.error({ text: 'Directory already exists!' });
37
37
  process.exit(1);
38
38
  }
@@ -41,19 +41,19 @@ async function createProject(projectName, options) {
41
41
  const templatePath = path.join(__dirname, '../templates', options.template.toLowerCase());
42
42
 
43
43
  // Ensure template exists
44
- if (!fs.existsSync(templatePath)) {
44
+ if (!fsExtra.existsSync(templatePath)) {
45
45
  spinner.error({ text: 'Template not found!' });
46
46
  process.exit(1);
47
47
  }
48
48
 
49
49
  // Copy template
50
- await fs.copy(templatePath, targetDir);
50
+ await fsExtra.copy(templatePath, targetDir);
51
51
 
52
52
  // Update package.json
53
53
  const packageJsonPath = path.join(targetDir, 'package.json');
54
- const packageJson = await fs.readJson(packageJsonPath);
54
+ const packageJson = await fsExtra.readJson(packageJsonPath);
55
55
  packageJson.name = projectName;
56
- await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
56
+ await fsExtra.writeJson(packageJsonPath, packageJson, { spaces: 2 });
57
57
 
58
58
  spinner.success({ text: `Project ${chalk.green(projectName)} created successfully!` });
59
59
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-hamroun",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "A lightweight frontend framework with hooks and virtual DOM",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",