frontend-hamroun 1.0.4 → 1.0.7

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 -17
  2. package/package.json +5 -11
package/bin/cli.js CHANGED
@@ -1,18 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- import { Command } from 'commander';
4
- import { createRequire } from 'module';
5
- import inquirer from 'inquirer';
6
- import chalk from 'chalk';
7
- import fsExtra from 'fs-extra';
8
- import * as path from 'path';
9
- import { createSpinner } from 'nanospinner';
10
- import { fileURLToPath } from 'url';
11
-
12
- const require = createRequire(import.meta.url);
3
+ const { Command } = require('commander');
4
+ const inquirer = require('inquirer');
5
+ const chalk = require('chalk');
6
+ const fs = require('fs-extra');
7
+ const path = require('path');
8
+ const { createSpinner } = require('nanospinner');
9
+
13
10
  const program = new Command();
14
- const __filename = fileURLToPath(import.meta.url);
15
- const __dirname = path.dirname(__filename);
16
11
 
17
12
  const CHOICES = {
18
13
  SPA: 'Single Page Application',
@@ -32,7 +27,7 @@ async function createProject(projectName, options) {
32
27
  const targetDir = path.join(process.cwd(), projectName);
33
28
 
34
29
  // Check if directory exists
35
- if (fsExtra.existsSync(targetDir)) {
30
+ if (fs.existsSync(targetDir)) {
36
31
  spinner.error({ text: 'Directory already exists!' });
37
32
  process.exit(1);
38
33
  }
@@ -41,19 +36,19 @@ async function createProject(projectName, options) {
41
36
  const templatePath = path.join(__dirname, '../templates', options.template.toLowerCase());
42
37
 
43
38
  // Ensure template exists
44
- if (!fsExtra.existsSync(templatePath)) {
39
+ if (!fs.existsSync(templatePath)) {
45
40
  spinner.error({ text: 'Template not found!' });
46
41
  process.exit(1);
47
42
  }
48
43
 
49
44
  // Copy template
50
- await fsExtra.copy(templatePath, targetDir);
45
+ await fs.copy(templatePath, targetDir);
51
46
 
52
47
  // Update package.json
53
48
  const packageJsonPath = path.join(targetDir, 'package.json');
54
- const packageJson = await fsExtra.readJson(packageJsonPath);
49
+ const packageJson = await fs.readJson(packageJsonPath);
55
50
  packageJson.name = projectName;
56
- await fsExtra.writeJson(packageJsonPath, packageJson, { spaces: 2 });
51
+ await fs.writeJson(packageJsonPath, packageJson, { spaces: 2 });
57
52
 
58
53
  spinner.success({ text: `Project ${chalk.green(projectName)} created successfully!` });
59
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frontend-hamroun",
3
- "version": "1.0.4",
3
+ "version": "1.0.7",
4
4
  "description": "A lightweight frontend framework with hooks and virtual DOM",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -42,24 +42,18 @@
42
42
  "type": "git",
43
43
  "url": "your-repo-url"
44
44
  },
45
- "engines": {
46
- "node": ">=14.16"
47
- },
48
- "dependencies": {
49
- "commander": "^11.0.0",
50
- "inquirer": "^9.2.10",
51
- "chalk": "^5.3.0",
52
- "fs-extra": "^11.1.1",
53
- "nanospinner": "^1.1.0"
54
- },
55
45
  "devDependencies": {
56
46
  "@types/react": "^19.0.8",
57
47
  "@vitejs/plugin-react": "^4.0.4",
48
+ "nanospinner": "^1.1.0",
58
49
  "typescript": "^5.0.0",
59
50
  "vite": "^4.4.9",
60
51
  "vitest": "^0.34.0"
61
52
  },
62
53
  "publishConfig": {
63
54
  "access": "public"
55
+ },
56
+ "dependencies": {
57
+ "commander": "^13.1.0"
64
58
  }
65
59
  }