Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
f15bf83
feat: add queue, schedule and workers tasks and a Taskfile sync comma…
roble Nov 5, 2026
76d55af
feat: create the E2E env file on install (sc-1108)
roble Nov 5, 2026
5b9a1cc
chore: forbid nested ternaries in both stacks' ESLint config
roble Nov 6, 2026
64f463b
feat: throw when two sources declare the same capability in a group (…
roble Nov 6, 2026
3a32e7c
feat: dashboard period filter, Period and TrendStat for widgets, and …
roble Nov 6, 2026
6ed4b00
fix: keep every month in the 12-month period, warn when the E2E env i…
roble Nov 6, 2026
472efcf
Merge branch 'main' of https://github.com/saucebase-dev/core into dev…
roble Nov 6, 2026
8b92522
Merge origin/main into dev
roble Nov 8, 2026
680b537
chore: alias the dev branch as 2.13.x-dev
roble Nov 8, 2026
09239d5
Merge branch 'renanroble-dev-branch-alias' into dev
roble Nov 8, 2026
33c8062
feat: named states replace --demo in modules:seed
roble Nov 10, 2026
2759c3d
Merge branch 'renanroble-named-states' into dev
roble Nov 10, 2026
d4e4765
feat: set up a template after the modules it requires
roble Nov 10, 2026
763a45f
Merge branch 'renanroble-template-type' into dev
roble Nov 10, 2026
fa3ca8d
feat: dashboard widgets fill gaps; drop the Discord links from the ap…
roble Nov 10, 2026
8863ddd
Merge branch 'renanroble-dashboard-dense' into dev
roble Nov 10, 2026
c68c13c
feat: template install and capture, module options
roble Nov 13, 2026
ea39de6
Merge branch 'renanroble-template-install' into dev
roble Nov 13, 2026
a3bac51
feat: install settings, set at install by templates, flags or prompts
roble Nov 13, 2026
c5bd04a
Merge branch 'renanroble-install-settings' into dev
roble Nov 13, 2026
03c80e5
feat: one configure key and --set for templates
roble Nov 13, 2026
c773758
Merge branch 'renanroble-configure' into dev
roble Nov 13, 2026
a3337b8
feat: template workspaces resolve @/ from the app first
roble Nov 13, 2026
b6cb20a
feat: select and table components in the Vue starter UI
roble Nov 13, 2026
a8e8d91
fix: every reka popup opens above an Inertia modal
roble Nov 13, 2026
dbd85d1
Merge branch 'renanroble-app-first-ui' into dev
roble Nov 13, 2026
57f567a
fix: popups opened from a modal keep focus and Escape
roble Nov 14, 2026
9b624ba
feat: combobox in the Vue starter UI
roble Nov 14, 2026
cadec30
fix: the same space above a page's title as below it
roble Nov 14, 2026
bcae913
Merge branch 'renanroble-qa-fixes' into dev
roble Nov 14, 2026
bc2f9ca
feat: a template installs clean; --state seeds its demo
roble Nov 14, 2026
0467bdd
Merge branch 'renanroble-template-demo-opt-in' into dev
roble Nov 14, 2026
8eeaf80
feat: a demo without DEMO_PASSWORD gets a random one, saved in .env
roble Nov 14, 2026
3242bfe
docs: a skill for building Saucebase templates
roble Nov 14, 2026
f03b08d
Merge branch 'renanroble-generated-demo-password' into dev
roble Nov 14, 2026
978f691
Merge branch 'renanroble-template-skill' into dev
roble Nov 14, 2026
44cc972
feat: build a template in any app, by any vendor
roble Nov 14, 2026
1141366
Merge branch 'renanroble-template-from-scratch' into dev
roble Nov 14, 2026
cfee9b1
fix: a recipe's dotfiles reach the module it makes
roble Nov 15, 2026
d9a0f2e
Merge branch 'renanroble-recipe-dotfiles' into dev
roble Nov 15, 2026
1911bb7
fix: a recipe's CI names the module by its folder
roble Nov 15, 2026
05573aa
Merge branch 'renanroble-recipe-ci-name' into dev
roble Nov 15, 2026
1d1439b
docs: what building the notes template taught the template skill
roble Nov 15, 2026
20dd450
Merge branch 'renanroble-template-skill-lessons' into dev
roble Nov 15, 2026
72353f2
fix: put composer files back when a package install fails
roble Nov 15, 2026
d1e25b0
chore: require module-installer 3.3 for templates, alias dev as 3.0.x…
roble Nov 15, 2026
a0d3244
ci: install a template's stubs in the test app, as a customer's app g…
roble Nov 15, 2026
b7b8925
feat!: modules:seed and module-install take --state, not --demo
roble Nov 15, 2026
ee4923f
fix: React popups opened from a modal show above it
roble Nov 15, 2026
6bbd5bb
fix: an override's relative imports find files beside it in the app
roble Nov 15, 2026
b07f886
fix: each post-install command gets only the answers it takes
roble Nov 15, 2026
60a32c4
chore: leave the select, table and combobox shadcn folders out of Sonar
roble Nov 15, 2026
7f79ac4
Merge remote-tracking branch 'origin/main' into dev
roble Nov 15, 2026
34bc51a
fix: module-install seeds a state in its own process, after setup
roble Nov 15, 2026
b7fe7c7
chore: alias dev as 3.1.x-dev, past the v3.0.0 release
roble Nov 15, 2026
5a8da44
fix: a failed package install leaves the app as it was, bootable
roble Nov 16, 2026
d80b343
chore: alias dev as 3.x-dev, so it never falls behind a minor release
roble Nov 16, 2026
ca14dc2
feat: seeders declare their demo accounts (#[DemoAccount])
roble Nov 16, 2026
5f60188
feat: AssertsDemoAccounts checks a seeder creates the accounts it dec…
roble Nov 16, 2026
3eb5184
chore: PHPStan skips AssertsDemoAccounts, used only by modules' tests
roble Nov 16, 2026
adeb2d9
feat: add shadcn Empty; EmptyState builds on it
roble Nov 18, 2026
7950a69
Merge branch 'renanroble-empty' into dev
roble Nov 18, 2026
3aee45a
feat: React select and table; modals and capture work for React templ…
roble Nov 18, 2026
643358f
Merge branch 'renanroble-react-select-table' into dev
roble Nov 18, 2026
a445e99
fix: type-checking skips template stubs
roble Nov 18, 2026
d182b2f
Merge branch 'renanroble-tsconfig-stubs' into dev
roble Nov 18, 2026
6e494b5
feat: template-capture --restore puts a template's files back
roble Nov 18, 2026
850d066
fix: React sidebar marks links that open in a new tab
roble Nov 18, 2026
c93dab6
Merge branch 'renanroble-template-restore' into dev
roble Nov 18, 2026
6f5ada4
Merge branch 'renanroble-react-nav-external' into dev
roble Nov 18, 2026
fbe1999
feat: RegistrationInvite lets an invited address sign up while sign-u…
roble Nov 19, 2026
33db225
Merge branch 'renanroble-night-2026-11-18' into dev
roble Nov 19, 2026
cc8afe7
fix: navigation loads on every instance, so Octane and queue workers …
roble Nov 19, 2026
9b5fd9e
Merge branch 'renanroble-bugfixes-2026-11-19' into dev
roble Nov 19, 2026
ff31261
fix: navigation marks a site-root item without a deprecation warning
roble Nov 20, 2026
fc3e371
Merge branch 'renanroble-nav-root-url' into dev
roble Nov 20, 2026
3220cb0
ci: lint with the project's own Pint
roble Nov 20, 2026
3a95728
Merge branch 'renanroble-ci-own-pint' into dev
roble Nov 20, 2026
1a3af2f
fix: an open collapsible no longer swallows a modal's Escape
roble Nov 20, 2026
0b6c59e
fix: template-capture --restore touches only the stack in use
roble Nov 20, 2026
204b956
fix: a failed install reinstalls from the restored lock
roble Nov 20, 2026
894be32
Merge branch 'renanroble-coderabbit-42' into dev
roble Nov 20, 2026
ca8028e
fix: React overlays over a modal keep their focus handlers and tooltips
roble Nov 20, 2026
f388681
fix: template-capture --restore checks every stub before writing
roble Nov 20, 2026
deed3e8
fix: a failed reinstall no longer claims nothing changed
roble Nov 20, 2026
22366f2
Merge branch 'renanroble-coderabbit-42' into dev
roble Nov 20, 2026
3efcb30
feat: Storybook and a design system for the Vue and React stacks (#44)
roble Nov 26, 2026
a25fdc5
feat: Vue story controls follow Storybook's Controls guide
roble Nov 26, 2026
49c15b6
feat: React story controls follow Storybook's Controls guide; stories…
roble Nov 26, 2026
9f8ad24
Merge nightly/2026-11-26-story-controls: story controls (Vue, React)
roble Nov 26, 2026
572abfe
Merge main into dev
roble Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,15 @@ jobs:
timeout-minutes: 2
run: ./node_modules/.bin/playwright install chromium --with-deps

# The design system: every story renders, and its play function passes.
- name: Execute the story tests
working-directory: app
run: npm run test:stories

- name: Build Storybook
working-directory: app
run: npm run storybook:build

# Playwright serves .env.e2e itself (laravelServer() in playwright.config.ts).
- name: Prepare the E2E environment
working-directory: app
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ tests/Fixtures/modules/*/resources/js/
/node_modules/
/resources/js/node_modules/
/stubs/stack/*/config/node_modules/

# Written by `saucebase stack --dev` in a contributor checkout: this machine's paths.
/stubs/stack/*/js/tsconfig.json
/stubs/stack/*/js/node_modules
6 changes: 4 additions & 2 deletions .sonarcloud.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Test files are tests, not product code: they are not measured for duplication.
# Test files are tests, not product code: they are not measured for duplication. Stories
# run as tests (`npm run test:stories`), and each stack has its own copy of them and of
# their Vitest config.
sonar.sources=.
sonar.tests=.
sonar.test.inclusions=tests/**,**/*.test.ts,**/*.test.tsx
sonar.test.inclusions=tests/**,**/*.test.ts,**/*.test.tsx,**/*.stories.ts,**/*.stories.tsx,stubs/stack/*/js/vitest.config.ts

# shadcn components are generated by its CLI and never edited by hand, so their findings
# are not ours to fix. `saucebase/` and `sonner/` hold our own components and stay
Expand Down
4 changes: 4 additions & 0 deletions config/laravel-translatable-string-exporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
'*.vue',
'*.blade.php',
'*.ts',
'*.tsx',
],

// Indicates whether new lines are allowed in translations.
Expand All @@ -49,6 +50,9 @@
'@lang',
'\$t',
'trans',
// React's t(): each name goes into the exporter's regex with nothing before it, so
// a bare `t` would also match import('./x') and emit('submit').
'(?<![\w$.])t',
],

// Indicates whether you need to sort the translations alphabetically
Expand Down
4 changes: 4 additions & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
<directory>src</directory>
</include>
</source>
<php>
<!-- The full suite peaks at about 129 MB, over PHP's default 128M. Tests only. -->
<ini name="memory_limit" value="256M"/>
</php>
</phpunit>
62 changes: 62 additions & 0 deletions resources/boost/skills/saucebase-module-development/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,68 @@ through `@/components`, `@/layouts` and `@/lib/utils`. The app's
`saucebase-frontend-development` skill lists exactly what is available. Never import a
`vendor/` path.

## Stories

A module's components get Storybook stories beside them, as core's do:
`resources/js/vue/components/Banner.stories.ts` and `resources/js/react/components/Banner.stories.tsx`.
Storybook and `npm run test:stories` find every module's stories for the app's stack; they list
under `Modules/`.

Write stories for every component that shows something and can render from props alone:
UI, design-system and module components, and any component with states of its own (empty,
error, loading). Skip the rest; E2E covers them:

- Pages.
- Slots that only read the page and pass it on (`ComingSoonBannerSlot`).
- Components with no UI of their own (a toast fired on page load).
- Large components that only compose others: their parts get the stories.

A component that reads the page, sends requests or submits a form but should have stories
splits in two: a view that takes props and emits events, with the stories, and a slot or
parent that reads the page and sends the request (`TenantSwitcher` and `TenantSwitcherSlot`).

- Set `title: '<Module>/<Component>'`. Storybook adds the `Modules/` prefix.
- Import the preview as core's stories do (`import preview from '@/.storybook/preview'`) and
page fixtures from `@/.storybook/page`.
- A component that reads page props gets them per story with `parameters: { inertia: { … } }`.
Storybook merges parameters, so a story can override a meta's prop but not remove it.
- Every story is a test: it must render, and its `play` function must pass. Inertia visits are
cancelled and logged in the Actions panel, so a story never needs a server.
- A plain link (`<a href>`) in an example points at `#`. Plain link clicks are cancelled and
logged too, but `#` shows the reader it goes nowhere. Inertia links keep real paths: Inertia
renders `#` as `href=""`, which is not a link to screen readers or to `getByRole('link')`.
- A story of a component that fetches on render needs a network mock; there is none, so don't
write one for it.

### Controls

Every control in the Controls panel must change the story, following Storybook's
[Controls guide](https://storybook.js.org/docs/essentials/controls). The preview already
shows each control's description and default, and hides `as`, `asChild`, `by`, `testId`,
`defaultValue` and `modelValue`. A component reads `defaultValue` only once and `modelValue`
two-way, so a control can't change either; stories still set both in `args`.

- Let docgen choose controls from the prop types. Write `argTypes` only for a control that
docgen gets wrong.
- Give union props a type without `null`: docgen shows `'a' | 'b' | null` as a JSON
editor. Wrap cva's types: `variant?: NonNullable<AlertVariants['variant']>`.
- Give a prop that takes a component (an icon) a list of names and a `mapping` to the real
components. Put the name in `args`, cast it (`icon: 'Rocket' as never`), because `mapping`
swaps it for the component.
- Give a text slot an arg with a starting value, and show it in the render
(`{{ args.default }}`). Set `control: false` on a slot the render fills itself.
- Leave object and array props on the JSON editor: that is their control.
- Give every main prop a starting value in the meta's `args`.
- Keep `fn()` out of the meta's `args`: Storybook can't print a call as an event handler,
so every story's snippet gets an "Incomplete code snippet" warning. Put the spy only on
the story whose `play` reads it, or handle the event in a decorator that passes its own
handler (`story({ args: { onDismiss } })`) and logs it with `action()`.
- Render stories inline on the docs page: controls there don't reach a story in its own
frame (`docs.story.inline: false`). A component that sticks or scrolls with the page
gets a scrolling box of its own in a decorator instead.
- Describe every prop, slot and event with a JSDoc comment in the component: the panel shows
it next to the control.

## npm Packages

Every module has a `package.json` (the recipe creates it), with only `name` and `private` until
Expand Down
18 changes: 18 additions & 0 deletions resources/js/settings.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import fs from 'node:fs';
import path from 'node:path';

/**
* The app's `saucebase.json`: its framework, contributor mode, server rendering and
* template. Read by the Vite preset and by Storybook's config, so both agree.
*/
export function readSettings(root: string): {
contributor?: boolean;
ssr?: boolean;
template?: string;
} {
const file = path.join(root, 'saucebase.json');

return fs.existsSync(file)
? JSON.parse(fs.readFileSync(file, 'utf-8'))
: {};
}
45 changes: 45 additions & 0 deletions resources/js/tests/design-system-colour.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { describe, expect, it } from 'vitest';
import * as react from '../../../stubs/stack/react/js/.storybook/design-system/colour.ts';
import * as vue from '../../../stubs/stack/vue/js/.storybook/design-system/colour.ts';

// The design-system pages grade each token pair against WCAG AA with these. The colours
// below are fixed samples, not read from theme.css: changing the theme never fails this.
describe.each([
['vue', vue],
['react', react],
])('%s design-system colour', (_, colour) => {
it('rates black on white 21 and a colour on itself 1', () => {
expect(colour.contrast([0, 0, 0], [255, 255, 255])).toBeCloseTo(21, 1);
expect(colour.contrast([239, 68, 68], [239, 68, 68])).toBe(1);
});

it("agrees with axe's ratios", () => {
// Pairs axe (Storybook's accessibility check) rated: white on red-500, and
// red-500 on a light grey.
expect(colour.contrast([255, 255, 255], [239, 68, 68])).toBeCloseTo(
3.76,
2,
);
expect(colour.contrast([239, 68, 68], [232, 235, 237])).toBeCloseTo(
3.14,
2,
);
});

it('is the same whichever colour comes first', () => {
expect(colour.contrast([107, 114, 128], [232, 235, 237])).toBe(
colour.contrast([232, 235, 237], [107, 114, 128]),
);
});

it('passes AA at 4.5 for text and 3 for interface parts', () => {
expect(colour.passes(4.5, 'text')).toBe(true);
expect(colour.passes(4.49, 'text')).toBe(false);
expect(colour.passes(3, 'ui')).toBe(true);
expect(colour.passes(2.99, 'ui')).toBe(false);
});

it('writes a colour as hex', () => {
expect(colour.hex([255, 107, 0])).toBe('#ff6b00');
});
});
30 changes: 30 additions & 0 deletions resources/js/tests/settings.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import fs from 'node:fs';
import os from 'node:os';
import path from 'node:path';
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
import { readSettings } from '../settings.ts';

let root: string;

beforeEach(() => {
root = fs.mkdtempSync(path.join(os.tmpdir(), 'saucebase-'));
});

afterEach(() => {
fs.rmSync(root, { recursive: true, force: true });
});

describe('readSettings()', () => {
it("reads the app's saucebase.json", () => {
fs.writeFileSync(
path.join(root, 'saucebase.json'),
'{"contributor": true, "ssr": false}',
);

expect(readSettings(root)).toEqual({ contributor: true, ssr: false });
});

it('is empty for an app without one', () => {
expect(readSettings(root)).toEqual({});
});
});
112 changes: 112 additions & 0 deletions resources/js/tests/stories-docs.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
import fs from 'node:fs';
import path from 'node:path';
import { describe, expect, it } from 'vitest';

const STACKS = path.resolve(import.meta.dirname, '../../../stubs/stack');

describe.each([
['vue', 'ts'],
['react', 'tsx'],
])('%s Storybook', (stack, ext) => {
const PREVIEW = path.join(STACKS, stack, `js/.storybook/preview.${ext}`);

// Storybook reads the preview's tags without running it, and only from
// `const preview = definePreview({...}); export default preview;`. Any other
// export hides them, and every component silently loses its docs page.
it('gives every component a docs page', () => {
const source = fs.readFileSync(PREVIEW, 'utf8');

expect(source).toMatch(/tags:\s*\['autodocs'\]/);
expect(source).not.toMatch(/export (const|\{)/);
});

// Server docgen finds components by their real path. In a contributor checkout that
// is saucebase/core, outside the app's tsconfig: no props table, and "Show code"
// shows the story's source. There, the builder's docgen reads them instead.
it('documents components in a contributor checkout too', () => {
const source = fs.readFileSync(
path.resolve(path.dirname(PREVIEW), 'main.ts'),
'utf8',
);

// Installed apps, and contributor checkouts whose `saucebase stack --dev` wrote
// core a tsconfig (js/tsconfig.json): there server docgen reaches the components.
expect(source).toContain("fs.existsSync('resources/js/.storybook')");
expect(source).toContain(
"fs.existsSync(path.resolve(import.meta.dirname, '../tsconfig.json'))",
);
// vue-docgen-api, the builder's default, can't follow imported prop types
// (SidebarProps): their controls would be JSON boxes, or missing.
if (stack === 'vue') {
expect(source).toContain("docgen: 'vue-component-meta'");
}
});

// A full-width story (Header, Footer, layouts) renders in a frame as wide as the docs
// column. Storybook's 1000px column is under `lg` (1024px): every one of them would
// show its phone layout.
it('gives docs pages room for the desktop layout', () => {
const head = fs.readFileSync(
path.resolve(path.dirname(PREVIEW), 'preview-head.html'),
'utf8',
);
const width = Number(
/\.sbdocs\.sbdocs-content\s*\{[^}]*max-width:\s*(\d+)px/.exec(
head,
)?.[1],
);

expect(width).toBeGreaterThan(1024 + 100);
});

// In a contributor checkout `saucebase stack --dev` links node_modules beside the
// stories, where `../**/*.stories.ts` finds Storybook's own template stories.
it('runs no story tests from node_modules', () => {
const source = fs.readFileSync(
path.resolve(path.dirname(PREVIEW), '../vitest.config.ts'),
'utf8',
);

expect(source).toContain("exclude: ['**/node_modules/**']");
});

// Stories of the welcome page's parts are for Saucebase's own team. Contributor mode
// comes from saucebase.json, never from core being symlinked: a contributor checkout
// can run a released core.
it('shows contributor-only stories in contributor mode alone', () => {
const dir = path.dirname(PREVIEW);
const main = fs.readFileSync(path.resolve(dir, 'main.ts'), 'utf8');

expect(main).toContain('readSettings(process.cwd())');
expect(main).toMatch(
/contributor:\s*\{\s*hideFromSidebar:\s*!contributor\s*\}/,
);
expect(main).not.toMatch(/isSymbolicLink/);

for (const name of ['ModuleCard', 'ModuleModal']) {
const story = fs.readFileSync(
path.resolve(
dir,
`../components/ui/saucebase/${name}.stories.${ext}`,
),
'utf8',
);
expect(story).toMatch(/tags:\s*\['contributor'\]/);
}
});
});

// The design-system pages are MDX, rendered by Storybook's React whatever the stack: one
// page, kept the same in both.
it('has the same design-system pages in both stacks', () => {
const dir = (stack: string) =>
path.join(STACKS, stack, 'js/.storybook/design-system');
const files = fs.readdirSync(dir('vue'));

expect(fs.readdirSync(dir('react'))).toEqual(files);
for (const file of files) {
expect(fs.readFileSync(path.join(dir('react'), file), 'utf8')).toBe(
fs.readFileSync(path.join(dir('vue'), file), 'utf8'),
);
}
});
32 changes: 32 additions & 0 deletions resources/js/tests/ui-boundary.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import fs from 'node:fs';
import path from 'node:path';
import { describe, expect, it } from 'vitest';

const STACK = path.resolve(import.meta.dirname, '../../../stubs/stack');

// App composites and app glue may know the app; the primitives under them may not.
const EXEMPT = [/\/ui\/saucebase\//, /\/ui\/sonner\/Wrapper\.vue$/];

function primitives(framework: 'vue' | 'react'): string[] {
const ui = path.join(STACK, framework, 'js/components/ui');

return (fs.readdirSync(ui, { recursive: true }) as string[])
.map((file) => path.join(ui, file))
.filter(
(file) => /\.(vue|ts|tsx)$/.test(file) && !/\.stories\./.test(file),
)
.filter((file) => !EXEMPT.some((pattern) => pattern.test(file)));
}

describe.each(['vue', 'react'] as const)('%s ui/ primitives', (framework) => {
// Props in, events out: they render in Storybook and in any page without an Inertia app.
it('take their data as props, not from Inertia or Ziggy', () => {
const coupled = primitives(framework).filter((file) =>
/from ['"](@inertiajs\/|ziggy-js)/.test(
fs.readFileSync(file, 'utf8'),
),
);

expect(coupled.map((file) => path.relative(STACK, file))).toEqual([]);
});
});
Loading