frontend-hamroun 1.0.2 → 1.0.3

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 +12 -11
  2. package/package.json +4 -1
package/bin/cli.js CHANGED
@@ -1,15 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import commander from 'commander';
3
+ import { Command } from 'commander';
4
+ import { createRequire } from 'module';
4
5
  import inquirer from 'inquirer';
5
6
  import chalk from 'chalk';
6
- import fsExtra from 'fs-extra';
7
- import path from 'path';
7
+ import { promises as fs } from 'fs';
8
+ import * as path from 'path';
8
9
  import { createSpinner } from 'nanospinner';
9
10
  import { fileURLToPath } from 'url';
10
11
 
11
- const { program } = commander;
12
-
12
+ const require = createRequire(import.meta.url);
13
+ const program = new Command();
13
14
  const __filename = fileURLToPath(import.meta.url);
14
15
  const __dirname = path.dirname(__filename);
15
16
 
@@ -31,7 +32,7 @@ async function createProject(projectName, options) {
31
32
  const targetDir = path.join(process.cwd(), projectName);
32
33
 
33
34
  // Check if directory exists
34
- if (fsExtra.existsSync(targetDir)) {
35
+ if (fs.existsSync(targetDir)) {
35
36
  spinner.error({ text: 'Directory already exists!' });
36
37
  process.exit(1);
37
38
  }
@@ -40,19 +41,19 @@ async function createProject(projectName, options) {
40
41
  const templatePath = path.join(__dirname, '../templates', options.template.toLowerCase());
41
42
 
42
43
  // Ensure template exists
43
- if (!fsExtra.existsSync(templatePath)) {
44
+ if (!fs.existsSync(templatePath)) {
44
45
  spinner.error({ text: 'Template not found!' });
45
46
  process.exit(1);
46
47
  }
47
48
 
48
49
  // Copy template
49
- await fsExtra.copy(templatePath, targetDir);
50
+ await fs.copy(templatePath, targetDir);
50
51
 
51
52
  // Update package.json
52
53
  const packageJsonPath = path.join(targetDir, 'package.json');
53
- const packageJson = await fsExtra.readJson(packageJsonPath);
54
+ const packageJson = await fs.readJson(packageJsonPath);
54
55
  packageJson.name = projectName;
55
- await fsExtra.writeJson(packageJsonPath, packageJson, { spaces: 2 });
56
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
56
57
 
57
58
  spinner.success({ text: `Project ${chalk.green(projectName)} created successfully!` });
58
59
 
@@ -108,4 +109,4 @@ program
108
109
  spinner.success({ text: 'Build complete!' });
109
110
  });
110
111
 
111
- program.parse();
112
+ program.parse(process.argv);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-hamroun",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "A lightweight frontend framework with hooks and virtual DOM",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -42,6 +42,9 @@
42
42
  "type": "git",
43
43
  "url": "your-repo-url"
44
44
  },
45
+ "engines": {
46
+ "node": ">=14.16"
47
+ },
45
48
  "dependencies": {
46
49
  "commander": "^11.0.0",
47
50
  "inquirer": "^9.2.10",