From 0cd87e6b84e4ea6758c216ce818df43c9e2575b6 Mon Sep 17 00:00:00 2001 From: Hunter Johnston Date: Sun, 6 Oct 2024 13:35:11 -0400 Subject: [PATCH] formatting --- .github/workflows/build-preview.yml | 44 +++---- .github/workflows/ci.yml | 112 +++++++++--------- .github/workflows/deploy-preview.yml | 58 ++++----- .github/workflows/deploy-prod.yml | 66 +++++------ .github/workflows/release.yml | 66 +++++------ README.md | 9 +- packages/formsnap/README.md | 28 ++--- packages/formsnap/playwright.config.ts | 10 +- packages/formsnap/postcss.config.cjs | 8 +- packages/formsnap/src/routes/+layout.svelte | 2 +- packages/formsnap/svelte.config.js | 4 +- packages/formsnap/tailwind.config.cjs | 6 +- packages/formsnap/vite.config.ts | 8 +- sites/docs/content/components/description.md | 4 +- .../docs/content/components/element-field.md | 19 +-- sites/docs/content/components/field.md | 5 +- sites/docs/content/components/fieldset.md | 16 +-- .../content/composition/get-form-field.md | 5 +- sites/docs/content/index.md | 4 +- sites/docs/content/quick-start.md | 22 ++-- sites/docs/content/recipes/dynamic-fields.md | 12 +- sites/docs/content/recipes/multiple-select.md | 20 +--- sites/docs/mdsx.config.js | 8 +- .../lib/components/copy-code-button.svelte | 2 +- .../docs/src/lib/components/icon-grid.svelte | 2 +- .../page-header-description.svelte | 2 +- .../page-header/page-header-tagline.svelte | 2 +- .../layout/page-header/page-header.svelte | 2 +- .../layout/sidebar/sidebar-nav-item.svelte | 9 +- .../src/lib/components/loading-card.svelte | 2 +- .../lib/components/markdown/blueprint.svelte | 22 +++- .../docs/src/lib/components/tabs/tabs.svelte | 2 +- .../docs/src/lib/components/ui/alert/index.ts | 11 +- .../dropdown-menu-content.svelte | 6 +- sites/docs/src/lib/styles/app.pcss | 4 +- sites/docs/src/lib/styles/markdown.pcss | 10 +- .../lib/styles/themes/tokyo-night-light.json | 6 +- .../lib/styles/themes/tokyo-night-storm.json | 6 +- sites/docs/src/routes/docs/+layout.svelte | 7 +- 39 files changed, 304 insertions(+), 327 deletions(-) diff --git a/.github/workflows/build-preview.yml b/.github/workflows/build-preview.yml index 573e792..262150c 100644 --- a/.github/workflows/build-preview.yml +++ b/.github/workflows/build-preview.yml @@ -2,32 +2,32 @@ name: Build Preview Deployment # cancel in-progress runs on new commits to same PR (github.event.number) concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.sha }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true on: - pull_request: - types: [opened, synchronize] + pull_request: + types: [opened, synchronize] jobs: - build-preview: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm + build-preview: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm - - name: Install dependencies - run: pnpm install + - name: Install dependencies + run: pnpm install - - name: Build site - run: pnpm build + - name: Build site + run: pnpm build - - name: Upload build artifact - uses: actions/upload-artifact@v4 - with: - name: preview-build - path: sites/docs/.svelte-kit/cloudflare + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: preview-build + path: sites/docs/.svelte-kit/cloudflare diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e210fbb..2183865 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,63 +1,63 @@ name: CI on: - push: - branches: - - main - pull_request: + push: + branches: + - main + pull_request: concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.sha }} - cancel-in-progress: true + group: ${{ github.workflow }}-${{ github.event.number || github.sha }} + cancel-in-progress: true jobs: - Check: - name: Run svelte-check - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm - - - name: Install dependencies - run: pnpm install - - - name: Run svelte-check - run: pnpm check - - Lint: - runs-on: ubuntu-latest - name: Lint - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm - - - name: Install dependencies - run: pnpm install - - - name: Lint - run: pnpm lint - - Test: - name: Test - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm - - - name: Install dependencies - run: pnpm install - - - name: Test - run: pnpm test + Check: + name: Run svelte-check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Run svelte-check + run: pnpm check + + Lint: + runs-on: ubuntu-latest + name: Lint + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Lint + run: pnpm lint + + Test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm + + - name: Install dependencies + run: pnpm install + + - name: Test + run: pnpm test diff --git a/.github/workflows/deploy-preview.yml b/.github/workflows/deploy-preview.yml index 9a88184..70d094a 100644 --- a/.github/workflows/deploy-preview.yml +++ b/.github/workflows/deploy-preview.yml @@ -1,37 +1,37 @@ name: Upload Preview Deployment on: - workflow_run: - workflows: ["Build Preview Deployment"] - types: - - completed + workflow_run: + workflows: ["Build Preview Deployment"] + types: + - completed permissions: - actions: read - deployments: write - contents: read - pull-requests: write + actions: read + deployments: write + contents: read + pull-requests: write jobs: - deploy-preview: - runs-on: ubuntu-latest - if: ${{ github.event.workflow_run.conclusion == 'success' }} - steps: - - name: Download build artifact - uses: actions/download-artifact@v4 - id: preview-build-artifact - with: - name: preview-build - path: build - github-token: ${{ secrets.GITHUB_TOKEN }} - run-id: ${{ github.event.workflow_run.id }} + deploy-preview: + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + steps: + - name: Download build artifact + uses: actions/download-artifact@v4 + id: preview-build-artifact + with: + name: preview-build + path: build + github-token: ${{ secrets.GITHUB_TOKEN }} + run-id: ${{ github.event.workflow_run.id }} - - name: Deploy to Cloudflare Pages - uses: AdrianGonz97/refined-cf-pages-action@v1 - with: - apiToken: ${{ secrets.CF_API_TOKEN }} - accountId: ${{ secrets.CF_ACCOUNT_ID }} - githubToken: ${{ secrets.GITHUB_TOKEN }} - projectName: formsnap - deploymentName: Preview - directory: ${{ steps.preview-build-artifact.outputs.download-path }} + - name: Deploy to Cloudflare Pages + uses: AdrianGonz97/refined-cf-pages-action@v1 + with: + apiToken: ${{ secrets.CF_API_TOKEN }} + accountId: ${{ secrets.CF_ACCOUNT_ID }} + githubToken: ${{ secrets.GITHUB_TOKEN }} + projectName: formsnap + deploymentName: Preview + directory: ${{ steps.preview-build-artifact.outputs.download-path }} diff --git a/.github/workflows/deploy-prod.yml b/.github/workflows/deploy-prod.yml index a4aaedc..c82b2d6 100644 --- a/.github/workflows/deploy-prod.yml +++ b/.github/workflows/deploy-prod.yml @@ -1,40 +1,40 @@ name: Production Deployment on: - push: - branches: - - main - paths: - - sites/docs/** - - packages/formsnap/** + push: + branches: + - main + paths: + - sites/docs/** + - packages/formsnap/** jobs: - deploy-production: - runs-on: ubuntu-latest - permissions: - contents: read - deployments: write - name: Deploy Production Site to Cloudflare Pages - steps: - - uses: actions/checkout@v4 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm + deploy-production: + runs-on: ubuntu-latest + permissions: + contents: read + deployments: write + name: Deploy Production Site to Cloudflare Pages + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm - - name: Install dependencies - run: pnpm install + - name: Install dependencies + run: pnpm install - - name: Build site - run: pnpm build + - name: Build site + run: pnpm build - - name: Deploy to Cloudflare Pages - uses: AdrianGonz97/refined-cf-pages-action@v1 - with: - apiToken: ${{ secrets.CF_API_TOKEN }} - accountId: ${{ secrets.CF_ACCOUNT_ID }} - githubToken: ${{ secrets.GITHUB_TOKEN }} - projectName: formsnap - directory: ./.svelte-kit/cloudflare - workingDirectory: sites/docs - deploymentName: Production + - name: Deploy to Cloudflare Pages + uses: AdrianGonz97/refined-cf-pages-action@v1 + with: + apiToken: ${{ secrets.CF_API_TOKEN }} + accountId: ${{ secrets.CF_ACCOUNT_ID }} + githubToken: ${{ secrets.GITHUB_TOKEN }} + projectName: formsnap + directory: ./.svelte-kit/cloudflare + workingDirectory: sites/docs + deploymentName: Production diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 14b668e..3688810 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,43 +1,43 @@ name: Release on: - push: - branches: - - main - - next + push: + branches: + - main + - next concurrency: ${{ github.workflow }}-${{ github.ref }} jobs: - release: - permissions: - contents: write # to create release (changesets/action) - pull-requests: write # to create pull request (changesets/action) - name: Release - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits - fetch-depth: 0 + release: + permissions: + contents: write # to create release (changesets/action) + pull-requests: write # to create pull request (changesets/action) + name: Release + runs-on: ubuntu-latest + steps: + - name: Checkout Repo + uses: actions/checkout@v4 + with: + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits + fetch-depth: 0 - - uses: pnpm/action-setup@v4 - - uses: actions/setup-node@v4 - with: - node-version: 20 - cache: pnpm + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 20 + cache: pnpm - - name: Install dependencies - run: pnpm install + - name: Install dependencies + run: pnpm install - - name: Create Release Pull Request or Publish to npm - id: changesets - uses: changesets/action@v1 - with: - commit: "chore(release): version package" - title: "chore(release): version package" - publish: pnpm ci:publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: Create Release Pull Request or Publish to npm + id: changesets + uses: changesets/action@v1 + with: + commit: "chore(release): version package" + title: "chore(release): version package" + publish: pnpm ci:publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/README.md b/README.md index 02efbe3..7a89a76 100644 --- a/README.md +++ b/README.md @@ -58,14 +58,14 @@ export const load: PageServerLoad = async () => { @@ -148,7 +148,6 @@ Made by [@huntabyte](https://github.com/huntabyte) and [community](https://githu - ## Community Join the Discord server to ask questions, find collaborators, or just say hi! @@ -158,4 +157,4 @@ Join the Discord server to ask questions, find collaborators, or just say hi! Svecosystem Discord community - \ No newline at end of file + diff --git a/packages/formsnap/README.md b/packages/formsnap/README.md index 1c92503..1ef5203 100644 --- a/packages/formsnap/README.md +++ b/packages/formsnap/README.md @@ -16,13 +16,13 @@ You'll handle the initial Superforms setup just as you normally would, where you ```ts // schemas.ts -import { z } from 'zod'; +import { z } from "zod"; export const settingsFormSchema = z.object({ email: z.string().email(), bio: z.string().max(250).optional(), marketingEmails: z.boolean().default(true), - language: z.enum(['en', 'es', 'fr']).default(['en']), - theme: z.enum(['light', 'dark']).default(['light']) + language: z.enum(["en", "es", "fr"]).default(["en"]), + theme: z.enum(["light", "dark"]).default(["light"]), }); ``` @@ -30,14 +30,14 @@ export const settingsFormSchema = z.object({ ```ts // +page.server.ts -import { superValidate } from 'sveltekit-superforms'; -import { zod } from 'sveltekit-superforms/adapters'; -import type { PageServerLoad } from './$types'; -import { settingsFormSchema } from './schemas'; +import { superValidate } from "sveltekit-superforms"; +import { zod } from "sveltekit-superforms/adapters"; +import type { PageServerLoad } from "./$types"; +import { settingsFormSchema } from "./schemas"; export const load: PageServerLoad = async () => { return { - form: await superValidate(zod(settingsFormSchema)) + form: await superValidate(zod(settingsFormSchema)), }; }; ``` @@ -46,15 +46,15 @@ export const load: PageServerLoad = async () => { ```svelte diff --git a/packages/formsnap/svelte.config.js b/packages/formsnap/svelte.config.js index 09eaef1..3333953 100644 --- a/packages/formsnap/svelte.config.js +++ b/packages/formsnap/svelte.config.js @@ -1,9 +1,9 @@ -import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; +import { vitePreprocess } from "@sveltejs/vite-plugin-svelte"; /** @type {import('@sveltejs/kit').Config} */ const config = { preprocess: [vitePreprocess({})], - kit: {} + kit: {}, }; export default config; diff --git a/packages/formsnap/tailwind.config.cjs b/packages/formsnap/tailwind.config.cjs index a2629b6..5373ea1 100644 --- a/packages/formsnap/tailwind.config.cjs +++ b/packages/formsnap/tailwind.config.cjs @@ -1,12 +1,12 @@ /** @type {import('tailwindcss').Config}*/ const config = { - content: ['./src/**/*.{html,js,svelte,ts}'], + content: ["./src/**/*.{html,js,svelte,ts}"], theme: { - extend: {} + extend: {}, }, - plugins: [] + plugins: [], }; module.exports = config; diff --git a/packages/formsnap/vite.config.ts b/packages/formsnap/vite.config.ts index 30eddb9..dfec53a 100644 --- a/packages/formsnap/vite.config.ts +++ b/packages/formsnap/vite.config.ts @@ -1,10 +1,10 @@ -import { sveltekit } from '@sveltejs/kit/vite'; -import { defineConfig } from 'vitest/config'; +import { sveltekit } from "@sveltejs/kit/vite"; +import { defineConfig } from "vitest/config"; export default defineConfig({ // eslint-disable-next-line @typescript-eslint/no-explicit-any plugins: [sveltekit() as any], test: { - include: ['src/**/*.{test,spec}.{js,ts}'] - } + include: ["src/**/*.{test,spec}.{js,ts}"], + }, }); diff --git a/sites/docs/content/components/description.md b/sites/docs/content/components/description.md index 1332b6b..bc6f6dc 100644 --- a/sites/docs/content/components/description.md +++ b/sites/docs/content/components/description.md @@ -16,9 +16,7 @@ Descriptions must be used within the context of a [Field](/docs/components/field - - Your full name, including your middle name if you have one. - + Your full name, including your middle name if you have one. ``` diff --git a/sites/docs/content/components/element-field.md b/sites/docs/content/components/element-field.md index c40adbf..e0787f6 100644 --- a/sites/docs/content/components/element-field.md +++ b/sites/docs/content/components/element-field.md @@ -14,14 +14,7 @@ Here's an example of how you might use the `ElementField` component to create a ```svelte - - -

