@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 CHANGED
@@ -1,46 +1,47 @@
1
1
  {
2
- "name": "@gluhar/cli",
3
- "version": "2.0.0-dev.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
- "dev": "npm run build && node ./dist/src/index.js"
18
- },
19
- "dependencies": {
20
- "chalk": "^4.1.2",
21
- "commander": "^12.1.0",
22
- "fs-extra": "^11.2.0",
23
- "glob": "^11.0.0",
24
- "humps": "^2.0.1",
25
- "inquirer": "^8.2.6",
26
- "istextorbinary": "^9.5.0",
27
- "npmlog": "^7.0.1",
28
- "shelljs": "^0.8.5"
29
- },
30
- "devDependencies": {
31
- "@nuxt/eslint-config": "^0.5.6",
32
- "@nuxt/schema": "^3.13.1",
33
- "@types/fs-extra": "^11.0.4",
34
- "@types/humps": "^2.0.6",
35
- "@types/inquirer": "^8.2.10",
36
- "@types/istextorbinary": "^2.3.4",
37
- "@types/node": "^20.16.5",
38
- "@types/npmlog": "^7.0.0",
39
- "@types/shelljs": "^0.8.15",
40
- "eslint": "^9.10.0",
41
- "tsc-alias": "^1.8.10",
42
- "tsconfig-paths": "^4.2.0",
43
- "typescript": "^5.5.4"
44
- },
45
- "gitHead": "7e440d8b9fec347229003a5d5a6885479bd426ab"
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,6 +1,7 @@
1
1
  export declare const generateTypes: readonly ["project", "package", "command"];
2
2
  export type GenerateType = (typeof generateTypes)[number];
3
3
  export interface GenerateOptions {
4
+ starterBranch?: string;
4
5
  noRepo?: boolean;
5
6
  keepHistory?: boolean;
6
7
  yes: boolean;
@@ -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":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAGpD,eAAO,MAAM,eAAe,SACpB,MAAM,OACP,MAAM,WACF,eAAe,kBAwGzB,CAAC"}
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
- (0, cmd_1.executeCmd)(`git clone --branch hui https://github.com/gluharry/starters.git ${name}`); // TODO create a git.clone; TODO allow other branches; TODO change hui to gluhar
44
+ git_1.git.clone("gluharry/starters", name, { branch: starterBranch });
44
45
  cmd_1.cmd.cd(name);
45
- log_1.log.verbose("Replacing hui-app with project's name");
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("hui-app", name);
54
+ const content = file.content.replaceAll("gluhar-app", name);
54
55
  return {
55
56
  ...file,
56
57
  content,
@@ -1,5 +1,5 @@
1
1
  export type ArgValue = string | number | boolean;
2
- export type Args = Record<string, ArgValue | undefined>;
2
+ export type Args = Record<string, ArgValue | undefined> | {};
3
3
  export interface ParsedArg {
4
4
  name: string;
5
5
  parsedName: string;
@@ -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;AAExD,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"}
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;AAOzC,eAAO,MAAM,GAAG;;;;mBAIC,IAAI;wBACC,MAAM;uBAEP,MAAM;wBAEL,MAAM,MAAM,OAAO;;;;;;;;;;;;;;;;;CAexC,CAAC;AAEF,YAAY,EAAE,UAAU,EAAE,MAAM,2BAA2B,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"}
@@ -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
  };