neonblade 0.0.1 → 0.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/index.js +55 -15
- package/package.json +14 -11
package/index.js
CHANGED
|
@@ -2,7 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
const fs = require("fs")
|
|
4
4
|
const path = require("path")
|
|
5
|
+
const axios = require("axios")
|
|
5
6
|
|
|
7
|
+
const BASE_URL = "https://neonbladeui-registry.vercel.app"
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
const projectRoot = process.cwd()
|
|
@@ -36,14 +38,16 @@ if (!fs.existsSync(componentDir)) {
|
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
// Read metadata
|
|
39
|
-
const metaPath = path.join(componentDir, "meta.json")
|
|
41
|
+
// const metaPath = path.join(componentDir, "meta.json")
|
|
40
42
|
|
|
41
|
-
if (!fs.existsSync(metaPath)) {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
43
|
+
// if (!fs.existsSync(metaPath)) {
|
|
44
|
+
// console.log("Component metadata not found")
|
|
45
|
+
// process.exit(1)
|
|
46
|
+
// }
|
|
47
|
+
|
|
48
|
+
// const meta = JSON.parse(fs.readFileSync(metaPath, "utf-8"))
|
|
45
49
|
|
|
46
|
-
const
|
|
50
|
+
const data = await fetchComponent(component)
|
|
47
51
|
|
|
48
52
|
console.log("\n⚡ NeonBlade UI\n")
|
|
49
53
|
|
|
@@ -51,28 +55,52 @@ console.log("\n⚡ NeonBlade UI\n")
|
|
|
51
55
|
logStep(`Adding ${component}...`)
|
|
52
56
|
logStep("Copying files...")
|
|
53
57
|
|
|
54
|
-
meta.files.forEach((file) => {
|
|
55
|
-
|
|
58
|
+
// meta.files.forEach((file) => {
|
|
59
|
+
// const sourcePath = path.join(componentDir, file)
|
|
60
|
+
|
|
61
|
+
// const targetPath = path.join(
|
|
62
|
+
// targetAppPath,
|
|
63
|
+
// "components/ui",
|
|
64
|
+
// toKebabCase(file)
|
|
65
|
+
// )
|
|
66
|
+
|
|
67
|
+
// fs.mkdirSync(path.dirname(targetPath), { recursive: true })
|
|
68
|
+
// fs.copyFileSync(sourcePath, targetPath)
|
|
69
|
+
// })
|
|
70
|
+
|
|
71
|
+
for (const file of data.files) {
|
|
72
|
+
const fileRes = await axios.get(file.url)
|
|
56
73
|
|
|
57
74
|
const targetPath = path.join(
|
|
58
75
|
targetAppPath,
|
|
59
|
-
|
|
60
|
-
toKebabCase(file)
|
|
76
|
+
file.path
|
|
61
77
|
)
|
|
62
78
|
|
|
63
79
|
fs.mkdirSync(path.dirname(targetPath), { recursive: true })
|
|
64
|
-
fs.
|
|
65
|
-
}
|
|
80
|
+
fs.writeFileSync(targetPath, fileRes.data)
|
|
81
|
+
}
|
|
66
82
|
|
|
67
83
|
const { execSync } = require("child_process")
|
|
68
84
|
|
|
69
85
|
// Install dependencies if any
|
|
70
|
-
if (meta.dependencies && meta.dependencies.length > 0) {
|
|
86
|
+
// if (meta.dependencies && meta.dependencies.length > 0) {
|
|
87
|
+
// logStep("Installing dependencies...")
|
|
88
|
+
|
|
89
|
+
// execSync(
|
|
90
|
+
// `pnpm add ${meta.dependencies.join(" ")}`,
|
|
91
|
+
// { stdio: "inherit", cwd: targetAppPath }
|
|
92
|
+
// )
|
|
93
|
+
// }
|
|
94
|
+
|
|
95
|
+
if (data.dependencies && data.dependencies.length > 0) {
|
|
71
96
|
logStep("Installing dependencies...")
|
|
72
97
|
|
|
73
98
|
execSync(
|
|
74
|
-
`pnpm add ${
|
|
75
|
-
{
|
|
99
|
+
`pnpm add ${data.dependencies.join(" ")}`,
|
|
100
|
+
{
|
|
101
|
+
stdio: "inherit",
|
|
102
|
+
cwd: targetAppPath,
|
|
103
|
+
}
|
|
76
104
|
)
|
|
77
105
|
}
|
|
78
106
|
|
|
@@ -152,3 +180,15 @@ function gradientLog(text) {
|
|
|
152
180
|
|
|
153
181
|
}
|
|
154
182
|
|
|
183
|
+
|
|
184
|
+
async function fetchComponent(component) {
|
|
185
|
+
try {
|
|
186
|
+
const res = await axios.get(
|
|
187
|
+
`${BASE_URL}/components/${component}/index.json`
|
|
188
|
+
)
|
|
189
|
+
return res.data
|
|
190
|
+
} catch (err) {
|
|
191
|
+
logError(`Component "${component}" not found`)
|
|
192
|
+
process.exit(1)
|
|
193
|
+
}
|
|
194
|
+
}
|
package/package.json
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "neonblade",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "NeonBlade UI CLI",
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "neonblade",
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "NeonBlade UI CLI",
|
|
5
|
+
"bin": {
|
|
6
|
+
"neonblade": "index.js"
|
|
7
|
+
},
|
|
8
|
+
"type": "commonjs",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"axios": "^1.14.0",
|
|
11
|
+
"lucide-react": "^1.7.0",
|
|
12
|
+
"react-icons": "^5.6.0"
|
|
13
|
+
}
|
|
14
|
+
}
|