Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) fuz.dev

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
164 changes: 9 additions & 155 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,160 +1,14 @@
# @fuzdev/fuz_template ❄
# www.fuz.dev

[<img src="/static/logo.svg" alt="a friendly pixelated spider facing you" align="right" width="192" height="192">](https://template.fuz.dev/)
[<img src="static/logo.svg" alt="a friendly brown spider facing you" align="right" width="192" height="192">](https://www.fuz.dev/)

> a static web app and Node library template with
> [TypeScript](https://github.com/microsoft/TypeScript),
> [Svelte](https://github.com/sveltejs/svelte),
> [SvelteKit](https://github.com/sveltejs/kit),
> [Vite](https://github.com/vitejs/vite),
> [esbuild](https://github.com/evanw/esbuild),
> [Gro](https://github.com/ryanatkn/gro),
> and [Fuz UI](https://github.com/fuzdev/fuz_ui)
> friendly user zystem 🦋 [fuz.dev](https://www.fuz.dev/)

[**template.fuz.dev**](https://template.fuz.dev/)
Fuz is a zippy stack and forge for the commons.
Today Fuz has a collection of libraries for making modern websites
with TypeScript, CSS, Svelte, and SvelteKit/Vite,
and soon they'll be joined by native tools for sovereign software development, written in Rust.

## contents
## License 🐦

- [SvelteKit](https://github.com/sveltejs/kit) with [Svelte](https://github.com/sveltejs/svelte) and
[Vite](https://github.com/vitejs/vite)
- [Fuz CSS](https://github.com/fuzdev/fuz_css): CSS framework and design system based on style variables
- [Fuz UI](https://github.com/fuzdev/fuz_ui):
- Svelte UI library - [ui.fuz.dev](https://ui.fuz.dev/)
- is optional, to remove, `npm uninstall @fuzdev/fuz_ui` and delete the imports
- [Gro](https://github.com/ryanatkn/gro):
- extends [SvelteKit](https://github.com/sveltejs/kit) and
[Vite](https://github.com/vitejs/vite)
- integrated [TypeScript](https://github.com/microsoft/TypeScript)
with [Svelte](https://github.com/sveltejs/svelte) and
[svelte-check](https://github.com/sveltejs/language-tools/tree/master/packages/svelte-check)
- testing with [Vitest](https://github.com/vitest-dev/vitest)
- formatting with [Prettier](https://github.com/prettier/prettier)
- linting with [ESLint](https://github.com/eslint/eslint)
and [`@ryanatkn/eslint-config`](https://github.com/ryanatkn/eslint-config)
- also has [a task system](https://github.com/ryanatkn/gro/blob/main/src/docs/task.md)
with a bunch of [builtins](https://github.com/ryanatkn/gro/blob/main/src/docs/tasks.md),
[codegen](https://github.com/ryanatkn/gro/blob/main/src/docs/gen.md),
and [other things](https://github.com/ryanatkn/gro/tree/main/src/lib/docs)
- optional [utilities library `@fuzdev/fuz_util`](https://github.com/fuzdev/fuz_util)

## usage

This project uses [SvelteKit](https://kit.svelte.dev/) with the static adapter
and [Vite](https://vitejs.dev/),
so the normal commands like `vite dev` work as expected.
It also uses [Gro](https://github.com/ryanatkn/gro)
for tasks like deploying and more.

**⚠️ Important,** this template is designed for **public** open source projects.
Its `package.json` has `"public": true` by default,
which [tells Gro](https://github.com/ryanatkn/gro/blob/main/src/docs/gro_plugin_sveltekit_app.md#well_known_package_json)
to publish the `package.json` and a map of its `src/` directory
to `static/.well-known/` during the build.
This can leak sensitive information if you are not careful ⚠️
To disable the feature, edit [package.json](/package.json):

```diff
// package.json
- "public": true, // remove this to disable the public `.well-known` files
+ "private": true, // if you want to disable npm publishing, add this
```

> [Windows will not be suported](https://github.com/fuzdev/fuz_template/issues/4)
> because I chose Bash instead - [WSL](https://docs.microsoft.com/en-us/windows/wsl/about) works

If you're logged into GitHub, click "Use this template" above or clone with
[`degit`](https://github.com/Rich-Harris/degit):

```bash
npx degit fuzdev/fuz_template cooltoy
cd cooltoy
npm i
# then
vite dev
# or
npm run dev
# or
gro dev # npm i -g @ryanatkn/gro
gro sync # called by `gro dev`, refreshes generated files and calls `svelte-kit sync`
```

> learn more about [SvelteKit](https://github.com/sveltejs/kit),
> [Vite](https://github.com/vitejs/vite), [Gro](https://github.com/ryanatkn/gro),
> and [Fuz UI](https://github.com/fuzdev/fuz_ui)

The template includes
[`@sveltejs/adapter-static`](https://github.com/sveltejs/kit/tree/master/packages/adapter-static)
so it can [deploy](https://github.com/ryanatkn/gro/blob/main/src/docs/deploy.md)
with no further configuration.
To learn how to swap it out for another deployment target, see
[the SvelteKit adapter docs](https://kit.svelte.dev/docs#adapters).

To make it your own, change `@fuzdev/fuz_template` and `template.fuz.dev`
to your project name in the following files:

- [`package.json`](package.json)
- [`svelte.config.js`](svelte.config.js)
- [`src/routes/+layout.svelte`](src/routes/+layout.svelte)
- [`src/routes/+page.svelte`](src/routes/+page.svelte)
- update or delete [`src/static/CNAME`](src/static/CNAME)
and [.github/FUNDING.yml](.github/FUNDING.yml)

Then run `npm i` to update `package-lock.json`.

Optionally add a [license file](https://choosealicense.com/)
and [`package.json` value](https://spdx.org/licenses/), like `"license": "MIT"`.

## build

```bash
npm run build
# or
gro build
```

See [Gro's build docs](https://github.com/ryanatkn/gro/blob/main/src/docs/build.md) for more.

## test

```bash
npm test
# or
gro test
gro test filepattern1 filepatternB
gro test -- --forwarded-args 'to vitest'
```

See [Vitest](https://github.com/vitest-dev/vitest),
[`src/lib/example.test.ts`](src/lib/example.test.ts),
and [Gro's test docs](https://github.com/ryanatkn/gro/blob/main/src/docs/test.md) for more.

## deploy

[Deploy](https://github.com/ryanatkn/gro/blob/main/src/docs/deploy.md)
(build, commit, and push) to the `deploy` branch, e.g. for GitHub Pages:

```bash
npm i -D @sveltejs/package # enables Gro's library plugin by default
npm run deploy
# or
gro deploy
```

## credits 🐢<sub>🐢</sub><sub><sub>🐢</sub></sub>

[Svelte](https://github.com/sveltejs/svelte) ∙
[SvelteKit](https://github.com/sveltejs/kit) ∙
[Vite](https://github.com/vitejs/vite) ∙
[esbuild](https://github.com/evanw/esbuild) ∙
[Vitest](https://github.com/vitest-dev/vitest) ∙
[TypeScript](https://github.com/microsoft/TypeScript) ∙
[ESLint](https://github.com/eslint/eslint) ∙
[Prettier](https://github.com/prettier/prettier) ∙
[Fuz CSS](https://github.com/fuzdev/fuz_css) ∙
[Fuz](https://github.com/fuzdev/fuz_ui) ∙
[Gro](https://github.com/ryanatkn/gro) ∙
[@fuzdev/fuz_util](https://github.com/fuzdev/fuz_util) ∙
[Zod](https://github.com/colinhacks/zod) ∙
& [more](package.json)

## [🐦](https://wikipedia.org/wiki/Free_and_open-source_software)
[MIT](LICENSE)
20 changes: 10 additions & 10 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
{
"name": "@fuzdev/fuz_template",
"name": "www.fuz.dev",
"version": "0.0.1",
"description": "a static web app and Node library template with TypeScript, Svelte, SvelteKit, Vite, esbuild, Gro, and Fuz",
"glyph": "❄",
"description": "website for the Fuz stack",
"motto": "friendly user zystem",
"glyph": "🦋",
"logo": "logo.svg",
"logo_alt": "a friendly pixelated spider facing you",
"public": true,
"homepage": "https://template.fuz.dev/",
"repository": "https://github.com/fuzdev/fuz_template",
"homepage": "https://www.fuz.dev/",
"repository": "https://github.com/fuzdev/www.fuz.dev",
"scripts": {
"start": "gro dev",
"dev": "gro dev",
Expand All @@ -22,8 +23,8 @@
"node": ">=22.15"
},
"devDependencies": {
"@fuzdev/fuz_css": "^0.42.0",
"@fuzdev/fuz_ui": "^0.171.0",
"@fuzdev/fuz_css": "^0.42.1",
"@fuzdev/fuz_ui": "^0.172.0",
"@fuzdev/fuz_util": "^0.42.0",
"@ryanatkn/eslint-config": "^0.9.0",
"@ryanatkn/gro": "^0.181.0",
Expand Down
17 changes: 13 additions & 4 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,31 @@
import '@fuzdev/fuz_css/style.css';
import '@fuzdev/fuz_css/theme.css';
import '$routes/fuz.css';
import '$routes/style.css';

import Themed from '@fuzdev/fuz_ui/Themed.svelte';
import type {Snippet} from 'svelte';
import Themed from '@fuzdev/fuz_ui/Themed.svelte';
import ContextmenuRoot from '@fuzdev/fuz_ui/ContextmenuRoot.svelte';
import {library_context, Library} from '@fuzdev/fuz_ui/library.svelte.js';
import Spiders from '@fuzdev/fuz_ui/Spiders.svelte';

import {library_json} from './library.js';

const {
children,
}: {
children: Snippet;
} = $props();

library_context.set(new Library(library_json));
</script>

<svelte:head>
<title>@fuzdev/fuz_template</title>
<title>Fuz - friendly user zystem</title>
</svelte:head>

<Themed>
{@render children()}
<ContextmenuRoot>
{@render children()}
<Spiders />
</ContextmenuRoot>
</Themed>
69 changes: 34 additions & 35 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
<script lang="ts">
import Svg from '@fuzdev/fuz_ui/Svg.svelte';
import {fuz_logo} from '@fuzdev/fuz_ui/logos.js';
import Card from '@fuzdev/fuz_ui/Card.svelte';
import {resolve} from '$app/paths';
import {random_item} from '@fuzdev/fuz_util/random.js';
import ColorSchemeInput from '@fuzdev/fuz_ui/ColorSchemeInput.svelte';
import ThemeInput from '@fuzdev/fuz_ui/ThemeInput.svelte';

import Mreows, {items} from '$routes/Mreows.svelte';
import DocsFooter from '@fuzdev/fuz_ui/DocsFooter.svelte';
import ProjectLinks from '@fuzdev/fuz_ui/ProjectLinks.svelte';
import {library_context} from '@fuzdev/fuz_ui/library.svelte.js';
import Svg from '@fuzdev/fuz_ui/Svg.svelte';
import {logo_fuz} from '@fuzdev/fuz_ui/logos.js';
import {MAIN_HEADER_MARGIN_TOP} from '@fuzdev/fuz_ui/constants.js';

let mreows: Array<{glyph: string}> | undefined = $state([random_item(items), items[4]!]);
const library = library_context.get();
</script>

<main>
<section class="box">
<header class="box pt_xl">
<Svg data={fuz_logo} size="var(--icon_size_xl)" />
<h1 class="mt_xl2">fuz_template</h1>
</header>
<Card href={resolve('/about')} icon="">about</Card>
</section>
<section class="box panel">
<div class="p_xl box">
<h2 class="mt_0">color scheme</h2>
<ColorSchemeInput />
<h2>theme</h2>
<ThemeInput />
</div>
</section>
<Mreows bind:mreows />
<main class="box width_100">
<div class="box width_upto_md mb_xl9">
<section class="box">
<h1 class="mb_sm" style:margin-top={MAIN_HEADER_MARGIN_TOP}>fuz</h1>
<div class="box mb_lg"><Svg data={logo_fuz} size="var(--icon_size_xl2)" /></div>
<blockquote class="shadow_bottom_sm px_xl bg mb_xl3">friendly user zystem 🦋</blockquote>
<div class="mb_lg p_xs2 shadow_md border_radius_sm">
<div class="width_upto_sm panel p_lg shadow_inset_xs bg">
<p>
Fuz is a zippy stack and forge for the commons. Today Fuz has a collection of libraries
for making modern websites with TypeScript, CSS, Svelte, and SvelteKit/Vite, and soon
they'll be joined by native tools for sovereign software development, written in Rust.
</p>
</div>
</div>
</section>
<section class="panel p_lg shadow_inset_xs">
<ProjectLinks />
</section>
<section>
<DocsFooter {library}>
{#snippet logo_header()}
<a href={resolve('/about')} class="mb_xs">about</a>
{/snippet}
</DocsFooter>
</section>
</div>
</main>

<style>
main {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 auto;
}
</style>
Loading