create-gtkx 2.0.0-beta.1 → 2.0.0-beta.11
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 +8 -163
- package/dist/build-allowance.d.ts.map +1 -1
- package/dist/build-allowance.js +6 -5
- package/dist/build-allowance.js.map +1 -1
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/command.d.ts +12 -3
- package/dist/command.d.ts.map +1 -1
- package/dist/command.js +111 -45
- package/dist/command.js.map +1 -1
- package/dist/manifest.d.ts.map +1 -1
- package/dist/manifest.js +2 -4
- package/dist/manifest.js.map +1 -1
- package/dist/package-managers.d.ts +3 -3
- package/dist/package-managers.d.ts.map +1 -1
- package/dist/package-managers.js +21 -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 +200 -112
- package/dist/scaffolder.js.map +1 -1
- package/dist/templates/gtkx.config.ts.ejs +3 -4
- 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.map +1 -1
- package/package.json +26 -12
- package/src/build-allowance.ts +6 -7
- package/src/cli.ts +1 -1
- package/src/command.ts +140 -57
- package/src/manifest.ts +2 -4
- package/src/package-managers.ts +21 -3
- package/src/scaffolder.ts +282 -153
- package/src/templates/gtkx.config.ts.ejs +3 -4
- package/src/templates/package.json.ejs +4 -1
- package/src/templates/src/app.tsx.ejs +27 -24
- package/src/templates.ts +1 -1
- package/dist/install-hints.d.ts +0 -3
- package/dist/install-hints.d.ts.map +0 -1
- package/dist/install-hints.js +0 -35
- package/dist/install-hints.js.map +0 -1
- package/src/install-hints.ts +0 -54
package/README.md
CHANGED
|
@@ -1,174 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
<img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/logo.svg" alt="GTKX" width="100" />
|
|
3
|
-
</p>
|
|
1
|
+
# create-gtkx
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
Create a GTKX application.
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
The React framework for Linux, built on GTK.<br />
|
|
9
|
-
Write native GTK4 desktop applications with React and TypeScript.
|
|
10
|
-
Real GTK widgets, the GNOME stack, and standard web tooling.
|
|
11
|
-
</p>
|
|
12
|
-
|
|
13
|
-
<p align="center">
|
|
14
|
-
<a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/v/create-gtkx?color=cb3837&logo=npm&label=create-gtkx" alt="npm version" /></a>
|
|
15
|
-
<a href="https://www.npmjs.com/package/create-gtkx"><img src="https://img.shields.io/npm/dm/create-gtkx?color=cb3837&logo=npm&label=downloads" alt="npm downloads" /></a>
|
|
16
|
-
<img src="https://img.shields.io/badge/node-%E2%89%A526.7-339933?logo=node.js&logoColor=white" alt="Node >= 26.7" />
|
|
17
|
-
<a href="https://github.com/gtkx-org/gtkx/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MPL--2.0-blue.svg" alt="License: MPL-2.0" /></a>
|
|
18
|
-
<a href="https://github.com/gtkx-org/gtkx/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/gtkx-org/gtkx/ci.yml?branch=main&logo=github&label=CI" alt="CI status" /></a>
|
|
19
|
-
<img src="https://img.shields.io/badge/TypeScript-strict-3178c6?logo=typescript&logoColor=white" alt="TypeScript" />
|
|
20
|
-
</p>
|
|
21
|
-
|
|
22
|
-
<p align="center">
|
|
23
|
-
<a href="https://gtkx.dev">Homepage</a> ·
|
|
24
|
-
<a href="https://gtkx.dev/guide/getting-started">Documentation</a> ·
|
|
25
|
-
<a href="https://github.com/gtkx-org/gtkx/tree/main/examples">Examples</a> ·
|
|
26
|
-
<a href="https://github.com/gtkx-org/gtkx/blob/main/CONTRIBUTING.md">Contributing</a>
|
|
27
|
-
</p>
|
|
28
|
-
|
|
29
|
-
---
|
|
30
|
-
|
|
31
|
-
<p align="center">
|
|
32
|
-
<img src="https://raw.githubusercontent.com/gtkx-org/gtkx/main/examples/tutorial/assets/screenshot.png" alt="The Tasks app: an Adwaita window with a sidebar of smart views and colored lists on the left, and a boxed task list on the right." />
|
|
33
|
-
</p>
|
|
34
|
-
|
|
35
|
-
<p align="center">
|
|
36
|
-
<em>The Tasks app you build in the <a href="https://gtkx.dev/tutorial/">tutorial</a>.</em>
|
|
37
|
-
</p>
|
|
38
|
-
|
|
39
|
-
## Demo
|
|
40
|
-
|
|
41
|
-
The intrinsic elements in this snippet render GTK4 widgets, and ordinary React hooks and events drive them:
|
|
42
|
-
|
|
43
|
-
```tsx
|
|
44
|
-
import * as Gtk from "@gtkx/gi/gtk";
|
|
45
|
-
import { GtkApplication, GtkApplicationWindow, GtkBox, GtkButton, GtkLabel } from "@gtkx/jsx/gtk";
|
|
46
|
-
import { createRoot, quit } from "@gtkx/react";
|
|
47
|
-
import { useState } from "react";
|
|
48
|
-
|
|
49
|
-
const Counter = () => {
|
|
50
|
-
const [count, setCount] = useState(0);
|
|
51
|
-
|
|
52
|
-
return (
|
|
53
|
-
<GtkApplicationWindow
|
|
54
|
-
title="Hello GTKX"
|
|
55
|
-
defaultWidth={400}
|
|
56
|
-
defaultHeight={300}
|
|
57
|
-
onCloseRequest={quit}
|
|
58
|
-
>
|
|
59
|
-
<GtkBox
|
|
60
|
-
orientation={Gtk.Orientation.VERTICAL}
|
|
61
|
-
spacing={20}
|
|
62
|
-
marginTop={40}
|
|
63
|
-
marginBottom={40}
|
|
64
|
-
marginStart={40}
|
|
65
|
-
marginEnd={40}
|
|
66
|
-
valign={Gtk.Align.CENTER}
|
|
67
|
-
halign={Gtk.Align.CENTER}
|
|
68
|
-
>
|
|
69
|
-
<GtkLabel cssClasses={["title-1"]}>Welcome to GTKX!</GtkLabel>
|
|
70
|
-
<GtkLabel cssClasses={["title-2"]}>{`Count: ${count}`}</GtkLabel>
|
|
71
|
-
<GtkButton
|
|
72
|
-
label="Increment"
|
|
73
|
-
onClicked={() => setCount((c) => c + 1)}
|
|
74
|
-
cssClasses={["suggested-action", "pill"]}
|
|
75
|
-
/>
|
|
76
|
-
</GtkBox>
|
|
77
|
-
</GtkApplicationWindow>
|
|
78
|
-
);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const App = () => (
|
|
82
|
-
<GtkApplication>
|
|
83
|
-
<Counter />
|
|
84
|
-
</GtkApplication>
|
|
85
|
-
);
|
|
86
|
-
|
|
87
|
-
createRoot().render(<App />);
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
This is the [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world) example, with `app.tsx` and `index.tsx` combined into a single snippet. `@gtkx/gi` and `@gtkx/jsx` are per-project bindings generated by the CLI, not packages you install from npm.
|
|
91
|
-
|
|
92
|
-
## Why GTKX
|
|
93
|
-
|
|
94
|
-
### A declarative layer for the GNOME stack
|
|
95
|
-
|
|
96
|
-
GTK4 is mature, and GtkBuilder XML can lay out a static interface, but nothing re-renders that interface when your application state changes, and nothing hot-reloads it as you work. GTKX adds that missing layer, and the tooling around it, on top of the stack you already know:
|
|
97
|
-
|
|
98
|
-
- a React reconciler that exposes every GObject as a JSX element,
|
|
99
|
-
- a CLI for scaffolding, development, and production builds,
|
|
100
|
-
- a dev server with Fast Refresh that patches your running UI in place,
|
|
101
|
-
- CSS-in-JS styling, React Hook Form-powered Adwaita controls, gettext-backed react-i18next localization, React Spring animations, React Navigation stack, tab, drawer, and split view navigators, and high-level list, grid, and dialog components,
|
|
102
|
-
- a Testing Library-style API for querying and driving your widgets in tests,
|
|
103
|
-
- and a Model Context Protocol (MCP) server that exposes your live app to AI agents.
|
|
104
|
-
|
|
105
|
-
### The full GNOME API surface
|
|
106
|
-
|
|
107
|
-
React Native and similar frameworks hide the native toolkit so one API can run everywhere. GTKX exposes it: GTK4, Adwaita, and any other GObject-Introspection library on your system. Linux-only by design.
|
|
108
|
-
|
|
109
|
-
### Why Node.js, and why generated bindings
|
|
110
|
-
|
|
111
|
-
GTKX runs on Node.js, which puts native modules, the npm ecosystem, and the tooling built for Node.js APIs within reach. GJS is GNOME's own runtime, built on SpiderMonkey rather than V8; node-gtk runs on Node.js but is lightly maintained, on the older nan/V8 ABI rather than N-API, and still centered on GTK3. The [Why GTKX guide](https://gtkx.dev/guide/why-gtkx) covers what running on Node.js means day to day.
|
|
112
|
-
|
|
113
|
-
GTKX generates the TypeScript types and the native FFI calls from the same GObject-Introspection data, so the types cannot drift from the calls they back. Codegen covers the whole GTK4 and Adwaita surface.
|
|
114
|
-
|
|
115
|
-
At runtime, the native Rust core calls straight into the system GTK4, Adwaita, and GLib libraries through libffi, without loading libgirepository at all.
|
|
116
|
-
|
|
117
|
-
## Quick start
|
|
118
|
-
|
|
119
|
-
GTKX is Linux-only and needs Node.js 26.7 or later. See [Requirements](#requirements).
|
|
120
|
-
|
|
121
|
-
Scaffold a new app with the `create-gtkx` initializer:
|
|
122
|
-
|
|
123
|
-
```sh
|
|
124
|
-
npm create gtkx
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
The same command works with other package managers: `pnpm create gtkx` or `yarn create gtkx`.
|
|
128
|
-
|
|
129
|
-
Then run your new app:
|
|
5
|
+
Scaffold a Linux app with React, TypeScript or JavaScript, an Adwaita window, and optional testing support.
|
|
130
6
|
|
|
131
7
|
```sh
|
|
8
|
+
npm create gtkx@beta my-app
|
|
132
9
|
cd my-app
|
|
133
10
|
npm run dev
|
|
134
11
|
```
|
|
135
12
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
## Documentation
|
|
139
|
-
|
|
140
|
-
The documentation at **[gtkx.dev](https://gtkx.dev)** includes a step-by-step tutorial that builds a complete GNOME app, from scaffolding to packaging and shipping, plus guides and a full API reference.
|
|
141
|
-
|
|
142
|
-
**[Read the docs →](https://gtkx.dev/guide/why-gtkx)**
|
|
143
|
-
|
|
144
|
-
## Requirements
|
|
145
|
-
|
|
146
|
-
GTKX is Linux-only. You need:
|
|
147
|
-
|
|
148
|
-
- Linux with the GTK4 (4.20 or later), Adwaita (1.8 or later), and GLib development libraries
|
|
149
|
-
- Node.js 26.7 or later
|
|
150
|
-
|
|
151
|
-
The `@gtkx/native` addon ships prebuilt for x64 and arm64 glibc Linux; other targets need to build it from the GTKX repository, which requires a Rust toolchain.
|
|
152
|
-
|
|
153
|
-
## Examples
|
|
154
|
-
|
|
155
|
-
Explore the [example apps](https://github.com/gtkx-org/gtkx/tree/main/examples):
|
|
156
|
-
|
|
157
|
-
- [`hello-world`](https://github.com/gtkx-org/gtkx/tree/main/examples/hello-world): the counter above.
|
|
158
|
-
- [`gtk-demo`](https://github.com/gtkx-org/gtkx/tree/main/examples/gtk-demo): a React port of the official GTK4 widget showcase, covering lists, dialogs, gestures, CSS, and OpenGL.
|
|
159
|
-
- [`browser`](https://github.com/gtkx-org/gtkx/tree/main/examples/browser): a WebKitWebView-based web browser.
|
|
160
|
-
- [`animations`](https://github.com/gtkx-org/gtkx/tree/main/examples/animations): a tour of `@gtkx/animated`, React Spring animations driven by the GTK frame clock.
|
|
161
|
-
- [`navigation`](https://github.com/gtkx-org/gtkx/tree/main/examples/navigation): a tour of `@gtkx/navigation`, React Navigation's stack, tab, and drawer navigators rendered with libadwaita.
|
|
162
|
-
- [`tutorial`](https://github.com/gtkx-org/gtkx/tree/main/examples/tutorial): the Tasks app the documentation builds.
|
|
163
|
-
|
|
164
|
-
## Status
|
|
165
|
-
|
|
166
|
-
GTKX is stable and ready for production use.
|
|
167
|
-
|
|
168
|
-
## Contributing
|
|
13
|
+
Install the [native prerequisites](https://gtkx.dev/v2/guide/getting-started) first. For language, test, package-manager, and overwrite options, see [Scaffold Options](https://gtkx.dev/v2/guide/scaffold-options).
|
|
169
14
|
|
|
170
|
-
|
|
15
|
+
[Guide](https://gtkx.dev/v2/guide/getting-started) · [GTKX](https://gtkx.dev)
|
|
171
16
|
|
|
172
|
-
|
|
17
|
+
GTKX runs on Linux with Node.js and system native libraries. See [Getting Started](https://gtkx.dev/v2/guide/getting-started) for supported versions and installation. This README describes the 2.0 beta.
|
|
173
18
|
|
|
174
|
-
|
|
19
|
+
[MPL-2.0](https://github.com/gtkx-org/gtkx/blob/main/LICENSE).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-allowance.d.ts","sourceRoot":"","sources":["../src/build-allowance.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build-allowance.d.ts","sourceRoot":"","sources":["../src/build-allowance.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAyB5D,QAAA,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,gBAAgB,cAAc,KAAG,IAc3E,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/build-allowance.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
|
+
import { stringify } from "yaml";
|
|
3
4
|
import { updateManifest } from "./manifest.js";
|
|
4
5
|
const BUILT_DEPENDENCIES = ["@swc/core", "esbuild"];
|
|
5
6
|
const PNPM_WORKSPACE_FILE = "pnpm-workspace.yaml";
|
|
6
|
-
const SAFE_YAML_KEY = /^[A-Za-z][A-Za-z0-9-]*$/;
|
|
7
|
-
const PNPM_PACKAGES_BLOCK = "packages:\n - '.'\n";
|
|
8
|
-
const quoteYamlKey = (name) => (SAFE_YAML_KEY.test(name) ? name : `'${name}'`);
|
|
9
7
|
const writePnpmAllowance = (root) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
8
|
+
const workspace = {
|
|
9
|
+
packages: ["."],
|
|
10
|
+
allowBuilds: Object.fromEntries(BUILT_DEPENDENCIES.map((name) => [name, true])),
|
|
11
|
+
};
|
|
12
|
+
writeFileSync(join(root, PNPM_WORKSPACE_FILE), stringify(workspace));
|
|
12
13
|
};
|
|
13
14
|
const writeNpmAllowance = (root) => {
|
|
14
15
|
updateManifest(root, (manifest) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-allowance.js","sourceRoot":"","sources":["../src/build-allowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,kBAAkB,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACpD,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAClD,MAAM,
|
|
1
|
+
{"version":3,"file":"build-allowance.js","sourceRoot":"","sources":["../src/build-allowance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,MAAM,kBAAkB,GAAG,CAAC,WAAW,EAAE,SAAS,CAAC,CAAC;AACpD,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAClD,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAQ,EAAE;IAC9C,MAAM,SAAS,GAAG;QACd,QAAQ,EAAE,CAAC,GAAG,CAAC;QACf,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;KAClF,CAAC;IACF,aAAa,CAAC,IAAI,CAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC;AACzE,CAAC,CAAC;AAEF,MAAM,iBAAiB,GAAG,CAAC,IAAY,EAAQ,EAAE;IAC7C,cAAc,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC9B,QAAQ,CAAC,YAAY,GAAG,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAAY,EAAQ,EAAE;IAC9C,cAAc,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE,EAAE;QAC9B,QAAQ,CAAC,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9G,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAEF,MAAM,mBAAmB,GAAG,CAAC,IAAY,EAAE,cAA8B,EAAQ,EAAE;IAC/E,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;QAC5B,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAEzB,OAAO;IACX,CAAC;IAED,IAAI,cAAc,KAAK,MAAM,EAAE,CAAC;QAC5B,kBAAkB,CAAC,IAAI,CAAC,CAAC;QAEzB,OAAO;IACX,CAAC;IAED,iBAAiB,CAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAC;AAEF,OAAO,EAAE,mBAAmB,EAAE,CAAC","sourcesContent":["import { writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { stringify } from \"yaml\";\nimport type { PackageManager } from \"./package-managers.js\";\nimport { updateManifest } from \"./manifest.js\";\n\nconst BUILT_DEPENDENCIES = [\"@swc/core\", \"esbuild\"];\nconst PNPM_WORKSPACE_FILE = \"pnpm-workspace.yaml\";\nconst writePnpmAllowance = (root: string): void => {\n const workspace = {\n packages: [\".\"],\n allowBuilds: Object.fromEntries(BUILT_DEPENDENCIES.map((name) => [name, true])),\n };\n writeFileSync(join(root, PNPM_WORKSPACE_FILE), stringify(workspace));\n};\n\nconst writeNpmAllowance = (root: string): void => {\n updateManifest(root, (manifest) => {\n manifest.allowScripts = Object.fromEntries(BUILT_DEPENDENCIES.map((name) => [name, true]));\n });\n};\n\nconst writeYarnAllowance = (root: string): void => {\n updateManifest(root, (manifest) => {\n manifest.dependenciesMeta = Object.fromEntries(BUILT_DEPENDENCIES.map((name) => [name, { built: true }]));\n });\n};\n\nconst writeBuildAllowance = (root: string, packageManager: PackageManager): void => {\n if (packageManager === \"pnpm\") {\n writePnpmAllowance(root);\n\n return;\n }\n\n if (packageManager === \"yarn\") {\n writeYarnAllowance(root);\n\n return;\n }\n\n writeNpmAllowance(root);\n};\n\nexport { writeBuildAllowance };\n"]}
|
package/dist/cli.js
CHANGED
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,eAAe,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;AAExC,MAAM,IAAI,GAAG,aAAa,CAAC;IACvB,GAAG,eAAe;IAClB,IAAI,EAAE;QACF,IAAI,EAAE,aAAa;QACnB,OAAO;QACP,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,eAAe,MAAM,iBAAiB,CAAC,OAAO,IAAI,EAAE,MAAM,EAAE,CAAC;AACpE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,OAAO,GAAG,eAAe,CAAC,OAAO,CAAC;AAExC,MAAM,IAAI,GAAG,aAAa,CAAC;IACvB,GAAG,eAAe;IAClB,IAAI,EAAE;QACF,IAAI,EAAE,aAAa;QACnB,OAAO;QACP,WAAW,EAAE,wCAAwC;KACxD;CACJ,CAAC,CAAC;AAEH,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC","sourcesContent":["import { defineCommand, runMain } from \"citty\";\nimport packageManifest from \"../package.json\" with { type: \"json\" };\nimport { scaffoldCommand } from \"./command.js\";\n\nconst version = packageManifest.version;\n\nconst main = defineCommand({\n ...scaffoldCommand,\n meta: {\n name: \"create-gtkx\",\n version,\n description: \"Scaffold a Linux application with GTKX\",\n },\n});\n\nvoid runMain(main);\n"]}
|
package/dist/command.d.ts
CHANGED
|
@@ -8,6 +8,10 @@ declare const scaffoldCommand: import("citty").CommandDef<{
|
|
|
8
8
|
readonly type: "string";
|
|
9
9
|
readonly description: "Application ID (e.g., com.example.myapp)";
|
|
10
10
|
};
|
|
11
|
+
readonly "display-name": {
|
|
12
|
+
readonly type: "string";
|
|
13
|
+
readonly description: "Application display name (e.g., My App)";
|
|
14
|
+
};
|
|
11
15
|
readonly "package-manager": {
|
|
12
16
|
readonly type: "string";
|
|
13
17
|
readonly alias: "p";
|
|
@@ -27,14 +31,19 @@ declare const scaffoldCommand: import("citty").CommandDef<{
|
|
|
27
31
|
readonly alias: "y";
|
|
28
32
|
readonly description: "Skip prompts and accept defaults for unspecified options";
|
|
29
33
|
};
|
|
30
|
-
readonly
|
|
34
|
+
readonly interactive: {
|
|
31
35
|
readonly type: "boolean";
|
|
32
|
-
readonly description:
|
|
36
|
+
readonly description: "Prompt for unspecified options when running in a terminal";
|
|
37
|
+
readonly negativeDescription: string;
|
|
33
38
|
};
|
|
34
39
|
readonly overwrite: {
|
|
35
40
|
readonly type: "boolean";
|
|
36
41
|
readonly alias: "f";
|
|
37
|
-
readonly description: "
|
|
42
|
+
readonly description: "Replace scaffold files in a non-empty target directory when running without prompts";
|
|
43
|
+
};
|
|
44
|
+
readonly "skip-install": {
|
|
45
|
+
readonly type: "boolean";
|
|
46
|
+
readonly description: "Create the project without installing dependencies";
|
|
38
47
|
};
|
|
39
48
|
}>;
|
|
40
49
|
export { scaffoldCommand };
|
package/dist/command.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AA0IA,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOnB,CAAC;AAmCH,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
package/dist/command.js
CHANGED
|
@@ -1,55 +1,117 @@
|
|
|
1
1
|
import * as p from "@clack/prompts";
|
|
2
|
-
import {
|
|
2
|
+
import { assertSupportedNodeVersion } from "@gtkx/config/internal";
|
|
3
|
+
import { camelCase, errorMessage, kebabCase } from "@gtkx/utils";
|
|
3
4
|
import { defineCommand } from "citty";
|
|
5
|
+
import { parseArgs } from "node:util";
|
|
4
6
|
import { OperationCanceledError, ScaffoldAbortedError } from "./errors.js";
|
|
5
7
|
import { PACKAGE_MANAGER_FLAG_DESCRIPTION } from "./package-managers.js";
|
|
6
8
|
import { scaffold } from "./scaffolder.js";
|
|
9
|
+
const CREATE_ARGS = {
|
|
10
|
+
name: {
|
|
11
|
+
type: "positional",
|
|
12
|
+
description: "Target directory or project name (e.g. my-app, ., apps/my-app)",
|
|
13
|
+
required: false,
|
|
14
|
+
},
|
|
15
|
+
"application-id": {
|
|
16
|
+
type: "string",
|
|
17
|
+
description: "Application ID (e.g., com.example.myapp)",
|
|
18
|
+
},
|
|
19
|
+
"display-name": {
|
|
20
|
+
type: "string",
|
|
21
|
+
description: "Application display name (e.g., My App)",
|
|
22
|
+
},
|
|
23
|
+
"package-manager": {
|
|
24
|
+
type: "string",
|
|
25
|
+
alias: "p",
|
|
26
|
+
description: PACKAGE_MANAGER_FLAG_DESCRIPTION,
|
|
27
|
+
},
|
|
28
|
+
typescript: {
|
|
29
|
+
type: "boolean",
|
|
30
|
+
negativeDescription: "Scaffold the application in JavaScript instead of TypeScript",
|
|
31
|
+
description: "Scaffold the application in TypeScript",
|
|
32
|
+
},
|
|
33
|
+
vitest: {
|
|
34
|
+
type: "boolean",
|
|
35
|
+
description: "Include a Vitest testing setup",
|
|
36
|
+
},
|
|
37
|
+
yes: {
|
|
38
|
+
type: "boolean",
|
|
39
|
+
alias: "y",
|
|
40
|
+
description: "Skip prompts and accept defaults for unspecified options",
|
|
41
|
+
},
|
|
42
|
+
interactive: {
|
|
43
|
+
type: "boolean",
|
|
44
|
+
description: "Prompt for unspecified options when running in a terminal",
|
|
45
|
+
negativeDescription: "Run without prompts, using the default for every option not passed on the command line " +
|
|
46
|
+
"(same as --yes)",
|
|
47
|
+
},
|
|
48
|
+
overwrite: {
|
|
49
|
+
type: "boolean",
|
|
50
|
+
alias: "f",
|
|
51
|
+
description: "Replace scaffold files in a non-empty target directory when running without prompts",
|
|
52
|
+
},
|
|
53
|
+
"skip-install": {
|
|
54
|
+
type: "boolean",
|
|
55
|
+
description: "Create the project without installing dependencies",
|
|
56
|
+
},
|
|
57
|
+
};
|
|
58
|
+
const strictOption = (definition) => ({
|
|
59
|
+
type: definition.type,
|
|
60
|
+
...("alias" in definition && { short: definition.alias }),
|
|
61
|
+
});
|
|
62
|
+
const createStrictOptions = () => {
|
|
63
|
+
const options = {};
|
|
64
|
+
for (const [name, definition] of Object.entries(CREATE_ARGS)) {
|
|
65
|
+
if (definition.type === "positional") {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
options[name] = strictOption(definition);
|
|
69
|
+
if (camelCase(name) !== name) {
|
|
70
|
+
options[camelCase(name)] = { type: definition.type };
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return options;
|
|
74
|
+
};
|
|
75
|
+
const STRICT_OPTIONS = createStrictOptions();
|
|
76
|
+
const BOOLEAN_OPTIONS = new Set(Object.entries(STRICT_OPTIONS).filter(([, option]) => option.type === "boolean").map(([name]) => `--${name}`));
|
|
77
|
+
const normalizeBooleanArgument = (argument) => {
|
|
78
|
+
const [option, value, ...rest] = argument.split("=");
|
|
79
|
+
if (option === undefined || rest.length > 0 || !BOOLEAN_OPTIONS.has(option)) {
|
|
80
|
+
return argument;
|
|
81
|
+
}
|
|
82
|
+
if (value === "true") {
|
|
83
|
+
return option;
|
|
84
|
+
}
|
|
85
|
+
return value === "false" ? `--no-${option.slice(2)}` : argument;
|
|
86
|
+
};
|
|
87
|
+
const canonicalOption = (token) => [kebabCase(token.name), token.value ?? !token.rawName.startsWith("--no-")];
|
|
88
|
+
/* TODO: Keep ordered token parsing until Citty respects the order of positive and negated flags.
|
|
89
|
+
* https://github.com/gtkx-org/gtkx/issues/732
|
|
90
|
+
*/
|
|
91
|
+
const parseCreateArguments = (rawArgs) => {
|
|
92
|
+
const { tokens, positionals } = parseArgs({
|
|
93
|
+
args: rawArgs.map((argument) => normalizeBooleanArgument(argument === "--noInteractive" ? "--no-interactive" : argument)),
|
|
94
|
+
options: STRICT_OPTIONS,
|
|
95
|
+
allowPositionals: true,
|
|
96
|
+
allowNegative: true,
|
|
97
|
+
strict: true,
|
|
98
|
+
tokens: true,
|
|
99
|
+
});
|
|
100
|
+
if (positionals.length > 1) {
|
|
101
|
+
throw new TypeError("Expected one project directory");
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
...Object.fromEntries(tokens.filter((token) => token.kind === "option").map((token) => canonicalOption(token))),
|
|
105
|
+
name: positionals[0],
|
|
106
|
+
};
|
|
107
|
+
};
|
|
7
108
|
const scaffoldCommand = defineCommand({
|
|
8
109
|
meta: {
|
|
9
110
|
name: "create",
|
|
10
|
-
description: "Create a
|
|
11
|
-
},
|
|
12
|
-
args: {
|
|
13
|
-
name: {
|
|
14
|
-
type: "positional",
|
|
15
|
-
description: "Target directory or project name (e.g. my-app, ., apps/my-app)",
|
|
16
|
-
required: false,
|
|
17
|
-
},
|
|
18
|
-
"application-id": {
|
|
19
|
-
type: "string",
|
|
20
|
-
description: "Application ID (e.g., com.example.myapp)",
|
|
21
|
-
},
|
|
22
|
-
"package-manager": {
|
|
23
|
-
type: "string",
|
|
24
|
-
alias: "p",
|
|
25
|
-
description: PACKAGE_MANAGER_FLAG_DESCRIPTION,
|
|
26
|
-
},
|
|
27
|
-
typescript: {
|
|
28
|
-
type: "boolean",
|
|
29
|
-
negativeDescription: "Scaffold the application in JavaScript instead of TypeScript",
|
|
30
|
-
description: "Scaffold the application in TypeScript",
|
|
31
|
-
},
|
|
32
|
-
vitest: {
|
|
33
|
-
type: "boolean",
|
|
34
|
-
description: "Include a Vitest testing setup",
|
|
35
|
-
},
|
|
36
|
-
yes: {
|
|
37
|
-
type: "boolean",
|
|
38
|
-
alias: "y",
|
|
39
|
-
description: "Skip prompts and accept defaults for unspecified options",
|
|
40
|
-
},
|
|
41
|
-
"no-interactive": {
|
|
42
|
-
type: "boolean",
|
|
43
|
-
description: "Run without prompts, using the default for every option not passed on the command line " +
|
|
44
|
-
"(same as --yes)",
|
|
45
|
-
},
|
|
46
|
-
overwrite: {
|
|
47
|
-
type: "boolean",
|
|
48
|
-
alias: "f",
|
|
49
|
-
description: "Overwrite the contents of a non-empty target directory when running without prompts",
|
|
50
|
-
},
|
|
111
|
+
description: "Create a Linux application with GTKX",
|
|
51
112
|
},
|
|
52
|
-
|
|
113
|
+
args: CREATE_ARGS,
|
|
114
|
+
run: ({ rawArgs }) => runCreate(rawArgs),
|
|
53
115
|
});
|
|
54
116
|
const settleScaffoldFailure = (error) => {
|
|
55
117
|
if (error instanceof OperationCanceledError) {
|
|
@@ -60,17 +122,21 @@ const settleScaffoldFailure = (error) => {
|
|
|
60
122
|
}
|
|
61
123
|
process.exitCode = 1;
|
|
62
124
|
};
|
|
63
|
-
const runCreate = async (
|
|
64
|
-
const isInteractive = args["no-interactive"] || args.yes ? false : process.stdin.isTTY;
|
|
125
|
+
const runCreate = async (rawArgs) => {
|
|
65
126
|
try {
|
|
127
|
+
const args = parseCreateArguments(rawArgs);
|
|
128
|
+
const isInteractive = args.interactive !== false && !args.yes && process.stdin.isTTY;
|
|
129
|
+
assertSupportedNodeVersion();
|
|
66
130
|
await scaffold({
|
|
67
131
|
name: args.name,
|
|
68
132
|
applicationId: args["application-id"],
|
|
133
|
+
displayName: args["display-name"],
|
|
69
134
|
packageManager: args["package-manager"],
|
|
70
135
|
isTypescript: args.typescript,
|
|
71
136
|
shouldIncludeTesting: args.vitest,
|
|
72
137
|
isInteractive,
|
|
73
138
|
shouldOverwrite: args.overwrite,
|
|
139
|
+
shouldInstallDependencies: args["skip-install"] !== true,
|
|
74
140
|
});
|
|
75
141
|
}
|
|
76
142
|
catch (error) {
|
package/dist/command.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,gCAAgC,EAAE,MAAM,uBAAuB,CAAC;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAa3C,MAAM,eAAe,GAAG,aAAa,CAAC;IAClC,IAAI,EAAE;QACF,IAAI,EAAE,QAAQ;QACd,WAAW,EAAE,+BAA+B;KAC/C;IACD,IAAI,EAAE;QACF,IAAI,EAAE;YACF,IAAI,EAAE,YAAY;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AI,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;IAEvF,IAAI,CAAC;QACD,MAAM,QAAQ,CAAC;YACX,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC;YACrC,cAAc,EAAE,IAAI,CAAC,iBAAiB,CAAC;YACvC,YAAY,EAAE,IAAI,CAAC,UAAU;YAC7B,oBAAoB,EAAE,IAAI,CAAC,MAAM;YACjC,aAAa;YACb,eAAe,EAAE,IAAI,CAAC,SAAS;SAClC,CAAC,CAAC;IACP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import * as p from \"@clack/prompts\";\nimport { errorMessage } from \"@gtkx/utils\";\nimport { defineCommand } from \"citty\";\nimport { OperationCanceledError, ScaffoldAbortedError } from \"./errors.js\";\nimport { PACKAGE_MANAGER_FLAG_DESCRIPTION } from \"./package-managers.js\";\nimport { scaffold } from \"./scaffolder.js\";\n\ntype CreateCommandArgs = {\n name?: string | undefined;\n \"application-id\"?: string | undefined;\n \"package-manager\"?: string | undefined;\n typescript?: boolean | undefined;\n vitest?: boolean | undefined;\n yes?: boolean | undefined;\n \"no-interactive\"?: boolean | undefined;\n overwrite?: boolean | undefined;\n};\n\nconst scaffoldCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create a new GTKX application\",\n },\n args: {\n name: {\n type: \"positional\",\n description: \"Target directory or project name (e.g. my-app, ., apps/my-app)\",\n required: false,\n },\n \"application-id\": {\n type: \"string\",\n description: \"Application ID (e.g., com.example.myapp)\",\n },\n \"package-manager\": {\n type: \"string\",\n alias: \"p\",\n description: PACKAGE_MANAGER_FLAG_DESCRIPTION,\n },\n typescript: {\n type: \"boolean\",\n negativeDescription: \"Scaffold the application in JavaScript instead of TypeScript\",\n description: \"Scaffold the application in TypeScript\",\n },\n vitest: {\n type: \"boolean\",\n description: \"Include a Vitest testing setup\",\n },\n yes: {\n type: \"boolean\",\n alias: \"y\",\n description: \"Skip prompts and accept defaults for unspecified options\",\n },\n \"no-interactive\": {\n type: \"boolean\",\n description:\n \"Run without prompts, using the default for every option not passed on the command line \" +\n \"(same as --yes)\",\n },\n overwrite: {\n type: \"boolean\",\n alias: \"f\",\n description: \"Overwrite the contents of a non-empty target directory when running without prompts\",\n },\n },\n run: ({ args }) => runCreate(args),\n});\n\nconst settleScaffoldFailure = (error: unknown): void => {\n if (error instanceof OperationCanceledError) {\n return;\n }\n\n if (!(error instanceof ScaffoldAbortedError)) {\n p.log.error(errorMessage(error));\n }\n\n process.exitCode = 1;\n};\n\nconst runCreate = async (args: CreateCommandArgs): Promise<void> => {\n const isInteractive = args[\"no-interactive\"] || args.yes ? false : process.stdin.isTTY;\n\n try {\n await scaffold({\n name: args.name,\n applicationId: args[\"application-id\"],\n packageManager: args[\"package-manager\"],\n isTypescript: args.typescript,\n shouldIncludeTesting: args.vitest,\n isInteractive,\n shouldOverwrite: args.overwrite,\n });\n } catch (error) {\n settleScaffoldFailure(error);\n }\n};\n\nexport { scaffoldCommand };\n"]}
|
|
1
|
+
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACjE,OAAO,EAAgB,aAAa,EAAmB,MAAM,OAAO,CAAC;AACrE,OAAO,EAAE,SAAS,EAA+B,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,gCAAg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AAC,CAAC;IACP,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACb,qBAAqB,CAAC,KAAK,CAAC,CAAC;IACjC,CAAC;AACL,CAAC,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC","sourcesContent":["import * as p from \"@clack/prompts\";\nimport { assertSupportedNodeVersion } from \"@gtkx/config/internal\";\nimport { camelCase, errorMessage, kebabCase } from \"@gtkx/utils\";\nimport { type ArgsDef, defineCommand, type ParsedArgs } from \"citty\";\nimport { parseArgs, type ParseArgsOptionsConfig } from \"node:util\";\nimport { OperationCanceledError, ScaffoldAbortedError } from \"./errors.js\";\nimport { PACKAGE_MANAGER_FLAG_DESCRIPTION } from \"./package-managers.js\";\nimport { scaffold } from \"./scaffolder.js\";\n\nconst CREATE_ARGS = {\n name: {\n type: \"positional\",\n description: \"Target directory or project name (e.g. my-app, ., apps/my-app)\",\n required: false,\n },\n \"application-id\": {\n type: \"string\",\n description: \"Application ID (e.g., com.example.myapp)\",\n },\n \"display-name\": {\n type: \"string\",\n description: \"Application display name (e.g., My App)\",\n },\n \"package-manager\": {\n type: \"string\",\n alias: \"p\",\n description: PACKAGE_MANAGER_FLAG_DESCRIPTION,\n },\n typescript: {\n type: \"boolean\",\n negativeDescription: \"Scaffold the application in JavaScript instead of TypeScript\",\n description: \"Scaffold the application in TypeScript\",\n },\n vitest: {\n type: \"boolean\",\n description: \"Include a Vitest testing setup\",\n },\n yes: {\n type: \"boolean\",\n alias: \"y\",\n description: \"Skip prompts and accept defaults for unspecified options\",\n },\n interactive: {\n type: \"boolean\",\n description: \"Prompt for unspecified options when running in a terminal\",\n negativeDescription:\n \"Run without prompts, using the default for every option not passed on the command line \" +\n \"(same as --yes)\",\n },\n overwrite: {\n type: \"boolean\",\n alias: \"f\",\n description: \"Replace scaffold files in a non-empty target directory when running without prompts\",\n },\n \"skip-install\": {\n type: \"boolean\",\n description: \"Create the project without installing dependencies\",\n },\n} as const satisfies ArgsDef;\n\ntype OptionToken = Extract<\n ReturnType<typeof parseArgs<{ tokens: true; strict: false }>>[\"tokens\"][number],\n { kind: \"option\" }\n>;\n\ntype CreateCommandArgs = Pick<ParsedArgs<typeof CREATE_ARGS>, keyof typeof CREATE_ARGS>;\ntype CreateOption = Exclude<(typeof CREATE_ARGS)[keyof typeof CREATE_ARGS], { type: \"positional\" }>;\n\nconst strictOption = (definition: CreateOption): ParseArgsOptionsConfig[string] => ({\n type: definition.type,\n ...(\"alias\" in definition && { short: definition.alias }),\n});\n\nconst createStrictOptions = (): ParseArgsOptionsConfig => {\n const options: ParseArgsOptionsConfig = {};\n\n for (const [name, definition] of Object.entries(CREATE_ARGS)) {\n if (definition.type === \"positional\") {\n continue;\n }\n\n options[name] = strictOption(definition);\n\n if (camelCase(name) !== name) {\n options[camelCase(name)] = { type: definition.type };\n }\n }\n\n return options;\n};\n\nconst STRICT_OPTIONS = createStrictOptions();\n\nconst BOOLEAN_OPTIONS = new Set(\n Object.entries(STRICT_OPTIONS).filter(([, option]) => option.type === \"boolean\").map(([name]) => `--${name}`),\n);\n\nconst normalizeBooleanArgument = (argument: string): string => {\n const [option, value, ...rest] = argument.split(\"=\");\n\n if (option === undefined || rest.length > 0 || !BOOLEAN_OPTIONS.has(option)) {\n return argument;\n }\n\n if (value === \"true\") {\n return option;\n }\n\n return value === \"false\" ? `--no-${option.slice(2)}` : argument;\n};\n\nconst canonicalOption = (token: OptionToken): [string, string | boolean] =>\n [kebabCase(token.name), token.value ?? !token.rawName.startsWith(\"--no-\")];\n\n/* TODO: Keep ordered token parsing until Citty respects the order of positive and negated flags.\n * https://github.com/gtkx-org/gtkx/issues/732\n */\nconst parseCreateArguments = (rawArgs: string[]): CreateCommandArgs => {\n const { tokens, positionals } = parseArgs({\n args: rawArgs.map((argument) =>\n normalizeBooleanArgument(argument === \"--noInteractive\" ? \"--no-interactive\" : argument)),\n options: STRICT_OPTIONS,\n allowPositionals: true,\n allowNegative: true,\n strict: true,\n tokens: true,\n });\n\n if (positionals.length > 1) {\n throw new TypeError(\"Expected one project directory\");\n }\n\n return {\n ...Object.fromEntries(tokens.filter((token) => token.kind === \"option\").map((token) => canonicalOption(token))),\n name: positionals[0],\n } as CreateCommandArgs;\n};\n\nconst scaffoldCommand = defineCommand({\n meta: {\n name: \"create\",\n description: \"Create a Linux application with GTKX\",\n },\n args: CREATE_ARGS,\n run: ({ rawArgs }) => runCreate(rawArgs),\n});\n\nconst settleScaffoldFailure = (error: unknown): void => {\n if (error instanceof OperationCanceledError) {\n return;\n }\n\n if (!(error instanceof ScaffoldAbortedError)) {\n p.log.error(errorMessage(error));\n }\n\n process.exitCode = 1;\n};\n\nconst runCreate = async (rawArgs: string[]): Promise<void> => {\n try {\n const args = parseCreateArguments(rawArgs);\n const isInteractive = args.interactive !== false && !args.yes && process.stdin.isTTY;\n assertSupportedNodeVersion();\n await scaffold({\n name: args.name,\n applicationId: args[\"application-id\"],\n displayName: args[\"display-name\"],\n packageManager: args[\"package-manager\"],\n isTypescript: args.typescript,\n shouldIncludeTesting: args.vitest,\n isInteractive,\n shouldOverwrite: args.overwrite,\n shouldInstallDependencies: args[\"skip-install\"] !== true,\n });\n } catch (error) {\n settleScaffoldFailure(error);\n }\n};\n\nexport { scaffoldCommand };\n"]}
|
package/dist/manifest.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,KAAG,
|
|
1
|
+
{"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAKA,QAAA,MAAM,cAAc,GAAI,MAAM,MAAM,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,KAAG,IAK3F,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
package/dist/manifest.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { readFileSync,
|
|
1
|
+
import { readFileSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
const PACKAGE_JSON_FILE = "package.json";
|
|
4
4
|
const updateManifest = (root, mutate) => {
|
|
5
5
|
const manifestPath = join(root, PACKAGE_JSON_FILE);
|
|
6
6
|
const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
|
|
7
7
|
mutate(manifest);
|
|
8
|
-
|
|
9
|
-
writeFileSync(pendingPath, `${JSON.stringify(manifest, null, 4)}\n`);
|
|
10
|
-
renameSync(pendingPath, manifestPath);
|
|
8
|
+
writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 4)}\n`);
|
|
11
9
|
};
|
|
12
10
|
export { updateManifest };
|
|
13
11
|
//# sourceMappingURL=manifest.js.map
|
package/dist/manifest.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,
|
|
1
|
+
{"version":3,"file":"manifest.js","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAEzC,MAAM,cAAc,GAAG,CAAC,IAAY,EAAE,MAAmD,EAAQ,EAAE;IAC/F,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC;IACnD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,YAAY,EAAE,MAAM,CAAC,CAA4B,CAAC;IAC3F,MAAM,CAAC,QAAQ,CAAC,CAAC;IACjB,aAAa,CAAC,YAAY,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,CAAC","sourcesContent":["import { readFileSync, writeFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nconst PACKAGE_JSON_FILE = \"package.json\";\n\nconst updateManifest = (root: string, mutate: (manifest: Record<string, unknown>) => void): void => {\n const manifestPath = join(root, PACKAGE_JSON_FILE);\n const manifest = JSON.parse(readFileSync(manifestPath, \"utf8\")) as Record<string, unknown>;\n mutate(manifest);\n writeFileSync(manifestPath, `${JSON.stringify(manifest, null, 4)}\\n`);\n};\n\nexport { updateManifest };\n"]}
|
|
@@ -3,19 +3,19 @@ declare const PACKAGE_MANAGERS: readonly [{
|
|
|
3
3
|
readonly value: "pnpm";
|
|
4
4
|
readonly label: "pnpm";
|
|
5
5
|
readonly devCommand: "pnpm dev";
|
|
6
|
-
readonly
|
|
6
|
+
readonly installCommand: "pnpm install";
|
|
7
7
|
readonly isRecommended: true;
|
|
8
8
|
}, {
|
|
9
9
|
readonly value: "npm";
|
|
10
10
|
readonly label: "npm";
|
|
11
11
|
readonly devCommand: "npm run dev";
|
|
12
|
-
readonly
|
|
12
|
+
readonly installCommand: "npm install";
|
|
13
13
|
readonly isRecommended: false;
|
|
14
14
|
}, {
|
|
15
15
|
readonly value: "yarn";
|
|
16
16
|
readonly label: "yarn";
|
|
17
17
|
readonly devCommand: "yarn dev";
|
|
18
|
-
readonly
|
|
18
|
+
readonly installCommand: "yarn install";
|
|
19
19
|
readonly isRecommended: false;
|
|
20
20
|
}];
|
|
21
21
|
declare const PACKAGE_MANAGER_VALUES: PackageManager[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-managers.d.ts","sourceRoot":"","sources":["../src/package-managers.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAEjE,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"package-managers.d.ts","sourceRoot":"","sources":["../src/package-managers.ts"],"names":[],"mappings":"AAAA,KAAK,cAAc,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC;AAEjE,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;EAsBZ,CAAC;AAEX,QAAA,MAAM,sBAAsB,EAAE,cAAc,EAAqD,CAAC;AAClG,QAAA,MAAM,gCAAgC,QAA2D,CAAC;AAElG,QAAA,MAAM,qBAAqB,GAAI,MAAM,MAAM,KAAG,IAAI,IAAI,cACC,CAAC;AAExD,OAAO,EACH,gBAAgB,EAChB,gCAAgC,EAChC,sBAAsB,EACtB,qBAAqB,EACrB,KAAK,cAAc,GACtB,CAAC"}
|
package/dist/package-managers.js
CHANGED
|
@@ -1,7 +1,25 @@
|
|
|
1
1
|
const PACKAGE_MANAGERS = [
|
|
2
|
-
{
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
{
|
|
3
|
+
value: "pnpm",
|
|
4
|
+
label: "pnpm",
|
|
5
|
+
devCommand: "pnpm dev",
|
|
6
|
+
installCommand: "pnpm install",
|
|
7
|
+
isRecommended: true,
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
value: "npm",
|
|
11
|
+
label: "npm",
|
|
12
|
+
devCommand: "npm run dev",
|
|
13
|
+
installCommand: "npm install",
|
|
14
|
+
isRecommended: false,
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
value: "yarn",
|
|
18
|
+
label: "yarn",
|
|
19
|
+
devCommand: "yarn dev",
|
|
20
|
+
installCommand: "yarn install",
|
|
21
|
+
isRecommended: false,
|
|
22
|
+
},
|
|
5
23
|
];
|
|
6
24
|
const PACKAGE_MANAGER_VALUES = PACKAGE_MANAGERS.map((manager) => manager.value);
|
|
7
25
|
const PACKAGE_MANAGER_FLAG_DESCRIPTION = `Package manager (${PACKAGE_MANAGER_VALUES.join(", ")})`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-managers.js","sourceRoot":"","sources":["../src/package-managers.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG;IACrB,
|
|
1
|
+
{"version":3,"file":"package-managers.js","sourceRoot":"","sources":["../src/package-managers.ts"],"names":[],"mappings":"AAEA,MAAM,gBAAgB,GAAG;IACrB;QACI,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,UAAU;QACtB,cAAc,EAAE,cAAc;QAC9B,aAAa,EAAE,IAAI;KACtB;IACD;QACI,KAAK,EAAE,KAAK;QACZ,KAAK,EAAE,KAAK;QACZ,UAAU,EAAE,aAAa;QACzB,cAAc,EAAE,aAAa;QAC7B,aAAa,EAAE,KAAK;KACvB;IACD;QACI,KAAK,EAAE,MAAM;QACb,KAAK,EAAE,MAAM;QACb,UAAU,EAAE,UAAU;QACtB,cAAc,EAAE,cAAc;QAC9B,aAAa,EAAE,KAAK;KACvB;CACK,CAAC;AAEX,MAAM,sBAAsB,GAAqB,gBAAgB,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAClG,MAAM,gCAAgC,GAAG,oBAAoB,sBAAsB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;AAElG,MAAM,qBAAqB,GAAG,CAAC,IAAY,EAA0B,EAAE,CAClE,sBAAmC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;AAExD,OAAO,EACH,gBAAgB,EAChB,gCAAgC,EAChC,sBAAsB,EACtB,qBAAqB,GAExB,CAAC","sourcesContent":["type PackageManager = (typeof PACKAGE_MANAGERS)[number][\"value\"];\n\nconst PACKAGE_MANAGERS = [\n {\n value: \"pnpm\",\n label: \"pnpm\",\n devCommand: \"pnpm dev\",\n installCommand: \"pnpm install\",\n isRecommended: true,\n },\n {\n value: \"npm\",\n label: \"npm\",\n devCommand: \"npm run dev\",\n installCommand: \"npm install\",\n isRecommended: false,\n },\n {\n value: \"yarn\",\n label: \"yarn\",\n devCommand: \"yarn dev\",\n installCommand: \"yarn install\",\n isRecommended: false,\n },\n] as const;\n\nconst PACKAGE_MANAGER_VALUES: PackageManager[] = PACKAGE_MANAGERS.map((manager) => manager.value);\nconst PACKAGE_MANAGER_FLAG_DESCRIPTION = `Package manager (${PACKAGE_MANAGER_VALUES.join(\", \")})`;\n\nconst isKnownPackageManager = (name: string): name is PackageManager =>\n (PACKAGE_MANAGER_VALUES as string[]).includes(name);\n\nexport {\n PACKAGE_MANAGERS,\n PACKAGE_MANAGER_FLAG_DESCRIPTION,\n PACKAGE_MANAGER_VALUES,\n isKnownPackageManager,\n type PackageManager,\n};\n"]}
|
package/dist/scaffolder.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
type CreateOptions = {
|
|
2
2
|
name?: string | undefined;
|
|
3
3
|
applicationId?: string | undefined;
|
|
4
|
+
displayName?: string | undefined;
|
|
4
5
|
packageManager?: string | undefined;
|
|
5
6
|
isTypescript?: boolean | undefined;
|
|
6
7
|
shouldIncludeTesting?: boolean | undefined;
|
|
7
8
|
isInteractive?: boolean | undefined;
|
|
8
9
|
shouldOverwrite?: boolean | undefined;
|
|
10
|
+
shouldInstallDependencies?: boolean | undefined;
|
|
9
11
|
};
|
|
10
12
|
declare const scaffold: (options?: CreateOptions) => Promise<void>;
|
|
11
13
|
export { scaffold };
|