create-peachy 0.0.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/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # create-peachy
2
+
3
+ Initialise a peachy application.
4
+
5
+ ## Usage
6
+
7
+ ```bash
8
+ npm create peachy
9
+ ```
10
+
11
+ If you use pnpm:
12
+
13
+ ```bash
14
+ pnpm create peachy
15
+ ```
package/dist/index.mjs ADDED
@@ -0,0 +1,44 @@
1
+ import { mkdir, readFile, readdir, stat, writeFile } from "node:fs/promises";
2
+ import { intro, log, outro, spinner, text } from "@clack/prompts";
3
+ import { dirname, resolve } from "node:path";
4
+ import h from "handlebars";
5
+
6
+ //#region package.json
7
+ var version = "0.0.1";
8
+
9
+ //#endregion
10
+ //#region src/index.ts
11
+ const TEMPLATE_DIR = resolve(import.meta.dirname, "..", "template");
12
+ intro(`create-peachy`);
13
+ const name = await text({
14
+ message: "What is the name of your project?",
15
+ placeholder: "peachy-app",
16
+ validate: (value) => {
17
+ if (!value.match(/^@?[a-z0-9-\/]+$/)) return "project name must be lowercase and contain only letters, numbers, and dashes";
18
+ }
19
+ });
20
+ const safeName = name.replace(/^@/, "").replaceAll(/\//g, "-");
21
+ const peachyVersion = version;
22
+ const OUTDIR = resolve(process.cwd(), name);
23
+ const s = spinner();
24
+ s.start("Copying files...");
25
+ const files = await readdir(TEMPLATE_DIR, { recursive: true });
26
+ for (const file of files) {
27
+ if (!(await stat(resolve(TEMPLATE_DIR, file))).isFile()) continue;
28
+ const inputPath = resolve(TEMPLATE_DIR, file);
29
+ const outputPath = resolve(OUTDIR, file);
30
+ await mkdir(dirname(outputPath), { recursive: true });
31
+ const fileContent = await readFile(inputPath, "utf8");
32
+ await writeFile(outputPath, h.compile(fileContent)({
33
+ name,
34
+ safeName,
35
+ peachyVersion
36
+ }));
37
+ }
38
+ s.stop("Copied files");
39
+ log.success(`Initialized peachy project at: ${OUTDIR}`);
40
+ log.info(`Remember to \`npm install\` and \`npm run dev\` to get started.`);
41
+ outro(`Done!`);
42
+
43
+ //#endregion
44
+ export { };
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "create-peachy",
3
+ "version": "0.0.1",
4
+ "type": "module",
5
+ "description": "Bootstrap a peachy application",
6
+ "bin": "./dist/index.mjs",
7
+ "author": "",
8
+ "license": "MIT",
9
+ "dependencies": {
10
+ "@clack/prompts": "^0.11.0",
11
+ "handlebars": "^4.7.8"
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "template"
16
+ ],
17
+ "devDependencies": {
18
+ "@types/node": "^25.0.9",
19
+ "tsdown": "0.20.0-beta.3",
20
+ "tsx": "^4.21.0",
21
+ "typescript": "^5.9.3"
22
+ },
23
+ "scripts": {
24
+ "build": "tsdown src/index.ts"
25
+ }
26
+ }
@@ -0,0 +1,15 @@
1
+ {
2
+ "name": "{{name}}",
3
+ "private": true,
4
+ "version": "1.0.0",
5
+ "scripts": {
6
+ "dev": "peachy dev",
7
+ "build": "peachy build"
8
+ },
9
+ "keywords": [],
10
+ "license": "MIT",
11
+ "dependencies": {
12
+ "@peachy/core": "{{peachyVersion}}",
13
+ "@peachy/react": "{{peachyVersion}}"
14
+ }
15
+ }
@@ -0,0 +1,15 @@
1
+ import Gtk from "gi://Gtk?version=4.0";
2
+
3
+ import { useState } from "react";
4
+
5
+ export function Counter() {
6
+ const [count, setCount] = useState(0);
7
+
8
+ return (
9
+ <Gtk.Box>
10
+ <Gtk.Button onClicked={() => setCount(count - 1)}>-</Gtk.Button>
11
+ <Gtk.Label hexpand label={count.toString()} />
12
+ <Gtk.Button onClicked={() => setCount(count + 1)}>+</Gtk.Button>
13
+ </Gtk.Box>
14
+ );
15
+ }
@@ -0,0 +1,25 @@
1
+ import Gio from "gi://Gio?version=2.0";
2
+ import Adw from "gi://Adw?version=1";
3
+
4
+ import { render } from "@peachy/react";
5
+ import { Counter } from "./counter";
6
+
7
+ const app = Adw.Application.new(
8
+ "dev.peachy.{{safeName}}",
9
+ Gio.ApplicationFlags.DEFAULT_FLAGS,
10
+ );
11
+
12
+ app.connect("activate", () => {
13
+ const app_window = new Adw.ApplicationWindow({
14
+ application: app,
15
+ title: "{{name}}",
16
+ defaultHeight: 240,
17
+ defaultWidth: 240,
18
+ });
19
+
20
+ render(<Counter />, app_window);
21
+
22
+ app_window.present();
23
+ });
24
+
25
+ app.run([]);
@@ -0,0 +1,3 @@
1
+ {
2
+ "extends": "@peachy/react/tsconfig",
3
+ }