chore: added script for handling site deployment 643e84aa
Steve · 2025-09-20 00:24 3 file(s) · +27 −1
package.json +1 −0
12 12
	],
13 13
	"scripts": {
14 14
		"build": "bun build src/index.ts --outdir dist --target node && cp -r src/components dist/",
15 +
		"deploy:site": "bun scripts/deploy-site.ts",
15 16
		"dev": "bun site/index.html --console"
16 17
	},
17 18
	"keywords": [
scripts/deploy-site.ts (added) +25 −0
1 +
import { $ } from "bun";
2 +
// Copy components folder from src to site
3 +
await $`cp -r src/components site/components`;
4 +
5 +
// Update script tag in HTML file to use local components path
6 +
const htmlContent = await Bun.file("site/index.html").text();
7 +
const updatedHtml = htmlContent.replace(
8 +
	`<script src="../src/components/connect-wallet.js"></script>`,
9 +
	`<script src="components/connect-wallet.js"></script>`,
10 +
);
11 +
await Bun.write("site/index.html", updatedHtml);
12 +
13 +
// Run orbiter update
14 +
await $`orbiter update -d norns site`;
15 +
16 +
// Remove components folder from site
17 +
await $`rm -rf site/components`;
18 +
19 +
// Change script tag back to original path
20 +
const finalHtmlContent = await Bun.file("site/index.html").text();
21 +
const restoredHtml = finalHtmlContent.replace(
22 +
	`<script src="components/connect-wallet.js"></script>`,
23 +
	`<script src="../src/components/connect-wallet.js"></script>`,
24 +
);
25 +
await Bun.write("site/index.html", restoredHtml);
site/index.html +1 −1
209 209
  </div>
210 210
  </main>
211 211
212 -
  <script src="components/connect-wallet.js"></script>
212 +
  <script src="../src/components/connect-wallet.js"></script>
213 213
</body>
214 214
</html>