create-fedi-app 0.1.0 → 0.1.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/dist/index.js +101 -3
- package/dist/templates/base/app/demo/page.tsx +34 -7
- package/dist/templates/base/app/globals.css +7 -1
- package/dist/templates/base/lib/demo-routes.ts +24 -0
- package/dist/templates/base/package.json +2 -0
- package/dist/templates/base/postcss.config.mjs +8 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
1
2
|
"use strict";
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
@@ -28,9 +29,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
28
29
|
mod
|
|
29
30
|
));
|
|
30
31
|
|
|
31
|
-
// ../../node_modules/.bun/tsup@8.5.1+
|
|
32
|
+
// ../../node_modules/.bun/tsup@8.5.1+e8e5604bba8b6375/node_modules/tsup/assets/cjs_shims.js
|
|
32
33
|
var init_cjs_shims = __esm({
|
|
33
|
-
"../../node_modules/.bun/tsup@8.5.1+
|
|
34
|
+
"../../node_modules/.bun/tsup@8.5.1+e8e5604bba8b6375/node_modules/tsup/assets/cjs_shims.js"() {
|
|
34
35
|
"use strict";
|
|
35
36
|
}
|
|
36
37
|
});
|
|
@@ -2920,7 +2921,7 @@ var require_package = __commonJS({
|
|
|
2920
2921
|
"package.json"(exports2, module2) {
|
|
2921
2922
|
module2.exports = {
|
|
2922
2923
|
name: "create-fedi-app",
|
|
2923
|
-
version: "0.1.
|
|
2924
|
+
version: "0.1.2",
|
|
2924
2925
|
description: "CLI scaffolder for Fedi Bitcoin mini apps",
|
|
2925
2926
|
bin: {
|
|
2926
2927
|
"create-fedi-app": "./dist/index.js"
|
|
@@ -3840,6 +3841,96 @@ function shouldApplyModuleFile(file, database) {
|
|
|
3840
3841
|
return database !== "none" && file.databaseType === database;
|
|
3841
3842
|
}
|
|
3842
3843
|
|
|
3844
|
+
// src/demo-routes.ts
|
|
3845
|
+
init_cjs_shims();
|
|
3846
|
+
var MODULE_DEMO_ROUTES = {
|
|
3847
|
+
"webln-payments": {
|
|
3848
|
+
href: "/demo/webln",
|
|
3849
|
+
title: "WebLN Payments",
|
|
3850
|
+
description: "Send and receive Lightning payments with WebLN."
|
|
3851
|
+
},
|
|
3852
|
+
"nostr-identity": {
|
|
3853
|
+
href: "/demo/nostr",
|
|
3854
|
+
title: "Nostr Identity",
|
|
3855
|
+
description: "Sign in with NIP-07 and sign messages with your Nostr key."
|
|
3856
|
+
},
|
|
3857
|
+
"ecash-balance": {
|
|
3858
|
+
href: "/demo/ecash",
|
|
3859
|
+
title: "Ecash Balance",
|
|
3860
|
+
description: "Read Fedi ecash balance and install mini app prompts."
|
|
3861
|
+
},
|
|
3862
|
+
"payment-gated-content": {
|
|
3863
|
+
href: "/demo/payment-gated",
|
|
3864
|
+
title: "Payment-Gated Content",
|
|
3865
|
+
description: "Unlock articles and content after a Lightning payment."
|
|
3866
|
+
},
|
|
3867
|
+
lnurl: {
|
|
3868
|
+
href: "/demo/lnurl",
|
|
3869
|
+
title: "LNURL",
|
|
3870
|
+
description: "LNURL-pay, withdraw, and auth flows with QR codes."
|
|
3871
|
+
},
|
|
3872
|
+
"ai-chat-gated": {
|
|
3873
|
+
href: "/demo/ai-chat",
|
|
3874
|
+
title: "Gated AI Chat",
|
|
3875
|
+
description: "Pay-per-message AI chat gated by Lightning invoice."
|
|
3876
|
+
},
|
|
3877
|
+
"ai-assistant": {
|
|
3878
|
+
href: "/demo/assistant",
|
|
3879
|
+
title: "AI Assistant",
|
|
3880
|
+
description: "Streaming AI assistant with tool use and markdown replies."
|
|
3881
|
+
},
|
|
3882
|
+
"multispend-demo": {
|
|
3883
|
+
href: "/demo/multispend",
|
|
3884
|
+
title: "Multispend",
|
|
3885
|
+
description: "Shared wallet proposals, votes, and approval flows."
|
|
3886
|
+
},
|
|
3887
|
+
"nostr-feed": {
|
|
3888
|
+
href: "/demo/nostr-feed",
|
|
3889
|
+
title: "Nostr Feed",
|
|
3890
|
+
description: "Publish notes, browse a relay feed, and zap posts."
|
|
3891
|
+
}
|
|
3892
|
+
};
|
|
3893
|
+
var DEMO_MODULE_ORDER = [
|
|
3894
|
+
"webln-payments",
|
|
3895
|
+
"nostr-identity",
|
|
3896
|
+
"ecash-balance",
|
|
3897
|
+
"payment-gated-content",
|
|
3898
|
+
"lnurl",
|
|
3899
|
+
"ai-chat-gated",
|
|
3900
|
+
"ai-assistant",
|
|
3901
|
+
"multispend-demo",
|
|
3902
|
+
"nostr-feed"
|
|
3903
|
+
];
|
|
3904
|
+
function buildDemoRoutes(moduleNames) {
|
|
3905
|
+
const routes = [];
|
|
3906
|
+
for (const moduleName of DEMO_MODULE_ORDER) {
|
|
3907
|
+
if (!moduleNames.includes(moduleName)) continue;
|
|
3908
|
+
const route = MODULE_DEMO_ROUTES[moduleName];
|
|
3909
|
+
if (route) routes.push(route);
|
|
3910
|
+
}
|
|
3911
|
+
return routes;
|
|
3912
|
+
}
|
|
3913
|
+
function renderDemoRoutesFile(routes) {
|
|
3914
|
+
const entries = routes.map(
|
|
3915
|
+
(route) => ` {
|
|
3916
|
+
href: '${route.href}',
|
|
3917
|
+
title: '${route.title}',
|
|
3918
|
+
description: '${route.description}',
|
|
3919
|
+
}`
|
|
3920
|
+
).join(",\n");
|
|
3921
|
+
return `/** Auto-generated by create-fedi-app \u2014 do not edit manually. */
|
|
3922
|
+
export interface IDemoRoute {
|
|
3923
|
+
href: string;
|
|
3924
|
+
title: string;
|
|
3925
|
+
description: string;
|
|
3926
|
+
}
|
|
3927
|
+
|
|
3928
|
+
export const demoRoutes: IDemoRoute[] = [
|
|
3929
|
+
${entries}
|
|
3930
|
+
];
|
|
3931
|
+
`;
|
|
3932
|
+
}
|
|
3933
|
+
|
|
3843
3934
|
// src/scaffold.ts
|
|
3844
3935
|
function getTemplatesDir() {
|
|
3845
3936
|
const bundled = import_path2.default.join(__dirname, "templates");
|
|
@@ -3973,8 +4064,15 @@ async function scaffold(selections, targetDir) {
|
|
|
3973
4064
|
["{{PACKAGE_MANAGER}}", selections.packageManager]
|
|
3974
4065
|
]);
|
|
3975
4066
|
await applyModules(selections, targetDir, templatesDir);
|
|
4067
|
+
await generateDemoRoutes(selections, targetDir);
|
|
3976
4068
|
await generateEnvLocal(selections, targetDir, templatesDir);
|
|
3977
4069
|
}
|
|
4070
|
+
async function generateDemoRoutes(selections, targetDir) {
|
|
4071
|
+
const moduleNames = getSelectedModuleNames(selections);
|
|
4072
|
+
const routes = buildDemoRoutes(moduleNames);
|
|
4073
|
+
const content = renderDemoRoutesFile(routes);
|
|
4074
|
+
await import_fs_extra2.default.writeFile(import_path2.default.join(targetDir, "lib/demo-routes.ts"), content, "utf-8");
|
|
4075
|
+
}
|
|
3978
4076
|
|
|
3979
4077
|
// src/install.ts
|
|
3980
4078
|
init_cjs_shims();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import Link from 'next/link';
|
|
2
|
+
import { demoRoutes } from '../../lib/demo-routes';
|
|
2
3
|
|
|
3
4
|
export default function DemoPage() {
|
|
4
5
|
return (
|
|
@@ -12,13 +13,39 @@ export default function DemoPage() {
|
|
|
12
13
|
>
|
|
13
14
|
← back
|
|
14
15
|
</Link>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
|
|
17
|
+
<div className="space-y-6">
|
|
18
|
+
<div className="space-y-2">
|
|
19
|
+
<h1 className="font-[family-name:var(--font-display)] text-2xl font-bold leading-tight text-[var(--color-text)]">
|
|
20
|
+
Demos
|
|
21
|
+
</h1>
|
|
22
|
+
<p className="max-w-[75ch] text-sm leading-[1.65] text-[var(--color-text-muted)]">
|
|
23
|
+
Interactive examples for each module in your project. Use the dev toolbar to toggle
|
|
24
|
+
mock WebLN and Nostr providers outside the Fedi app.
|
|
25
|
+
</p>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
{demoRoutes.length === 0 ? (
|
|
29
|
+
<p className="text-sm text-[var(--color-text-muted)]">No demo routes configured.</p>
|
|
30
|
+
) : (
|
|
31
|
+
<ul className="space-y-3">
|
|
32
|
+
{demoRoutes.map((route) => (
|
|
33
|
+
<li key={route.href}>
|
|
34
|
+
<Link
|
|
35
|
+
href={route.href}
|
|
36
|
+
className="block rounded-lg border border-[var(--color-border)] bg-[var(--color-surface-1)] p-4 transition-opacity duration-200 ease-[cubic-bezier(0.25,1,0.5,1)] hover:opacity-90 active:opacity-80"
|
|
37
|
+
>
|
|
38
|
+
<span className="font-[family-name:var(--font-display)] text-base font-semibold text-[var(--color-text)]">
|
|
39
|
+
{route.title}
|
|
40
|
+
</span>
|
|
41
|
+
<span className="mt-1 block text-sm leading-[1.65] text-[var(--color-text-muted)]">
|
|
42
|
+
{route.description}
|
|
43
|
+
</span>
|
|
44
|
+
</Link>
|
|
45
|
+
</li>
|
|
46
|
+
))}
|
|
47
|
+
</ul>
|
|
48
|
+
)}
|
|
22
49
|
</div>
|
|
23
50
|
</main>
|
|
24
51
|
);
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
@import "tailwindcss";
|
|
2
|
-
@
|
|
2
|
+
@plugin "@tailwindcss/typography";
|
|
3
|
+
|
|
4
|
+
@source "../app/**/*.{ts,tsx}";
|
|
5
|
+
@source "../components/**/*.{ts,tsx}";
|
|
6
|
+
@source "../hooks/**/*.{ts,tsx}";
|
|
7
|
+
@source "../lib/**/*.{ts,tsx}";
|
|
3
8
|
|
|
4
9
|
@theme {
|
|
5
10
|
/* Fedi palette */
|
|
6
11
|
--color-bg: #0a0a0a;
|
|
7
12
|
--color-surface: #141414;
|
|
13
|
+
--color-surface-1: #181818;
|
|
8
14
|
--color-surface-2: #1c1c1c;
|
|
9
15
|
--color-border: rgba(255, 255, 255, 0.08);
|
|
10
16
|
--color-accent: #ff6b35;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/** Auto-generated by create-fedi-app — replaced during scaffold. */
|
|
2
|
+
export interface IDemoRoute {
|
|
3
|
+
href: string;
|
|
4
|
+
title: string;
|
|
5
|
+
description: string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const demoRoutes: IDemoRoute[] = [
|
|
9
|
+
{
|
|
10
|
+
href: '/demo/webln',
|
|
11
|
+
title: 'WebLN Payments',
|
|
12
|
+
description: 'Send and receive Lightning payments with WebLN.',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
href: '/demo/nostr',
|
|
16
|
+
title: 'Nostr Identity',
|
|
17
|
+
description: 'Sign in with NIP-07 and sign messages with your Nostr key.',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
href: '/demo/ecash',
|
|
21
|
+
title: 'Ecash Balance',
|
|
22
|
+
description: 'Read Fedi ecash balance and install mini app prompts.',
|
|
23
|
+
},
|
|
24
|
+
];
|