@govela/create 0.0.0-stage → 0.7.0
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 +21 -0
- package/README.md +17 -2
- package/bin/create.js +146 -0
- package/package.json +24 -4
- package/templates/app/base/AGENTS.md +44 -0
- package/templates/app/base/README.md +19 -0
- package/templates/app/base/_github/workflows/ci.yml +23 -0
- package/templates/app/base/_gitignore +7 -0
- package/templates/app/base/cmd/server/main.go +53 -0
- package/templates/app/base/go.mod +8 -0
- package/templates/app/base/server/routes/load.go +30 -0
- package/templates/app/base/vela.config.json +6 -0
- package/templates/app/base/vite.config.js +11 -0
- package/templates/app/base/vitest.setup.__EXT__ +5 -0
- package/templates/app/js/eslint.config.js +12 -0
- package/templates/app/js/package.json +32 -0
- package/templates/app/js/src/routes/Layout.vela +24 -0
- package/templates/app/js/src/routes/Page.test.js +13 -0
- package/templates/app/js/src/routes/Page.vela +10 -0
- package/templates/app/ts/eslint.config.js +14 -0
- package/templates/app/ts/package.json +34 -0
- package/templates/app/ts/src/routes/Layout.vela +26 -0
- package/templates/app/ts/src/routes/Page.test.ts +13 -0
- package/templates/app/ts/src/routes/Page.vela +12 -0
- package/templates/app/ts/tsconfig.json +4 -0
- package/templates/app/ts/vela.app.json +1 -0
- package/templates/default/base/AGENTS.md +28 -0
- package/templates/default/base/README.md +17 -0
- package/templates/default/base/_github/workflows/ci.yml +20 -0
- package/templates/default/base/_gitignore +2 -0
- package/templates/default/base/index.html +12 -0
- package/templates/default/base/vite.config.js +9 -0
- package/templates/default/base/vitest.setup.__EXT__ +5 -0
- package/templates/default/js/eslint.config.js +12 -0
- package/templates/default/js/package.json +28 -0
- package/templates/default/js/src/App.vela +25 -0
- package/templates/default/js/src/Counter.test.js +20 -0
- package/templates/default/js/src/Counter.vela +23 -0
- package/templates/default/js/src/main.js +4 -0
- package/templates/default/ts/eslint.config.js +14 -0
- package/templates/default/ts/package.json +30 -0
- package/templates/default/ts/src/App.vela +25 -0
- package/templates/default/ts/src/Counter.test.ts +20 -0
- package/templates/default/ts/src/Counter.vela +27 -0
- package/templates/default/ts/src/main.ts +4 -0
- package/templates/default/ts/tsconfig.json +18 -0
- package/templates/ssr/base/AGENTS.md +34 -0
- package/templates/ssr/base/README.md +30 -0
- package/templates/ssr/base/_github/workflows/ci.yml +23 -0
- package/templates/ssr/base/_gitignore +4 -0
- package/templates/ssr/base/cmd/server/main.go +57 -0
- package/templates/ssr/base/go.mod +5 -0
- package/templates/ssr/base/vela.config.json +6 -0
- package/templates/ssr/base/vite.config.js +11 -0
- package/templates/ssr/base/vitest.setup.__EXT__ +5 -0
- package/templates/ssr/js/eslint.config.js +12 -0
- package/templates/ssr/js/package.json +30 -0
- package/templates/ssr/js/src/App.vela +27 -0
- package/templates/ssr/js/src/Counter.test.js +20 -0
- package/templates/ssr/js/src/Counter.vela +23 -0
- package/templates/ssr/js/src/client.js +5 -0
- package/templates/ssr/ts/eslint.config.js +14 -0
- package/templates/ssr/ts/package.json +32 -0
- package/templates/ssr/ts/src/App.vela +27 -0
- package/templates/ssr/ts/src/Counter.test.ts +20 -0
- package/templates/ssr/ts/src/Counter.vela +27 -0
- package/templates/ssr/ts/src/client.ts +5 -0
- package/templates/ssr/ts/tsconfig.json +18 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<script>
|
|
2
|
+
export let step = 1;
|
|
3
|
+
|
|
4
|
+
let count = $state(0);
|
|
5
|
+
|
|
6
|
+
function increment() {
|
|
7
|
+
count += step;
|
|
8
|
+
$$dispatch('change', count);
|
|
9
|
+
}
|
|
10
|
+
</script>
|
|
11
|
+
|
|
12
|
+
<template>
|
|
13
|
+
<button @click={increment}>
|
|
14
|
+
<slot>Count</slot>: {count}
|
|
15
|
+
</button>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<style>
|
|
19
|
+
button {
|
|
20
|
+
font: inherit;
|
|
21
|
+
padding: 0.5rem 1rem;
|
|
22
|
+
}
|
|
23
|
+
</style>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { defineConfig } from 'eslint/config';
|
|
2
|
+
import js from '@eslint/js';
|
|
3
|
+
import globals from 'globals';
|
|
4
|
+
import tseslint from 'typescript-eslint';
|
|
5
|
+
import vela from '@govela/eslint-plugin';
|
|
6
|
+
|
|
7
|
+
export default defineConfig(
|
|
8
|
+
{ ignores: ['dist/', 'out/', 'build/', 'src/_app/'] },
|
|
9
|
+
js.configs.recommended,
|
|
10
|
+
tseslint.configs.recommended,
|
|
11
|
+
vela.configs.recommended,
|
|
12
|
+
{ files: ['src/**/*.ts', '**/*.vela/*.ts'], languageOptions: { globals: globals.browser } },
|
|
13
|
+
{ files: ['*.config.js'], languageOptions: { globals: globals.node } },
|
|
14
|
+
);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "__NAME__",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"dev:vela": "vela --watch",
|
|
8
|
+
"dev:server": "go run ./cmd/server -dev http://localhost:5173",
|
|
9
|
+
"check": "vela check --project src --types --ssr",
|
|
10
|
+
"lint": "eslint .",
|
|
11
|
+
"test": "vitest run",
|
|
12
|
+
"build": "vela && vite build && go build -o build/server ./cmd/server",
|
|
13
|
+
"start": "./build/server"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@govela/runtime": "__VERSION__"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@eslint/js": "^10.0.1",
|
|
20
|
+
"@govela/compiler": "__VERSION__",
|
|
21
|
+
"@govela/eslint-plugin": "__VERSION__",
|
|
22
|
+
"@govela/testing": "__VERSION__",
|
|
23
|
+
"@govela/unplugin": "__VERSION__",
|
|
24
|
+
"eslint": "^10.14.0",
|
|
25
|
+
"globals": "^17.0.0",
|
|
26
|
+
"happy-dom": "^21.0.4",
|
|
27
|
+
"typescript": "^6.0.3",
|
|
28
|
+
"typescript-eslint": "^8.72.1",
|
|
29
|
+
"vite": "^8.3.5",
|
|
30
|
+
"vitest": "^5.1.0"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import Counter from './Counter.vela';
|
|
3
|
+
|
|
4
|
+
export let title: string = 'Vela';
|
|
5
|
+
|
|
6
|
+
let total = $state(0);
|
|
7
|
+
|
|
8
|
+
function changed(event: CustomEvent<number>): void {
|
|
9
|
+
total = event.detail;
|
|
10
|
+
}
|
|
11
|
+
</script>
|
|
12
|
+
|
|
13
|
+
<template>
|
|
14
|
+
<main>
|
|
15
|
+
<h1>{title}</h1>
|
|
16
|
+
<Counter :step={1} @on:change={changed}>Clicks</Counter>
|
|
17
|
+
<p class="total">Total: {total}</p>
|
|
18
|
+
</main>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<style>
|
|
22
|
+
main {
|
|
23
|
+
font-family: system-ui, sans-serif;
|
|
24
|
+
max-width: 32rem;
|
|
25
|
+
margin: 4rem auto;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { expect, test } from 'vitest';
|
|
2
|
+
import { fireEvent, render } from '@govela/testing';
|
|
3
|
+
import Counter from './Counter.vela';
|
|
4
|
+
|
|
5
|
+
test('counts by its step and reports the count', async () => {
|
|
6
|
+
const counts: number[] = [];
|
|
7
|
+
const { container } = render(Counter, {
|
|
8
|
+
props: { step: 2 },
|
|
9
|
+
slots: { default: 'Clicks' },
|
|
10
|
+
events: { change: (event) => counts.push(event.detail) },
|
|
11
|
+
});
|
|
12
|
+
const button = container.querySelector('button')!;
|
|
13
|
+
expect(button.textContent).toBe('Clicks: 0');
|
|
14
|
+
|
|
15
|
+
await fireEvent.click(button);
|
|
16
|
+
await fireEvent.click(button);
|
|
17
|
+
|
|
18
|
+
expect(button.textContent).toBe('Clicks: 4');
|
|
19
|
+
expect(counts).toEqual([2, 4]);
|
|
20
|
+
});
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
interface $$Events {
|
|
3
|
+
change: number;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export let step: number = 1;
|
|
7
|
+
|
|
8
|
+
let count = $state(0);
|
|
9
|
+
|
|
10
|
+
function increment(): void {
|
|
11
|
+
count += step;
|
|
12
|
+
$$dispatch('change', count);
|
|
13
|
+
}
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<template>
|
|
17
|
+
<button @click={increment}>
|
|
18
|
+
<slot>Count</slot>: {count}
|
|
19
|
+
</button>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<style>
|
|
23
|
+
button {
|
|
24
|
+
font: inherit;
|
|
25
|
+
padding: 0.5rem 1rem;
|
|
26
|
+
}
|
|
27
|
+
</style>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "bundler",
|
|
6
|
+
"strict": true,
|
|
7
|
+
"noEmit": true,
|
|
8
|
+
"isolatedModules": true,
|
|
9
|
+
"verbatimModuleSyntax": true,
|
|
10
|
+
"erasableSyntaxOnly": true,
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"useDefineForClassFields": true,
|
|
13
|
+
"skipLibCheck": true,
|
|
14
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
15
|
+
"types": ["@govela/runtime/ambient"]
|
|
16
|
+
},
|
|
17
|
+
"include": ["src"]
|
|
18
|
+
}
|