@gluhar/cli 2.0.0-dev.0 → 2.1.0
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 +45 -44
- package/src/commands/generate/GenerateOptions.d.ts +1 -0
- package/src/commands/generate/GenerateOptions.d.ts.map +1 -1
- package/src/commands/generate/generateProject.d.ts.map +1 -1
- package/src/commands/generate/generateProject.js +5 -4
- package/src/scripts/cmd/types.d.ts +1 -1
- package/src/scripts/cmd/types.d.ts.map +1 -1
- package/src/scripts/git/clone.d.ts +10 -0
- package/src/scripts/git/clone.d.ts.map +1 -0
- package/src/scripts/git/clone.js +14 -0
- package/src/scripts/git/index.d.ts +1 -0
- package/src/scripts/git/index.d.ts.map +1 -1
- package/src/scripts/git/index.js +2 -0
package/package.json
CHANGED
|
@@ -1,46 +1,47 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
"
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
2
|
+
"name": "@gluhar/cli",
|
|
3
|
+
"version": "2.1.0",
|
|
4
|
+
"description": "Gluhar cli commands and scripts",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": "./src/index.ts",
|
|
7
|
+
"./*": "./src/*/index.ts"
|
|
8
|
+
},
|
|
9
|
+
"main": "./src/index.js",
|
|
10
|
+
"bin": {
|
|
11
|
+
"gluhar": "./src/index.js"
|
|
12
|
+
},
|
|
13
|
+
"scripts": {
|
|
14
|
+
"clean": "rm -rf dist",
|
|
15
|
+
"copy:files": "copyfiles \"src/**/*.sh\" dist",
|
|
16
|
+
"build": "tsc && tsc-alias && npm run copy:files",
|
|
17
|
+
"prepack": "npm run build",
|
|
18
|
+
"dev": "npm run build && node ./dist/src/index.js"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"chalk": "^4.1.2",
|
|
22
|
+
"commander": "^12.1.0",
|
|
23
|
+
"fs-extra": "^11.2.0",
|
|
24
|
+
"glob": "^11.0.0",
|
|
25
|
+
"humps": "^2.0.1",
|
|
26
|
+
"inquirer": "^8.2.6",
|
|
27
|
+
"istextorbinary": "^9.5.0",
|
|
28
|
+
"npmlog": "^7.0.1",
|
|
29
|
+
"shelljs": "^0.8.5"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@nuxt/eslint-config": "^0.5.6",
|
|
33
|
+
"@nuxt/schema": "^3.13.1",
|
|
34
|
+
"@types/fs-extra": "^11.0.4",
|
|
35
|
+
"@types/humps": "^2.0.6",
|
|
36
|
+
"@types/inquirer": "^8.2.10",
|
|
37
|
+
"@types/istextorbinary": "^2.3.4",
|
|
38
|
+
"@types/node": "^20.16.5",
|
|
39
|
+
"@types/npmlog": "^7.0.0",
|
|
40
|
+
"@types/shelljs": "^0.8.15",
|
|
41
|
+
"eslint": "^9.10.0",
|
|
42
|
+
"tsc-alias": "^1.8.10",
|
|
43
|
+
"tsconfig-paths": "^4.2.0",
|
|
44
|
+
"typescript": "^5.5.4"
|
|
45
|
+
},
|
|
46
|
+
"gitHead": "0a8a79da3978f88f2bf27892f00b037a88da1987"
|
|
46
47
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"GenerateOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/GenerateOptions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,4CAA6C,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;CACd"}
|
|
1
|
+
{"version":3,"file":"GenerateOptions.d.ts","sourceRoot":"","sources":["../../../../src/commands/generate/GenerateOptions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,4CAA6C,CAAC;AACxE,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1D,MAAM,WAAW,eAAe;IAC9B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,GAAG,EAAE,OAAO,CAAC;CACd"}
|
|
@@ -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":"AAMA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,eAAe,SACpB,MAAM,OACP,MAAM,WACF,eAAe,kBAsGzB,CAAC"}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateProject = void 0;
|
|
4
4
|
const filesystem_1 = require("../../scripts/filesystem");
|
|
5
|
+
const git_1 = require("../../scripts/git");
|
|
5
6
|
const log_1 = require("./log");
|
|
6
7
|
const cmd_1 = require("../../scripts/cmd");
|
|
7
8
|
const utils_1 = require("../../utils");
|
|
8
9
|
const generateProject = async (name, cwd, options) => {
|
|
9
|
-
const { noRepo, keepHistory, yes } = options;
|
|
10
|
+
const { starterBranch = "base", noRepo, keepHistory, yes } = options;
|
|
10
11
|
log_1.log.verbose("Check if project name is valid");
|
|
11
12
|
if (!name.match(/^[a-z0-9-]+$/)) {
|
|
12
13
|
log_1.log.error("Project name must be lowercase, alphanumeric, and contain hyphens only.");
|
|
@@ -40,9 +41,9 @@ const generateProject = async (name, cwd, options) => {
|
|
|
40
41
|
log_1.log.verbose("Skipping gh verification");
|
|
41
42
|
}
|
|
42
43
|
log_1.log.verbose("Cloning gluhar project template");
|
|
43
|
-
|
|
44
|
+
git_1.git.clone("gluharry/starters", name, { branch: starterBranch });
|
|
44
45
|
cmd_1.cmd.cd(name);
|
|
45
|
-
log_1.log.verbose("Replacing
|
|
46
|
+
log_1.log.verbose("Replacing gluhar-app with project's name");
|
|
46
47
|
await filesystem_1.filesystem.copyFiles([
|
|
47
48
|
"./package.json",
|
|
48
49
|
"./README.md",
|
|
@@ -50,7 +51,7 @@ const generateProject = async (name, cwd, options) => {
|
|
|
50
51
|
"./sanity/sanity.config.ts",
|
|
51
52
|
"./sanity/structure.ts",
|
|
52
53
|
], (file) => {
|
|
53
|
-
const content = file.content.replaceAll("
|
|
54
|
+
const content = file.content.replaceAll("gluhar-app", name);
|
|
54
55
|
return {
|
|
55
56
|
...file,
|
|
56
57
|
content,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACjD,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/scripts/cmd/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AACjD,MAAM,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG,EAAE,CAAC;AAE7D,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,QAAQ,GAAG,SAAS,CAAC;IAC5B,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;CACjC;AAED,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAAI;KAC/B,CAAC,IAAI,MAAM,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAClC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface CloneOptions {
|
|
2
|
+
branch?: string;
|
|
3
|
+
singleBranch?: boolean;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Clone a repo.
|
|
7
|
+
* @param repo The repo name in the format: 'gluharry/starters'.
|
|
8
|
+
*/
|
|
9
|
+
export declare const clone: (repo: string, dir?: string, options?: CloneOptions) => void;
|
|
10
|
+
//# sourceMappingURL=clone.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clone.d.ts","sourceRoot":"","sources":["../../../../src/scripts/git/clone.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,YAAY;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,eAAO,MAAM,KAAK,SACV,MAAM,QACP,MAAM,YACF,YAAY,SAItB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.clone = void 0;
|
|
4
|
+
const cmd_1 = require("../../scripts/cmd");
|
|
5
|
+
const log_1 = require("./log");
|
|
6
|
+
/**
|
|
7
|
+
* Clone a repo.
|
|
8
|
+
* @param repo The repo name in the format: 'gluharry/starters'.
|
|
9
|
+
*/
|
|
10
|
+
const clone = (repo, dir = "", options = {}) => {
|
|
11
|
+
log_1.log.verbose("Cloning:", repo, dir, options);
|
|
12
|
+
(0, cmd_1.executeCmd)(`git clone https://github.com/${repo}.git ${dir}`, options);
|
|
13
|
+
};
|
|
14
|
+
exports.clone = clone;
|
|
@@ -23,6 +23,7 @@ export declare const git: {
|
|
|
23
23
|
rename: (oldTagName: string, newTagName: string) => void;
|
|
24
24
|
pushAll: (remote?: string) => import("child_process").SpawnSyncReturns<Buffer>;
|
|
25
25
|
};
|
|
26
|
+
clone: (repo: string, dir?: string, options?: import("./clone").CloneOptions) => void;
|
|
26
27
|
};
|
|
27
28
|
export type { BranchInfo } from "./branch/getCurrentBranch";
|
|
28
29
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scripts/git/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/scripts/git/index.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAQzC,eAAO,MAAM,GAAG;;;;mBAIC,IAAI;wBACC,MAAM;uBAEP,MAAM;wBAEL,MAAM,MAAM,OAAO;;;;;;;;;;;;;;;;;;CAgBxC,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC"}
|
package/src/scripts/git/index.js
CHANGED
|
@@ -14,6 +14,7 @@ const getTags_1 = require("./tag/getTags");
|
|
|
14
14
|
const pushAllTags_1 = require("./tag/pushAllTags");
|
|
15
15
|
const deleteTag_1 = require("./tag/deleteTag");
|
|
16
16
|
const renameTag_1 = require("./tag/renameTag");
|
|
17
|
+
const clone_1 = require("./clone");
|
|
17
18
|
exports.git = {
|
|
18
19
|
openPr: openPr_1.openPr,
|
|
19
20
|
getRepo: getRepo_1.getRepo,
|
|
@@ -35,4 +36,5 @@ exports.git = {
|
|
|
35
36
|
rename: renameTag_1.renameTag,
|
|
36
37
|
pushAll: pushAllTags_1.pushAllTags,
|
|
37
38
|
},
|
|
39
|
+
clone: clone_1.clone,
|
|
38
40
|
};
|