@alstar/create 0.0.0-beta.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/main.js +3 -0
- package/package.json +11 -0
- package/template/_gitignore +3 -0
- package/template/components/SiteLayout.ts +27 -0
- package/template/components/Welcome/Welcome.css +55 -0
- package/template/components/Welcome/Welcome.ts +27 -0
- package/template/index.ts +21 -0
- package/template/package.json +16 -0
- package/template/pages/index.ts +4 -0
- package/template/public/favicon.svg +6 -0
- package/template/public/main.css +3 -0
- package/template/public/refresh-client.js +12 -0
- package/template/tsconfig.json +3 -0
package/main.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { html } from 'hono/html'
|
|
2
|
+
import { type HtmlEscapedString } from 'hono/utils/html'
|
|
3
|
+
|
|
4
|
+
export default (
|
|
5
|
+
content: string | HtmlEscapedString | Promise<HtmlEscapedString>
|
|
6
|
+
) => {
|
|
7
|
+
return html`
|
|
8
|
+
<!DOCTYPE html>
|
|
9
|
+
<html lang="en">
|
|
10
|
+
<head>
|
|
11
|
+
<meta charset="UTF-8" />
|
|
12
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
13
|
+
<title>Alster</title>
|
|
14
|
+
|
|
15
|
+
<link rel="icon" type="image/svg" href="/favicon.svg" />
|
|
16
|
+
|
|
17
|
+
<meta name="color-scheme" content="light dark" />
|
|
18
|
+
|
|
19
|
+
<script src="refresh-client.js"></script>
|
|
20
|
+
<link rel="stylesheet" href="/main.css" />
|
|
21
|
+
</head>
|
|
22
|
+
<body>
|
|
23
|
+
${content}
|
|
24
|
+
</body>
|
|
25
|
+
</html>
|
|
26
|
+
`
|
|
27
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
section.welcome {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
align-items: center;
|
|
5
|
+
justify-content: center;
|
|
6
|
+
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
|
|
9
|
+
width: 100%;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
padding-bottom: 10vh;
|
|
12
|
+
margin-bottom: 0;
|
|
13
|
+
|
|
14
|
+
color: #333;
|
|
15
|
+
font-family: 15px;
|
|
16
|
+
|
|
17
|
+
a {
|
|
18
|
+
color: dodgerblue;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div {
|
|
22
|
+
> h1 {
|
|
23
|
+
display: flex;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
|
|
26
|
+
a {
|
|
27
|
+
display: block;
|
|
28
|
+
max-width: 150px;
|
|
29
|
+
color: inherit;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
svg {
|
|
33
|
+
width: 100%;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
ol {
|
|
38
|
+
font-family: monospace;
|
|
39
|
+
|
|
40
|
+
margin-top: 2rem;
|
|
41
|
+
padding-left: 1.2rem;
|
|
42
|
+
|
|
43
|
+
li {
|
|
44
|
+
line-height: 1.8;
|
|
45
|
+
margin-bottom: 0.25rem;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
code {
|
|
50
|
+
background-color: #eeeeee;
|
|
51
|
+
padding: 0.375rem;
|
|
52
|
+
border-radius: 4px;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { html } from 'hono/html'
|
|
2
|
+
|
|
3
|
+
export default () => {
|
|
4
|
+
return html`
|
|
5
|
+
<link rel="stylesheet" href="/components/Welcome/Welcome.css" />
|
|
6
|
+
|
|
7
|
+
<section class="welcome">
|
|
8
|
+
<div>
|
|
9
|
+
<h1>
|
|
10
|
+
<a href="/" aria-label="Go to Alsters homepage">
|
|
11
|
+
<svg viewBox="0 0 1289 342" fill="none">
|
|
12
|
+
<path
|
|
13
|
+
d="M7.152 342C2.88533 342 0.752001 339.867 0.752001 335.6V98.288C0.752001 95.5573 1.60533 92.9973 3.312 90.608L63.728 4.59198C65.6053 2.03198 68.336 0.751984 71.92 0.751984H163.568C167.323 0.751984 170.053 2.03198 171.76 4.59198L232.688 90.608C234.395 92.9973 235.248 95.5573 235.248 98.288V335.6C235.248 339.867 233.115 342 228.848 342H135.152C130.885 342 128.752 339.867 128.752 335.6V239.6H107.248V335.6C107.248 339.867 105.115 342 100.848 342H7.152ZM118 150.768C125.339 150.768 131.312 148.464 135.92 143.856C140.528 139.248 142.832 133.36 142.832 126.192C142.832 118.853 140.528 112.88 135.92 108.272C131.312 103.664 125.339 101.36 118 101.36C110.661 101.36 104.688 103.664 100.08 108.272C95.472 112.88 93.168 118.853 93.168 126.192C93.168 133.36 95.472 139.248 100.08 143.856C104.688 148.464 110.661 150.768 118 150.768ZM263.152 342C258.885 342 256.752 339.867 256.752 335.6V7.15198C256.752 2.88531 258.885 0.751984 263.152 0.751984H356.848C361.115 0.751984 363.248 2.88531 363.248 7.15198V239.6H406.512C410.779 239.6 412.912 241.733 412.912 246V335.6C412.912 339.867 410.779 342 406.512 342H263.152ZM440.652 342C436.385 342 434.252 339.867 434.252 335.6V263.408C434.252 261.36 434.337 259.739 434.508 258.544C434.849 257.179 435.873 255.984 437.58 254.96L491.852 223.728V210.928L438.348 182.768C435.617 181.232 434.252 178.672 434.252 175.088V59.888C434.252 57.1573 434.423 55.1947 434.764 54C435.105 52.6347 436.3 51.184 438.348 49.648L505.932 4.07999C507.297 3.05598 508.748 2.28797 510.284 1.77597C511.82 1.09331 513.783 0.751984 516.172 0.751984H606.54C610.807 0.751984 612.94 2.88531 612.94 7.15198V82.928C612.94 86.6826 611.66 89.2427 609.1 90.608L542.028 120.048V133.36L609.1 171.76C611.66 172.955 612.94 175.685 612.94 179.952V291.312C612.94 292.677 612.684 294.128 612.172 295.664C611.831 297.029 610.977 298.139 609.612 298.992L529.228 338.928C528.204 339.611 526.924 340.293 525.388 340.976C524.023 341.659 522.657 342 521.292 342H440.652ZM676.748 342C672.481 342 670.348 339.867 670.348 335.6V103.152H640.652C636.385 103.152 634.252 101.019 634.252 96.752V7.15198C634.252 2.88531 636.385 0.751984 640.652 0.751984H807.052C811.319 0.751984 813.452 2.88531 813.452 7.15198V96.752C813.452 101.019 811.319 103.152 807.052 103.152H777.1V335.6C777.1 339.867 774.967 342 770.7 342H676.748ZM841.152 342C836.885 342 834.752 339.867 834.752 335.6V7.15198C834.752 2.88531 836.885 0.751984 841.152 0.751984H1019.33C1023.59 0.751984 1025.73 2.88531 1025.73 7.15198V96.752C1025.73 101.019 1023.59 103.152 1019.33 103.152H941.248V124.4H1019.33C1023.59 124.4 1025.73 126.533 1025.73 130.8V211.952C1025.73 216.219 1023.59 218.352 1019.33 218.352H941.248V239.6H1019.33C1023.59 239.6 1025.73 241.733 1025.73 246V335.6C1025.73 339.867 1023.59 342 1019.33 342H841.152ZM1053.65 342C1049.39 342 1047.25 339.867 1047.25 335.6V7.15198C1047.25 2.88531 1049.39 0.751984 1053.65 0.751984H1210.07C1214.51 0.751984 1217.92 1.86132 1220.31 4.07999L1279.19 62.448C1281.07 64.1547 1282.26 65.6053 1282.77 66.8C1283.28 67.9946 1283.54 69.9573 1283.54 72.688V142.832C1283.54 145.051 1282.09 147.611 1279.19 150.512L1243.86 185.84L1238.23 190.96L1254.1 214.768L1286.1 276.208C1286.95 277.744 1287.47 279.28 1287.64 280.816C1287.98 282.181 1288.15 283.973 1288.15 286.192V335.6C1288.15 339.867 1286.01 342 1281.75 342H1200.85C1197.1 342 1194.54 340.293 1193.17 336.88L1158.1 246.768H1153.75V335.6C1153.75 339.867 1151.61 342 1147.35 342H1053.65ZM1165.27 139.76C1172.27 139.76 1177.9 137.541 1182.16 133.104C1186.6 128.667 1188.82 123.035 1188.82 116.208C1188.82 109.381 1186.6 103.835 1182.16 99.568C1177.9 95.1307 1172.27 92.912 1165.27 92.912C1158.44 92.912 1152.81 95.1307 1148.37 99.568C1144.11 103.835 1141.97 109.381 1141.97 116.208C1141.97 123.035 1144.11 128.667 1148.37 133.104C1152.81 137.541 1158.44 139.76 1165.27 139.76Z"
|
|
14
|
+
fill="currentColor"
|
|
15
|
+
/>
|
|
16
|
+
</svg>
|
|
17
|
+
</a>
|
|
18
|
+
</h1>
|
|
19
|
+
|
|
20
|
+
<ol>
|
|
21
|
+
<li>Get started by editing <code>pages/index.ts</code></li>
|
|
22
|
+
<li>Go to <a href="/admin">/admin</a> to add content</li>
|
|
23
|
+
</ol>
|
|
24
|
+
</div>
|
|
25
|
+
</section>
|
|
26
|
+
`
|
|
27
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createStudio, defineStructure } from '@alstar/studio'
|
|
2
|
+
import { createRefresher } from 'refresher'
|
|
3
|
+
|
|
4
|
+
createRefresher({ rootdir: '.' })
|
|
5
|
+
|
|
6
|
+
const structure = defineStructure([
|
|
7
|
+
{
|
|
8
|
+
name: 'entry',
|
|
9
|
+
label: 'Entry',
|
|
10
|
+
type: 'entry',
|
|
11
|
+
fields: [
|
|
12
|
+
{
|
|
13
|
+
name: 'title',
|
|
14
|
+
label: 'Title',
|
|
15
|
+
type: 'text',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
},
|
|
19
|
+
])
|
|
20
|
+
|
|
21
|
+
await createStudio(structure)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "alstar-app",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"dev": "node --watch index.ts",
|
|
6
|
+
"start": "node index.ts"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {
|
|
9
|
+
"@types/node": "^24.1.0"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@alstar/studio": "workspace:*",
|
|
13
|
+
"@alstar/refresher": "workspace:*",
|
|
14
|
+
"hono": "^4.8.12"
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
<svg width="512" height="512" viewBox="0 0 512 512" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path
|
|
3
|
+
d="M89.728 512C83.328 512 80.128 508.8 80.128 502.4V146.432C80.128 142.336 81.408 138.496 83.968 134.912L174.592 5.88797C177.408 2.04797 181.504 0.127975 186.88 0.127975H324.352C329.984 0.127975 334.08 2.04797 336.64 5.88797L428.032 134.912C430.592 138.496 431.872 142.336 431.872 146.432V502.4C431.872 508.8 428.672 512 422.272 512H281.728C275.328 512 272.128 508.8 272.128 502.4V358.4H239.872V502.4C239.872 508.8 236.672 512 230.272 512H89.728ZM256 225.152C267.008 225.152 275.968 221.696 282.88 214.784C289.792 207.872 293.248 199.04 293.248 188.288C293.248 177.28 289.792 168.32 282.88 161.408C275.968 154.496 267.008 151.04 256 151.04C244.992 151.04 236.032 154.496 229.12 161.408C222.208 168.32 218.752 177.28 218.752 188.288C218.752 199.04 222.208 207.872 229.12 214.784C236.032 221.696 244.992 225.152 256 225.152Z"
|
|
4
|
+
fill="#222222" />
|
|
5
|
+
</svg>
|
|
6
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// client side script
|
|
2
|
+
const eventSource = new EventSource('http://localhost:5432')
|
|
3
|
+
eventSource.onmessage = () => {
|
|
4
|
+
setTimeout(() => {
|
|
5
|
+
window.location.reload()
|
|
6
|
+
}, 1000)
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
console.log(
|
|
10
|
+
'%c REFRESHER ACTIVE ',
|
|
11
|
+
'color: green; background: lightgreen; border-radius: 2px'
|
|
12
|
+
)
|