Add build script
This commit is contained in:
parent
1160a04d23
commit
aa89362a0f
24 changed files with 509 additions and 461 deletions
41
.forgejo/workflows/build.yaml
Normal file
41
.forgejo/workflows/build.yaml
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
name: Build application
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup Node
|
||||||
|
uses: actions/setup-node@v4
|
||||||
|
with:
|
||||||
|
node-version: 22
|
||||||
|
- name: Get NPM cache directory
|
||||||
|
id: npm-cache-dir
|
||||||
|
shell: bash
|
||||||
|
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}
|
||||||
|
- uses: actions/cache@v4
|
||||||
|
name: Cache NPM
|
||||||
|
id: npm-cache
|
||||||
|
with:
|
||||||
|
path: ${{ steps.npm-cache-dir.outputs.dir }}
|
||||||
|
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-node-
|
||||||
|
- run: npm ci
|
||||||
|
name: Install dependencies
|
||||||
|
- run: npm lint
|
||||||
|
name: Lint code
|
||||||
|
- run: npm build
|
||||||
|
name: Build project
|
||||||
|
- run: npm test
|
||||||
|
name: Test project
|
||||||
|
- run: npm build-storybook
|
||||||
|
name: Build storybook
|
||||||
|
- uses: actions/upload-artifact@v4
|
||||||
|
name: Upload build directories
|
||||||
|
with:
|
||||||
|
name: build-artifacts
|
||||||
|
path: |
|
||||||
|
dist/
|
||||||
|
build/
|
||||||
|
.svelte-kit/
|
||||||
|
storybook-static/
|
2
.gitignore
vendored
2
.gitignore
vendored
|
@ -21,3 +21,5 @@ Thumbs.db
|
||||||
# Vite
|
# Vite
|
||||||
vite.config.js.timestamp-*
|
vite.config.js.timestamp-*
|
||||||
vite.config.ts.timestamp-*
|
vite.config.ts.timestamp-*
|
||||||
|
|
||||||
|
/storybook-static
|
||||||
|
|
|
@ -1,20 +1,15 @@
|
||||||
|
|
||||||
|
|
||||||
/** @type { import('@storybook/sveltekit').StorybookConfig } */
|
/** @type { import('@storybook/sveltekit').StorybookConfig } */
|
||||||
const config = {
|
const config = {
|
||||||
"stories": [
|
stories: ['../src/**/*.mdx', '../src/**/*.stories.@(js|ts|svelte)'],
|
||||||
"../src/**/*.mdx",
|
addons: [
|
||||||
"../src/**/*.stories.@(js|ts|svelte)"
|
'@storybook/addon-svelte-csf',
|
||||||
|
'@storybook/addon-essentials',
|
||||||
|
'@chromatic-com/storybook',
|
||||||
|
'@storybook/addon-interactions'
|
||||||
],
|
],
|
||||||
"addons": [
|
framework: {
|
||||||
"@storybook/addon-svelte-csf",
|
name: '@storybook/sveltekit',
|
||||||
"@storybook/addon-essentials",
|
options: {}
|
||||||
"@chromatic-com/storybook",
|
|
||||||
"@storybook/addon-interactions"
|
|
||||||
],
|
|
||||||
"framework": {
|
|
||||||
"name": "@storybook/sveltekit",
|
|
||||||
"options": {}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
export default config;
|
export default config;
|
|
@ -4,10 +4,10 @@ const preview = {
|
||||||
controls: {
|
controls: {
|
||||||
matchers: {
|
matchers: {
|
||||||
color: /(background|color)$/i,
|
color: /(background|color)$/i,
|
||||||
date: /Date$/i,
|
date: /Date$/i
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
},
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default preview;
|
export default preview;
|
4
.vscode/extensions.json
vendored
4
.vscode/extensions.json
vendored
|
@ -1,5 +1,3 @@
|
||||||
{
|
{
|
||||||
"recommendations": [
|
"recommendations": ["inlang.vs-code-extension"]
|
||||||
"inlang.vs-code-extension"
|
|
||||||
]
|
|
||||||
}
|
}
|
31
src/app.css
31
src/app.css
|
@ -18,28 +18,33 @@
|
||||||
--color-secondary-900: #a8a4ea;
|
--color-secondary-900: #a8a4ea;
|
||||||
--color-accent: var(--color-primary-500);
|
--color-accent: var(--color-primary-500);
|
||||||
--color-accent-contrast: #fff;
|
--color-accent-contrast: #fff;
|
||||||
--color-border: rgba(0, 0, 0, .1);
|
--color-border: rgba(0, 0, 0, 0.1);
|
||||||
--color-surface: #ececec;
|
--color-surface: #ececec;
|
||||||
--color-dark-surface: rgba(26, 37, 22, .9);
|
--color-dark-surface: rgba(26, 37, 22, 0.9);
|
||||||
--color-dark-surface-text: white;
|
--color-dark-surface-text: white;
|
||||||
--color-dark-surface-text-dim: #808080;
|
--color-dark-surface-text-dim: #808080;
|
||||||
--color-light-surface: rgba(255, 255, 255, .9);
|
--color-light-surface: rgba(255, 255, 255, 0.9);
|
||||||
--color-light-surface-text: var(--color-text);
|
--color-light-surface-text: var(--color-text);
|
||||||
--color-accent-surface: var(--color-accent);
|
--color-accent-surface: var(--color-accent);
|
||||||
--color-accent-surface-text: var(--color-accent-contrast);
|
--color-accent-surface-text: var(--color-accent-contrast);
|
||||||
--color-highlight-accent: rgba(255, 145, 49, .2);
|
--color-highlight-accent: rgba(255, 145, 49, 0.2);
|
||||||
--color-highlight-blue: rgba(10, 10, 255, .2);
|
--color-highlight-blue: rgba(10, 10, 255, 0.2);
|
||||||
--color-highlight-white: rgba(200, 200, 200, .2);
|
--color-highlight-white: rgba(200, 200, 200, 0.2);
|
||||||
--color-highlight-grey: rgba(100, 100, 100, .2);
|
--color-highlight-grey: rgba(100, 100, 100, 0.2);
|
||||||
--color-highlight-yellow: rgba(255, 230, 10, .2);
|
--color-highlight-yellow: rgba(255, 230, 10, 0.2);
|
||||||
--color-highlight-green: rgba(10, 255, 10, .2);
|
--color-highlight-green: rgba(10, 255, 10, 0.2);
|
||||||
--color-highlight-red: rgba(255, 10, 10, .2);
|
--color-highlight-red: rgba(255, 10, 10, 0.2);
|
||||||
--color-highlight-pink: rgba(255, 128, 255, .2);
|
--color-highlight-pink: rgba(255, 128, 255, 0.2);
|
||||||
--color-highlight-purple: rgba(204, 30, 152, .2);
|
--color-highlight-purple: rgba(204, 30, 152, 0.2);
|
||||||
--color-text: black;
|
--color-text: black;
|
||||||
--color-background: var(--color-base);
|
--color-background: var(--color-base);
|
||||||
--nav-space: 95px;
|
--nav-space: 95px;
|
||||||
--fill-pattern: repeating-linear-gradient( var(--layout-slant), var(--color-base) 0, var(--color-primary-500) .5px 3px, var(--color-base) 3.5px 12px );
|
--fill-pattern: repeating-linear-gradient(
|
||||||
|
var(--layout-slant),
|
||||||
|
var(--color-base) 0,
|
||||||
|
var(--color-primary-500) 0.5px 3px,
|
||||||
|
var(--color-base) 3.5px 12px
|
||||||
|
);
|
||||||
--filter-gray: grayscale(1);
|
--filter-gray: grayscale(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Action } from "$lib/types";
|
import type { Action } from '$lib/types';
|
||||||
import { Coins } from "lucide-svelte";
|
import { Coins } from 'lucide-svelte';
|
||||||
import * as m from '$lib/paraglide/messages.js';
|
import * as m from '$lib/paraglide/messages.js';
|
||||||
|
|
||||||
export let action: Action;
|
export let action: Action;
|
||||||
|
|
||||||
const onclick = (ev: MouseEvent) => {
|
const onclick = (ev: MouseEvent) => {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
}
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button class="action-card" {onclick}>
|
<button class="action-card" {onclick}>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
|
|
||||||
.body-part {
|
.body-part {
|
||||||
opacity: .75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
.type {
|
.type {
|
||||||
|
@ -43,7 +43,7 @@
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
gap: 5px;
|
gap: 5px;
|
||||||
opacity: .75;
|
opacity: 0.75;
|
||||||
|
|
||||||
> :global(svg) {
|
> :global(svg) {
|
||||||
color: var(--color-accent);
|
color: var(--color-accent);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Action } from "$lib/types";
|
import type { Action } from '$lib/types';
|
||||||
import ActionCard from './ActionCard.svelte';
|
import ActionCard from './ActionCard.svelte';
|
||||||
export let actions: Action[];
|
export let actions: Action[];
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
/**
|
/**
|
||||||
* An action to execute.
|
* An action to execute.
|
||||||
*/
|
*/
|
||||||
export type ActionType = "shock"|"vibrate";
|
export type ActionType = 'shock' | 'vibrate';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A body part an action can affect.
|
* A body part an action can affect.
|
||||||
*/
|
*/
|
||||||
export type BodyPartKey = "throat"|"thigh"|"ankle"|"upper_arm";
|
export type BodyPartKey = 'throat' | 'thigh' | 'ankle' | 'upper_arm';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Time in seconds or burst.
|
* Time in seconds or burst.
|
||||||
*/
|
*/
|
||||||
export type Time = number|"burst";
|
export type Time = number | 'burst';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Entry in the coinshop.
|
* Entry in the coinshop.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { i18n } from '$lib/i18n';
|
import { i18n } from '$lib/i18n';
|
||||||
import { ParaglideJS } from '@inlang/paraglide-sveltekit';
|
import { ParaglideJS } from '@inlang/paraglide-sveltekit';
|
||||||
import "../app.css";
|
import '../app.css';
|
||||||
|
|
||||||
import '@fontsource-variable/roboto-flex/full.css';
|
import '@fontsource-variable/roboto-flex/full.css';
|
||||||
|
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import StoreGrid from "$lib/components/StoreGrid.svelte";
|
import StoreGrid from '$lib/components/StoreGrid.svelte';
|
||||||
import type { Action } from "$lib/types.js";
|
import type { Action } from '$lib/types.js';
|
||||||
|
|
||||||
const exampleEntries: Action[] = [
|
const exampleEntries: Action[] = [
|
||||||
{
|
{
|
||||||
id: "abcd",
|
id: 'abcd',
|
||||||
type: "shock",
|
type: 'shock',
|
||||||
bodyPart: "thigh",
|
bodyPart: 'thigh',
|
||||||
cost: 12,
|
cost: 12,
|
||||||
subject: "raider",
|
subject: 'raider',
|
||||||
time: "burst"
|
time: 'burst'
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "efgh",
|
id: 'efgh',
|
||||||
type: "shock",
|
type: 'shock',
|
||||||
bodyPart: "ankle",
|
bodyPart: 'ankle',
|
||||||
cost: 8,
|
cost: 8,
|
||||||
subject: "raider",
|
subject: 'raider',
|
||||||
time: "burst"
|
time: 'burst'
|
||||||
}
|
}
|
||||||
]
|
];
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<h1>Punish Raider</h1>
|
<h1>Punish Raider</h1>
|
||||||
|
|
|
@ -12,11 +12,11 @@
|
||||||
backgroundColor: { control: 'color' },
|
backgroundColor: { control: 'color' },
|
||||||
size: {
|
size: {
|
||||||
control: { type: 'select' },
|
control: { type: 'select' },
|
||||||
options: ['small', 'medium', 'large'],
|
options: ['small', 'medium', 'large']
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
onClick: fn(),
|
onClick: fn()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
import { Meta } from "@storybook/blocks";
|
import { Meta } from '@storybook/blocks';
|
||||||
|
|
||||||
import Github from "./assets/github.svg";
|
import Github from './assets/github.svg';
|
||||||
import Discord from "./assets/discord.svg";
|
import Discord from './assets/discord.svg';
|
||||||
import Youtube from "./assets/youtube.svg";
|
import Youtube from './assets/youtube.svg';
|
||||||
import Tutorials from "./assets/tutorials.svg";
|
import Tutorials from './assets/tutorials.svg';
|
||||||
import Styling from "./assets/styling.png";
|
import Styling from './assets/styling.png';
|
||||||
import Context from "./assets/context.png";
|
import Context from './assets/context.png';
|
||||||
import Assets from "./assets/assets.png";
|
import Assets from './assets/assets.png';
|
||||||
import Docs from "./assets/docs.png";
|
import Docs from './assets/docs.png';
|
||||||
import Share from "./assets/share.png";
|
import Share from './assets/share.png';
|
||||||
import FigmaPlugin from "./assets/figma-plugin.png";
|
import FigmaPlugin from './assets/figma-plugin.png';
|
||||||
import Testing from "./assets/testing.png";
|
import Testing from './assets/testing.png';
|
||||||
import Accessibility from "./assets/accessibility.png";
|
import Accessibility from './assets/accessibility.png';
|
||||||
import Theming from "./assets/theming.png";
|
import Theming from './assets/theming.png';
|
||||||
import AddonLibrary from "./assets/addon-library.png";
|
import AddonLibrary from './assets/addon-library.png';
|
||||||
|
|
||||||
export const RightArrow = () => <svg
|
export const RightArrow = () => (
|
||||||
|
<svg
|
||||||
viewBox="0 0 14 14"
|
viewBox="0 0 14 14"
|
||||||
width="8px"
|
width="8px"
|
||||||
height="14px"
|
height="14px"
|
||||||
|
@ -27,9 +28,10 @@ export const RightArrow = () => <svg
|
||||||
fill: 'currentColor',
|
fill: 'currentColor',
|
||||||
'path fill': 'currentColor'
|
'path fill': 'currentColor'
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
|
<path d="m11.1 7.35-5.5 5.5a.5.5 0 0 1-.7-.7L10.04 7 4.9 1.85a.5.5 0 1 1 .7-.7l5.5 5.5c.2.2.2.5 0 .7Z" />
|
||||||
</svg>
|
</svg>
|
||||||
|
);
|
||||||
|
|
||||||
<Meta title="Configure your project" />
|
<Meta title="Configure your project" />
|
||||||
|
|
||||||
|
@ -38,6 +40,7 @@ export const RightArrow = () => <svg
|
||||||
# Configure your project
|
# Configure your project
|
||||||
|
|
||||||
Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community.
|
Because Storybook works separately from your app, you'll need to configure it for your specific stack and setup. Below, explore guides for configuring Storybook with popular frameworks and tools. If you get stuck, learn how you can ask for help from our community.
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div className="sb-section">
|
<div className="sb-section">
|
||||||
<div className="sb-section-item">
|
<div className="sb-section-item">
|
||||||
|
@ -84,6 +87,7 @@ export const RightArrow = () => <svg
|
||||||
# Do more with Storybook
|
# Do more with Storybook
|
||||||
|
|
||||||
Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs.
|
Now that you know the basics, let's explore other parts of Storybook that will improve your experience. This list is just to get you started. You can customise Storybook in many ways to fit your needs.
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="sb-section">
|
<div className="sb-section">
|
||||||
|
@ -203,6 +207,7 @@ export const RightArrow = () => <svg
|
||||||
target="_blank"
|
target="_blank"
|
||||||
>Discover tutorials<RightArrow /></a>
|
>Discover tutorials<RightArrow /></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|
|
@ -11,12 +11,12 @@
|
||||||
tags: ['autodocs'],
|
tags: ['autodocs'],
|
||||||
parameters: {
|
parameters: {
|
||||||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
||||||
layout: 'fullscreen',
|
layout: 'fullscreen'
|
||||||
},
|
},
|
||||||
args: {
|
args: {
|
||||||
onLogin: fn(),
|
onLogin: fn(),
|
||||||
onLogout: fn(),
|
onLogout: fn(),
|
||||||
onCreateAccount: fn(),
|
onCreateAccount: fn()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -10,12 +10,14 @@
|
||||||
component: Page,
|
component: Page,
|
||||||
parameters: {
|
parameters: {
|
||||||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout
|
||||||
layout: 'fullscreen',
|
layout: 'fullscreen'
|
||||||
},
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Story name="Logged In" play={async ({ canvasElement }) => {
|
<Story
|
||||||
|
name="Logged In"
|
||||||
|
play={async ({ canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
const loginButton = canvas.getByRole('button', { name: /Log in/i });
|
||||||
await expect(loginButton).toBeInTheDocument();
|
await expect(loginButton).toBeInTheDocument();
|
||||||
|
@ -25,6 +27,6 @@
|
||||||
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
const logoutButton = canvas.getByRole('button', { name: /Log out/i });
|
||||||
await expect(logoutButton).toBeInTheDocument();
|
await expect(logoutButton).toBeInTheDocument();
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Story name="Logged Out" />
|
<Story name="Logged Out" />
|
||||||
|
|
Loading…
Add table
Reference in a new issue