@gtkx/cli 0.2.1 → 0.2.2
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.js +10 -3
- package/package.json +3 -3
package/dist/create.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
2
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { join, resolve } from "node:path";
|
|
4
4
|
import * as p from "@clack/prompts";
|
|
@@ -191,6 +191,13 @@ const isValidProjectName = (name) => {
|
|
|
191
191
|
const isValidAppId = (appId) => {
|
|
192
192
|
return /^[a-zA-Z][a-zA-Z0-9]*(\.[a-zA-Z][a-zA-Z0-9]*)+$/.test(appId);
|
|
193
193
|
};
|
|
194
|
+
const runCommand = (command, cwd) => {
|
|
195
|
+
return new Promise((resolve, reject) => {
|
|
196
|
+
const proc = spawn(command, { cwd, stdio: "pipe", shell: true });
|
|
197
|
+
proc.on("close", (code) => code === 0 ? resolve() : reject(new Error(`Command failed with exit code ${code}`)));
|
|
198
|
+
proc.on("error", reject);
|
|
199
|
+
});
|
|
200
|
+
};
|
|
194
201
|
const suggestAppId = (name) => {
|
|
195
202
|
const sanitized = name.replace(/-/g, "");
|
|
196
203
|
return `org.gtkx.${sanitized}`;
|
|
@@ -302,9 +309,9 @@ export const createApp = async (options = {}) => {
|
|
|
302
309
|
}
|
|
303
310
|
try {
|
|
304
311
|
const addCmd = getAddCommand(packageManager, DEPENDENCIES, false);
|
|
305
|
-
|
|
312
|
+
await runCommand(addCmd, projectPath);
|
|
306
313
|
const addDevCmd = getAddCommand(packageManager, devDeps, true);
|
|
307
|
-
|
|
314
|
+
await runCommand(addDevCmd, projectPath);
|
|
308
315
|
installSpinner.stop("Dependencies installed!");
|
|
309
316
|
}
|
|
310
317
|
catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gtkx/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
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.
|
|
51
|
-
"@gtkx/react": "0.2.
|
|
50
|
+
"@gtkx/ffi": "0.2.2",
|
|
51
|
+
"@gtkx/react": "0.2.2"
|
|
52
52
|
},
|
|
53
53
|
"peerDependencies": {
|
|
54
54
|
"react": "^19"
|