@gtkx/cli 0.3.1 → 0.3.3

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/dist/create.d.ts CHANGED
@@ -1,10 +1,16 @@
1
- type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
2
- type TestingFramework = "vitest" | "jest" | "node" | "none";
1
+ export type PackageManager = "pnpm" | "npm" | "yarn" | "bun";
2
+ export type TestingFramework = "vitest" | "jest" | "node" | "none";
3
3
  export interface CreateOptions {
4
4
  name?: string;
5
5
  appId?: string;
6
6
  packageManager?: PackageManager;
7
7
  testing?: TestingFramework;
8
8
  }
9
+ export declare const getTestScript: (testing: TestingFramework) => string | undefined;
10
+ export declare const generatePackageJson: (name: string, appId: string, testing: TestingFramework) => string;
11
+ export declare const generateTsConfig: () => string;
12
+ export declare const getAddCommand: (pm: PackageManager, deps: string[], dev: boolean) => string;
13
+ export declare const getRunCommand: (pm: PackageManager) => string;
14
+ export declare const isValidProjectName: (name: string) => boolean;
15
+ export declare const isValidAppId: (appId: string) => boolean;
9
16
  export declare const createApp: (options?: CreateOptions) => Promise<void>;
10
- export {};
package/dist/create.js CHANGED
@@ -9,7 +9,7 @@ const TESTING_DEV_DEPENDENCIES = {
9
9
  jest: ["@gtkx/testing", "jest", "@types/jest", "ts-jest"],
10
10
  node: ["@gtkx/testing", "@types/node"],
11
11
  };
12
- const getTestScript = (testing) => {
12
+ export const getTestScript = (testing) => {
13
13
  switch (testing) {
14
14
  case "vitest":
15
15
  return "GDK_BACKEND=x11 xvfb-run -a vitest";
@@ -21,7 +21,7 @@ const getTestScript = (testing) => {
21
21
  return undefined;
22
22
  }
23
23
  };
24
- const generatePackageJson = (name, appId, testing) => {
24
+ export const generatePackageJson = (name, appId, testing) => {
25
25
  const testScript = getTestScript(testing);
26
26
  const scripts = {
27
27
  dev: "gtkx dev src/app.tsx",
@@ -42,7 +42,7 @@ const generatePackageJson = (name, appId, testing) => {
42
42
  },
43
43
  }, null, 4);
44
44
  };
45
- const generateTsConfig = () => {
45
+ export const generateTsConfig = () => {
46
46
  return JSON.stringify({
47
47
  compilerOptions: {
48
48
  target: "ESNext",
@@ -160,7 +160,7 @@ export default {
160
160
  };
161
161
  `;
162
162
  };
163
- const getAddCommand = (pm, deps, dev) => {
163
+ export const getAddCommand = (pm, deps, dev) => {
164
164
  const devFlag = dev ? (pm === "npm" ? "--save-dev" : "-D") : "";
165
165
  const packages = deps.join(" ");
166
166
  switch (pm) {
@@ -174,7 +174,7 @@ const getAddCommand = (pm, deps, dev) => {
174
174
  return `bun add ${devFlag} ${packages}`.trim();
175
175
  }
176
176
  };
177
- const getRunCommand = (pm) => {
177
+ export const getRunCommand = (pm) => {
178
178
  switch (pm) {
179
179
  case "npm":
180
180
  return "npm run dev";
@@ -186,10 +186,10 @@ const getRunCommand = (pm) => {
186
186
  return "bun dev";
187
187
  }
188
188
  };
189
- const isValidProjectName = (name) => {
189
+ export const isValidProjectName = (name) => {
190
190
  return /^[a-z0-9-]+$/.test(name);
191
191
  };
192
- const isValidAppId = (appId) => {
192
+ export const isValidAppId = (appId) => {
193
193
  return /^[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)+$/.test(appId);
194
194
  };
195
195
  const runCommand = (command, cwd) => {
package/package.json CHANGED
@@ -1,18 +1,7 @@
1
1
  {
2
2
  "name": "@gtkx/cli",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "CLI for GTKX - create and develop GTK4 React applications",
5
- "license": "MPL-2.0",
6
- "author": "Eugenio Depalo <eugeniodepalo@gmail.com>",
7
- "homepage": "https://eugeniodepalo.github.io/gtkx",
8
- "bugs": {
9
- "url": "https://github.com/eugeniodepalo/gtkx/issues"
10
- },
11
- "repository": {
12
- "type": "git",
13
- "url": "https://github.com/eugeniodepalo/gtkx.git",
14
- "directory": "packages/cli"
15
- },
16
5
  "keywords": [
17
6
  "gtk",
18
7
  "react",
@@ -23,6 +12,17 @@
23
12
  "hmr",
24
13
  "vite"
25
14
  ],
15
+ "homepage": "https://eugeniodepalo.github.io/gtkx",
16
+ "bugs": {
17
+ "url": "https://github.com/eugeniodepalo/gtkx/issues"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "https://github.com/eugeniodepalo/gtkx.git",
22
+ "directory": "packages/cli"
23
+ },
24
+ "license": "MPL-2.0",
25
+ "author": "Eugenio Depalo <eugeniodepalo@gmail.com>",
26
26
  "type": "module",
27
27
  "exports": {
28
28
  "./package.json": "./package.json",
@@ -47,13 +47,14 @@
47
47
  "@vitejs/plugin-react": "5.1.2",
48
48
  "citty": "0.1.6",
49
49
  "vite": "7.2.7",
50
- "@gtkx/ffi": "0.3.1",
51
- "@gtkx/react": "0.3.1"
50
+ "@gtkx/ffi": "0.3.3",
51
+ "@gtkx/react": "0.3.3"
52
52
  },
53
53
  "peerDependencies": {
54
54
  "react": "^19"
55
55
  },
56
56
  "scripts": {
57
- "build": "tsc -b"
57
+ "build": "tsc -b",
58
+ "test": "vitest run"
58
59
  }
59
60
  }