@h3ravel/shared 2.2.0 → 2.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/index.d.ts CHANGED
@@ -1,9 +1,12 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
2
  import { ChalkInstance } from "chalk";
3
+ import { Table } from "console-table-printer";
3
4
  import { JitiOptions, JitiResolveOptions } from "jiti";
4
5
  import { ChoiceOrSeparatorArray, ChoiceOrSeparatorArray as ChoiceOrSeparatorArray$1 } from "inquirer-autocomplete-standalone";
5
6
  import { Separator } from "@inquirer/prompts";
6
7
  import { Options, Ora } from "ora";
8
+ import { multiline } from "@cli-prompts/multiline";
9
+ import { ComplexOptions } from "console-table-printer/dist/src/models/external-table.js";
7
10
  import { ClassConstructor, IPathName } from "@h3ravel/contracts";
8
11
 
9
12
  //#region src/Container.d.ts
@@ -158,6 +161,13 @@ declare class Logger {
158
161
  * @param preserveCol
159
162
  */
160
163
  static error(msg: any, exit?: boolean, preserveCol?: boolean): void;
164
+ /**
165
+ * Creates a table with the given options and logs it to the console.
166
+ *
167
+ * @param options
168
+ * @returns
169
+ */
170
+ static table(options?: string[] | ComplexOptions | undefined): Table;
161
171
  /**
162
172
  * Logs a warning message
163
173
  *
@@ -524,6 +534,14 @@ declare class Prompts extends Logger {
524
534
  * @returns
525
535
  */
526
536
  static editor(message?: string, postfix?: string, defaultValue?: string, validate?: (text: string) => boolean | string): Promise<string>;
537
+ /**
538
+ * Prompt the user for multi-line input directly in the console.
539
+ *
540
+ * @param prompt Message to display
541
+ * @param placeholder The placeholder text for the input
542
+ * @returns
543
+ */
544
+ static text(prompt?: string, placeholder?: string, options?: Omit<Exclude<Parameters<typeof multiline>[0], string>, 'prompt' | 'placeholder'>): Promise<string>;
527
545
  }
528
546
  //#endregion
529
547
  //#region src/Utils/Resolver.d.ts
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import chalk from "chalk";
2
+ import { Table } from "console-table-printer";
2
3
  import { access } from "fs/promises";
3
4
  import escalade from "escalade/sync";
4
5
  import { existsSync } from "fs";
@@ -10,6 +11,7 @@ import path$1, { resolve } from "node:path";
10
11
  import autocomplete from "inquirer-autocomplete-standalone";
11
12
  import { checkbox, confirm, editor, input, password, select } from "@inquirer/prompts";
12
13
  import ora from "ora";
14
+ import { multiline } from "@cli-prompts/multiline";
13
15
  import crypto from "crypto";
14
16
  import preferredPM from "preferred-pm";
15
17
  //#region src/Container.ts
@@ -448,6 +450,15 @@ var Logger = class Logger {
448
450
  if (exit) process.exit(1);
449
451
  }
450
452
  /**
453
+ * Creates a table with the given options and logs it to the console.
454
+ *
455
+ * @param options
456
+ * @returns
457
+ */
458
+ static table(options) {
459
+ return new Table(options);
460
+ }
461
+ /**
451
462
  * Logs a warning message
452
463
  *
453
464
  * @param msg
@@ -895,6 +906,20 @@ var Prompts = class extends Logger {
895
906
  validate
896
907
  });
897
908
  }
909
+ /**
910
+ * Prompt the user for multi-line input directly in the console.
911
+ *
912
+ * @param prompt Message to display
913
+ * @param placeholder The placeholder text for the input
914
+ * @returns
915
+ */
916
+ static async text(prompt = "Please provide your input below:", placeholder, options) {
917
+ return await multiline({
918
+ prompt,
919
+ placeholder,
920
+ ...options
921
+ });
922
+ }
898
923
  };
899
924
  //#endregion
900
925
  //#region src/Utils/Resolver.ts
package/package.json CHANGED
@@ -1,22 +1,13 @@
1
1
  {
2
2
  "name": "@h3ravel/shared",
3
- "version": "2.2.0",
3
+ "version": "2.2.2",
4
4
  "description": "Shared Utilities.",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "exports": {
8
- ".": {
9
- "import": "./dist/index.js",
10
- "require": "./dist/index.cjs"
11
- },
12
- "./*": "./*"
13
- },
14
- "typesVersions": {
15
- "*": {
16
- "*": [
17
- "dist/index.d.ts"
18
- ]
19
- }
8
+ ".": "./dist/index.js",
9
+ "./package.json": "./package.json",
10
+ "./tsconfig.base.json": "./tsconfig.base.json"
20
11
  },
21
12
  "files": [
22
13
  "dist",
@@ -42,18 +33,20 @@
42
33
  "laravel"
43
34
  ],
44
35
  "dependencies": {
36
+ "@cli-prompts/multiline": "^1.0.0",
45
37
  "@inquirer/prompts": "^7.9.0",
46
38
  "chalk": "^5.6.0",
39
+ "console-table-printer": "^2.16.1",
47
40
  "edge.js": "^6.3.0",
48
41
  "escalade": "^3.2.0",
49
- "h3": "2.0.1-rc.5",
42
+ "h3": "^2.0.1-rc.22",
50
43
  "inquirer-autocomplete-standalone": "^0.8.1",
51
44
  "jiti": "^2.7.0",
52
45
  "ora": "^9.1.0",
53
46
  "preferred-pm": "^4.1.1"
54
47
  },
55
48
  "devDependencies": {
56
- "@h3ravel/contracts": "^2.2.0",
49
+ "@h3ravel/contracts": "^2.2.2",
57
50
  "fetchdts": "^0.1.6",
58
51
  "pnpm": "^10.14.0"
59
52
  },
@@ -62,7 +55,7 @@
62
55
  "dev": "tsdown --watch --config-loader unrun",
63
56
  "start": "node dist/index.js",
64
57
  "lint": "eslint . --ext .ts",
65
- "test": "jest --passWithNoTests",
58
+ "test": "vitest",
66
59
  "release:patch": "pnpm build && pnpm version patch && git add . && git commit -m \"version: bump shared package and publish\" && pnpm publish --tag latest",
67
60
  "version-patch": "pnpm version patch"
68
61
  }