chore: refactored to node, moved website file f8681342
Steve · 2025-09-19 06:36 3 file(s) · +24 −13
index.html → src/index.html +14 −4
15 15
      display: flex;
16 16
      flex-direction: column;
17 17
      align-items: center;
18 -
      justify-content: center;
18 +
      justify-content: start;
19 +
    }
20 +
21 +
    main {
22 +
      display: flex;
23 +
      align-items: start;
24 +
      flex-direction: column;
25 +
      padding: 2rem 0;
19 26
    }
20 27
21 28
    .container {
31 38
    .component-showcase {
32 39
      display: flex;
33 40
      flex-direction: column;
34 -
      align-items: center;
41 +
      align-items: start;
35 42
      gap: 1rem;
36 43
    }
37 44
52 59
    }
53 60
54 61
    .header {
55 -
      text-align: center;
62 +
      text-align: start;
56 63
      margin-bottom: 2rem;
64 +
      max-width: 300px;
57 65
    }
58 66
59 67
  </style>
60 68
</head>
61 69
<body>
70 +
  <main>
62 71
  <div class="header">
63 72
    <h1>Norns</h1>
64 -
    <p>Interopable web components for dApps</p>
73 +
    <p>Interopable web components for decentralized applications</p>
65 74
  </div>
66 75
  <div class="component-showcase">
67 76
    <div class="container">
72 81
      npx norns add connect-wallet
73 82
    </div>
74 83
  </div>
84 +
  </main>
75 85
76 86
  <script src="components/connect-wallet.js"></script>
77 87
</body>
package.json +3 −3
1 1
{
2 -
	"name": "norns",
2 +
	"name": "norns-ui",
3 3
	"version": "0.1.0",
4 -
	"description": "A Web Component Library CLI",
4 +
	"description": "Interoperable web components for decentralized applications",
5 5
	"main": "dist/index.js",
6 6
	"bin": {
7 7
		"norns": "./dist/index.js"
12 12
	],
13 13
	"scripts": {
14 14
		"build": "bun build src/index.ts --outdir dist --target node && cp -r src/components dist/",
15 -
		"dev": "bun index.html --console"
15 +
		"dev": "bun src/index.html --console"
16 16
	},
17 17
	"keywords": [
18 18
		"web-components",
src/index.ts +7 −6
1 -
#!/usr/bin/env bun
1 +
#!/usr/bin/env node
2 2
3 3
import { parseArgs } from "util";
4 +
import { readFile, writeFile } from "node:fs/promises";
4 5
import { mkdir } from "node:fs/promises";
5 6
import { existsSync } from "node:fs";
6 7
import { join } from "node:path";
53 54
			process.exit(1);
54 55
		}
55 56
56 -
		const componentCode = await Bun.file(sourceComponentPath).text();
57 +
		const componentCode = await readFile(sourceComponentPath, "utf8");
57 58
		const componentPath = join(componentsDir, `${componentName}.js`);
58 59
59 -
		await Bun.write(componentPath, componentCode);
60 +
		await writeFile(componentPath, componentCode, "utf8");
60 61
61 62
		console.log(`✅ Added ${componentName} to ${componentPath}`);
62 63
		console.log(`📝 You can now use it in your HTML:`);
86 87
`);
87 88
}
88 89
89 -
// Parse command line arguments using Bun's parseArgs
90 -
// Bun.argv includes [bun_path, script_path, ...actual_args]
90 +
// Parse command line arguments using Node's parseArgs
91 +
// process.argv includes [node_path, script_path, ...actual_args]
91 92
// We need to slice from index 2 to get the actual command arguments
92 93
const { values, positionals } = parseArgs({
93 -
	args: Bun.argv.slice(2),
94 +
	args: process.argv.slice(2),
94 95
	options: {
95 96
		help: { type: "boolean", short: "h" },
96 97
	},