+

diff --git a/sites/docs/src/lib/components/layout/page-header/page-header-tagline.svelte b/sites/docs/src/lib/components/layout/page-header/page-header-tagline.svelte index 7105e06..4fedb1f 100644 --- a/sites/docs/src/lib/components/layout/page-header/page-header-tagline.svelte +++ b/sites/docs/src/lib/components/layout/page-header/page-header-tagline.svelte @@ -4,6 +4,6 @@ export { className as class }; -

+

diff --git a/sites/docs/src/lib/components/layout/page-header/page-header.svelte b/sites/docs/src/lib/components/layout/page-header/page-header.svelte index b7c22fc..9df5238 100644 --- a/sites/docs/src/lib/components/layout/page-header/page-header.svelte +++ b/sites/docs/src/lib/components/layout/page-header/page-header.svelte @@ -6,7 +6,7 @@
diff --git a/sites/docs/src/lib/components/layout/sidebar/sidebar-nav-item.svelte b/sites/docs/src/lib/components/layout/sidebar/sidebar-nav-item.svelte index 6b467aa..e98f3cb 100644 --- a/sites/docs/src/lib/components/layout/sidebar/sidebar-nav-item.svelte +++ b/sites/docs/src/lib/components/layout/sidebar/sidebar-nav-item.svelte @@ -28,7 +28,7 @@ {/if} -
    +
      {#each navItem.items as item} {@const isActive = item.href @@ -38,7 +38,7 @@ {:else} - + {navItem.title} {/if} diff --git a/sites/docs/src/lib/components/loading-card.svelte b/sites/docs/src/lib/components/loading-card.svelte index 2ea7fab..9624718 100644 --- a/sites/docs/src/lib/components/loading-card.svelte +++ b/sites/docs/src/lib/components/loading-card.svelte @@ -16,7 +16,7 @@ {...$$restProps} >
      - +
      diff --git a/sites/docs/src/lib/components/markdown/blueprint.svelte b/sites/docs/src/lib/components/markdown/blueprint.svelte index 46f77c8..7c1c9eb 100644 --- a/sites/docs/src/lib/components/markdown/blueprint.svelte +++ b/sites/docs/src/lib/components/markdown/blueprint.svelte @@ -21,7 +21,27 @@ ul, } from "$lib/components/markdown/index.js"; - export { a, blockquote, h1, h2, h3, h4, h5, h6, hr, img, li, ol, p, pre, table, td, th, tr, ul }; + export { + a, + blockquote, + h1, + h2, + h3, + h4, + h5, + h6, + hr, + img, + li, + ol, + p, + pre, + table, + td, + th, + tr, + ul, + };