create-gtkx 1.6.0 → 2.0.0-beta.10
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 +47 -44
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/command.d.ts +9 -1
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +72 -4
- package/dist/command.js.map +1 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +10 -4
- package/dist/manifest.js.map +1 -1
- package/dist/package-managers.d.ts +3 -0
- package/dist/package-managers.d.ts.map +1 -1
- package/dist/package-managers.js +24 -3
- package/dist/package-managers.js.map +1 -1
- package/dist/scaffolder.d.ts +2 -0
- package/dist/scaffolder.d.ts.map +1 -1
- package/dist/scaffolder.js +274 -117
- package/dist/scaffolder.js.map +1 -1
- package/dist/templates/gtkx.config.ts.ejs +3 -13
- package/dist/templates/package.json.ejs +4 -1
- package/dist/templates/src/app.tsx.ejs +27 -24
- package/dist/templates.d.ts +1 -1
- package/dist/templates.d.ts.map +1 -1
- package/dist/templates.js +5 -7
- package/dist/templates.js.map +1 -1
- package/package.json +13 -9
- package/src/cli.ts +1 -1
- package/src/command.ts +88 -4
- package/src/manifest.ts +10 -4
- package/src/package-managers.ts +24 -3
- package/src/scaffolder.ts +397 -145
- package/src/templates/gtkx.config.ts.ejs +3 -13
- package/src/templates/package.json.ejs +4 -1
- package/src/templates/src/app.tsx.ejs +27 -24
- package/src/templates.ts +6 -8
|
@@ -3,21 +3,11 @@ import { defineConfig } from "@gtkx/config";
|
|
|
3
3
|
export default defineConfig({
|
|
4
4
|
applicationId: "<%= applicationId %>",
|
|
5
5
|
applicationIcon: "data/icons",
|
|
6
|
-
future: {
|
|
7
|
-
v2ByteArrays: true,
|
|
8
|
-
v2ValueReturns: true,
|
|
9
|
-
v2FinishResults: true,
|
|
10
|
-
v2InoutReturns: true,
|
|
11
|
-
v2ResourceImports: true,
|
|
12
|
-
v2DefaultLibraries: true,
|
|
13
|
-
v2TreeShaking: true,
|
|
14
|
-
},
|
|
15
6
|
deploy: {
|
|
16
|
-
name:
|
|
17
|
-
summary: "A
|
|
7
|
+
name: <%- sourceStringLiteral(displayName) %>,
|
|
8
|
+
summary: "A GNOME application built with GTKX",
|
|
18
9
|
description: [
|
|
19
|
-
|
|
20
|
-
+ "widgets from React. Replace this paragraph with a description of what your application does.",
|
|
10
|
+
<%- sourceStringLiteral(`${displayName} is a GNOME application built with GTKX on Adwaita and GTK4, with native GObject widgets rendered from React. Replace this paragraph with a description of what your application does.`) %>,
|
|
21
11
|
],
|
|
22
12
|
categories: ["Utility"],
|
|
23
13
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "<%= name %>",
|
|
3
3
|
"version": "0.0.1",
|
|
4
4
|
"private": true,
|
|
5
|
-
"description": "A
|
|
5
|
+
"description": "A GNOME application built with GTKX",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
<% if (developerEmail) { -%>
|
|
8
8
|
"author": <%- sourceStringLiteral(`${developerName} <${developerEmail}>`) %>,
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
"author": <%- sourceStringLiteral(developerName) %>,
|
|
11
11
|
<% } -%>
|
|
12
12
|
"type": "module",
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=26.7.0"
|
|
15
|
+
},
|
|
13
16
|
"scripts": {
|
|
14
17
|
"dev": "gtkx dev",
|
|
15
18
|
"build": "gtkx build",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as Gtk from "@gtkx/gi/gtk";
|
|
2
|
-
import {
|
|
2
|
+
import { AdwApplication, AdwApplicationWindow, AdwHeaderBar, AdwToolbarView } from "@gtkx/jsx/adw";
|
|
3
|
+
import { GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
|
|
3
4
|
import { quit } from "@gtkx/react";
|
|
4
5
|
import { useState } from "react";
|
|
5
6
|
|
|
@@ -7,38 +8,40 @@ const MainWindow = () => {
|
|
|
7
8
|
const [count, setCount] = useState(0);
|
|
8
9
|
|
|
9
10
|
return (
|
|
10
|
-
<
|
|
11
|
-
title=
|
|
11
|
+
<AdwApplicationWindow
|
|
12
|
+
title={<%- sourceStringLiteral(displayName) %>}
|
|
12
13
|
defaultWidth={400}
|
|
13
14
|
defaultHeight={300}
|
|
14
15
|
onCloseRequest={quit}
|
|
15
16
|
>
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
17
|
+
<AdwToolbarView topBar={<AdwHeaderBar />}>
|
|
18
|
+
<GtkBox
|
|
19
|
+
orientation={Gtk.Orientation.VERTICAL}
|
|
20
|
+
spacing={20}
|
|
21
|
+
marginTop={40}
|
|
22
|
+
marginBottom={40}
|
|
23
|
+
marginStart={40}
|
|
24
|
+
marginEnd={40}
|
|
25
|
+
valign={Gtk.Align.CENTER}
|
|
26
|
+
halign={Gtk.Align.CENTER}
|
|
27
|
+
>
|
|
28
|
+
<GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
|
|
29
|
+
<GtkLabel cssClasses={["title-2"]}>Count: {count}</GtkLabel>
|
|
30
|
+
<GtkButton
|
|
31
|
+
label="Increment"
|
|
32
|
+
onClicked={() => setCount((c) => c + 1)}
|
|
33
|
+
cssClasses={["suggested-action", "pill"]}
|
|
34
|
+
/>
|
|
35
|
+
</GtkBox>
|
|
36
|
+
</AdwToolbarView>
|
|
37
|
+
</AdwApplicationWindow>
|
|
35
38
|
);
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
export const App = () => (
|
|
39
|
-
<
|
|
42
|
+
<AdwApplication>
|
|
40
43
|
<MainWindow />
|
|
41
|
-
</
|
|
44
|
+
</AdwApplication>
|
|
42
45
|
);
|
|
43
46
|
|
|
44
47
|
export default App;
|
package/src/templates.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { sortStrings, sourceStringLiteral } from "@gtkx/utils";
|
|
1
|
+
import { sortStrings, sourceStringLiteral, toPosixPath } from "@gtkx/utils";
|
|
2
2
|
import ejs from "ejs";
|
|
3
3
|
import { readdirSync } from "node:fs";
|
|
4
4
|
import { join } from "node:path";
|
|
@@ -6,7 +6,7 @@ import { join } from "node:path";
|
|
|
6
6
|
type TemplateContext = {
|
|
7
7
|
name: string;
|
|
8
8
|
applicationId: string;
|
|
9
|
-
|
|
9
|
+
displayName: string;
|
|
10
10
|
shouldIncludeTesting: boolean;
|
|
11
11
|
isTypescript: boolean;
|
|
12
12
|
importExtension: string;
|
|
@@ -14,20 +14,18 @@ type TemplateContext = {
|
|
|
14
14
|
developerEmail: string | null;
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
const
|
|
18
|
-
return join(import.meta.dirname, "templates");
|
|
19
|
-
};
|
|
17
|
+
const TEMPLATES_DIR = join(import.meta.dirname, "templates");
|
|
20
18
|
|
|
21
19
|
const listTemplates = (): string[] =>
|
|
22
20
|
sortStrings(
|
|
23
|
-
readdirSync(
|
|
21
|
+
readdirSync(TEMPLATES_DIR, { recursive: true, withFileTypes: true })
|
|
24
22
|
.filter((entry) => entry.isFile())
|
|
25
23
|
.map((entry) => join(entry.parentPath, entry.name))
|
|
26
|
-
.map((absolute) => absolute.slice(
|
|
24
|
+
.map((absolute) => toPosixPath(absolute.slice(TEMPLATES_DIR.length + 1)))
|
|
27
25
|
.map((relative) => relative.replace(/\.ejs$/, "")),
|
|
28
26
|
);
|
|
29
27
|
|
|
30
28
|
const renderFile = async (templateName: string, context: TemplateContext): Promise<string> =>
|
|
31
|
-
ejs.renderFile(join(
|
|
29
|
+
ejs.renderFile(join(TEMPLATES_DIR, `${templateName}.ejs`), { ...context, sourceStringLiteral });
|
|
32
30
|
|
|
33
31
|
export { listTemplates, renderFile, type TemplateContext };
|