Skip to content

Commit 91984be

Browse files
authored
Merge pull request #145 from eviltester/storybook-investigation
Storybook investigation
2 parents 7e3f84d + 417048d commit 91984be

62 files changed

Lines changed: 3894 additions & 192 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Publish Test Environment
2+
3+
on:
4+
push:
5+
branches: ['master']
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: pages
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build:
14+
name: Build testenv
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
env:
19+
NODE_ENV: development
20+
TESTENV_BRANCH_NAME: ${{ github.ref_name }}
21+
TESTENV_COMMIT_SHA: ${{ github.sha }}
22+
23+
steps:
24+
- name: Check out repository
25+
uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
29+
- name: Set up Pages
30+
uses: actions/configure-pages@v5
31+
32+
- name: Use Node.js 22.21.1
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: 22.21.1
36+
37+
- name: Set up pnpm
38+
shell: bash
39+
run: |
40+
corepack enable
41+
corepack prepare pnpm@11.1.1 --activate
42+
pnpm --version
43+
44+
- name: Install dependencies
45+
run: pnpm install --frozen-lockfile
46+
47+
- name: Build test environment
48+
run: pnpm run testenv:create
49+
50+
- name: Upload Pages artifact
51+
uses: actions/upload-pages-artifact@v3
52+
with:
53+
path: testenv
54+
55+
deploy:
56+
name: Deploy to GitHub Pages
57+
needs: build
58+
runs-on: ubuntu-latest
59+
permissions:
60+
pages: write
61+
id-token: write
62+
environment:
63+
name: github-pages
64+
url: ${{ steps.deployment.outputs.page_url }}
65+
66+
steps:
67+
- name: Deploy Pages artifact
68+
id: deployment
69+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ test-results
1414
.tmp-pack
1515
apps/web/dist
1616
apps/web/dist/
17+
storybook-static
18+
storybook-static/
19+
testenv
20+
testenv/
1721
.agentic-qe
1822
.tmp
1923
.claude
20-
.pet-runs
24+
.pet-runs

.storybook/main.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import path from 'node:path';
2+
import { fileURLToPath } from 'node:url';
3+
import { mergeConfig } from 'vite';
4+
5+
const __filename = fileURLToPath(import.meta.url);
6+
const __dirname = path.dirname(__filename);
7+
8+
export default {
9+
framework: {
10+
name: '@storybook/html-vite',
11+
options: {},
12+
},
13+
stories: ['../apps/web/src/stories/**/*.stories.js'],
14+
staticDirs: [{ from: '../apps/web/images', to: '/images' }],
15+
addons: ['@storybook/addon-docs', '@storybook/addon-a11y'],
16+
docs: {
17+
autodocs: true,
18+
},
19+
async viteFinal(config) {
20+
return mergeConfig(config, {
21+
resolve: {
22+
alias: {
23+
'https://cdn.skypack.dev/@faker-js/faker@v9.7.0': '@faker-js/faker',
24+
'@storybook-stories': path.resolve(__dirname, '../apps/web/src/stories'),
25+
'@anywaydata/core/data_formats': path.resolve(__dirname, '../packages/core/js/data_formats'),
26+
'@anywaydata/core/data_generation': path.resolve(__dirname, '../packages/core/js/data_generation'),
27+
'@anywaydata/core/grid': path.resolve(__dirname, '../packages/core/js/grid'),
28+
'@anywaydata/core/utils': path.resolve(__dirname, '../packages/core/js/utils'),
29+
'@anywaydata/core/faker': path.resolve(__dirname, '../packages/core/js/faker'),
30+
'@anywaydata/core/domain': path.resolve(__dirname, '../packages/core/js/domain'),
31+
'@anywaydata/core/libs': path.resolve(__dirname, '../packages/core/js/libs'),
32+
'@anywaydata/core': path.resolve(__dirname, '../packages/core/src/index.js'),
33+
},
34+
},
35+
});
36+
},
37+
};

.storybook/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"type": "module"
3+
}

.storybook/preview.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import '../apps/web/styles.css';
2+
3+
const preview = {
4+
parameters: {
5+
layout: 'fullscreen',
6+
controls: {
7+
expanded: true,
8+
},
9+
options: {
10+
storySort: {
11+
order: ['Test Data', 'Export Formats'],
12+
},
13+
},
14+
},
15+
};
16+
17+
export default preview;

