nh-library 1.0.0

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.
@@ -0,0 +1,3 @@
1
+ h1{
2
+ color: cyan;
3
+ }
@@ -0,0 +1,11 @@
1
+ import "./ComponentTest.css"
2
+
3
+ const ComponentTest = () => {
4
+ return (
5
+ <div>
6
+ <h1>Nirmata is here! </h1>
7
+ </div>
8
+ )
9
+ }
10
+
11
+ export default ComponentTest
package/cli/index.cjs ADDED
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("fs")
4
+ const path = require("path")
5
+
6
+ // Get the component name from CLI arguments
7
+ const componentName = process.argv[2]
8
+
9
+ if (!componentName) {
10
+ console.log("Please specify a component. Example: NH-Library ComponentTest")
11
+ process.exit(1)
12
+ }
13
+
14
+ // Load the registry
15
+ const registry = require("../registry/components.json")
16
+
17
+ if (!registry[componentName]) {
18
+ console.log(`Component "${componentName}" not found in registry.`)
19
+ process.exit(1)
20
+ }
21
+
22
+ // Destination folder in the target project
23
+ const destFolder = path.join(process.cwd(), "src/components/ui", componentName)
24
+
25
+ // Ensure destination folder exists
26
+ fs.mkdirSync(destFolder, { recursive: true })
27
+
28
+ // Function to copy a folder recursively
29
+ function copyFolderRecursive(src, dest) {
30
+ const entries = fs.readdirSync(src, { withFileTypes: true })
31
+ entries.forEach((entry) => {
32
+ const srcPath = path.join(src, entry.name)
33
+ const destPath = path.join(dest, entry.name)
34
+
35
+ if (entry.isDirectory()) {
36
+ fs.mkdirSync(destPath, { recursive: true })
37
+ copyFolderRecursive(srcPath, destPath)
38
+ } else {
39
+ fs.copyFileSync(srcPath, destPath)
40
+ console.log(`Copied ${entry.name} → ${destPath}`)
41
+ }
42
+ })
43
+ }
44
+
45
+ // Copy all files/folders listed in the registry
46
+ registry[componentName].files.forEach((file) => {
47
+ const source = path.join(__dirname, "..", file)
48
+ copyFolderRecursive(source, destFolder)
49
+ })
50
+
51
+ console.log(`Component "${componentName}" installed successfully!`)
package/package.json ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "nh-library",
3
+ "version": "1.0.0",
4
+ "description": "CLI-based React component library",
5
+ "main": "cli/index.cjs",
6
+ "bin": {
7
+ "NH-Library": "./cli/index.cjs"
8
+ },
9
+ "type": "commonjs",
10
+ "author": "Nirmata",
11
+ "license": "MIT"
12
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "ComponentTest": {
3
+ "files": [
4
+ "Components/ComponentTest"
5
+ ]
6
+ }
7
+ }