rdy-dashboard 1.0.0 → 1.0.1

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/init.js +47 -0
  2. package/package.json +5 -2
package/bin/init.js ADDED
@@ -0,0 +1,47 @@
1
+ #!/usr/bin/env node
2
+
3
+ import fs from "fs";
4
+ import path from "path";
5
+
6
+ // Получаем текущую рабочую директорию пользователя
7
+ const root = process.cwd();
8
+
9
+ console.log("🚀 Creating dashboard structure...");
10
+
11
+ // helper функция для создания папки, если её нет
12
+ function ensureDir(dir) {
13
+ if (!fs.existsSync(dir)) {
14
+ fs.mkdirSync(dir, { recursive: true });
15
+ }
16
+ }
17
+
18
+ // helper функция для записи файла
19
+ function writeFile(filePath, content) {
20
+ fs.writeFileSync(filePath, content, { flag: "wx" }); // fail if exists
21
+ console.log(`✔ Created: ${filePath}`);
22
+ }
23
+
24
+ // Пути к файлам
25
+ const files = [
26
+ {
27
+ filePath: path.join(root, "app/dashboard/layout.tsx"),
28
+ templatePath: path.join(__dirname, "../templates/dashboard-layout.tsx")
29
+ },
30
+ {
31
+ filePath: path.join(root, "app/dashboard/page.tsx"),
32
+ templatePath: path.join(__dirname, "../templates/dashboard-page.tsx")
33
+ },
34
+ {
35
+ filePath: path.join(root, "app/login/page.tsx"),
36
+ templatePath: path.join(__dirname, "../templates/login-page.tsx")
37
+ }
38
+ ];
39
+
40
+ // Создаём файлы
41
+ for (const { filePath, templatePath } of files) {
42
+ ensureDir(path.dirname(filePath));
43
+ const content = fs.readFileSync(templatePath, "utf-8");
44
+ writeFile(filePath, content);
45
+ }
46
+
47
+ console.log("🎉 Dashboard files created successfully!");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rdy-dashboard",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Rdy Admin Panel Package",
5
5
  "repository": {
6
6
  "type": "git",
@@ -15,6 +15,9 @@
15
15
  "files": [
16
16
  "dist"
17
17
  ],
18
+ "bin": {
19
+ "rdy-dashboard": "./bin/init.js"
20
+ },
18
21
  "scripts": {
19
22
  "build": "rollup -c",
20
23
  "dev": "rollup -c -w",
@@ -52,4 +55,4 @@
52
55
  "react-router-dom": "^7.9.4",
53
56
  "rollup-plugin-peer-deps-external": "^2.2.4"
54
57
  }
55
- }
58
+ }