README.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,25 @@ The application is live at [AnyWayData.com](https://anywaydata.com)
3232
Use `pnpm run build:web` to create a production build and `pnpm run preview:web` to preview the built output.
3333
The old static-server flow (e.g. `python3 -m http.server`) is no longer the recommended local runtime path.
3434

35+
### Use Storybook
36+
37+
Storybook is available for isolated frontend development and UI review:
38+
39+
- `pnpm run storybook`
40+
- open `http://127.0.0.1:6006`
41+
42+
Current story groups:
43+
44+
- `Test Data / Embedded Panel` for the in-app schema editor inside the main table editor
45+
- `Test Data / Generator` for the standalone generator schema editor states
46+
- `Export Formats / Previews` for export-preview flows such as Markdown, CSV, DSV, JSON, JSONL, XML, SQL, HTML, Gherkin, ASCII table, and code-oriented outputs
47+
48+
Useful workflows:
49+
50+
- use Storybook when iterating on schema-editor rendering, validation states, and text/schema mode transitions
51+
- use Storybook when adjusting export-preview UI without needing the full app boot flow
52+
- use `pnpm run build-storybook` to create a static Storybook build in `storybook-static`
53+
3554
### Select Grid Engine
3655

3756
The editor can run with AG Grid or Tabulator using the same import/export and toolbar processing layer.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createExportPreviewStory, sharedArgTypes } from './export-format-story-factory.js';
2+
3+
const meta = {
4+
title: 'Export Formats/Previews/ASCII',
5+
tags: ['autodocs'],
6+
argTypes: sharedArgTypes,
7+
};
8+
9+
export default meta;
10+
11+
export const StartBlank = createExportPreviewStory('asciitable', 'start-blank');
12+
export const Previewed = createExportPreviewStory('asciitable', 'auto-previewed');
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createExportPreviewStory, sharedArgTypes } from './export-format-story-factory.js';
2+
3+
const meta = {
4+
title: 'Export Formats/Previews/Code/C#',
5+
tags: ['autodocs'],
6+
argTypes: sharedArgTypes,
7+
};
8+
9+
export default meta;
10+
11+
export const StartBlank = createExportPreviewStory('csharp', 'start-blank');
12+
export const Previewed = createExportPreviewStory('csharp', 'auto-previewed');
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { createExportPreviewStory, sharedArgTypes } from './export-format-story-factory.js';
2+
3+
const meta = {
4+
title: 'Export Formats/Previews/Code/Java',
5+
tags: ['autodocs'],
6+
argTypes: sharedArgTypes,
7+
};
8+
9+
export default meta;
10+
11+
export const StartBlank = createExportPreviewStory('java', 'start-blank');
12+
export const Previewed = createExportPreviewStory('java', 'auto-previewed');
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import { createExportPreviewStory, sharedArgTypes } from './export-format-story-factory.js';
2+
import { playCodePreview } from './export-format-interactions.js';
3+
4+
const meta = {
5+
title: 'Export Formats/Previews/Code/JavaScript',
6+
tags: ['autodocs'],
7+
argTypes: sharedArgTypes,
8+
parameters: {
9+
docs: {
10+
description: {
11+
component: `
12+
Code preview stories show the grid rendered as JavaScript-oriented output rather than as a plain data interchange format.
13+
14+
## What This Shows
15+
These stories help you inspect how the current grid rows are represented in generated JavaScript text. The focus is on output shape and readability, not on generating a full runnable project.
16+
17+
## Key Stories
18+
- \`Start Blank\`: the grid is ready, but JavaScript output has not been rendered yet.
19+
- \`Previewed\`: JavaScript output is already shown.
20+
21+
## Recommended Workflow
22+
1. Open \`Start Blank\`.
23+
2. Adjust any formatting controls if present.
24+
3. Click \`Set Text From Grid\`.
25+
4. Review the generated JavaScript in the preview area.
26+
27+
## What To Watch
28+
The preview text should look like code-oriented output rather than CSV or JSON. The Actions panel is most useful here for confirming preview generation and copy/download requests.
29+
30+
## Interaction Demo
31+
\`Start Blank\` demonstrates the main workflow for code formats: render the current grid into JavaScript output.
32+
`,
33+
},
34+
},
35+
},
36+
};
37+
38+
export default meta;
39+
40+
export const StartBlank = {
41+
...createExportPreviewStory('javascript', 'start-blank'),
42+
play: playCodePreview,
43+
parameters: {
44+
docs: {
45+
description: {
46+
story: 'Use this story to render JavaScript output from the current grid and inspect the generated code shape.',
47+
},
48+
},
49+
},
50+
};
51+
export const Previewed = {
52+
...createExportPreviewStory('javascript', 'auto-previewed'),
53+
parameters: {
54+
docs: {
55+
description: {
56+
story:
57+
'Use this when you want the generated JavaScript already visible without first triggering preview generation.',
58+
},
59+
},
60+
},
61+
};

0 commit comments

Comments
 (0)