create-feltkit 0.3.21 → 0.3.23
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/bin/create.js +15 -101
- package/package.json +2 -2
- package/scaffold.js +0 -3
- package/template/package.json +3 -1
- package/template-managed/package.json +1 -1
- package/template-foundation/README.md +0 -24
- package/template-foundation/_gitignore +0 -12
- package/template-foundation/feltkit/_generated/api.ts +0 -7
- package/template-foundation/feltkit/app.ts +0 -11
- package/template-foundation/index.html +0 -15
- package/template-foundation/package.json +0 -31
- package/template-foundation/public/apple-touch-icon.png +0 -0
- package/template-foundation/public/favicon.png +0 -0
- package/template-foundation/src/App.tsx +0 -60
- package/template-foundation/src/main.tsx +0 -17
- package/template-foundation/src/styles.css +0 -38
- package/template-foundation/tests/foundation.test.ts +0 -24
- package/template-foundation/tsconfig.json +0 -16
- package/template-foundation/vite.config.ts +0 -6
package/bin/create.js
CHANGED
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
// npm create feltkit@latest <dir>
|
|
3
|
-
// npm create feltkit@latest <dir> -- --template <t>
|
|
2
|
+
// npm create feltkit@latest <dir> a complete, working application (the tasks starter)
|
|
3
|
+
// npm create feltkit@latest <dir> -- --template <t> another starter
|
|
4
4
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
//
|
|
9
|
-
// Why it runs the composer's binary instead of importing it: `@feltdb/feltkit` does not export its CLI (its public
|
|
10
|
-
// exports are the runtime, not `createCommand`), and a wrapper must not reach past a package's export map. Running
|
|
11
|
-
// the binary also hands the terminal, the signals and the exit code to the composer unchanged, which is what a
|
|
12
|
-
// developer answering questions needs. The binary comes from the declared dependency on disk; nothing is downloaded
|
|
13
|
-
// or installed when this runs.
|
|
14
|
-
import { spawnSync } from "node:child_process";
|
|
15
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
16
|
-
import { dirname, join, resolve } from "node:path";
|
|
17
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
+
// One job: lay down an application someone can run, read and change the same minute. No dependencies, so
|
|
6
|
+
// `npm create` is fast.
|
|
7
|
+
import { resolve } from "node:path";
|
|
18
8
|
|
|
19
9
|
import { scaffold, TEMPLATES, VERSION } from "../scaffold.js";
|
|
20
10
|
|
|
21
11
|
// `npm create feltkit <dir> -- --flag` has npm remove the `--` before this runs, but a direct
|
|
22
|
-
// `create-feltkit <dir> -- --flag` does not
|
|
23
|
-
// after it. Dropping a standalone separator makes both spellings mean the same thing.
|
|
12
|
+
// `create-feltkit <dir> -- --flag` does not. Dropping a standalone separator makes both spellings mean the same.
|
|
24
13
|
const args = process.argv.slice(2).filter((a) => a !== "--");
|
|
25
14
|
const color = process.stdout.isTTY && !process.env.NO_COLOR;
|
|
26
15
|
const bold = (s) => (color ? `\u001b[1m${s}\u001b[22m` : s);
|
|
@@ -28,23 +17,18 @@ const dim = (s) => (color ? `\u001b[2m${s}\u001b[22m` : s);
|
|
|
28
17
|
const green = (s) => (color ? `\u001b[32m${s}\u001b[39m` : s);
|
|
29
18
|
const red = (s) => (color ? `\u001b[31m${s}\u001b[39m` : s);
|
|
30
19
|
|
|
31
|
-
const COMPOSER = "@feltdb/feltkit";
|
|
32
|
-
|
|
33
20
|
if (args.includes("--help") || args.includes("-h")) {
|
|
34
21
|
console.log(`npm create feltkit@latest <directory>
|
|
35
22
|
|
|
36
|
-
|
|
37
|
-
who uses it and which capabilities it needs, then generates the foundation from your answers.
|
|
38
|
-
Every \`feltkit create\` flag works here too; pass them after \`--\`.
|
|
23
|
+
Creates a complete, working FeltKit application. Run it straight away:
|
|
39
24
|
|
|
40
25
|
npm create feltkit@latest my-app
|
|
41
|
-
|
|
42
|
-
npm create feltkit@latest my-app -- --help (every composition flag)
|
|
26
|
+
cd my-app && npm install && npm run dev
|
|
43
27
|
|
|
44
|
-
Starters
|
|
28
|
+
Starters (--template), each a whole application you can read and change:
|
|
45
29
|
${Object.entries(TEMPLATES).map(([name, { description }]) => ` ${name.padEnd(9)}${description}`).join("\n")}
|
|
46
30
|
|
|
47
|
-
--managed is short for --template managed.`);
|
|
31
|
+
--managed is short for --template managed. tasks is the default.`);
|
|
48
32
|
process.exit(0);
|
|
49
33
|
}
|
|
50
34
|
if (args.includes("--version")) {
|
|
@@ -58,82 +42,12 @@ const valueOf = (flag) => {
|
|
|
58
42
|
return index >= 0 ? args[index + 1] : undefined;
|
|
59
43
|
};
|
|
60
44
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
* works whatever the package's export map allows: `require.resolve("<pkg>/package.json")` throws for a package whose
|
|
66
|
-
* exports do not list it, and most now do not.
|
|
67
|
-
*/
|
|
68
|
-
function composerBin() {
|
|
69
|
-
let from;
|
|
70
|
-
try {
|
|
71
|
-
from = fileURLToPath(import.meta.resolve(COMPOSER));
|
|
72
|
-
} catch {
|
|
73
|
-
return null;
|
|
74
|
-
}
|
|
75
|
-
for (let dir = dirname(from); ; dir = dirname(dir)) {
|
|
76
|
-
const manifest = join(dir, "package.json");
|
|
77
|
-
if (existsSync(manifest)) {
|
|
78
|
-
try {
|
|
79
|
-
if (JSON.parse(readFileSync(manifest, "utf8")).name === COMPOSER) {
|
|
80
|
-
const bin = join(dir, "bin", "feltkit.js");
|
|
81
|
-
return existsSync(bin) ? bin : null;
|
|
82
|
-
}
|
|
83
|
-
} catch {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
if (dirname(dir) === dir) return null;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const template = args.includes("--managed") ? "managed" : valueOf("--template");
|
|
92
|
-
// The destination is the first argument that is neither a flag nor a flag's value. Its index is kept so only that
|
|
93
|
-
// one argument is replaced when the rest is forwarded: a `--name my-app` whose value happens to equal the directory
|
|
94
|
-
// must survive.
|
|
95
|
-
const dirIndex = args.findIndex((a, i) => !a.startsWith("-") && !VALUE_FLAGS.includes(args[i - 1]));
|
|
96
|
-
const dir = dirIndex >= 0 ? args[dirIndex] : "my-feltkit-app";
|
|
97
|
-
|
|
98
|
-
if (!template) {
|
|
99
|
-
// The default: compose. Everything after the directory is the composer's to interpret, so a flag added to
|
|
100
|
-
// `feltkit create` works here the day it ships, without this file knowing about it.
|
|
101
|
-
//
|
|
102
|
-
// With no terminal, and nothing in the arguments saying what to do instead, refuse here rather than letting the
|
|
103
|
-
// composer refuse. Both refuse for the same good reason — an interview needs someone to answer it — but the
|
|
104
|
-
// composer answers in its own vocabulary, telling the reader to run `feltkit create …`, which is not a command
|
|
105
|
-
// someone who typed `npm create feltkit` has. This is the caller that most often has no terminal (a script, a
|
|
106
|
-
// container build, a test), so it is the caller whose routes the message should name.
|
|
107
|
-
if (!process.stdin.isTTY && !args.includes("--yes") && !args.includes("--interactive")) {
|
|
108
|
-
console.error(`${red("✗")} Not a terminal, so the composition interview cannot be answered. Nothing was written.`);
|
|
109
|
-
console.error(" Choose one:");
|
|
110
|
-
console.error(` npm create feltkit@latest ${dir} -- --template tasks a complete starter, no questions`);
|
|
111
|
-
console.error(` npm create feltkit@latest ${dir} -- --yes --param identity.accounts.emailFrom=auth@example.com`);
|
|
112
|
-
console.error(" compose from flags, no questions");
|
|
113
|
-
console.error(` npm create feltkit@latest ${dir} -- --interactive answer the questions over a pipe`);
|
|
114
|
-
console.error(dim(` Starters: ${Object.keys(TEMPLATES).join(", ")}. Every composition flag: npm create feltkit@latest ${dir} -- --help`));
|
|
115
|
-
process.exit(1);
|
|
116
|
-
}
|
|
117
|
-
const bin = composerBin();
|
|
118
|
-
if (!bin) {
|
|
119
|
-
console.error(`${red("✗")} ${COMPOSER} is not installed beside this package, so the composition interview cannot be started.`);
|
|
120
|
-
console.error(` hint: run \`npm create feltkit@latest ${dir}\` again (npm installs this package's dependencies), or scaffold a starter instead: \`npm create feltkit@latest ${dir} -- --template tasks\``);
|
|
121
|
-
process.exit(1);
|
|
122
|
-
}
|
|
123
|
-
const forwarded = args.filter((_, i) => i !== dirIndex);
|
|
124
|
-
const result = spawnSync(process.execPath, [bin, "create", dir, ...forwarded], { stdio: "inherit" });
|
|
125
|
-
// The composer owns the outcome: its exit code, and a signal that stopped it, pass through unchanged so a
|
|
126
|
-
// cancelled interview is a cancelled command here too.
|
|
127
|
-
if (result.error) {
|
|
128
|
-
console.error(`${red("✗")} could not start the composition interview: ${result.error.message}`);
|
|
129
|
-
process.exit(1);
|
|
130
|
-
}
|
|
131
|
-
if (result.signal) process.kill(process.pid, result.signal);
|
|
132
|
-
process.exit(result.status ?? 1);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
// A starter, asked for explicitly. Unchanged behaviour, including every message.
|
|
45
|
+
const template = args.includes("--managed") ? "managed" : valueOf("--template") ?? "tasks";
|
|
46
|
+
// The destination is the first argument that is neither a flag nor a flag's value, so a `--name my-app` whose
|
|
47
|
+
// value happens to equal the directory still works.
|
|
48
|
+
const dir = args.find((a, i) => !a.startsWith("-") && !VALUE_FLAGS.includes(args[i - 1])) ?? "my-feltkit-app";
|
|
136
49
|
const name = valueOf("--name");
|
|
50
|
+
|
|
137
51
|
try {
|
|
138
52
|
const result = scaffold({ target: resolve(process.cwd(), dir), template, ...(name ? { name } : {}) });
|
|
139
53
|
console.log(`${green("✓")} Created ${bold(result.name)} in ${result.dir}${template === "tasks" ? "" : ` (${template} starter)`}\n`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-feltkit",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.23",
|
|
4
4
|
"description": "Create a FeltKit application: npm create feltkit@latest my-app (add -- --template managed for Managed FeltDB)",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -37,6 +37,6 @@
|
|
|
37
37
|
},
|
|
38
38
|
"homepage": "https://www.npmjs.com/package/create-feltkit",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@feltdb/feltkit": "0.3.
|
|
40
|
+
"@feltdb/feltkit": "0.3.23"
|
|
41
41
|
}
|
|
42
42
|
}
|
package/scaffold.js
CHANGED
|
@@ -7,8 +7,6 @@ export const VERSION = JSON.parse(readFileSync(new URL("./package.json", import.
|
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* The starters. All are the same FeltKit; they differ in where state lives and how it is deployed.
|
|
10
|
-
* foundation the shell `npx feltkit create` composes into: FeltKit's auth and workspace screens, a
|
|
11
|
-
* placeholder feltkit/app.ts that the composer replaces, no domain of its own.
|
|
12
10
|
* tasks a task manager with a React frontend, AppPort Services (files, intelligence) and an agent;
|
|
13
11
|
* state in local FeltDB (`.feltkit/<env>/state`), or a FeltDB server you run.
|
|
14
12
|
* managed an inventory API whose state lives in Managed FeltDB: no AppPort Services (Managed FeltDB
|
|
@@ -18,7 +16,6 @@ export const VERSION = JSON.parse(readFileSync(new URL("./package.json", import.
|
|
|
18
16
|
export const TEMPLATES = Object.freeze({
|
|
19
17
|
tasks: { dir: "template", description: "Task manager with a frontend; local FeltDB (default)" },
|
|
20
18
|
managed: { dir: "template-managed", description: "Inventory API on Managed FeltDB; contract, keys and deployment as code" },
|
|
21
|
-
foundation: { dir: "template-foundation", description: "A composed foundation (accounts, workspaces when the data belongs to organizations, your capabilities); `npx feltkit create` fills it in" },
|
|
22
19
|
});
|
|
23
20
|
|
|
24
21
|
export class ScaffoldError extends Error {
|
package/template/package.json
CHANGED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
# foundation
|
|
2
|
-
|
|
3
|
-
A FeltKit application composed with `npx feltkit create`. Its foundation (accounts, workspaces, roles,
|
|
4
|
-
invitations, and the capabilities you selected) is generated into `feltkit/_foundation/declaration.ts`
|
|
5
|
-
from `feltkit.composition.json`; `feltkit/app.ts` imports it and adds what is yours: your data, your
|
|
6
|
-
functions, your permissions on them.
|
|
7
|
-
|
|
8
|
-
```bash
|
|
9
|
-
npm install
|
|
10
|
-
npm run dev # backend, frontend and dashboard with hot reload
|
|
11
|
-
npm test # the foundation tests, and yours
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
Composition:
|
|
15
|
-
|
|
16
|
-
```bash
|
|
17
|
-
npx feltkit compose --check # the generated foundation is what the record says
|
|
18
|
-
npx feltkit compose reconcile # how the foundation relates to feltkit/app.ts
|
|
19
|
-
npx feltkit compose plan --include <cap> # what adding a capability would change
|
|
20
|
-
npx feltkit compose apply … --approve <id> # apply exactly that plan
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Do not edit the three generated files (`feltkit/_foundation/declaration.ts`, `feltkit.composition.json`,
|
|
24
|
-
`feltkit.composition.lock.json`); change the composition with `feltkit compose`. Everything else is yours.
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
node_modules/
|
|
2
|
-
dist/
|
|
3
|
-
.feltkit/
|
|
4
|
-
.feltkit-platform/
|
|
5
|
-
# Credentials and local deployment state: environment files (FELTKIT_*, FELTDB_* keys), and what
|
|
6
|
-
# `feltdb init-managed` / `feltdb managed keys` write if this app later moves to Managed FeltDB.
|
|
7
|
-
# Never commit.
|
|
8
|
-
.env
|
|
9
|
-
.env.*
|
|
10
|
-
!.env.example
|
|
11
|
-
.feltdb/
|
|
12
|
-
*.app/
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
/* Generated by `feltkit dev` / `feltkit codegen`. Do not edit; it is rewritten when feltkit/ changes. */
|
|
2
|
-
/* eslint-disable */
|
|
3
|
-
import { createApi } from "@feltdb/feltkit/client";
|
|
4
|
-
import type * as app_module from "../app.js";
|
|
5
|
-
|
|
6
|
-
/** Typed references to every query and mutation. Type-only imports: no backend code reaches the browser. */
|
|
7
|
-
export const api = createApi<{ "app": typeof app_module }>();
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The application. `feltkit create` replaces this file with the one it composes from your selections:
|
|
3
|
-
* it imports the generated foundation (feltkit/_foundation/declaration.ts) and adds what is yours.
|
|
4
|
-
*/
|
|
5
|
-
import { feltkit } from "@feltdb/feltkit";
|
|
6
|
-
|
|
7
|
-
export const app = feltkit({
|
|
8
|
-
name: "foundation",
|
|
9
|
-
roles: { member: [] },
|
|
10
|
-
auth: { accounts: { roles: ["member"] } },
|
|
11
|
-
});
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="UTF-8" />
|
|
5
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
-
<meta name="color-scheme" content="light dark" />
|
|
7
|
-
<link rel="icon" href="/favicon.png" type="image/png" />
|
|
8
|
-
<link rel="apple-touch-icon" href="/apple-touch-icon.png" />
|
|
9
|
-
<title>foundation · FeltKit</title>
|
|
10
|
-
</head>
|
|
11
|
-
<body>
|
|
12
|
-
<div id="root"></div>
|
|
13
|
-
<script type="module" src="/src/main.tsx"></script>
|
|
14
|
-
</body>
|
|
15
|
-
</html>
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "feltkit-foundation",
|
|
3
|
-
"private": true,
|
|
4
|
-
"version": "0.1.0",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"scripts": {
|
|
7
|
-
"dev": "feltkit dev",
|
|
8
|
-
"build": "feltkit build",
|
|
9
|
-
"start": "feltkit start",
|
|
10
|
-
"test": "feltkit test",
|
|
11
|
-
"inspect": "feltkit inspect",
|
|
12
|
-
"deploy": "feltkit deploy",
|
|
13
|
-
"typecheck": "tsc --noEmit",
|
|
14
|
-
"compose:check": "feltkit compose --check",
|
|
15
|
-
"compose:reconcile": "feltkit compose reconcile",
|
|
16
|
-
"compose:plan": "feltkit compose plan"
|
|
17
|
-
},
|
|
18
|
-
"dependencies": {
|
|
19
|
-
"@feltdb/feltkit": "0.3.21",
|
|
20
|
-
"react": "19.2.0",
|
|
21
|
-
"react-dom": "19.2.0"
|
|
22
|
-
},
|
|
23
|
-
"devDependencies": {
|
|
24
|
-
"@types/node": "22.19.1",
|
|
25
|
-
"@types/react": "19.2.2",
|
|
26
|
-
"@types/react-dom": "19.2.2",
|
|
27
|
-
"@vitejs/plugin-react": "5.1.0",
|
|
28
|
-
"typescript": "5.9.3",
|
|
29
|
-
"vite": "7.3.7"
|
|
30
|
-
}
|
|
31
|
-
}
|
|
Binary file
|
|
Binary file
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The app shell. Sign-in, invitations, workspaces, members and account settings are FeltKit's
|
|
3
|
-
* components, driven by the foundation `feltkit create` composed; this file only arranges them.
|
|
4
|
-
* Your own screens go where <Home /> is: query and mutate your collections through
|
|
5
|
-
* feltkit/_generated/api (run `npx feltkit codegen` after adding functions under feltkit/).
|
|
6
|
-
*/
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
import {
|
|
9
|
-
AcceptInvitation, AccountSettings, AuthNotices, CreateTenant, SignIn, TenantSettings, TenantSwitcher, VerifyEmailBanner,
|
|
10
|
-
useAuth, useAuthRedirect, useTenant,
|
|
11
|
-
} from "@feltdb/feltkit/react";
|
|
12
|
-
|
|
13
|
-
type View = "home" | "workspace" | "account";
|
|
14
|
-
const BRAND = "foundation";
|
|
15
|
-
|
|
16
|
-
export function App() {
|
|
17
|
-
const auth = useAuth();
|
|
18
|
-
const tenant = useTenant();
|
|
19
|
-
const { redirect } = useAuthRedirect();
|
|
20
|
-
const [view, setView] = useState<View>("home");
|
|
21
|
-
|
|
22
|
-
if (auth.loading) return <div className="center" aria-busy="true">Loading…</div>;
|
|
23
|
-
if (redirect?.kind === "invitation") return <AcceptInvitation brand={{ name: BRAND }} onAccepted={() => setView("home")} />;
|
|
24
|
-
if (!auth.user) return <SignIn brand={{ name: BRAND, logo: "/favicon.png" }} />;
|
|
25
|
-
if (!tenant.current) return <CreateTenant />;
|
|
26
|
-
|
|
27
|
-
return (
|
|
28
|
-
<div className="shell">
|
|
29
|
-
<header className="topbar">
|
|
30
|
-
<div className="left">
|
|
31
|
-
<strong className="brand">{BRAND}</strong>
|
|
32
|
-
<TenantSwitcher onSwitched={() => setView("home")} />
|
|
33
|
-
</div>
|
|
34
|
-
<nav aria-label="Main">
|
|
35
|
-
{(["home", "workspace", "account"] as const).map((v) => (
|
|
36
|
-
<button key={v} type="button" className={view === v ? "on" : ""} aria-current={view === v ? "page" : undefined} onClick={() => setView(v)}>
|
|
37
|
-
{v === "home" ? "Home" : v === "workspace" ? "Workspace" : "Account"}
|
|
38
|
-
</button>
|
|
39
|
-
))}
|
|
40
|
-
</nav>
|
|
41
|
-
</header>
|
|
42
|
-
<main>
|
|
43
|
-
<AuthNotices />
|
|
44
|
-
<VerifyEmailBanner />
|
|
45
|
-
{view === "home" && <Home role={tenant.current.role} />}
|
|
46
|
-
{view === "workspace" && <TenantSettings />}
|
|
47
|
-
{view === "account" && <AccountSettings />}
|
|
48
|
-
</main>
|
|
49
|
-
</div>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function Home({ role }: { role: string }) {
|
|
54
|
-
return (
|
|
55
|
-
<section>
|
|
56
|
-
<h1>Welcome</h1>
|
|
57
|
-
<p className="muted">You are a {role} here. Accounts, workspaces, roles and invitations work already; the screens for your own data are yours to build.</p>
|
|
58
|
-
</section>
|
|
59
|
-
);
|
|
60
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { StrictMode } from "react";
|
|
2
|
-
import { createRoot } from "react-dom/client";
|
|
3
|
-
import { createClient } from "@feltdb/feltkit/client";
|
|
4
|
-
import { FeltKitProvider } from "@feltdb/feltkit/react";
|
|
5
|
-
import { App } from "./App";
|
|
6
|
-
import "./styles.css";
|
|
7
|
-
|
|
8
|
-
// Same origin as the page. In a browser the session is an HttpOnly cookie (never readable by scripts).
|
|
9
|
-
const client = createClient();
|
|
10
|
-
|
|
11
|
-
createRoot(document.getElementById("root")!).render(
|
|
12
|
-
<StrictMode>
|
|
13
|
-
<FeltKitProvider client={client}>
|
|
14
|
-
<App />
|
|
15
|
-
</FeltKitProvider>
|
|
16
|
-
</StrictMode>,
|
|
17
|
-
);
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
/* The app's own tokens. FeltKit's components pick them up (--accent, --surface, --ink, --muted, --line, --radius). */
|
|
2
|
-
:root {
|
|
3
|
-
color-scheme: light dark;
|
|
4
|
-
--bg: light-dark(#f6f6f4, #101211);
|
|
5
|
-
--surface: light-dark(#ffffff, #181b1a);
|
|
6
|
-
--ink: light-dark(#1b1d1c, #eceeed);
|
|
7
|
-
--muted: light-dark(#6b706d, #9aa19d);
|
|
8
|
-
--line: light-dark(#e4e5e1, #2a2f2c);
|
|
9
|
-
--accent: light-dark(#4338ca, #a5b4fc);
|
|
10
|
-
--accent-ink: light-dark(#ffffff, #111827);
|
|
11
|
-
--radius: 10px;
|
|
12
|
-
font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
|
|
13
|
-
background: var(--bg);
|
|
14
|
-
color: var(--ink);
|
|
15
|
-
}
|
|
16
|
-
* { box-sizing: border-box; }
|
|
17
|
-
body { margin: 0; }
|
|
18
|
-
button, input, textarea { font: inherit; color: inherit; }
|
|
19
|
-
.center { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }
|
|
20
|
-
.shell { min-height: 100vh; }
|
|
21
|
-
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
|
|
22
|
-
.topbar .left { display: flex; align-items: center; gap: 12px; min-width: 0; }
|
|
23
|
-
.brand { font-size: 17px; }
|
|
24
|
-
nav { display: flex; gap: 4px; }
|
|
25
|
-
nav button { border: 0; background: transparent; padding: 8px 12px; border-radius: 8px; cursor: pointer; color: var(--muted); }
|
|
26
|
-
nav button.on { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--ink); font-weight: 600; }
|
|
27
|
-
main { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; display: flex; flex-direction: column; gap: 12px; }
|
|
28
|
-
h1 { font-size: 22px; margin: 4px 0 12px; }
|
|
29
|
-
.muted { color: var(--muted); }
|
|
30
|
-
.error { color: #c0262d; }
|
|
31
|
-
.compose { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
|
|
32
|
-
.compose input, .compose textarea { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
|
|
33
|
-
.compose button { align-self: flex-start; padding: 9px 16px; border: 0; border-radius: var(--radius); background: var(--accent); color: var(--accent-ink); font-weight: 600; cursor: pointer; }
|
|
34
|
-
.list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
|
|
35
|
-
.list li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
|
|
36
|
-
.list p { margin: 4px 0; white-space: pre-wrap; }
|
|
37
|
-
.ghost { border: 1px solid var(--line); background: transparent; border-radius: 8px; padding: 4px 10px; cursor: pointer; height: fit-content; }
|
|
38
|
-
@media (max-width: 560px) { .topbar { padding: 8px 12px; } nav button { padding: 6px 8px; } }
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The composed foundation, as executable guarantees: accounts exist, a workspace can be created and
|
|
3
|
-
* its members hold the roles the composition declared. Add your own tests beside this one.
|
|
4
|
-
* Run with `npm test` (`feltkit test`).
|
|
5
|
-
*/
|
|
6
|
-
import { test } from "node:test";
|
|
7
|
-
import assert from "node:assert/strict";
|
|
8
|
-
import { createTestApp } from "@feltdb/feltkit/testing";
|
|
9
|
-
|
|
10
|
-
test("the foundation: accounts, a workspace, and its declared roles", async () => {
|
|
11
|
-
const t = await createTestApp();
|
|
12
|
-
try {
|
|
13
|
-
const runtime = t.runtime;
|
|
14
|
-
assert.ok(runtime.accounts, "accounts are part of the foundation");
|
|
15
|
-
const created = await runtime.accounts!.signUp({ email: "owner@example.com", password: "a-long-password-1", name: "Owner" });
|
|
16
|
-
await runtime.accounts!.markVerified(created.id);
|
|
17
|
-
assert.ok(t.tenancy, "workspaces are part of the foundation");
|
|
18
|
-
const options = runtime.project.app.options as unknown as { roles: Record<string, string[]>; auth: { tenant: { roles: string[] } } };
|
|
19
|
-
assert.ok(options.auth.tenant.roles.length > 0, "the workspace declares its roles");
|
|
20
|
-
for (const role of options.auth.tenant.roles) assert.ok(role in options.roles, `role ${role} is declared`);
|
|
21
|
-
} finally {
|
|
22
|
-
await t.close();
|
|
23
|
-
}
|
|
24
|
-
});
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "ES2022",
|
|
4
|
-
"module": "ESNext",
|
|
5
|
-
"moduleResolution": "Bundler",
|
|
6
|
-
"lib": ["ES2023", "DOM", "DOM.Iterable"],
|
|
7
|
-
"jsx": "react-jsx",
|
|
8
|
-
"strict": true,
|
|
9
|
-
"noEmit": true,
|
|
10
|
-
"skipLibCheck": true,
|
|
11
|
-
"isolatedModules": true,
|
|
12
|
-
"verbatimModuleSyntax": true,
|
|
13
|
-
"types": ["node", "vite/client"]
|
|
14
|
-
},
|
|
15
|
-
"include": ["src", "feltkit", "tests", "vite.config.ts"]
|
|
16
|
-
}
|