@aurelia/storybook 0.1.1 → 1.0.1
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/LICENSE +1 -1
- package/README.md +47 -22
- package/__tests__/preset.test.ts +49 -0
- package/__tests__/preview.test.ts +139 -0
- package/__tests__/render.test.ts +1 -2
- package/__tests__/webpack.test.ts +21 -0
- package/apps/hello-world/.storybook/main.ts +28 -0
- package/apps/hello-world/.storybook/preview.ts +1 -0
- package/apps/hello-world/.stylelintrc.json +5 -0
- package/apps/hello-world/.yarnrc.yml +2 -0
- package/apps/hello-world/README.md +28 -0
- package/apps/hello-world/eslint.config.mjs +25 -0
- package/apps/hello-world/favicon.ico +0 -0
- package/apps/hello-world/index.html +17 -0
- package/apps/hello-world/package-lock.json +10141 -0
- package/apps/hello-world/package.json +61 -0
- package/apps/hello-world/src/hello-world.html +6 -0
- package/apps/hello-world/src/hello-world.ts +17 -0
- package/apps/hello-world/src/main.ts +6 -0
- package/apps/hello-world/src/my-app.html +1 -0
- package/apps/hello-world/src/my-app.ts +3 -0
- package/apps/hello-world/src/resource.d.ts +15 -0
- package/apps/hello-world/src/stories/hello-world.stories.ts +54 -0
- package/apps/hello-world/test/my-app.spec.ts +15 -0
- package/apps/hello-world/test/setup.ts +29 -0
- package/apps/hello-world/tsconfig.json +18 -0
- package/apps/hello-world/tsconfig.vitest.json +11 -0
- package/apps/hello-world/vite.config.ts +19 -0
- package/apps/hello-world/vitest.config.ts +15 -0
- package/apps/hello-world-webpack/.env.development +0 -0
- package/apps/hello-world-webpack/.storybook/main.ts +16 -0
- package/apps/hello-world-webpack/.storybook/preview.ts +3 -0
- package/apps/hello-world-webpack/.stylelintrc.json +5 -0
- package/apps/hello-world-webpack/.yarnrc.yml +2 -0
- package/apps/hello-world-webpack/README.md +29 -0
- package/apps/hello-world-webpack/eslint.config.mjs +25 -0
- package/apps/hello-world-webpack/favicon.ico +0 -0
- package/apps/hello-world-webpack/index.html +15 -0
- package/apps/hello-world-webpack/package-lock.json +8856 -0
- package/apps/hello-world-webpack/package.json +53 -0
- package/apps/hello-world-webpack/src/main.ts +6 -0
- package/apps/hello-world-webpack/src/my-app.css +3 -0
- package/apps/hello-world-webpack/src/my-app.html +1 -0
- package/apps/hello-world-webpack/src/my-app.stories.ts +12 -0
- package/apps/hello-world-webpack/src/my-app.ts +3 -0
- package/apps/hello-world-webpack/src/resource.d.ts +13 -0
- package/apps/hello-world-webpack/tsconfig.json +18 -0
- package/apps/hello-world-webpack/webpack.config.js +111 -0
- package/dist/index.js +79 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -3
- package/dist/index.mjs.map +1 -1
- package/dist/preset.js +35 -1
- package/dist/preset.js.map +1 -1
- package/dist/preset.mjs +34 -2
- package/dist/preset.mjs.map +1 -1
- package/dist/preview/render.js +79 -3
- package/dist/preview/render.js.map +1 -1
- package/dist/preview/render.mjs +79 -3
- package/dist/preview/render.mjs.map +1 -1
- package/dist/preview.js +74 -0
- package/dist/preview.js.map +1 -0
- package/dist/preview.mjs +72 -0
- package/dist/preview.mjs.map +1 -0
- package/dist/webpack.js +23 -0
- package/dist/webpack.js.map +1 -0
- package/dist/webpack.mjs +21 -0
- package/dist/webpack.mjs.map +1 -0
- package/jest.config.js +1 -1
- package/package.json +23 -24
- package/rollup.config.mjs +0 -3
- package/src/preset.ts +22 -5
- package/src/preview/render.ts +2 -2
- package/src/preview/types.ts +1 -1
- package/src/preview.ts +50 -0
- package/src/webpack.ts +21 -0
- package/__tests__/render.test.d.ts +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/preset.d.ts +0 -8
- package/dist/preview/render.d.ts +0 -17
- package/dist/preview/types.d.ts +0 -5
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# @aurelia/storybook
|
|
2
2
|
|
|
3
|
-
> **Note:** Storybook support is currently in an early stage, and there may be bugs, issues, or unsupported features in this plugin. The intention is to make this plugin more production-ready when Aurelia 2 reaches stable release.
|
|
3
|
+
> **Note:** Storybook support is currently in an early stage, and there may be bugs, issues, or unsupported features in this plugin. The intention is to make this plugin more production-ready when Aurelia 2 reaches stable release.
|
|
4
4
|
|
|
5
|
-
This package provides an integration between Aurelia 2 and Storybook
|
|
5
|
+
This package provides an integration between Aurelia 2 and Storybook 9 using Vite or Webpack. It lets you write and render Aurelia 2 components as Storybook stories with full support for Storybook controls, actions, and interactive testing.
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- **Vite
|
|
9
|
+
- **Vite & Webpack Support**: Works with both Vite (via `@storybook/builder-vite`) and Webpack 5 (via `@storybook/builder-webpack5`).
|
|
10
10
|
- **Aurelia Enhancement**: Renders Aurelia 2 components using Aurelia's `enhance()` API.
|
|
11
|
-
- **Storybook
|
|
11
|
+
- **Storybook 9 Compatibility**: Fully compatible with Storybook 9's new rendering API.
|
|
12
12
|
- **Arg & Action Support**: Use story args and actions as you would with any Storybook story.
|
|
13
13
|
|
|
14
14
|
## Installation
|
|
@@ -22,7 +22,13 @@ npm install --save-dev @aurelia/storybook
|
|
|
22
22
|
Also, make sure to have the required dependencies installed in your project:
|
|
23
23
|
|
|
24
24
|
```bash
|
|
25
|
-
npm install --save-dev
|
|
25
|
+
npm install --save-dev storybook @storybook/builder-vite
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
For testing functionality, you may also want to install:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npm install --save-dev @storybook/test @storybook/addon-actions
|
|
26
32
|
```
|
|
27
33
|
|
|
28
34
|
> **Tip:** Check your existing Aurelia 2 app for already installed versions. The peer dependencies are expected to be compatible with Aurelia 2 beta releases (see `package.json` for version details).
|
|
@@ -43,16 +49,14 @@ To integrate Aurelia 2 with your Storybook instance, follow these steps:
|
|
|
43
49
|
Create or update your `.storybook/main.ts` file with the following contents:
|
|
44
50
|
|
|
45
51
|
```typescript
|
|
46
|
-
import type { StorybookConfig } from '
|
|
47
|
-
import { mergeConfig } from 'vite';
|
|
52
|
+
import type { StorybookConfig } from 'storybook/internal/types';
|
|
53
|
+
import { mergeConfig, type InlineConfig } from 'vite';
|
|
48
54
|
|
|
49
|
-
const config: StorybookConfig & { viteFinal?: (config:
|
|
55
|
+
const config: StorybookConfig & { viteFinal?: (config: InlineConfig, options: { configType: string }) => InlineConfig | Promise<InlineConfig> } = {
|
|
50
56
|
stories: ['../src/stories/**/*.stories.@(ts|tsx|js|jsx|mdx)'],
|
|
51
57
|
addons: [
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
// '@storybook/addon-essentials',
|
|
55
|
-
// '@storybook/addon-interactions'
|
|
58
|
+
// Additional addons (essentials are now built into Storybook 9 core):
|
|
59
|
+
'@storybook/addon-links'
|
|
56
60
|
],
|
|
57
61
|
framework: {
|
|
58
62
|
name: '@aurelia/storybook',
|
|
@@ -73,7 +77,7 @@ To integrate Aurelia 2 with your Storybook instance, follow these steps:
|
|
|
73
77
|
},
|
|
74
78
|
};
|
|
75
79
|
|
|
76
|
-
export default config
|
|
80
|
+
export default config;
|
|
77
81
|
```
|
|
78
82
|
|
|
79
83
|
- **.storybook/preview.ts**
|
|
@@ -85,7 +89,34 @@ To integrate Aurelia 2 with your Storybook instance, follow these steps:
|
|
|
85
89
|
export { render, renderToCanvas } from '@aurelia/storybook';
|
|
86
90
|
```
|
|
87
91
|
|
|
88
|
-
> **Note:**
|
|
92
|
+
> **Note:** Essential features like actions, controls, backgrounds, and viewport are now built into Storybook 9 core and don't need to be installed separately. However, if you need to use the `action()` function in your stories (for programmatic actions), you may still need to install `@storybook/addon-actions`. Additional addons like `@storybook/addon-links` can be installed and added to the `addons` array in your configuration.
|
|
93
|
+
|
|
94
|
+
### Using with Webpack
|
|
95
|
+
|
|
96
|
+
If you prefer to use Webpack instead of Vite, update your `.storybook/main.ts` configuration:
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import type { StorybookConfig } from 'storybook/internal/types';
|
|
100
|
+
|
|
101
|
+
const config: StorybookConfig = {
|
|
102
|
+
stories: ['../src/**/*.stories.@(ts|tsx|js|jsx|mdx)'],
|
|
103
|
+
addons: [
|
|
104
|
+
'@storybook/addon-webpack5-compiler-swc',
|
|
105
|
+
'@storybook/addon-links'
|
|
106
|
+
],
|
|
107
|
+
framework: {
|
|
108
|
+
name: '@aurelia/storybook',
|
|
109
|
+
options: {},
|
|
110
|
+
},
|
|
111
|
+
core: {
|
|
112
|
+
builder: '@storybook/builder-webpack5',
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
export default config;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The `.storybook/preview.ts` file remains the same for both Vite and Webpack configurations.
|
|
89
120
|
|
|
90
121
|
3. **Add scripts to your package.json**:
|
|
91
122
|
Add the following scripts to your `package.json` file to work with Storybook:
|
|
@@ -105,7 +136,7 @@ Aurelia 2 stories are written similarly to standard Storybook stories, with a fe
|
|
|
105
136
|
```typescript
|
|
106
137
|
import { HelloWorld } from '../hello-world';
|
|
107
138
|
import { action } from '@storybook/addon-actions';
|
|
108
|
-
import { userEvent, within } from '@storybook/
|
|
139
|
+
import { userEvent, within } from '@storybook/test';
|
|
109
140
|
|
|
110
141
|
const meta = {
|
|
111
142
|
title: 'Example/HelloWorld',
|
|
@@ -186,13 +217,7 @@ If you wish to contribute or modify the integration:
|
|
|
186
217
|
npm run watch
|
|
187
218
|
```
|
|
188
219
|
|
|
189
|
-
3. **
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
npm link @aurelia/storybook
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
4. **Run Storybook** in your local Aurelia application to see the integration in action.
|
|
220
|
+
3. **Run Storybook** in your local application to see the integration in action.
|
|
196
221
|
|
|
197
222
|
## Contributing
|
|
198
223
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { webpackFinal, viteFinal } from '../src/preset';
|
|
2
|
+
import { getRules } from '../src/webpack';
|
|
3
|
+
|
|
4
|
+
jest.mock('../src/webpack', () => ({
|
|
5
|
+
getRules: jest.fn(() => [
|
|
6
|
+
{ test: /\.ts$/, use: 'ts-loader' },
|
|
7
|
+
{ test: /\.html$/, use: 'html-loader' },
|
|
8
|
+
]),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
describe('preset', () => {
|
|
12
|
+
describe('webpackFinal', () => {
|
|
13
|
+
it('should add rules to the webpack config', async () => {
|
|
14
|
+
const config = {
|
|
15
|
+
module: {
|
|
16
|
+
rules: [],
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const result = await webpackFinal(config);
|
|
20
|
+
expect(result.module.rules).toEqual(getRules());
|
|
21
|
+
expect(getRules).toHaveBeenCalled();
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
it('should handle a config with no module.rules', async () => {
|
|
25
|
+
const config = {};
|
|
26
|
+
const result = await webpackFinal(config);
|
|
27
|
+
expect(result).toEqual(config);
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
it('should handle a config with existing rules', async () => {
|
|
31
|
+
const existingRule = { test: /\.js$/, use: 'babel-loader' };
|
|
32
|
+
const config = {
|
|
33
|
+
module: {
|
|
34
|
+
rules: [existingRule],
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const result = await webpackFinal(config);
|
|
38
|
+
expect(result.module.rules).toEqual([existingRule, ...getRules()]);
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
describe('viteFinal', () => {
|
|
43
|
+
it('should return the config unchanged', async () => {
|
|
44
|
+
const config = { some: 'property' };
|
|
45
|
+
const result = await viteFinal(config);
|
|
46
|
+
expect(result).toBe(config);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
});
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { render } from '../src/preview';
|
|
2
|
+
import * as renderUtils from '../src/preview/render';
|
|
3
|
+
|
|
4
|
+
jest.mock('../src/preview/render', () => ({
|
|
5
|
+
...jest.requireActual('../src/preview/render'),
|
|
6
|
+
bootstrapAureliaApp: jest.fn(),
|
|
7
|
+
}));
|
|
8
|
+
|
|
9
|
+
describe('preview', () => {
|
|
10
|
+
let bootstrapAureliaAppSpy: jest.SpyInstance;
|
|
11
|
+
let fakeAureliaApp: { start: jest.Mock; stop: jest.Mock };
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
bootstrapAureliaAppSpy = jest.spyOn(renderUtils, 'bootstrapAureliaApp');
|
|
15
|
+
fakeAureliaApp = {
|
|
16
|
+
start: jest.fn().mockResolvedValue(undefined),
|
|
17
|
+
stop: jest.fn().mockResolvedValue(undefined),
|
|
18
|
+
};
|
|
19
|
+
bootstrapAureliaAppSpy.mockReturnValue(fakeAureliaApp);
|
|
20
|
+
document.body.innerHTML = '';
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
afterEach(() => {
|
|
24
|
+
jest.clearAllMocks();
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
it('should return a container element', () => {
|
|
28
|
+
const context = {
|
|
29
|
+
storyFn: () => ({ Component: class {} }),
|
|
30
|
+
component: class {},
|
|
31
|
+
};
|
|
32
|
+
const container = render({}, context);
|
|
33
|
+
expect(container).toBeInstanceOf(HTMLElement);
|
|
34
|
+
expect(container.tagName).toBe('DIV');
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it('should call storyFn', () => {
|
|
38
|
+
const storyFn = jest.fn(() => ({ Component: class {} }));
|
|
39
|
+
const context = {
|
|
40
|
+
storyFn,
|
|
41
|
+
component: class {},
|
|
42
|
+
};
|
|
43
|
+
render({}, context);
|
|
44
|
+
expect(storyFn).toHaveBeenCalledTimes(1);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should not bootstrap Aurelia if story has no Component or template', () => {
|
|
48
|
+
const context = {
|
|
49
|
+
storyFn: () => ({}),
|
|
50
|
+
component: class {},
|
|
51
|
+
};
|
|
52
|
+
render({}, context);
|
|
53
|
+
expect(bootstrapAureliaAppSpy).not.toHaveBeenCalled();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it('should bootstrap Aurelia if story has a Component', () => {
|
|
57
|
+
const DummyComponent = class {};
|
|
58
|
+
const context = {
|
|
59
|
+
storyFn: () => ({ Component: DummyComponent }),
|
|
60
|
+
component: class {},
|
|
61
|
+
};
|
|
62
|
+
const args = { a: 1 };
|
|
63
|
+
const container = render(args, context);
|
|
64
|
+
expect(bootstrapAureliaAppSpy).toHaveBeenCalledWith(
|
|
65
|
+
{ Component: DummyComponent },
|
|
66
|
+
args,
|
|
67
|
+
container,
|
|
68
|
+
DummyComponent
|
|
69
|
+
);
|
|
70
|
+
expect(fakeAureliaApp.start).toHaveBeenCalled();
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
it('should bootstrap Aurelia if story has a template', () => {
|
|
74
|
+
const template = '<div></div>';
|
|
75
|
+
const context = {
|
|
76
|
+
storyFn: () => ({ template }),
|
|
77
|
+
component: class {},
|
|
78
|
+
};
|
|
79
|
+
const args = { a: 1 };
|
|
80
|
+
const container = render(args, context);
|
|
81
|
+
expect(bootstrapAureliaAppSpy).toHaveBeenCalledWith(
|
|
82
|
+
{ template },
|
|
83
|
+
args,
|
|
84
|
+
container,
|
|
85
|
+
context.component
|
|
86
|
+
);
|
|
87
|
+
expect(fakeAureliaApp.start).toHaveBeenCalled();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
it('should call cleanup for the previous story', () => {
|
|
91
|
+
const storyFn1 = () => ({ Component: class {} });
|
|
92
|
+
const storyFn2 = () => ({ template: 'hello' });
|
|
93
|
+
|
|
94
|
+
// First render
|
|
95
|
+
render({}, { storyFn: storyFn1, component: class {} });
|
|
96
|
+
|
|
97
|
+
// Second render
|
|
98
|
+
render({}, { storyFn: storyFn2, component: class {} });
|
|
99
|
+
|
|
100
|
+
expect(fakeAureliaApp.stop).toHaveBeenCalledTimes(1);
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
it('should handle Aurelia start failure', async () => {
|
|
104
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
105
|
+
const error = new Error('Failed to start');
|
|
106
|
+
fakeAureliaApp.start.mockRejectedValue(error);
|
|
107
|
+
|
|
108
|
+
const context = {
|
|
109
|
+
storyFn: () => ({ Component: class {} }),
|
|
110
|
+
component: class {},
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
render({}, context);
|
|
114
|
+
|
|
115
|
+
// allow microtasks to run
|
|
116
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
117
|
+
|
|
118
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Failed to start Aurelia app:', error);
|
|
119
|
+
consoleErrorSpy.mockRestore();
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
it('should handle Aurelia stop failure', async () => {
|
|
123
|
+
const consoleErrorSpy = jest.spyOn(console, 'error').mockImplementation(() => {});
|
|
124
|
+
const error = new Error('Failed to stop');
|
|
125
|
+
fakeAureliaApp.stop.mockRejectedValue(error);
|
|
126
|
+
|
|
127
|
+
// First render
|
|
128
|
+
render({}, { storyFn: () => ({ Component: class {} }), component: class {} });
|
|
129
|
+
|
|
130
|
+
// Second render to trigger cleanup
|
|
131
|
+
render({}, { storyFn: () => ({ Component: class {} }), component: class {} });
|
|
132
|
+
|
|
133
|
+
// allow microtasks to run
|
|
134
|
+
await new Promise(resolve => setTimeout(resolve, 0));
|
|
135
|
+
|
|
136
|
+
expect(consoleErrorSpy).toHaveBeenCalledWith('Failed to stop Aurelia app:', error);
|
|
137
|
+
consoleErrorSpy.mockRestore();
|
|
138
|
+
});
|
|
139
|
+
});
|
package/__tests__/render.test.ts
CHANGED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { getRules } from '../src/webpack';
|
|
2
|
+
|
|
3
|
+
describe('webpack', () => {
|
|
4
|
+
describe('getRules', () => {
|
|
5
|
+
it('should return the correct rules', () => {
|
|
6
|
+
const rules = getRules();
|
|
7
|
+
expect(rules).toEqual([
|
|
8
|
+
{
|
|
9
|
+
test: /\.ts$/i,
|
|
10
|
+
use: ['ts-loader', '@aurelia/webpack-loader'],
|
|
11
|
+
exclude: /node_modules/,
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
test: /\.html$/i,
|
|
15
|
+
use: '@aurelia/webpack-loader',
|
|
16
|
+
exclude: /node_modules/,
|
|
17
|
+
},
|
|
18
|
+
]);
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { StorybookConfig } from 'storybook/internal/types';
|
|
2
|
+
import { mergeConfig, type InlineConfig } from 'vite';
|
|
3
|
+
|
|
4
|
+
const config: StorybookConfig & { viteFinal?: (config: InlineConfig, options: { configType: string }) => InlineConfig | Promise<InlineConfig> } = {
|
|
5
|
+
stories: ['../src/stories/**/*.stories.@(ts|tsx|js|jsx|mdx)'],
|
|
6
|
+
addons: [
|
|
7
|
+
'@storybook/addon-links'
|
|
8
|
+
],
|
|
9
|
+
framework: {
|
|
10
|
+
name: '@aurelia/storybook',
|
|
11
|
+
options: {},
|
|
12
|
+
},
|
|
13
|
+
core: {
|
|
14
|
+
builder: '@storybook/builder-vite',
|
|
15
|
+
},
|
|
16
|
+
viteFinal: async (viteConfig) => {
|
|
17
|
+
viteConfig.optimizeDeps = viteConfig.optimizeDeps || {};
|
|
18
|
+
viteConfig.optimizeDeps.exclude = viteConfig.optimizeDeps.exclude || [];
|
|
19
|
+
if (!viteConfig.optimizeDeps.exclude.includes('@aurelia/runtime-html')) {
|
|
20
|
+
viteConfig.optimizeDeps.exclude.push('@aurelia/runtime-html');
|
|
21
|
+
}
|
|
22
|
+
return mergeConfig(viteConfig, {
|
|
23
|
+
// ...any additional Vite configuration
|
|
24
|
+
});
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default config;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { render, renderToCanvas } from '@aurelia/storybook';
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# Aurelia Storybook Hello World
|
|
2
|
+
|
|
3
|
+
This project is bootstrapped by [aurelia/new](https://github.com/aurelia/new).
|
|
4
|
+
|
|
5
|
+
## Start dev web server
|
|
6
|
+
|
|
7
|
+
npm start
|
|
8
|
+
|
|
9
|
+
## Start Storybook
|
|
10
|
+
|
|
11
|
+
npm run storybook
|
|
12
|
+
|
|
13
|
+
## Build the app in production mode
|
|
14
|
+
|
|
15
|
+
npm run build
|
|
16
|
+
|
|
17
|
+
## Build Storybook
|
|
18
|
+
|
|
19
|
+
npm run build-storybook
|
|
20
|
+
|
|
21
|
+
## Unit Tests
|
|
22
|
+
|
|
23
|
+
npm run test
|
|
24
|
+
|
|
25
|
+
Run unit tests in watch mode.
|
|
26
|
+
|
|
27
|
+
npm run test:watch
|
|
28
|
+
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import eslint from "@eslint/js";
|
|
2
|
+
import tseslint from 'typescript-eslint';
|
|
3
|
+
import tsParser from "@typescript-eslint/parser";
|
|
4
|
+
import globals from "globals";
|
|
5
|
+
|
|
6
|
+
export default [
|
|
7
|
+
eslint.configs.recommended,
|
|
8
|
+
...tseslint.configs.recommended,
|
|
9
|
+
{
|
|
10
|
+
files: ["**/*.ts"],
|
|
11
|
+
|
|
12
|
+
languageOptions: {
|
|
13
|
+
globals: {
|
|
14
|
+
...globals.builtin,
|
|
15
|
+
...globals.nodeBuiltin,
|
|
16
|
+
...globals.browser,
|
|
17
|
+
...globals.node,
|
|
18
|
+
},
|
|
19
|
+
|
|
20
|
+
parser: tsParser,
|
|
21
|
+
ecmaVersion: 2019,
|
|
22
|
+
sourceType: "module",
|
|
23
|
+
},
|
|
24
|
+
}
|
|
25
|
+
];
|
|
Binary file
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
|
|
4
|
+
<head>
|
|
5
|
+
<meta charset="utf-8">
|
|
6
|
+
<title>Aurelia</title>
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
8
|
+
<script type="module" src="/src/main.ts"></script>
|
|
9
|
+
<base href="/">
|
|
10
|
+
</head>
|
|
11
|
+
|
|
12
|
+
<body>
|
|
13
|
+
<my-app></my-app>
|
|
14
|
+
</body>
|
|
15
|
+
|
|
16
|
+
</html>
|
|
17
|
+
|