@pyreon/create-zero 0.1.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/LICENSE +21 -0
- package/README.md +32 -0
- package/bin/create-zero.js +2 -0
- package/lib/index.js +28 -0
- package/lib/index.js.map +1 -0
- package/package.json +29 -0
- package/templates/default/env.d.ts +6 -0
- package/templates/default/index.html +17 -0
- package/templates/default/package.json +27 -0
- package/templates/default/public/favicon.svg +10 -0
- package/templates/default/src/entry-client.ts +5 -0
- package/templates/default/src/entry-server.ts +19 -0
- package/templates/default/src/global.css +629 -0
- package/templates/default/src/routes/(admin)/dashboard.tsx +133 -0
- package/templates/default/src/routes/_error.tsx +24 -0
- package/templates/default/src/routes/_layout.tsx +49 -0
- package/templates/default/src/routes/_loading.tsx +8 -0
- package/templates/default/src/routes/about.tsx +125 -0
- package/templates/default/src/routes/counter.tsx +94 -0
- package/templates/default/src/routes/index.tsx +225 -0
- package/templates/default/src/routes/posts/[id].tsx +97 -0
- package/templates/default/src/routes/posts/index.tsx +115 -0
- package/templates/default/tsconfig.json +16 -0
- package/templates/default/vite.config.ts +29 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-present Vit Bokisch
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# create-zero
|
|
2
|
+
|
|
3
|
+
Scaffold a new [Pyreon Zero](https://github.com/user/pyreon-zero) project.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
bun create zero my-app
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Or with npx:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npx create-zero my-app
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## What's Included
|
|
18
|
+
|
|
19
|
+
The default template sets up a full-featured project with:
|
|
20
|
+
|
|
21
|
+
- Streaming SSR
|
|
22
|
+
- Dark/light theme
|
|
23
|
+
- Font optimization
|
|
24
|
+
- SEO (sitemap, robots.txt)
|
|
25
|
+
- Cache and security middleware
|
|
26
|
+
- File-based routing with example routes
|
|
27
|
+
- Error and loading boundaries
|
|
28
|
+
- Route guards
|
|
29
|
+
|
|
30
|
+
## License
|
|
31
|
+
|
|
32
|
+
[MIT](LICENSE)
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { cp, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { basename, join, resolve } from "node:path";
|
|
4
|
+
|
|
5
|
+
//#region src/index.ts
|
|
6
|
+
const TEMPLATE_DIR = resolve(import.meta.dirname, "../templates/default");
|
|
7
|
+
async function main() {
|
|
8
|
+
const projectName = process.argv.slice(2)[0];
|
|
9
|
+
if (!projectName || projectName === "--help" || projectName === "-h") process.exit(projectName ? 0 : 1);
|
|
10
|
+
const targetDir = resolve(process.cwd(), projectName);
|
|
11
|
+
if (existsSync(targetDir)) process.exit(1);
|
|
12
|
+
await cp(TEMPLATE_DIR, targetDir, { recursive: true });
|
|
13
|
+
const pkgPath = join(targetDir, "package.json");
|
|
14
|
+
const pkg = JSON.parse(await readFile(pkgPath, "utf-8"));
|
|
15
|
+
pkg.name = basename(projectName);
|
|
16
|
+
await writeFile(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`);
|
|
17
|
+
await writeFile(join(targetDir, ".gitignore"), `node_modules
|
|
18
|
+
dist
|
|
19
|
+
.DS_Store
|
|
20
|
+
*.local
|
|
21
|
+
`);
|
|
22
|
+
}
|
|
23
|
+
main().catch((_err) => {
|
|
24
|
+
process.exit(1);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/index.ts"],"sourcesContent":["import { existsSync } from 'node:fs'\nimport { cp, readFile, writeFile } from 'node:fs/promises'\nimport { basename, join, resolve } from 'node:path'\n\n// ─── Config ──────────────────────────────────────────────────────────────────\n\nconst TEMPLATE_DIR = resolve(import.meta.dirname, '../templates/default')\n\n// ─── CLI ─────────────────────────────────────────────────────────────────────\n\nasync function main() {\n const args = process.argv.slice(2)\n const projectName = args[0]\n\n if (!projectName || projectName === '--help' || projectName === '-h') {\n process.exit(projectName ? 0 : 1)\n }\n\n const targetDir = resolve(process.cwd(), projectName)\n\n if (existsSync(targetDir)) {\n process.exit(1)\n }\n\n // Copy template\n await cp(TEMPLATE_DIR, targetDir, { recursive: true })\n\n // Update package.json with project name\n const pkgPath = join(targetDir, 'package.json')\n const pkg = JSON.parse(await readFile(pkgPath, 'utf-8'))\n pkg.name = basename(projectName)\n await writeFile(pkgPath, `${JSON.stringify(pkg, null, 2)}\\n`)\n\n // Create .gitignore (can't be in template — npm ignores .gitignore in packages)\n await writeFile(\n join(targetDir, '.gitignore'),\n `node_modules\ndist\n.DS_Store\n*.local\n`,\n )\n}\n\nmain().catch((_err) => {\n process.exit(1)\n})\n"],"mappings":";;;;;AAMA,MAAM,eAAe,QAAQ,OAAO,KAAK,SAAS,uBAAuB;AAIzE,eAAe,OAAO;CAEpB,MAAM,cADO,QAAQ,KAAK,MAAM,EAAE,CACT;AAEzB,KAAI,CAAC,eAAe,gBAAgB,YAAY,gBAAgB,KAC9D,SAAQ,KAAK,cAAc,IAAI,EAAE;CAGnC,MAAM,YAAY,QAAQ,QAAQ,KAAK,EAAE,YAAY;AAErD,KAAI,WAAW,UAAU,CACvB,SAAQ,KAAK,EAAE;AAIjB,OAAM,GAAG,cAAc,WAAW,EAAE,WAAW,MAAM,CAAC;CAGtD,MAAM,UAAU,KAAK,WAAW,eAAe;CAC/C,MAAM,MAAM,KAAK,MAAM,MAAM,SAAS,SAAS,QAAQ,CAAC;AACxD,KAAI,OAAO,SAAS,YAAY;AAChC,OAAM,UAAU,SAAS,GAAG,KAAK,UAAU,KAAK,MAAM,EAAE,CAAC,IAAI;AAG7D,OAAM,UACJ,KAAK,WAAW,aAAa,EAC7B;;;;EAKD;;AAGH,MAAM,CAAC,OAAO,SAAS;AACrB,SAAQ,KAAK,EAAE;EACf"}
|
package/package.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pyreon/create-zero",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Create a new Pyreon Zero project",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Vit Bokisch",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/pyreon/zero",
|
|
10
|
+
"directory": "packages/create-zero"
|
|
11
|
+
},
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./lib/index.js",
|
|
14
|
+
"bin": {
|
|
15
|
+
"create-zero": "./bin/create-zero.js"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"bin",
|
|
19
|
+
"lib",
|
|
20
|
+
"!lib/analysis",
|
|
21
|
+
"templates",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"build": "vl_rolldown_build",
|
|
27
|
+
"typecheck": "tsc --noEmit"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en" data-theme="dark">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8" />
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
6
|
+
<meta name="theme-color" content="#0a0a0b" />
|
|
7
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
8
|
+
<!-- Prevent flash of wrong theme -->
|
|
9
|
+
<script>(function(){try{var t=localStorage.getItem("zero-theme");var r=t==="light"?"light":t==="dark"?"dark":window.matchMedia("(prefers-color-scheme:dark)").matches?"dark":"light";document.documentElement.dataset.theme=r}catch(e){}})()</script>
|
|
10
|
+
<!--pyreon-head-->
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
<div id="app"><!--pyreon-app--></div>
|
|
14
|
+
<!--pyreon-scripts-->
|
|
15
|
+
<script type="module" src="/src/entry-client.ts"></script>
|
|
16
|
+
</body>
|
|
17
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "my-zero-app",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"dev": "zero dev",
|
|
8
|
+
"build": "zero build",
|
|
9
|
+
"preview": "zero preview"
|
|
10
|
+
},
|
|
11
|
+
"dependencies": {
|
|
12
|
+
"@pyreon/core": "latest",
|
|
13
|
+
"@pyreon/reactivity": "latest",
|
|
14
|
+
"@pyreon/runtime-dom": "latest",
|
|
15
|
+
"@pyreon/runtime-server": "latest",
|
|
16
|
+
"@pyreon/router": "latest",
|
|
17
|
+
"@pyreon/head": "latest",
|
|
18
|
+
"@pyreon/server": "latest",
|
|
19
|
+
"@pyreon/zero": "latest"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@pyreon/vite-plugin": "latest",
|
|
23
|
+
"zero-cli": "latest",
|
|
24
|
+
"typescript": "^5.9.3",
|
|
25
|
+
"vite": "^7.0.0"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 32 32">
|
|
2
|
+
<defs>
|
|
3
|
+
<linearGradient id="g" x1="0%" y1="0%" x2="100%" y2="100%">
|
|
4
|
+
<stop offset="0%" stop-color="#6d5cff"/>
|
|
5
|
+
<stop offset="100%" stop-color="#a78bfa"/>
|
|
6
|
+
</linearGradient>
|
|
7
|
+
</defs>
|
|
8
|
+
<rect width="32" height="32" rx="6" fill="url(#g)"/>
|
|
9
|
+
<text x="16" y="23" font-family="system-ui,sans-serif" font-size="20" font-weight="800" fill="white" text-anchor="middle">Z</text>
|
|
10
|
+
</svg>
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { routes } from 'virtual:zero/routes'
|
|
2
|
+
import { createServer } from '@pyreon/zero'
|
|
3
|
+
import {
|
|
4
|
+
cacheMiddleware,
|
|
5
|
+
securityHeaders,
|
|
6
|
+
varyEncoding,
|
|
7
|
+
} from '@pyreon/zero/cache'
|
|
8
|
+
|
|
9
|
+
export default createServer({
|
|
10
|
+
routes,
|
|
11
|
+
config: {
|
|
12
|
+
ssr: { mode: 'stream' },
|
|
13
|
+
},
|
|
14
|
+
middleware: [
|
|
15
|
+
securityHeaders(),
|
|
16
|
+
cacheMiddleware({ staleWhileRevalidate: 120 }),
|
|
17
|
+
varyEncoding(),
|
|
18
|
+
],
|
|
19
|
+
})
|