@somewhere-cloud/cli 0.38.96 → 0.38.97
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/CHANGELOG.md +10 -0
- package/dist/commands/cron.js +45 -0
- package/dist/commands/cron.js.map +1 -1
- package/dist/commands/deploy.d.ts +2 -2
- package/dist/commands/deploy.js +12 -11
- package/dist/commands/deploy.js.map +1 -1
- package/dist/commands/dev.js +70 -11
- package/dist/commands/dev.js.map +1 -1
- package/dist/commands/lint.js +1 -1
- package/dist/commands/lint.js.map +1 -1
- package/dist/commands/test.js +13 -3
- package/dist/commands/test.js.map +1 -1
- package/dist/lib/app-test.d.ts +5 -29
- package/dist/lib/app-test.js +27 -49
- package/dist/lib/app-test.js.map +1 -1
- package/dist/lib/form-accounts.d.ts +2 -1
- package/dist/lib/form-accounts.js +3 -2
- package/dist/lib/form-accounts.js.map +1 -1
- package/dist/lib/form-auth.d.ts +4 -0
- package/dist/lib/form-auth.js +24 -4
- package/dist/lib/form-auth.js.map +1 -1
- package/dist/lib/init-agent-guide.d.ts +2 -2
- package/dist/lib/init-agent-guide.js +20 -10
- package/dist/lib/init-agent-guide.js.map +1 -1
- package/dist/lib/init-feature-template.js +5 -5
- package/dist/lib/init-scaffold.d.ts +5 -2
- package/dist/lib/init-scaffold.js +7 -3
- package/dist/lib/init-scaffold.js.map +1 -1
- package/dist/lib/init-test-template.js +7 -3
- package/dist/lib/init-test-template.js.map +1 -1
- package/dist/lib/init-ui-kit.d.ts +2 -2
- package/dist/lib/init-ui-kit.js +10 -10
- package/dist/lib/next-actions.js +4 -3
- package/dist/lib/next-actions.js.map +1 -1
- package/dist/lib/preview-jobs.d.ts +32 -0
- package/dist/lib/preview-jobs.js +38 -0
- package/dist/lib/preview-jobs.js.map +1 -0
- package/dist/lib/reference-check-note.d.ts +17 -0
- package/dist/lib/reference-check-note.js +27 -0
- package/dist/lib/reference-check-note.js.map +1 -0
- package/dist/lib/test-diagnostics.js +34 -7
- package/dist/lib/test-diagnostics.js.map +1 -1
- package/dist/lib/test-report.d.ts +18 -0
- package/dist/lib/test-report.js +39 -0
- package/dist/lib/test-report.js.map +1 -0
- package/dist/lib/test-scripts.d.ts +10 -2
- package/dist/lib/test-scripts.js +68 -20
- package/dist/lib/test-scripts.js.map +1 -1
- package/npm-shrinkwrap.json +2 -2
- package/package.json +1 -1
- package/runtime/DECLARED-DATA-VENDOR.json +5 -4
- package/runtime/PLATFORM-SOURCE.json +1 -1
- package/runtime/declared-data.cjs +1 -1
|
@@ -2065,8 +2065,8 @@ export function AppShell({ appName, homeLink, account, busy, children }: AppShel
|
|
|
2065
2065
|
<a className="brand" {...homeLink}>{appName}</a>
|
|
2066
2066
|
{account ? (
|
|
2067
2067
|
<div className="account">
|
|
2068
|
-
<span className="account__label" title={account.label}>{account.label}</span>
|
|
2069
|
-
<button type="button" className="button button--quiet" onClick={account.onSignOut} disabled={account.signingOut} data-sw-auth="sign-out">
|
|
2068
|
+
<span className="account__label" title={account.label} data-testid="current-user">{account.label}</span>
|
|
2069
|
+
<button type="button" className="button button--quiet" onClick={account.onSignOut} disabled={account.signingOut} data-sw-auth="sign-out" data-testid="signout">
|
|
2070
2070
|
{account.signingOut ? 'Signing out…' : 'Sign out'}
|
|
2071
2071
|
</button>
|
|
2072
2072
|
</div>
|
|
@@ -2237,8 +2237,8 @@ export function AppShell({ appName, homeLink, account, busy, children }: AppShel
|
|
|
2237
2237
|
<a {...homeLink}>{appName}</a>
|
|
2238
2238
|
{account ? (
|
|
2239
2239
|
<>
|
|
2240
|
-
{' '}<span>{account.label}</span>{' '}
|
|
2241
|
-
<button type="button" onClick={account.onSignOut} disabled={account.signingOut} data-sw-auth="sign-out">
|
|
2240
|
+
{' '}<span data-testid="current-user">{account.label}</span>{' '}
|
|
2241
|
+
<button type="button" onClick={account.onSignOut} disabled={account.signingOut} data-sw-auth="sign-out" data-testid="signout">
|
|
2242
2242
|
{account.signingOut ? 'Signing out…' : 'Sign out'}
|
|
2243
2243
|
</button>
|
|
2244
2244
|
{account.error ? <p role="alert">{account.error}</p> : null}
|
|
@@ -3183,7 +3183,7 @@ export function createFeatureTemplate(selection, options) {
|
|
|
3183
3183
|
...starterTests({ privateData }),
|
|
3184
3184
|
{ path: '.gitignore', content: buildScaffoldGitignore() },
|
|
3185
3185
|
{ path: 'AGENTS.md', content: INIT_AGENTS_MD.replace(/## Getting started[^]*?After edits:/, `## Testing
|
|
3186
|
-
Run somewhere test after a successful deploy: npx somewhere deploy && npx somewhere test
|
|
3186
|
+
Run somewhere test after a successful deploy: npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
|
|
3187
3187
|
It runs every tests/*.mjs and tests/*.cjs Playwright script and prints failures first.
|
|
3188
3188
|
Start from tests/app-check.mjs: change its checks to the journeys you changed and your access boundaries.
|
|
3189
3189
|
Helpers from @somewhere-cloud/cli/script (import or require): signUp/signIn/signOut through your form,
|
|
@@ -8,8 +8,11 @@ export interface InitScaffoldResult {
|
|
|
8
8
|
/**
|
|
9
9
|
* Rule-9 boundary for `somewhere init`: a new/empty directory receives the
|
|
10
10
|
* starter, while a directory containing application source keeps the original
|
|
11
|
-
* link-only behavior.
|
|
12
|
-
*
|
|
11
|
+
* link-only behavior. Metadata the init command owns and other hidden files
|
|
12
|
+
* (a `.t_start` timestamp, `.env`, `.nvmrc`) are not source, so the starter is
|
|
13
|
+
* written beside them; a hidden file the starter also writes (`.gitignore`) is
|
|
14
|
+
* refused by the writer's overwrite check, never replaced. Hidden folders still
|
|
15
|
+
* count as source.
|
|
13
16
|
*/
|
|
14
17
|
export declare function canWriteInitScaffold(dir: string): boolean;
|
|
15
18
|
/**
|
|
@@ -10,13 +10,17 @@ const INIT_METADATA = new Set([
|
|
|
10
10
|
/**
|
|
11
11
|
* Rule-9 boundary for `somewhere init`: a new/empty directory receives the
|
|
12
12
|
* starter, while a directory containing application source keeps the original
|
|
13
|
-
* link-only behavior.
|
|
14
|
-
*
|
|
13
|
+
* link-only behavior. Metadata the init command owns and other hidden files
|
|
14
|
+
* (a `.t_start` timestamp, `.env`, `.nvmrc`) are not source, so the starter is
|
|
15
|
+
* written beside them; a hidden file the starter also writes (`.gitignore`) is
|
|
16
|
+
* refused by the writer's overwrite check, never replaced. Hidden folders still
|
|
17
|
+
* count as source.
|
|
15
18
|
*/
|
|
16
19
|
export function canWriteInitScaffold(dir) {
|
|
17
20
|
if (!existsSync(dir))
|
|
18
21
|
return true;
|
|
19
|
-
return readdirSync(dir
|
|
22
|
+
return readdirSync(dir, { withFileTypes: true })
|
|
23
|
+
.every((entry) => INIT_METADATA.has(entry.name) || (entry.name.startsWith('.') && entry.isFile()));
|
|
20
24
|
}
|
|
21
25
|
/**
|
|
22
26
|
* The non-metadata entries of `dir`, split into app source and everything
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-scaffold.js","sourceRoot":"","sources":["../../src/lib/init-scaffold.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAW5D,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC;IAC5B,WAAW;IACX,MAAM;IACN,WAAW;IACX,iBAAiB;CAClB,CAAC,CAAC;AAEH
|
|
1
|
+
{"version":3,"file":"init-scaffold.js","sourceRoot":"","sources":["../../src/lib/init-scaffold.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,SAAS,EACT,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAW5D,MAAM,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,CAAC,CAAC;QAClE,CAAC;QACD,IAAI,CAAC;YACH,aAAa,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;YACvF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;gBAAE,MAAM,GAAG,CAAC;YAChE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvB,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;AAC3B,CAAC"}
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
// from @somewhere-cloud/cli/script and work the same from .mjs or .cjs.
|
|
4
4
|
const SCRIPT = (privateData) => `// tests/app-check.mjs — an ordinary Playwright script for this app: change the checks to match
|
|
5
5
|
// what you built. Run it after a successful deploy, never after a refused one:
|
|
6
|
-
// npx somewhere deploy && npx somewhere test
|
|
6
|
+
// npx @somewhere-cloud/cli deploy && npx @somewhere-cloud/cli test
|
|
7
7
|
// It writes its result once to .somewhere/app-check.json; the exit code is the verdict.
|
|
8
8
|
// It stops at the first failed check and prints the page's URL and visible error text.
|
|
9
|
-
// After a fix, rerun
|
|
9
|
+
// After a fix, rerun the scripts that failed, each one whole: npx @somewhere-cloud/cli test --failed.
|
|
10
10
|
// From a .cjs script: const { openAppTest } = require('@somewhere-cloud/cli/script');
|
|
11
11
|
import { chromium } from '@playwright/test';
|
|
12
12
|
import { openAppTest${privateData ? ', captureResponses, dataReady' : ''} } from '@somewhere-cloud/cli/script';
|
|
@@ -46,7 +46,11 @@ ${privateData ? ` await app.check('a note stays private to its owner', async ()
|
|
|
46
46
|
// data contract and the Origin, and says ok, empty or refused. No need to read either from the page.
|
|
47
47
|
// const { data: [task] } = await app.data(ana.page, { table: 'tasks', operation: 'list' });
|
|
48
48
|
// await app.expectRefused(ben.page, { table: 'tasks', operation: 'get', id: task.id }, { allowed: ana.page });
|
|
49
|
-
`}
|
|
49
|
+
`} // A list item opens its page when a person clicks the item itself. Click the item element, not a link
|
|
50
|
+
// inside it: a test that clicks the inner link passes even when clicking the item does nothing.
|
|
51
|
+
// await ana.page.getByTestId('team-item').first().click();
|
|
52
|
+
// await ana.page.getByTestId('team-name').waitFor(); // the item's own page, reached in the app
|
|
53
|
+
await app.check('at phone width nothing scrolls sideways', async () => {
|
|
50
54
|
await ana.page.setViewportSize({ width: 390, height: 844 });
|
|
51
55
|
await ana.page.reload();
|
|
52
56
|
await ana.page.getByText(ana.account.email).waitFor();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,kGAAkG;AAClG,wEAAwE;AAExE,MAAM,MAAM,GAAG,CAAC,WAAoB,EAAE,EAAE,CAAC;;;;;;;;sBAQnB,WAAW,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;EAkBtE,WAAW,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;CAef,CAAC,CAAC,CAAC;;;;CAIH
|
|
1
|
+
{"version":3,"file":"init-test-template.js","sourceRoot":"","sources":["../../src/lib/init-test-template.ts"],"names":[],"mappings":"AAEA,iGAAiG;AACjG,kGAAkG;AAClG,wEAAwE;AAExE,MAAM,MAAM,GAAG,CAAC,WAAoB,EAAE,EAAE,CAAC;;;;;;;;sBAQnB,WAAW,CAAC,CAAC,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;EAkBtE,WAAW,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;CAef,CAAC,CAAC,CAAC;;;;CAIH;;;;;;;;;;;;;;;;;;CAkBA,CAAC;AAEF,kGAAkG;AAClG,MAAM,UAAU,YAAY,CAAC,UAAqC,EAAE;IAClE,OAAO,CAAC,EAAE,IAAI,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { InitScaffoldFile } from './init-scaffold.js';
|
|
2
2
|
export declare const TOKENS_CSS = "/* Design tokens: the only place colours, type and spacing are defined.\n app.css and src/ui read these; pages never write a raw hex or px value.\n To restyle the whole app, change the values here.\n\n Fonts are local stacks only (no network fonts), chosen so every platform\n falls back to a good face, not to Arial/Times. Prefer one family: set\n --font-display to a serif stack only if the app wants that personality. */\n:root {\n color-scheme: light;\n\n --font-body: system-ui, -apple-system, \"Segoe UI\", Roboto, \"Helvetica Neue\", Arial, sans-serif;\n --font-display: var(--font-body);\n /* Serif alternative: \"Iowan Old Style\", \"Palatino Linotype\", Palatino, Georgia, serif; */\n --font-mono: ui-monospace, \"SF Mono\", Menlo, Consolas, \"Liberation Mono\", monospace;\n\n --text-xs: 0.75rem;\n --text-sm: 0.875rem;\n --text-base: 1rem;\n --text-lg: 1.125rem;\n --text-xl: 1.375rem;\n --text-2xl: 1.75rem;\n --text-display: clamp(2rem, 4.4vw, 2.75rem);\n --tracking-display: -0.02em;\n --tracking-label: 0.06em;\n\n --space-1: 4px;\n --space-2: 8px;\n --space-3: 12px;\n --space-4: 16px;\n --space-5: 20px;\n --space-6: 24px;\n --space-8: 32px;\n --space-10: 40px;\n --space-12: 48px;\n --space-16: 64px;\n\n --radius-control: 8px;\n --radius-panel: 14px;\n --radius-pill: 999px;\n\n --control-height: 44px;\n --content-width: 1040px;\n\n --shadow-sm: 0 1px 2px rgba(28, 27, 24, 0.05);\n --shadow-md: 0 1px 2px rgba(28, 27, 24, 0.05), 0 16px 40px -28px rgba(28, 27, 24, 0.35);\n --shadow-lg: 0 24px 64px -24px rgba(28, 27, 24, 0.45);\n\n /* Surfaces and text */\n --color-bg: #f5f3ee;\n --color-surface: #ffffff;\n --color-surface-2: #faf8f4;\n --color-text: #1c1b18;\n --color-muted: #66615a;\n --color-border: #e0dbd1;\n --color-border-strong: #c9c2b5;\n\n /* One accent. Everything interactive uses it. */\n --color-accent: #1d6b52;\n --color-accent-hover: #185b46;\n --color-accent-soft: #e3efe9;\n --color-on-accent: #ffffff;\n --color-focus: #1d6b52;\n\n /* Semantic tones for badges, notices and stats: not for buttons. */\n --color-success: #1d6b52;\n --color-success-soft: #e3efe9;\n --color-warning: #8a5a00;\n --color-warning-soft: #f7ebd2;\n --color-danger: #b42318;\n --color-danger-soft: #fbe4e1;\n --color-info: #2a5d9f;\n --color-info-soft: #e1eaf7;\n}\n\n@media (prefers-color-scheme: dark) {\n :root {\n color-scheme: dark;\n\n --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);\n --shadow-md: 0 1px 2px rgba(0, 0, 0, 0.3), 0 16px 40px -28px rgba(0, 0, 0, 0.7);\n --shadow-lg: 0 24px 64px -24px rgba(0, 0, 0, 0.8);\n\n --color-bg: #15161a;\n --color-surface: #1e2025;\n --color-surface-2: #24272d;\n --color-text: #ecebe6;\n --color-muted: #a19d95;\n --color-border: #31343b;\n --color-border-strong: #454953;\n\n --color-accent: #5fbf9a;\n --color-accent-hover: #74cba9;\n --color-accent-soft: #1f3a31;\n --color-on-accent: #0f1f19;\n --color-focus: #5fbf9a;\n\n --color-success: #5fbf9a;\n --color-success-soft: #1f3a31;\n --color-warning: #e2b25a;\n --color-warning-soft: #3a2f16;\n --color-danger: #f0867c;\n --color-danger-soft: #42221f;\n --color-info: #7fa9e6;\n --color-info-soft: #1f2d42;\n }\n}\n";
|
|
3
3
|
export declare const APP_CSS = "/* Base styles and the classes src/ui components render. Values come from\n tokens.css. Add app-specific styles at the end of this file, or in a new\n file imported from src/main.tsx; do not restyle native elements globally. */\n\n/* ---------- Base ---------- */\n*, *::before, *::after { box-sizing: border-box; }\nhtml { -webkit-text-size-adjust: 100%; }\nbody {\n margin: 0;\n min-width: 320px;\n background: var(--color-bg);\n color: var(--color-text);\n font: 400 var(--text-base)/1.55 var(--font-body);\n -webkit-font-smoothing: antialiased;\n}\nbutton, input, select, textarea { font: inherit; color: inherit; }\nh1, h2, h3, p { margin: 0; }\nh1, h2, h3 { font-family: var(--font-display); line-height: 1.2; letter-spacing: var(--tracking-display); font-weight: 600; }\nh1 { font-size: var(--text-2xl); }\nh2 { font-size: var(--text-xl); }\nh3 { font-size: var(--text-lg); }\na { color: var(--color-accent); text-underline-offset: 3px; }\ncode, kbd { font-family: var(--font-mono); font-size: 0.9em; }\n:focus-visible { outline: 3px solid var(--color-focus); outline-offset: 2px; }\n::placeholder { color: var(--color-muted); opacity: 0.8; }\n\n.muted { color: var(--color-muted); }\n.hint { margin: 0; color: var(--color-muted); font-size: var(--text-sm); font-weight: 400; }\n.error { margin: 0; color: var(--color-danger); font-size: var(--text-sm); }\n.skip-link { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; position: absolute; left: var(--space-3); top: -60px; padding: var(--space-2) var(--space-3); background: var(--color-text); color: var(--color-bg); z-index: 10; }\n.skip-link:focus { top: var(--space-3); }\n.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }\n\n/* ---------- Layout primitives (src/ui/layout.tsx) ---------- */\n.stack { display: grid; gap: var(--stack-gap, var(--space-4)); align-content: start; }\n.stack > *, .grid > *, .card > *, .content > * { min-width: 0; }\n.inline { display: flex; flex-wrap: wrap; gap: var(--inline-gap, var(--space-2)); align-items: var(--inline-align, center); justify-content: var(--inline-justify, flex-start); }\n.grid { display: grid; gap: var(--grid-gap, var(--space-4)); grid-template-columns: repeat(auto-fit, minmax(min(var(--grid-min, 220px), 100%), 1fr)); }\n.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }\n\n.page-header { display: flex; flex-wrap: wrap; gap: var(--space-4); align-items: flex-end; justify-content: space-between; margin-bottom: var(--space-8); }\n.page-header__text { display: grid; gap: var(--space-1); min-width: 0; }\n.page-header__title { font-size: var(--text-display); line-height: 1.1; }\n.page-header__description { color: var(--color-muted); max-width: 60ch; }\n\n.eyebrow { margin: 0; color: var(--color-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; }\n.section-title { margin: 0 0 var(--space-3); font-size: var(--text-sm); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--color-muted); }\n\n/* ---------- Panel and Card ---------- */\n.panel {\n display: grid;\n gap: var(--space-4);\n padding: var(--space-6);\n border: 1px solid var(--color-border);\n border-radius: var(--radius-panel);\n background: var(--color-surface);\n box-shadow: var(--shadow-md);\n}\n.panel__title { margin: 0; font: 600 var(--text-lg)/1.2 var(--font-display); }\n\n.card { display: grid; gap: 0; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); box-shadow: var(--shadow-sm); overflow: hidden; }\n.card__header { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; padding: var(--space-4) var(--space-5); border-bottom: 1px solid var(--color-border); }\n.card__heading { display: grid; gap: 2px; min-width: 0; }\n.card__title { font-size: var(--text-base); font-weight: 600; letter-spacing: 0; }\n.card__description { color: var(--color-muted); font-size: var(--text-sm); }\n.card__body { padding: var(--space-5); }\n.card__body--flush { padding: 0; }\n.card__footer { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); background: var(--color-surface-2); }\n\n/* ---------- Buttons (src/ui/Button.tsx) ---------- */\n.button {\n display: inline-flex;\n align-items: center;\n justify-content: center;\n gap: var(--space-2);\n min-height: var(--control-height);\n padding: 0 var(--space-4);\n border: 1px solid var(--color-accent);\n border-radius: var(--radius-control);\n background: var(--color-accent);\n color: var(--color-on-accent);\n font-weight: 600;\n line-height: 1.2;\n white-space: nowrap;\n text-decoration: none;\n cursor: pointer;\n transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;\n}\n.button:hover:not(:disabled) { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }\n.button:disabled { opacity: 0.5; cursor: not-allowed; }\n.button--secondary { background: var(--color-surface); border-color: var(--color-border-strong); color: var(--color-text); }\n.button--secondary:hover:not(:disabled) { background: var(--color-surface-2); border-color: var(--color-border-strong); }\n.button--quiet { background: transparent; border-color: transparent; color: var(--color-text); }\n.button--quiet:hover:not(:disabled) { background: var(--color-accent-soft); border-color: transparent; }\n.button--danger { background: var(--color-danger); border-color: var(--color-danger); color: #fff; }\n.button--danger:hover:not(:disabled) { background: var(--color-danger); border-color: var(--color-danger); filter: brightness(0.92); }\n.button--sm { padding: 0 var(--space-3); font-size: var(--text-sm); }\n.button--block { width: 100%; }\n.button__spinner { width: 1em; height: 1em; border-width: 2px; }\n\n.link-button {\n display: inline-flex; align-items: center; min-height: var(--control-height);\n padding: 0 var(--space-2); border: 0; background: none;\n color: var(--color-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;\n}\n.link-button:disabled { opacity: 0.5; cursor: not-allowed; }\n.link-button--danger { color: var(--color-danger); }\n\n/* ---------- Fields (src/ui/Field.tsx) ---------- */\n.field { display: grid; gap: 6px; min-width: 0; }\n.field__label { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); font-weight: 600; }\n.field__optional { color: var(--color-muted); font-weight: 400; }\n.field .control {\n width: 100%;\n min-height: var(--control-height);\n padding: 10px 12px;\n border: 1px solid var(--color-border-strong);\n border-radius: var(--radius-control);\n background: var(--color-surface);\n color: var(--color-text);\n}\n.field .control:hover { border-color: var(--color-muted); }\n.field .control[aria-invalid=\"true\"] { border-color: var(--color-danger); }\n.field .control:disabled { background: var(--color-surface-2); color: var(--color-muted); cursor: not-allowed; }\n.field textarea.control { min-height: calc(var(--control-height) * 2.2); resize: vertical; line-height: 1.5; }\n.field select.control {\n appearance: none;\n padding-right: 40px;\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16' fill='none' stroke='%2366615a' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E\");\n background-repeat: no-repeat;\n background-position: right 12px center;\n}\n.field input[type=\"date\"].control, .field input[type=\"time\"].control { min-width: 10ch; }\n.field--inline { grid-template-columns: auto 1fr; align-items: center; }\n.field--inline .field__label { font-weight: 400; }\n.field input[type=\"checkbox\"], .field input[type=\"radio\"] { width: 20px; height: 20px; margin: 0; accent-color: var(--color-accent); }\n.field__hint { color: var(--color-muted); font-size: var(--text-sm); }\n.field__error { color: var(--color-danger); font-size: var(--text-sm); }\n.form-row { display: grid; gap: var(--space-4); grid-template-columns: repeat(auto-fit, minmax(min(var(--form-row-min, 160px), 100%), 1fr)); align-items: start; }\n\n/* ---------- Tabs (src/ui/Tabs.tsx) ---------- */\n.tabs { display: flex; gap: var(--space-1); padding: var(--space-1); min-height: var(--control-height); border: 1px solid var(--color-border); border-radius: var(--radius-control); background: var(--color-surface-2); overflow-x: auto; scrollbar-width: none; max-width: 100%; }\n.tabs::-webkit-scrollbar { display: none; }\n.tab { flex: 0 0 auto; min-height: calc(var(--control-height) - 8px); padding: 0 var(--space-4); border: 0; border-radius: calc(var(--radius-control) - 2px); background: transparent; color: var(--color-muted); font-weight: 600; font-size: var(--text-sm); white-space: nowrap; cursor: pointer; }\n.tab:hover { color: var(--color-text); }\n.tab[aria-selected=\"true\"] { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-sm); }\n\n/* ---------- Badge (src/ui/Badge.tsx) ---------- */\n.badge { display: inline-flex; align-items: center; gap: 6px; min-height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--color-surface-2); border: 1px solid var(--color-border); color: var(--color-text); font-size: var(--text-xs); font-weight: 600; letter-spacing: 0.02em; white-space: nowrap; }\n.badge--accent { background: var(--color-accent-soft); border-color: transparent; color: var(--color-accent); }\n.badge--success { background: var(--color-success-soft); border-color: transparent; color: var(--color-success); }\n.badge--warning { background: var(--color-warning-soft); border-color: transparent; color: var(--color-warning); }\n.badge--danger { background: var(--color-danger-soft); border-color: transparent; color: var(--color-danger); }\n.badge--info { background: var(--color-info-soft); border-color: transparent; color: var(--color-info); }\n.badge__dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }\n\n/* ---------- Stat (src/ui/Stat.tsx) ---------- */\n.stat { display: grid; gap: var(--space-2); padding: var(--space-5); border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); box-shadow: var(--shadow-sm); }\n.stat__value { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 600; letter-spacing: var(--tracking-display); line-height: 1.1; font-variant-numeric: tabular-nums; }\n.stat__value small { color: var(--color-muted); font-size: 0.55em; font-weight: 500; letter-spacing: 0; margin-left: 0.3em; }\n.stat__detail { color: var(--color-muted); font-size: var(--text-sm); }\n.stat__detail--success { color: var(--color-success); }\n.stat__detail--danger { color: var(--color-danger); }\n.meter { height: 6px; border-radius: var(--radius-pill); background: var(--color-border); overflow: hidden; }\n.meter__fill { height: 100%; border-radius: inherit; background: var(--color-accent); transition: width 240ms ease; }\n\n/* ---------- Table (src/ui/Table.tsx) ---------- */\n.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; container-type: inline-size; }\n.table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); font-variant-numeric: tabular-nums; }\n.table th, .table td { padding: var(--space-3) var(--space-5); text-align: left; vertical-align: middle; border-bottom: 1px solid var(--color-border); }\n.table th { color: var(--color-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; white-space: nowrap; background: var(--color-surface-2); }\n.table tbody tr:last-child td { border-bottom: 0; }\n.table tbody tr:hover td { background: var(--color-surface-2); }\n.table .is-numeric { text-align: right; }\n.table__empty { padding: var(--space-8) var(--space-5); text-align: center; color: var(--color-muted); }\n/* A narrow card (a phone): each row becomes a block of label and value lines, so nothing scrolls sideways. */\n@container (max-width: 560px) {\n .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }\n .table, .table tbody, .table tr { display: block; width: 100%; }\n .table tr { padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); }\n .table tbody tr:last-child { border-bottom: 0; }\n .table td { display: flex; gap: var(--space-3); align-items: baseline; padding: var(--space-1) 0; border-bottom: 0; text-align: left; overflow-wrap: anywhere; }\n .table td::before { content: attr(data-label); flex: 0 0 38%; color: var(--color-muted); font-size: var(--text-xs); font-weight: 600; letter-spacing: var(--tracking-label); text-transform: uppercase; }\n .table td.is-numeric { text-align: left; }\n .table tbody tr:hover td { background: transparent; }\n .table .table__empty { display: block; padding: var(--space-6) 0; text-align: center; }\n .table .table__empty::before { content: none; }\n}\n\n/* ---------- Notice (src/ui/Notice.tsx) ---------- */\n.notice { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-left-width: 4px; border-radius: var(--radius-control); background: var(--color-surface); font-size: var(--text-sm); }\n.notice__body { flex: 1 1 240px; display: grid; gap: 2px; min-width: 0; }\n.notice__title { font-weight: 600; }\n.notice--info { border-left-color: var(--color-info); }\n.notice--success { border-left-color: var(--color-success); }\n.notice--warning { border-left-color: var(--color-warning); }\n.notice--danger { border-left-color: var(--color-danger); }\n.notice__actions { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }\n\n/* Alert from feedback.tsx; Notice is preferred for new code. */\n.alert { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; padding: var(--space-3) var(--space-4); border: 1px solid var(--color-danger); border-radius: var(--radius-control); color: var(--color-danger); background: var(--color-surface); }\n.alert p { margin: 0; }\n\n/* ---------- Dialog (src/ui/Dialog.tsx) ---------- */\n.dialog { width: min(480px, calc(100% - 2 * var(--space-4))); padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius-panel); background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-lg); }\n.dialog::backdrop { background: rgba(20, 20, 18, 0.45); backdrop-filter: blur(2px); }\n.dialog__header { display: flex; align-items: start; justify-content: space-between; gap: var(--space-3); padding: var(--space-5) var(--space-5) 0; }\n.dialog__title { font-size: var(--text-lg); }\n.dialog__body { display: grid; gap: var(--space-4); padding: var(--space-4) var(--space-5) var(--space-5); }\n.dialog__footer { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: flex-end; padding: var(--space-3) var(--space-5); border-top: 1px solid var(--color-border); background: var(--color-surface-2); }\n\n/* ---------- Skeleton (src/ui/Skeleton.tsx) ---------- */\n.skeleton { display: grid; gap: var(--space-2); }\n.skeleton__line { height: 1em; border-radius: 4px; background: linear-gradient(90deg, var(--color-border) 25%, var(--color-surface-2) 50%, var(--color-border) 75%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }\n@keyframes shimmer { to { background-position: -200% 0; } }\n\n/* ---------- Empty state (src/ui/feedback.tsx) ---------- */\n.empty { display: grid; gap: var(--space-2); justify-items: center; padding: var(--space-10) var(--space-6); border: 1px dashed var(--color-border-strong); border-radius: var(--radius-panel); text-align: center; }\n.empty__title { margin: 0; font: 600 var(--text-lg)/1.3 var(--font-display); }\n.empty__body { margin: 0; color: var(--color-muted); max-width: 44ch; }\n\n/* ---------- Loading, unavailable, banner ---------- */\n.loading { display: grid; place-content: center; justify-items: center; gap: var(--space-3); min-height: 100vh; color: var(--color-muted); }\n.unavailable { max-width: 380px; margin: 0 var(--space-4); color: var(--color-text); }\n.unavailable p { margin: 0; }\n.banner { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: center; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-danger); background: var(--color-surface); color: var(--color-danger); }\n.banner p { margin: 0; }\n.spinner { width: 24px; height: 24px; border: 3px solid var(--color-border); border-top-color: var(--color-accent); border-radius: 50%; animation: spin 0.8s linear infinite; }\n@keyframes spin { to { transform: rotate(360deg); } }\n\n/* ---------- Sign-in (src/ui/AuthCard.tsx) ---------- */\n.auth {\n display: grid;\n grid-template-columns: minmax(0, 1fr) minmax(300px, 400px);\n gap: var(--space-12);\n align-items: center;\n width: min(960px, calc(100% - 2 * var(--space-6)));\n min-height: 100vh;\n margin: 0 auto;\n padding: var(--space-12) 0;\n}\n.auth__intro { display: grid; gap: var(--space-3); align-content: center; }\n.auth__app { margin: 0; color: var(--color-accent); font-weight: 600; }\n.auth__title { margin: 0; font-size: var(--text-display); line-height: 1.05; }\n.auth__column { display: grid; gap: var(--space-4); }\n.auth__form .button { width: 100%; }\n.auth__providers { display: grid; gap: var(--space-2); }\n.auth__forgot { margin: 0; text-align: right; font-size: var(--text-sm); }\n.auth__switch { margin: 0; text-align: center; color: var(--color-muted); font-size: var(--text-sm); }\n.auth__forgot a, .auth__switch a { display: inline-flex; align-items: center; min-height: 44px; }\n.divider { display: flex; align-items: center; gap: var(--space-3); color: var(--color-muted); font-size: var(--text-sm); }\n.divider::before, .divider::after { content: \"\"; flex: 1; height: 1px; background: var(--color-border); }\n.provider-icon { width: 18px; height: 18px; flex: none; }\n\n/* ---------- Signed-in frame (src/ui/AppShell.tsx) ---------- */\n.shell { min-height: 100vh; }\n.topbar {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: var(--space-4);\n width: min(var(--content-width), calc(100% - 2 * var(--space-6)));\n margin: 0 auto;\n padding: var(--space-3) 0;\n border-bottom: 1px solid var(--color-border);\n}\n.topbar__error { width: min(var(--content-width), calc(100% - 2 * var(--space-6))); margin: var(--space-2) auto 0; }\n.brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: 44px; font: 600 var(--text-lg)/1 var(--font-display); letter-spacing: var(--tracking-display); color: inherit; text-decoration: none; }\n.account { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }\n.account__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-muted); font-size: var(--text-sm); }\n.content { width: min(var(--content-width), calc(100% - 2 * var(--space-6))); margin: 0 auto; padding: var(--space-8) 0 var(--space-16); outline: none; }\n\n/* ---------- Email verification (src/ui/VerifyEmail.tsx) ---------- */\n.verify-email { margin-bottom: var(--space-6); }\n.verify-email__form { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }\n.verify-email__form .field { grid-template-columns: auto auto; align-items: center; }\n.verify-email__form input { width: 8ch; letter-spacing: 0.2em; text-align: center; }\n\n/* ---------- Responsive ---------- */\n@media (max-width: 760px) {\n .auth { grid-template-columns: 1fr; gap: var(--space-6); align-content: start; padding-top: var(--space-8); }\n .auth__title { font-size: var(--text-2xl); }\n .page-header { margin-bottom: var(--space-6); }\n .page-header__title { font-size: var(--text-2xl); }\n .content { padding-top: var(--space-6); }\n}\n@media (max-width: 480px) {\n .panel { padding: var(--space-4); }\n .card__header, .card__body, .card__footer { padding-left: var(--space-4); padding-right: var(--space-4); }\n .table th, .table td { padding-left: var(--space-4); padding-right: var(--space-4); }\n}\n@media (prefers-reduced-motion: reduce) {\n .spinner { animation-duration: 3s; }\n .skeleton__line { animation: none; }\n .button, .meter__fill { transition: none; }\n}\n\n/* ---------- Your app ---------- */\n/* Add page-specific styles below. Use tokens; add a class, don't restyle a tag. */\n";
|
|
4
|
-
export declare const STYLED_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** Anything that belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page: an intro column and a form column. Add to it through\n * the `providers` and `children` slots; the two-column grid holds exactly\n * these two columns, so don't add siblings to it. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n // Enter signs in; Create account is its own button. Both are always on the page.\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit('sign-in');\n }\n\n return (\n <main className=\"auth\">\n <div className=\"auth__intro\">\n <p className=\"auth__app\">{appName}</p>\n <h1 className=\"auth__title\">Welcome</h1>\n <p className=\"muted\">{tagline ?? 'Sign in, or create an account in a few seconds.'}</p>\n </div>\n <div className=\"auth__column\">\n <form className=\"panel auth__form\" onSubmit={onSubmit} noValidate aria-label=\"Sign in or create an account\" data-sw-auth=\"form\">\n {providers ? (\n <>\n {providers}\n <p className=\"divider\" aria-hidden=\"true\">or use email</p>\n </>\n ) : null}\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\"\n autoComplete=\"current-password\"\n hint={`A new account needs at least ${form.passwordMinLength} characters.`}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n <p className=\"auth__forgot\"><a href=\"/forgot-password\">Forgot password?</a></p>\n {form.error ? <p className=\"error\" role=\"alert\" data-sw-auth=\"error\">{form.error}</p> : null}\n <Button type=\"submit\" block disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth=\"sign-in\">Sign in</Button>\n <Button variant=\"secondary\" block disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth=\"sign-up\"\n onClick={() => void form.submit('sign-up')}>Create account</Button>\n </form>\n {children}\n </div>\n </main>\n );\n}\n";
|
|
5
|
-
export declare const PLAIN_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** What belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page. Add to it through the `providers` and `children` slots. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n // Enter signs in; Create account is its own button. Both are always on the page.\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit('sign-in');\n }\n\n return (\n <main>\n <h1>Sign in or create an account \u00B7 {appName}</h1>\n {tagline ? <p>{tagline}</p> : null}\n {providers}\n <form onSubmit={onSubmit} noValidate aria-label=\"Sign in or create an account\" data-sw-auth=\"form\">\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\"\n autoComplete=\"current-password\"\n hint={`A new account needs at least ${form.passwordMinLength} characters.`}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n <p><a href=\"/forgot-password\">Forgot password?</a></p>\n {form.error ? <p role=\"alert\" data-sw-auth=\"error\">{form.error}</p> : null}\n <Button type=\"submit\" disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth=\"sign-in\">Sign in</Button>{' '}\n <Button variant=\"secondary\" disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth=\"sign-up\"\n onClick={() => void form.submit('sign-up')}>Create account</Button>\n </form>\n {children}\n </main>\n );\n}\n";
|
|
4
|
+
export declare const STYLED_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** Anything that belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page: an intro column and a form column. Add to it through\n * the `providers` and `children` slots; the two-column grid holds exactly\n * these two columns, so don't add siblings to it. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n // Enter signs in; Create account is its own button. Both are always on the page.\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit('sign-in');\n }\n\n return (\n <main className=\"auth\">\n <div className=\"auth__intro\">\n <p className=\"auth__app\">{appName}</p>\n <h1 className=\"auth__title\">Welcome</h1>\n <p className=\"muted\">{tagline ?? 'Sign in, or create an account in a few seconds.'}</p>\n </div>\n <div className=\"auth__column\">\n <form className=\"panel auth__form\" onSubmit={onSubmit} noValidate aria-label=\"Sign in or create an account\" data-sw-auth=\"form\">\n {providers ? (\n <>\n {providers}\n <p className=\"divider\" aria-hidden=\"true\">or use email</p>\n </>\n ) : null}\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\" data-testid=\"auth-email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\" data-testid=\"auth-password\"\n autoComplete=\"current-password\"\n hint={`A new account needs at least ${form.passwordMinLength} characters.`}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n <p className=\"auth__forgot\"><a href=\"/forgot-password\">Forgot password?</a></p>\n {form.error ? <p className=\"error\" role=\"alert\" data-sw-auth=\"error\" data-testid=\"auth-error\">{form.error}</p> : null}\n <Button type=\"submit\" block disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth=\"sign-in\" data-testid=\"auth-signin\">Sign in</Button>\n <Button variant=\"secondary\" block disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth=\"sign-up\" data-testid=\"auth-signup\"\n onClick={() => void form.submit('sign-up')}>Create account</Button>\n </form>\n {children}\n </div>\n </main>\n );\n}\n";
|
|
5
|
+
export declare const PLAIN_AUTH_CARD = "import type { FormEvent, ReactNode } from 'react';\nimport type { CredentialsForm } from '../../types/auth';\nimport { Button } from './Button';\nimport { TextField } from './Field';\n\ninterface AuthCardProps {\n appName: string;\n /** One line under the title: what the app is for. */\n tagline?: string;\n form: CredentialsForm;\n /** Social sign-in buttons, shown above the email form (see ProviderButtons). */\n providers?: ReactNode;\n /** What belongs under the form: a magic-link form, a terms line. */\n children?: ReactNode;\n}\n\n/** The sign-in page. Add to it through the `providers` and `children` slots. */\nexport function AuthCard({ appName, tagline, form, providers, children }: AuthCardProps) {\n // Enter signs in; Create account is its own button. Both are always on the page.\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void form.submit('sign-in');\n }\n\n return (\n <main>\n <h1>Sign in or create an account \u00B7 {appName}</h1>\n {tagline ? <p>{tagline}</p> : null}\n {providers}\n <form onSubmit={onSubmit} noValidate aria-label=\"Sign in or create an account\" data-sw-auth=\"form\">\n <TextField id=\"auth-email\" label=\"Email\" type=\"email\" name=\"email\" autoComplete=\"email\" inputMode=\"email\" autoFocus data-sw-auth=\"email\" data-testid=\"auth-email\"\n value={form.email} onChange={(event) => form.setEmail(event.target.value)} />\n <TextField id=\"auth-password\" label=\"Password\" type=\"password\" name=\"password\" data-sw-auth=\"password\" data-testid=\"auth-password\"\n autoComplete=\"current-password\"\n hint={`A new account needs at least ${form.passwordMinLength} characters.`}\n value={form.password} onChange={(event) => form.setPassword(event.target.value)} />\n <p><a href=\"/forgot-password\">Forgot password?</a></p>\n {form.error ? <p role=\"alert\" data-sw-auth=\"error\" data-testid=\"auth-error\">{form.error}</p> : null}\n <Button type=\"submit\" disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth=\"sign-in\" data-testid=\"auth-signin\">Sign in</Button>{' '}\n <Button variant=\"secondary\" disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth=\"sign-up\" data-testid=\"auth-signup\"\n onClick={() => void form.submit('sign-up')}>Create account</Button>\n </form>\n {children}\n </main>\n );\n}\n";
|
|
6
6
|
export declare const STYLED_VERIFY_EMAIL = "import type { FormEvent } from 'react';\nimport type { EmailVerification } from '../../types/auth';\n\n/** A quiet reminder above the page, never its main call to action. */\nexport function VerifyEmailPanel({ verification }: { verification: EmailVerification }) {\n if (verification.status === 'checking' || verification.status === 'verified') return null;\n if (verification.status === 'unavailable') {\n return (\n <div className=\"notice notice--warning verify-email\" role=\"alert\">\n <p className=\"notice__body\">Could not check whether your email is verified.</p>\n <div className=\"notice__actions\">\n <button type=\"button\" className=\"button button--secondary button--sm\" onClick={verification.retry}>Try again</button>\n </div>\n </div>\n );\n }\n function onSubmit(event: FormEvent<HTMLFormElement>) {\n event.preventDefault();\n void verification.submit();\n }\n return (\n <section className=\"notice notice--info verify-email\" aria-label=\"Verify your email\">\n <div className=\"notice__body\">\n <p className=\"notice__title\">Verify your email</p>\n <p>{verification.sent ? 'Enter the 6-digit code we emailed you.' : verification.entering ? 'Enter the 6-digit code from the latest email we sent you.' : 'We will email you a 6-digit code.'}</p>\n {verification.error ? <p className=\"error\" role=\"alert\">{verification.error}</p> : null}\n </div>\n {verification.entering ? (\n <form className=\"notice__actions verify-email__form\" onSubmit={onSubmit} noValidate>\n <label className=\"visually-hidden\" htmlFor=\"verify-code\">Code</label>\n <input id=\"verify-code\" className=\"control\" inputMode=\"numeric\" autoComplete=\"one-time-code\" maxLength={6} required placeholder=\"000000\"\n value={verification.code} onChange={(event) => verification.setCode(event.target.value)} />\n <button type=\"submit\" className=\"button button--sm\" disabled={!verification.canSubmit} aria-busy={verification.pending}>Verify</button>\n <button type=\"button\" className=\"button button--quiet button--sm\" onClick={() => void verification.sendCode()} disabled={verification.pending}>Send a new code</button>\n </form>\n ) : (\n <div className=\"notice__actions\">\n <button type=\"button\" className=\"button button--secondary button--sm\" onClick={() => void verification.sendCode()} disabled={verification.pending} aria-busy={verification.pending}>\n Email me a code\n </button>\n <button type=\"button\" className=\"button button--quiet button--sm\" onClick={verification.enterCode} disabled={verification.pending}>I already have a code</button>\n </div>\n )}\n </section>\n );\n}\n";
|
|
7
7
|
export declare const STYLED_UI_KIT: InitScaffoldFile[];
|
|
8
8
|
export declare const PLAIN_UI_KIT: InitScaffoldFile[];
|
package/dist/lib/init-ui-kit.js
CHANGED
|
@@ -452,16 +452,16 @@ export function AuthCard({ appName, tagline, form, providers, children }: AuthCa
|
|
|
452
452
|
<p className="divider" aria-hidden="true">or use email</p>
|
|
453
453
|
</>
|
|
454
454
|
) : null}
|
|
455
|
-
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email"
|
|
455
|
+
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email" data-testid="auth-email"
|
|
456
456
|
value={form.email} onChange={(event) => form.setEmail(event.target.value)} />
|
|
457
|
-
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password"
|
|
457
|
+
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password" data-testid="auth-password"
|
|
458
458
|
autoComplete="current-password"
|
|
459
459
|
hint={\`A new account needs at least \${form.passwordMinLength} characters.\`}
|
|
460
460
|
value={form.password} onChange={(event) => form.setPassword(event.target.value)} />
|
|
461
461
|
<p className="auth__forgot"><a href="/forgot-password">Forgot password?</a></p>
|
|
462
|
-
{form.error ? <p className="error" role="alert" data-sw-auth="error">{form.error}</p> : null}
|
|
463
|
-
<Button type="submit" block disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth="sign-in">Sign in</Button>
|
|
464
|
-
<Button variant="secondary" block disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth="sign-up"
|
|
462
|
+
{form.error ? <p className="error" role="alert" data-sw-auth="error" data-testid="auth-error">{form.error}</p> : null}
|
|
463
|
+
<Button type="submit" block disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth="sign-in" data-testid="auth-signin">Sign in</Button>
|
|
464
|
+
<Button variant="secondary" block disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth="sign-up" data-testid="auth-signup"
|
|
465
465
|
onClick={() => void form.submit('sign-up')}>Create account</Button>
|
|
466
466
|
</form>
|
|
467
467
|
{children}
|
|
@@ -500,16 +500,16 @@ export function AuthCard({ appName, tagline, form, providers, children }: AuthCa
|
|
|
500
500
|
{tagline ? <p>{tagline}</p> : null}
|
|
501
501
|
{providers}
|
|
502
502
|
<form onSubmit={onSubmit} noValidate aria-label="Sign in or create an account" data-sw-auth="form">
|
|
503
|
-
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email"
|
|
503
|
+
<TextField id="auth-email" label="Email" type="email" name="email" autoComplete="email" inputMode="email" autoFocus data-sw-auth="email" data-testid="auth-email"
|
|
504
504
|
value={form.email} onChange={(event) => form.setEmail(event.target.value)} />
|
|
505
|
-
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password"
|
|
505
|
+
<TextField id="auth-password" label="Password" type="password" name="password" data-sw-auth="password" data-testid="auth-password"
|
|
506
506
|
autoComplete="current-password"
|
|
507
507
|
hint={\`A new account needs at least \${form.passwordMinLength} characters.\`}
|
|
508
508
|
value={form.password} onChange={(event) => form.setPassword(event.target.value)} />
|
|
509
509
|
<p><a href="/forgot-password">Forgot password?</a></p>
|
|
510
|
-
{form.error ? <p role="alert" data-sw-auth="error">{form.error}</p> : null}
|
|
511
|
-
<Button type="submit" disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth="sign-in">Sign in</Button>{' '}
|
|
512
|
-
<Button variant="secondary" disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth="sign-up"
|
|
510
|
+
{form.error ? <p role="alert" data-sw-auth="error" data-testid="auth-error">{form.error}</p> : null}
|
|
511
|
+
<Button type="submit" disabled={form.pending !== null} pending={form.pending === 'sign-in'} data-sw-auth="sign-in" data-testid="auth-signin">Sign in</Button>{' '}
|
|
512
|
+
<Button variant="secondary" disabled={form.pending !== null} pending={form.pending === 'sign-up'} data-sw-auth="sign-up" data-testid="auth-signup"
|
|
513
513
|
onClick={() => void form.submit('sign-up')}>Create account</Button>
|
|
514
514
|
</form>
|
|
515
515
|
{children}
|
package/dist/lib/next-actions.js
CHANGED
|
@@ -24,7 +24,7 @@ const SEE_IT_LINKED = {
|
|
|
24
24
|
};
|
|
25
25
|
const CHECK_IT_LINKED = {
|
|
26
26
|
command: 'somewhere verify',
|
|
27
|
-
why: '
|
|
27
|
+
why: 'the page loads and looks right at desktop and phone size; nothing to write',
|
|
28
28
|
};
|
|
29
29
|
/** EYES mode on a public URL, which REQUIRES `--store` — commands/browser.ts
|
|
30
30
|
* refuses `--screenshot` without it. Temporary credentials carry the `browser`
|
|
@@ -63,11 +63,12 @@ export function nextActions(ctx) {
|
|
|
63
63
|
},
|
|
64
64
|
];
|
|
65
65
|
case 'deploy': {
|
|
66
|
-
const test = { command: 'somewhere test', why: '
|
|
66
|
+
const test = { command: 'somewhere test', why: 'journeys, several users and access rules: your tests/*.mjs' };
|
|
67
67
|
if (ctx.temporary)
|
|
68
68
|
return ctx.liveUrl ? [seeItByUrl(ctx.liveUrl), test] : [];
|
|
69
|
+
// Test first, then verify (the AGENTS.md split); the screenshot link last.
|
|
69
70
|
if (ctx.projectLinked)
|
|
70
|
-
return [
|
|
71
|
+
return [test, CHECK_IT_LINKED, SEE_IT_LINKED];
|
|
71
72
|
if (ctx.liveUrl)
|
|
72
73
|
return [seeItByUrl(ctx.liveUrl), test];
|
|
73
74
|
return [];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"next-actions.js","sourceRoot":"","sources":["../../src/lib/next-actions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAyBH;4EAC4E;AAC5E,MAAM,UAAU,UAAU,CAAC,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E,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,CAAC;IAC9E,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAChE,OAAO,OAAO,CAAC,GAAG,CAChB,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAC1E,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface FolderPreview {
|
|
2
|
+
projectId: string;
|
|
3
|
+
previewSessionId: string;
|
|
4
|
+
credential: string;
|
|
5
|
+
}
|
|
6
|
+
/** This folder's open preview (or the one named) and its tool credential. */
|
|
7
|
+
export declare function folderPreviewTool(opts: {
|
|
8
|
+
project?: string;
|
|
9
|
+
previewSession?: string;
|
|
10
|
+
}): Promise<FolderPreview>;
|
|
11
|
+
/** The preview's current version, as the platform resolves it for this credential. */
|
|
12
|
+
export declare function previewCurrentVersion(credential: string): Promise<{
|
|
13
|
+
preview_session_id: string;
|
|
14
|
+
preview_id: string;
|
|
15
|
+
}>;
|
|
16
|
+
export interface PreviewJob {
|
|
17
|
+
job_id: string;
|
|
18
|
+
status: string;
|
|
19
|
+
handler: string;
|
|
20
|
+
result: unknown;
|
|
21
|
+
error: string | null;
|
|
22
|
+
error_code: string | null;
|
|
23
|
+
timeout_seconds: number;
|
|
24
|
+
attempts_allowed: number;
|
|
25
|
+
preview_session_id: string;
|
|
26
|
+
preview_id: string;
|
|
27
|
+
}
|
|
28
|
+
/** Waits for a preview job to finish, reading it through the preview's own credential. */
|
|
29
|
+
export declare function waitForPreviewJob(credential: string, jobId: string, timeoutSeconds: number): Promise<{
|
|
30
|
+
job: PreviewJob;
|
|
31
|
+
timedOut: boolean;
|
|
32
|
+
}>;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Preview jobs from the CLI: `somewhere preview run-job` and `somewhere cron run --preview`.
|
|
2
|
+
// Every call about the preview's own jobs carries ONLY that preview's tool credential (lib/preview-credential.ts); your
|
|
3
|
+
// own sign-in is used for nothing but minting it, and a production job read never sees a preview job.
|
|
4
|
+
import { ApiClient } from './client.js';
|
|
5
|
+
import { getToken, loadProjectConfig } from './config.js';
|
|
6
|
+
import { loadPreviewCredential, mintPreviewCredential, previewToolClient } from './preview-credential.js';
|
|
7
|
+
import { loadPreviewRecord } from './preview-record.js';
|
|
8
|
+
/** This folder's open preview (or the one named) and its tool credential. */
|
|
9
|
+
export async function folderPreviewTool(opts) {
|
|
10
|
+
const projectId = opts.project ?? loadProjectConfig()?.project_id;
|
|
11
|
+
if (!projectId)
|
|
12
|
+
throw new Error('No project linked. Run `somewhere init` or pass --project <id>.');
|
|
13
|
+
const previewSessionId = opts.previewSession ?? loadPreviewRecord(process.cwd(), projectId)?.preview_session_id;
|
|
14
|
+
if (!previewSessionId)
|
|
15
|
+
throw new Error('This folder has no open preview. Open one with `somewhere preview`, or name one with --preview-session <id> (`somewhere preview list`).');
|
|
16
|
+
const credential = loadPreviewCredential(projectId, previewSessionId)
|
|
17
|
+
?? await mintPreviewCredential(new ApiClient(getToken()), projectId, previewSessionId);
|
|
18
|
+
return { projectId, previewSessionId, credential };
|
|
19
|
+
}
|
|
20
|
+
/** The preview's current version, as the platform resolves it for this credential. */
|
|
21
|
+
export async function previewCurrentVersion(credential) {
|
|
22
|
+
return previewToolClient(credential).call('GET', '/preview-tools/whoami');
|
|
23
|
+
}
|
|
24
|
+
const TERMINAL = new Set(['complete', 'failed', 'cancelled', 'indeterminate']);
|
|
25
|
+
/** Waits for a preview job to finish, reading it through the preview's own credential. */
|
|
26
|
+
export async function waitForPreviewJob(credential, jobId, timeoutSeconds) {
|
|
27
|
+
const client = previewToolClient(credential);
|
|
28
|
+
const deadline = Date.now() + timeoutSeconds * 1000;
|
|
29
|
+
for (;;) {
|
|
30
|
+
const job = await client.call('GET', `/preview-tools/jobs/${encodeURIComponent(jobId)}`);
|
|
31
|
+
if (TERMINAL.has(job.status))
|
|
32
|
+
return { job, timedOut: false };
|
|
33
|
+
if (Date.now() >= deadline)
|
|
34
|
+
return { job, timedOut: true };
|
|
35
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=preview-jobs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-jobs.js","sourceRoot":"","sources":["../../src/lib/preview-jobs.ts"],"names":[],"mappings":"AAAA,6FAA6F;AAC7F,wHAAwH;AACxH,sGAAsG;AACtG,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC1D,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC1G,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAIxD,6EAA6E;AAC7E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAmD;IACzF,MAAM,SAAS,GAAG,IAAI,CAAC,OAAO,IAAI,iBAAiB,EAAE,EAAE,UAAU,CAAC;IAClE,IAAI,CAAC,SAAS;QAAE,MAAM,IAAI,KAAK,CAAC,iEAAiE,CAAC,CAAC;IACnG,MAAM,gBAAgB,GAAG,IAAI,CAAC,cAAc,IAAI,iBAAiB,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,EAAE,kBAAkB,CAAC;IAChH,IAAI,CAAC,gBAAgB;QAAE,MAAM,IAAI,KAAK,CAAC,yIAAyI,CAAC,CAAC;IAClL,MA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CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface ReferenceCheck {
|
|
2
|
+
status?: string;
|
|
3
|
+
reason?: string;
|
|
4
|
+
findings?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface DeployLogRead {
|
|
7
|
+
version?: number;
|
|
8
|
+
reference_check?: ReferenceCheck | null;
|
|
9
|
+
}
|
|
10
|
+
interface LogClient {
|
|
11
|
+
call<T>(method: string, path: string, body?: unknown, query?: Record<string, string>): Promise<T>;
|
|
12
|
+
}
|
|
13
|
+
/** The line for this log, or null when the check is clean, still running, or absent. */
|
|
14
|
+
export declare function describeReferenceCheck(log: DeployLogRead | null): string | null;
|
|
15
|
+
/** Read the live release's log once and return the line to print, if any. A failed read says so. */
|
|
16
|
+
export declare function referenceCheckNote(client: () => LogClient, projectId: string): Promise<string | null>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// `somewhere test` starts with one line about the live release's background reference check, only when it is not
|
|
2
|
+
// clean: the deploy can only say the check is running, and its result is otherwise read by hand (bench-1115c:
|
|
3
|
+
// three builders never saw it).
|
|
4
|
+
/** The line for this log, or null when the check is clean, still running, or absent. */
|
|
5
|
+
export function describeReferenceCheck(log) {
|
|
6
|
+
const check = log?.reference_check;
|
|
7
|
+
if (!check || typeof log?.version !== 'number')
|
|
8
|
+
return null;
|
|
9
|
+
const read = `somewhere call project_deploy_log '${JSON.stringify({ version: log.version })}'`;
|
|
10
|
+
if (check.status === 'checked' && (check.findings ?? 0) > 0) {
|
|
11
|
+
return `The last deploy's background reference check found ${check.findings} warning${check.findings === 1 ? '' : 's'}; read them with: ${read}`;
|
|
12
|
+
}
|
|
13
|
+
if (check.status === 'unavailable') {
|
|
14
|
+
return `The last deploy's background reference check ${check.reason === 'not_finished' ? 'never finished' : 'could not run'}, so its warnings are unknown: ${read}`;
|
|
15
|
+
}
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
/** Read the live release's log once and return the line to print, if any. A failed read says so. */
|
|
19
|
+
export async function referenceCheckNote(client, projectId) {
|
|
20
|
+
try {
|
|
21
|
+
return describeReferenceCheck(await client().call('GET', '/deploy/log', undefined, { project_id: projectId }));
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return `Could not read the last deploy's background reference check: ${error instanceof Error ? error.message : String(error)}`;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=reference-check-note.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reference-check-note.js","sourceRoot":"","sources":["../../src/lib/reference-check-note.ts"],"names":[],"mappings":"AAAA,iHAAiH;AACjH,8GAA8G;AAC9G,gCAAgC;AAMhC,wFAAwF;AACxF,MAAM,UAAU,sBAAsB,CAAC,GAAyB;IAC9D,MAAM,KAAK,GAAG,GAAG,EAAE,eAAe,CAAC;IACnC,IAAI,CAAC,KAAK,IAAI,OAAO,GAAG,EAAE,OAAO,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC5D,MAAM,IAAI,GAAG,sCAAsC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,GAAG,CAAC;IAC/F,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS,IAAI,CAAC,KAAK,CAAC,QAAQ,IAAI,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;QAC5D,OAAO,sDAAsD,KAAK,CAAC,QAAQ,WAAW,KAAK,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,qBAAqB,IAAI,EAAE,CAAC;IACnJ,CAAC;IACD,IAAI,KAAK,CAAC,MAAM,KAAK,aAAa,EAAE,CAAC;QACnC,OAAO,gDAAgD,KAAK,CAAC,MAAM,KAAK,cAAc,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,eAAe,kCAAkC,IAAI,EAAE,CAAC;IACtK,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,oGAAoG;AACpG,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAuB,EAAE,SAAiB;IACjF,IAAI,CAAC;QACH,OAAO,sBAAsB,CAAC,MAAM,MAAM,EAAE,CAAC,IAAI,CAAgB,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;IAChI,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,gEAAgE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC;IAClI,CAAC;AACH,CAAC"}
|
|
@@ -10,19 +10,46 @@ export function containsSecret(text) {
|
|
|
10
10
|
return true;
|
|
11
11
|
return false;
|
|
12
12
|
}
|
|
13
|
+
/** Signed download, upload and scratch links: everything after the prefix is the credential. */
|
|
14
|
+
const SIGNED_PATH = /^\/v1\/(?:fs-signed|upload|scratch)[^/]*/i;
|
|
15
|
+
/** A path segment that looks like a credential: long, from a token's alphabet, and either mixing upper case,
|
|
16
|
+
* lower case and digits (random base64) or 40+ characters (hex tokens). Ids such as UUIDs are kept. */
|
|
17
|
+
function tokenShaped(segment) {
|
|
18
|
+
if (segment.length < 20 || !/^[A-Za-z0-9._~+=%-]+$/.test(segment))
|
|
19
|
+
return false;
|
|
20
|
+
return segment.length >= 40 || (/[a-z]/.test(segment) && /[A-Z]/.test(segment) && /\d/.test(segment));
|
|
21
|
+
}
|
|
22
|
+
/** A URL in test output. The app's own pages (SW_TEST_ORIGIN) keep their path, so a failure says which page;
|
|
23
|
+
* the query and fragment are hidden, and so is any credential-shaped segment. Any other address keeps only
|
|
24
|
+
* its origin. */
|
|
25
|
+
function scrubUrl(match) {
|
|
26
|
+
const [, raw, trailing] = /^(.*?)([).,;:!]*)$/.exec(match);
|
|
27
|
+
let url;
|
|
28
|
+
try {
|
|
29
|
+
url = new URL(raw);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return '[redacted-url]' + trailing;
|
|
33
|
+
}
|
|
34
|
+
let app = null;
|
|
35
|
+
try {
|
|
36
|
+
app = process.env.SW_TEST_ORIGIN ? new URL(process.env.SW_TEST_ORIGIN).origin : null;
|
|
37
|
+
}
|
|
38
|
+
catch { /* not a URL: no app origin */ }
|
|
39
|
+
if (url.origin !== app)
|
|
40
|
+
return url.origin + '/[redacted-url]' + trailing;
|
|
41
|
+
const signed = SIGNED_PATH.exec(url.pathname);
|
|
42
|
+
const path = signed ? `${signed[0]}/[redacted]`
|
|
43
|
+
: url.pathname.split('/').map((segment) => tokenShaped(segment) ? '[redacted]' : segment).join('/').replaceAll('%5Bredacted%5D', '[redacted]');
|
|
44
|
+
return url.origin + path + (url.search ? '?[redacted]' : '') + (url.hash ? '#[redacted]' : '') + trailing;
|
|
45
|
+
}
|
|
13
46
|
export function scrub(value) {
|
|
14
47
|
for (const secret of secrets)
|
|
15
48
|
value = value.split(secret).join('[redacted]');
|
|
16
49
|
// Preview tool credentials (swpt.<project>.<preview>.<secret>) and preview browser sessions
|
|
17
50
|
// (draft_….rel_….<uuid>), whether or not this process registered them.
|
|
18
51
|
value = value.replace(/swpt\.[A-Za-z0-9._-]+/g, '[redacted]').replace(/draft_[0-9a-f-]{36}\.rel_[A-Za-z0-9_-]+\.[0-9a-f-]{36}/gi, '[redacted]');
|
|
19
|
-
return value.replace(/https?:\/\/[^\s<>"']+/g,
|
|
20
|
-
const url = new URL(raw);
|
|
21
|
-
return url.origin + '/[redacted-url]';
|
|
22
|
-
}
|
|
23
|
-
catch {
|
|
24
|
-
return '[redacted-url]';
|
|
25
|
-
} }).replace(/([?&](?:token|code|secret|key|password|access_token|refresh_token)=)[^&\s]+/gi, '$1[redacted]').replace(/(\/(?:reset-password|reset|verify|magic|invite)\/)[^\s?#]+/gi, '$1[redacted]').replace(/\u001b\[[0-9;]*m/g, '').replace(/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+|smt_[A-Za-z0-9_-]+/g, '[redacted]');
|
|
52
|
+
return value.replace(/https?:\/\/[^\s<>"']+/g, scrubUrl).replace(/([?&](?:token|code|secret|key|password|access_token|refresh_token)=)[^&\s]+/gi, '$1[redacted]').replace(/(\/(?:reset-password|reset|verify|magic|invite)\/)[^\s?#]+/gi, '$1[redacted]').replace(/\u001b\[[0-9;]*m/g, '').replace(/eyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+|smt_[A-Za-z0-9_-]+/g, '[redacted]');
|
|
26
53
|
}
|
|
27
54
|
/**
|
|
28
55
|
* Scrub a test's errors IN PLACE, before Playwright writes anything from them. Playwright builds
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test-diagnostics.js","sourceRoot":"","sources":["../../src/lib/test-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;AAClC,MAAM,UAAU,eAAe,CAAC,GAAG,MAAgB,IAAU,KAAK,MAAM,KAAK,IAAI,MAAM;IAAE,IAAI,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACzH,uGAAuG;AACvG,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,KAAK,MAAM,MAAM,IAAI,OAAO;QAAE,IAAI,MAAM,CAAC,MAAM,IAAI,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YAAE,OAAO,IAAI,CAAC;IAC3F,OAAO,KAAK,CAAC;AACf,CAAC;AACD,MAAM,
|
|
1
|
+
{"version":3,"file":"test-diagnostics.js","sourceRoot":"","sources":["../../src/lib/test-diagnostics.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAA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AC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC3H,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;AAC7D,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,MAAM,CAAC,OAA2B,EAAE,KAAa;IAC/D,OAAO,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,WAAW,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** The one way the docs, the starter's test file and this output write the commands: works in a fresh project
|
|
2
|
+
* with no global install (the starter pins @somewhere-cloud/cli). */
|
|
3
|
+
export declare const DEPLOY_COMMAND = "npx @somewhere-cloud/cli deploy";
|
|
4
|
+
export declare const TEST_COMMAND = "npx @somewhere-cloud/cli test";
|
|
5
|
+
export interface ReportCheck {
|
|
6
|
+
name: string;
|
|
7
|
+
ok: boolean;
|
|
8
|
+
skipped?: 'after-failure';
|
|
9
|
+
error?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ReportGroup {
|
|
12
|
+
script: string;
|
|
13
|
+
checks: ReportCheck[];
|
|
14
|
+
resultFile: string | null;
|
|
15
|
+
}
|
|
16
|
+
export declare function describeReport(groups: ReportGroup[], options?: {
|
|
17
|
+
verbose?: boolean;
|
|
18
|
+
}): string[];
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// What a test run prints at the end, the same for a script run on its own (openAppTest's finish()) and for
|
|
2
|
+
// `somewhere test`: failures first, one line each; then passes and checks that did not run, one line each; one
|
|
3
|
+
// summary line; what to do next; and, only after a failure or with --verbose, the full result file, relative to the
|
|
4
|
+
// project. No release ids and no absolute paths on the result lines.
|
|
5
|
+
/** The one way the docs, the starter's test file and this output write the commands: works in a fresh project
|
|
6
|
+
* with no global install (the starter pins @somewhere-cloud/cli). */
|
|
7
|
+
export const DEPLOY_COMMAND = 'npx @somewhere-cloud/cli deploy';
|
|
8
|
+
export const TEST_COMMAND = 'npx @somewhere-cloud/cli test';
|
|
9
|
+
const firstLine = (text) => (text ?? '').split('\n').map((line) => line.trim()).find(Boolean) ?? '';
|
|
10
|
+
const plural = (n, word) => `${n} ${word}${n === 1 ? '' : 's'}`;
|
|
11
|
+
export function describeReport(groups, options = {}) {
|
|
12
|
+
const many = groups.length > 1;
|
|
13
|
+
const checks = groups.flatMap((group) => group.checks.map((check) => ({ ...check, script: many && check.name !== group.script ? group.script : null })));
|
|
14
|
+
// One bracket per line: the script (when several ran) and any note together.
|
|
15
|
+
const note = (script, extra) => { const parts = [script, extra].filter(Boolean); return parts.length ? ` (${parts.join(', ')})` : ''; };
|
|
16
|
+
const failed = checks.filter((check) => !check.ok && !check.skipped);
|
|
17
|
+
const notRun = checks.filter((check) => check.skipped === 'after-failure');
|
|
18
|
+
const lines = [
|
|
19
|
+
...failed.map((check) => `FAIL ${check.name}${note(check.script)}: ${firstLine(check.error) || 'failed'}`),
|
|
20
|
+
...checks.filter((check) => check.ok).map((check) => `PASS ${check.name}${note(check.script)}`),
|
|
21
|
+
...notRun.map((check) => `NOT RUN ${check.name}${note(check.script, 'after the first failure')}`),
|
|
22
|
+
];
|
|
23
|
+
const scripts = plural(groups.length, 'script');
|
|
24
|
+
if (!checks.length)
|
|
25
|
+
lines.push(`FAILED: no check ran in ${scripts}: it stopped before its first check (its error is in the script's output).`);
|
|
26
|
+
else if (failed.length)
|
|
27
|
+
lines.push(`FAILED: ${failed.length} of ${plural(checks.length, 'check')} in ${scripts}${notRun.length ? ` (${notRun.length} not run)` : ''}`);
|
|
28
|
+
else
|
|
29
|
+
lines.push(`PASSED: ${plural(checks.length, 'check')} in ${scripts}`);
|
|
30
|
+
if (!checks.length)
|
|
31
|
+
lines.push(`Next: fix the error in the script's output, then run ${TEST_COMMAND} again.`);
|
|
32
|
+
else if (failed.length)
|
|
33
|
+
lines.push(`Next: fix what each FAIL line names, run ${DEPLOY_COMMAND}, then ${TEST_COMMAND} --failed to rerun each script that failed.`);
|
|
34
|
+
const files = [...new Set(groups.map((group) => group.resultFile).filter((file) => Boolean(file)))];
|
|
35
|
+
if (files.length && (failed.length || !checks.length || options.verbose))
|
|
36
|
+
lines.push(`Full result: ${files.join(', ')}`);
|
|
37
|
+
return lines;
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=test-report.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-report.js","sourceRoot":"","sources":["../../src/lib/test-report.ts"],"names":[],"mappings":"AAAA,2GAA2G;AAC3G,+GAA+G;AAC/G,oHAAoH;AACpH,qEAAqE;AAErE;sEACsE;AACtE,MAAM,CAAC,MAAM,cAAc,GAAG,iCAAiC,CAAC;AAChE,MAAM,CAAC,MAAM,YAAY,GAAG,+BAA+B,CAAC;AAK5D,MAAM,SAAS,GAAG,CAAC,IAAwB,EAAE,EAAE,CAAC,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC;AACxH,MAAM,MAAM,GAAG,CAAC,CAAS,EAAE,IAAY,EAAE,EAAE,CAAC,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAEhF,MAAM,UAAU,cAAc,CAAC,MAAqB,EAAE,UAAiC,EAAE;IACvF,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MA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