@gluhar/cli 3.0.0 → 3.0.1
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gluhar/cli",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Gluhar cli commands and scripts",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./src/index.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"tsconfig-paths": "^4.2.0",
|
|
45
45
|
"typescript": "^5.5.4"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "3f6146afe2337d676ad6db90a13737ba9d58e16c"
|
|
48
48
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateProject.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/generateProject.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"generateProject.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/generateProject.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,eAAe,SACpB,MAAM,OACP,MAAM,WACF,eAAe,kBAuGzB,CAAC"}
|
|
@@ -4,6 +4,7 @@ exports.generateProject = void 0;
|
|
|
4
4
|
const filesystem_1 = require("../../scripts/filesystem");
|
|
5
5
|
const git_1 = require("../../scripts/git");
|
|
6
6
|
const log_1 = require("./log");
|
|
7
|
+
const common_1 = require("../../utils/common");
|
|
7
8
|
const cmd_1 = require("../../scripts/cmd");
|
|
8
9
|
const utils_1 = require("../../utils");
|
|
9
10
|
const generateProject = async (name, cwd, options) => {
|
|
@@ -75,9 +76,10 @@ const generateProject = async (name, cwd, options) => {
|
|
|
75
76
|
log_1.log.verbose("Skipping repo creation and deleting .git. You are on your own.");
|
|
76
77
|
(0, cmd_1.executeCmd)("rm -rf .git");
|
|
77
78
|
}
|
|
78
|
-
const openCode = await (0, utils_1.confirmQuestion)(`Project '${name}' was created successfully! Do you want to open it in VSCode?`, yes);
|
|
79
|
+
const openCode = await (0, utils_1.confirmQuestion)(`Project '${name}' was created successfully! Do you want to open it in VSCode/Cursor?`, yes);
|
|
79
80
|
if (openCode) {
|
|
80
|
-
(0,
|
|
81
|
+
const editorCommand = (0, common_1.commandExists)("cursor") ? "cursor" : "code";
|
|
82
|
+
(0, cmd_1.executeCmd)(`${editorCommand} . -g README.md`);
|
|
81
83
|
}
|
|
82
84
|
};
|
|
83
85
|
exports.generateProject = generateProject;
|
package/src/utils/common.d.ts
CHANGED
|
@@ -1,2 +1,8 @@
|
|
|
1
1
|
export declare const capitalize: (s: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* Check if a command exists in the system PATH
|
|
4
|
+
* @param command The command to check
|
|
5
|
+
* @returns true if the command exists, false otherwise
|
|
6
|
+
*/
|
|
7
|
+
export declare const commandExists: (command: string) => boolean;
|
|
2
8
|
//# sourceMappingURL=common.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,MAAO,MAAM,WAAoC,CAAC"}
|
|
1
|
+
{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/utils/common.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU,MAAO,MAAM,WAAoC,CAAC;AAEzE;;;;GAIG;AACH,eAAO,MAAM,aAAa,YAAa,MAAM,KAAG,OAQ/C,CAAC"}
|
package/src/utils/common.js
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.capitalize = void 0;
|
|
3
|
+
exports.commandExists = exports.capitalize = void 0;
|
|
4
4
|
const capitalize = (s) => s[0].toUpperCase() + s.slice(1);
|
|
5
5
|
exports.capitalize = capitalize;
|
|
6
|
+
/**
|
|
7
|
+
* Check if a command exists in the system PATH
|
|
8
|
+
* @param command The command to check
|
|
9
|
+
* @returns true if the command exists, false otherwise
|
|
10
|
+
*/
|
|
11
|
+
const commandExists = (command) => {
|
|
12
|
+
try {
|
|
13
|
+
const { spawnSync } = require("child_process");
|
|
14
|
+
const result = spawnSync("which", [command], { stdio: "ignore" });
|
|
15
|
+
return result.status === 0;
|
|
16
|
+
}
|
|
17
|
+
catch {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
exports.commandExists = commandExists;
|