@gtkx/cli 0.2.2 → 0.2.4

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.
Files changed (2) hide show
  1. package/dist/create.js +16 -7
  2. package/package.json +3 -3
package/dist/create.js CHANGED
@@ -12,11 +12,11 @@ const TESTING_DEV_DEPENDENCIES = {
12
12
  const getTestScript = (testing) => {
13
13
  switch (testing) {
14
14
  case "vitest":
15
- return "vitest";
15
+ return "GDK_BACKEND=x11 xvfb-run -a vitest";
16
16
  case "jest":
17
- return "jest";
17
+ return "GDK_BACKEND=x11 xvfb-run -a jest";
18
18
  case "node":
19
- return "node --import tsx --test tests/**/*.test.ts";
19
+ return "GDK_BACKEND=x11 xvfb-run -a node --import tsx --test tests/**/*.test.ts";
20
20
  case "none":
21
21
  return undefined;
22
22
  }
@@ -107,6 +107,7 @@ import { strict as assert } from "node:assert";`;
107
107
  const afterEachFn = testing === "node" ? "after" : "afterEach";
108
108
  const assertion = testing === "node" ? `assert.ok(button, "Button should be rendered");` : `expect(button).toBeDefined();`;
109
109
  return `${imports}
110
+ import { AccessibleRole } from "@gtkx/ffi/gtk";
110
111
  import { cleanup, render, screen } from "@gtkx/testing";
111
112
  import App from "../src/app.js";
112
113
 
@@ -116,8 +117,8 @@ ${afterEachFn}(async () => {
116
117
 
117
118
  describe("App", () => {
118
119
  it("renders the increment button", async () => {
119
- await render(<App />);
120
- const button = await screen.findByRole("button", { name: "Increment" });
120
+ await render(<App />, { wrapper: false });
121
+ const button = await screen.findByRole(AccessibleRole.BUTTON, { name: "Increment" });
121
122
  ${assertion}
122
123
  });
123
124
  });
@@ -323,6 +324,14 @@ export const createApp = async (options = {}) => {
323
324
  p.log.info(` ${getAddCommand(packageManager, devDeps, true)}`);
324
325
  }
325
326
  const runCmd = getRunCommand(packageManager);
326
- p.note(`cd ${name}\n${runCmd}`, "Next steps");
327
- p.outro("Happy hacking!");
327
+ const nextSteps = `cd ${name}
328
+ ${runCmd}`;
329
+ const testingNote = testing !== "none"
330
+ ? `
331
+
332
+ To run tests, you need xvfb installed:
333
+ Fedora: sudo dnf install xorg-x11-server-Xvfb
334
+ Ubuntu: sudo apt install xvfb`
335
+ : "";
336
+ p.note(`${nextSteps}${testingNote}`, "Next steps");
328
337
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtkx/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "CLI for GTKX - create and develop GTK4 React applications",
5
5
  "license": "MPL-2.0",
6
6
  "author": "Eugenio Depalo <eugeniodepalo@gmail.com>",
@@ -47,8 +47,8 @@
47
47
  "@vitejs/plugin-react": "5.1.2",
48
48
  "citty": "0.1.6",
49
49
  "vite": "7.2.7",
50
- "@gtkx/ffi": "0.2.2",
51
- "@gtkx/react": "0.2.2"
50
+ "@gtkx/react": "0.2.4",
51
+ "@gtkx/ffi": "0.2.4"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": "^19"