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