@decaf-ts/utils 1.0.10 → 1.2.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.
Files changed (210) hide show
  1. package/README.md +1 -1
  2. package/dist/utils.cjs +1 -1
  3. package/dist/utils.cjs.map +1 -1
  4. package/dist/utils.js +1 -1
  5. package/dist/utils.js.map +1 -1
  6. package/lib/cjs/assets/slogans.cjs +3 -2
  7. package/lib/cjs/assets/slogans.cjs.map +1 -0
  8. package/lib/cjs/bin/build-scripts.cjs +5 -4
  9. package/lib/cjs/bin/build-scripts.cjs.map +1 -0
  10. package/lib/cjs/bin/release-chain-dispatch.cjs +5 -4
  11. package/lib/cjs/bin/release-chain-dispatch.cjs.map +1 -0
  12. package/lib/cjs/bin/release-chain.cjs +5 -4
  13. package/lib/cjs/bin/release-chain.cjs.map +1 -0
  14. package/lib/cjs/bin/tag-release.cjs +5 -4
  15. package/lib/cjs/bin/tag-release.cjs.map +1 -0
  16. package/lib/cjs/cli/command.cjs +11 -10
  17. package/lib/cjs/cli/command.cjs.map +1 -0
  18. package/lib/cjs/cli/commands/build-scripts.cjs +163 -44
  19. package/lib/cjs/cli/commands/build-scripts.cjs.map +1 -0
  20. package/lib/cjs/cli/commands/index.cjs +1 -0
  21. package/lib/cjs/cli/commands/index.cjs.map +1 -0
  22. package/lib/cjs/cli/commands/release-chain.cjs +12 -11
  23. package/lib/cjs/cli/commands/release-chain.cjs.map +1 -0
  24. package/lib/cjs/cli/commands/tag-release.cjs +21 -20
  25. package/lib/cjs/cli/commands/tag-release.cjs.map +1 -0
  26. package/lib/cjs/cli/constants.cjs +1 -0
  27. package/lib/cjs/cli/constants.cjs.map +1 -0
  28. package/lib/cjs/cli/index.cjs +1 -0
  29. package/lib/cjs/cli/index.cjs.map +1 -0
  30. package/lib/cjs/cli/types.cjs +1 -0
  31. package/lib/cjs/cli/types.cjs.map +1 -0
  32. package/lib/cjs/index.cjs +2 -1
  33. package/lib/cjs/index.cjs.map +1 -0
  34. package/lib/cjs/input/index.cjs +1 -0
  35. package/lib/cjs/input/index.cjs.map +1 -0
  36. package/lib/cjs/input/input.cjs +1 -0
  37. package/lib/cjs/input/input.cjs.map +1 -0
  38. package/lib/cjs/input/types.cjs +1 -0
  39. package/lib/cjs/input/types.cjs.map +1 -0
  40. package/lib/cjs/output/common.cjs +4 -3
  41. package/lib/cjs/output/common.cjs.map +1 -0
  42. package/lib/cjs/output/index.cjs +1 -0
  43. package/lib/cjs/output/index.cjs.map +1 -0
  44. package/lib/cjs/release-chain/index.cjs +1 -0
  45. package/lib/cjs/release-chain/index.cjs.map +1 -0
  46. package/lib/cjs/tests/Consumer.cjs +3 -2
  47. package/lib/cjs/tests/Consumer.cjs.map +1 -0
  48. package/lib/cjs/tests/ProducerChildProcess.cjs.map +1 -0
  49. package/lib/cjs/tests/TestReporter.cjs +5 -4
  50. package/lib/cjs/tests/TestReporter.cjs.map +1 -0
  51. package/lib/cjs/tests/index.cjs +1 -0
  52. package/lib/cjs/tests/index.cjs.map +1 -0
  53. package/lib/cjs/tests/jestPerformanceRunner.cjs +5 -4
  54. package/lib/cjs/tests/jestPerformanceRunner.cjs.map +1 -0
  55. package/lib/cjs/tests/utils.cjs +5 -4
  56. package/lib/cjs/tests/utils.cjs.map +1 -0
  57. package/lib/cjs/utils/constants.cjs +3 -16
  58. package/lib/cjs/utils/constants.cjs.map +1 -0
  59. package/lib/cjs/utils/fs.cjs +16 -15
  60. package/lib/cjs/utils/fs.cjs.map +1 -0
  61. package/lib/cjs/utils/http.cjs +1 -0
  62. package/lib/cjs/utils/http.cjs.map +1 -0
  63. package/lib/cjs/utils/index.cjs +1 -0
  64. package/lib/cjs/utils/index.cjs.map +1 -0
  65. package/lib/cjs/utils/md.cjs +1 -0
  66. package/lib/cjs/utils/md.cjs.map +1 -0
  67. package/lib/cjs/utils/performanceRunner.cjs +1 -0
  68. package/lib/cjs/utils/performanceRunner.cjs.map +1 -0
  69. package/lib/cjs/utils/timeout.cjs +1 -0
  70. package/lib/cjs/utils/timeout.cjs.map +1 -0
  71. package/lib/cjs/utils/types.cjs +1 -0
  72. package/lib/cjs/utils/types.cjs.map +1 -0
  73. package/lib/cjs/utils/utils.cjs +5 -4
  74. package/lib/cjs/utils/utils.cjs.map +1 -0
  75. package/lib/cjs/writers/OutputWriter.cjs +1 -0
  76. package/lib/cjs/writers/OutputWriter.cjs.map +1 -0
  77. package/lib/cjs/writers/RegexpOutputWriter.cjs +3 -2
  78. package/lib/cjs/writers/RegexpOutputWriter.cjs.map +1 -0
  79. package/lib/cjs/writers/StandardOutputWriter.cjs +3 -2
  80. package/lib/cjs/writers/StandardOutputWriter.cjs.map +1 -0
  81. package/lib/cjs/writers/index.cjs +1 -0
  82. package/lib/cjs/writers/index.cjs.map +1 -0
  83. package/lib/cjs/writers/types.cjs +1 -0
  84. package/lib/cjs/writers/types.cjs.map +1 -0
  85. package/lib/esm/cli/commands/build-scripts.js +142 -24
  86. package/lib/esm/cli/commands/build-scripts.js.map +1 -1
  87. package/lib/esm/index.js +1 -1
  88. package/lib/types/assets/slogans.d.cts +19 -0
  89. package/lib/types/assets/slogans.d.mts +19 -0
  90. package/lib/types/bin/build-scripts.d.cts +1 -0
  91. package/lib/types/bin/build-scripts.d.mts +1 -0
  92. package/lib/types/bin/release-chain-dispatch.d.cts +1 -0
  93. package/lib/types/bin/release-chain-dispatch.d.mts +1 -0
  94. package/lib/types/bin/release-chain.d.cts +1 -0
  95. package/lib/types/bin/release-chain.d.mts +1 -0
  96. package/lib/types/bin/tag-release.d.cts +1 -0
  97. package/lib/types/bin/tag-release.d.mts +1 -0
  98. package/lib/types/cli/command.d.cts +104 -0
  99. package/lib/types/cli/command.d.mts +104 -0
  100. package/lib/types/cli/commands/build-scripts.d.cts +148 -0
  101. package/lib/types/cli/commands/build-scripts.d.mts +148 -0
  102. package/lib/types/cli/commands/build-scripts.d.ts +5 -0
  103. package/lib/types/cli/commands/index.d.cts +3 -0
  104. package/lib/types/cli/commands/index.d.mts +3 -0
  105. package/lib/types/cli/commands/release-chain.d.cts +62 -0
  106. package/lib/types/cli/commands/release-chain.d.mts +62 -0
  107. package/lib/types/cli/commands/tag-release.d.cts +105 -0
  108. package/lib/types/cli/commands/tag-release.d.mts +105 -0
  109. package/lib/types/cli/constants.d.cts +75 -0
  110. package/lib/types/cli/constants.d.mts +75 -0
  111. package/lib/types/cli/index.d.cts +4 -0
  112. package/lib/types/cli/index.d.mts +4 -0
  113. package/lib/types/cli/types.d.cts +30 -0
  114. package/lib/types/cli/types.d.mts +30 -0
  115. package/lib/types/index.d.cts +38 -0
  116. package/lib/types/index.d.mts +38 -0
  117. package/lib/types/index.d.ts +1 -1
  118. package/lib/types/input/index.d.cts +2 -0
  119. package/lib/types/input/index.d.mts +2 -0
  120. package/lib/types/input/input.d.cts +517 -0
  121. package/lib/types/input/input.d.mts +517 -0
  122. package/lib/types/input/types.d.cts +159 -0
  123. package/lib/types/input/types.d.mts +159 -0
  124. package/lib/types/output/common.d.cts +53 -0
  125. package/lib/types/output/common.d.mts +53 -0
  126. package/lib/types/output/index.d.cts +1 -0
  127. package/lib/types/output/index.d.mts +1 -0
  128. package/lib/types/release-chain/index.d.cts +43 -0
  129. package/lib/types/release-chain/index.d.mts +43 -0
  130. package/lib/types/tests/Consumer.d.cts +151 -0
  131. package/lib/types/tests/Consumer.d.mts +151 -0
  132. package/lib/types/tests/ProducerChildProcess.d.cts +18 -0
  133. package/lib/types/tests/ProducerChildProcess.d.mts +18 -0
  134. package/lib/types/tests/TestReporter.d.cts +245 -0
  135. package/lib/types/tests/TestReporter.d.mts +245 -0
  136. package/lib/types/tests/index.d.cts +4 -0
  137. package/lib/types/tests/index.d.mts +4 -0
  138. package/lib/types/tests/jestPerformanceRunner.d.cts +37 -0
  139. package/lib/types/tests/jestPerformanceRunner.d.mts +37 -0
  140. package/lib/types/tests/utils.d.cts +5 -0
  141. package/lib/types/tests/utils.d.mts +5 -0
  142. package/lib/types/utils/constants.d.cts +65 -0
  143. package/lib/types/utils/constants.d.mts +65 -0
  144. package/lib/types/utils/fs.d.cts +259 -0
  145. package/lib/types/utils/fs.d.mts +259 -0
  146. package/lib/types/utils/http.d.cts +41 -0
  147. package/lib/types/utils/http.d.mts +41 -0
  148. package/lib/types/utils/index.d.cts +6 -0
  149. package/lib/types/utils/index.d.mts +6 -0
  150. package/lib/types/utils/md.d.cts +156 -0
  151. package/lib/types/utils/md.d.mts +156 -0
  152. package/lib/types/utils/performanceRunner.d.cts +129 -0
  153. package/lib/types/utils/performanceRunner.d.mts +129 -0
  154. package/lib/types/utils/timeout.d.cts +12 -0
  155. package/lib/types/utils/timeout.d.mts +12 -0
  156. package/lib/types/utils/types.d.cts +112 -0
  157. package/lib/types/utils/types.d.mts +112 -0
  158. package/lib/types/utils/utils.d.cts +133 -0
  159. package/lib/types/utils/utils.d.mts +133 -0
  160. package/lib/types/writers/OutputWriter.d.cts +49 -0
  161. package/lib/types/writers/OutputWriter.d.mts +49 -0
  162. package/lib/types/writers/RegexpOutputWriter.d.cts +110 -0
  163. package/lib/types/writers/RegexpOutputWriter.d.mts +110 -0
  164. package/lib/types/writers/StandardOutputWriter.d.cts +130 -0
  165. package/lib/types/writers/StandardOutputWriter.d.mts +130 -0
  166. package/lib/types/writers/index.d.cts +4 -0
  167. package/lib/types/writers/index.d.mts +4 -0
  168. package/lib/types/writers/types.d.cts +29 -0
  169. package/lib/types/writers/types.d.mts +29 -0
  170. package/package.json +14 -8
  171. package/lib/cjs/assets/slogans.js.map +0 -1
  172. package/lib/cjs/bin/build-scripts.js.map +0 -1
  173. package/lib/cjs/bin/release-chain-dispatch.js.map +0 -1
  174. package/lib/cjs/bin/release-chain.js.map +0 -1
  175. package/lib/cjs/bin/tag-release.js.map +0 -1
  176. package/lib/cjs/cli/command.js.map +0 -1
  177. package/lib/cjs/cli/commands/build-scripts.js.map +0 -1
  178. package/lib/cjs/cli/commands/index.js.map +0 -1
  179. package/lib/cjs/cli/commands/release-chain.js.map +0 -1
  180. package/lib/cjs/cli/commands/tag-release.js.map +0 -1
  181. package/lib/cjs/cli/constants.js.map +0 -1
  182. package/lib/cjs/cli/index.js.map +0 -1
  183. package/lib/cjs/cli/types.js.map +0 -1
  184. package/lib/cjs/index.js.map +0 -1
  185. package/lib/cjs/input/index.js.map +0 -1
  186. package/lib/cjs/input/input.js.map +0 -1
  187. package/lib/cjs/input/types.js.map +0 -1
  188. package/lib/cjs/output/common.js.map +0 -1
  189. package/lib/cjs/output/index.js.map +0 -1
  190. package/lib/cjs/release-chain/index.js.map +0 -1
  191. package/lib/cjs/tests/Consumer.js.map +0 -1
  192. package/lib/cjs/tests/ProducerChildProcess.js.map +0 -1
  193. package/lib/cjs/tests/TestReporter.js.map +0 -1
  194. package/lib/cjs/tests/index.js.map +0 -1
  195. package/lib/cjs/tests/jestPerformanceRunner.js.map +0 -1
  196. package/lib/cjs/tests/utils.js.map +0 -1
  197. package/lib/cjs/utils/constants.js.map +0 -1
  198. package/lib/cjs/utils/fs.js.map +0 -1
  199. package/lib/cjs/utils/http.js.map +0 -1
  200. package/lib/cjs/utils/index.js.map +0 -1
  201. package/lib/cjs/utils/md.js.map +0 -1
  202. package/lib/cjs/utils/performanceRunner.js.map +0 -1
  203. package/lib/cjs/utils/timeout.js.map +0 -1
  204. package/lib/cjs/utils/types.js.map +0 -1
  205. package/lib/cjs/utils/utils.js.map +0 -1
  206. package/lib/cjs/writers/OutputWriter.js.map +0 -1
  207. package/lib/cjs/writers/RegexpOutputWriter.js.map +0 -1
  208. package/lib/cjs/writers/StandardOutputWriter.js.map +0 -1
  209. package/lib/cjs/writers/index.js.map +0 -1
  210. package/lib/cjs/writers/types.js.map +0 -1
@@ -0,0 +1,19 @@
1
+ /**
2
+ * @description Definition of a slogan item.
3
+ * @summary Represents a single slogan entry with text and tags.
4
+ * @typedef {Object} SloganItem
5
+ * @property {string} Slogan - The slogan text.
6
+ * @property {string} Tags - Comma-separated tags describing the slogan.
7
+ * @memberOf module:utils
8
+ */
9
+ /**
10
+ * @description List of available slogans for banners and messages.
11
+ * @summary Immutable array of slogan entries used by {@link getSlogan} and banner rendering.
12
+ * @type {SloganItem[]}
13
+ * @const slogans
14
+ * @memberOf module:utils
15
+ */
16
+ export declare const slogans: {
17
+ Slogan: string;
18
+ Tags: string;
19
+ }[];
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,104 @@
1
+ import { ParseArgsResult } from "../input/types.cjs";
2
+ import { CommandOptions } from "./types.cjs";
3
+ import { DefaultCommandValues } from "./constants.cjs";
4
+ import { LoggedClass, Logger, LoggingConfig } from "@decaf-ts/logging";
5
+ /**
6
+ * @class Command
7
+ * @abstract
8
+ * @template I - The type of input options for the command.
9
+ * @template R - The return type of the command execution.
10
+ * @memberOf module:utils
11
+ * @description Abstract base class for command implementation.
12
+ * @summary Provides a structure for creating command-line interface commands with input handling, logging, and execution flow.
13
+ *
14
+ * @param {string} name - The name of the command.
15
+ * @param {CommandOptions<I>} [inputs] - The input options for the command.
16
+ * @param {string[]} [requirements] - The list of required dependencies for the command.
17
+ */
18
+ export declare abstract class Command<I, R> extends LoggedClass {
19
+ protected name: string;
20
+ protected inputs: CommandOptions<I>;
21
+ protected requirements: string[];
22
+ /**
23
+ * @static
24
+ * @description Static logger for the Command class.
25
+ * @type {Logger}
26
+ */
27
+ static log: Logger;
28
+ protected constructor(name: string, inputs?: CommandOptions<I>, requirements?: string[]);
29
+ /**
30
+ * @protected
31
+ * @async
32
+ * @description Checks if all required dependencies are present.
33
+ * @summary Retrieves the list of dependencies and compares it against the required dependencies for the command.
34
+ * @returns {Promise<void>} A promise that resolves when the check is complete.
35
+ *
36
+ * @mermaid
37
+ * sequenceDiagram
38
+ * participant Command
39
+ * participant getDependencies
40
+ * participant Set
41
+ * Command->>getDependencies: Call
42
+ * getDependencies-->>Command: Return {prod, dev, peer}
43
+ * Command->>Set: Create Set from prod, dev, peer
44
+ * Set-->>Command: Return unique dependencies
45
+ * Command->>Command: Compare against requirements
46
+ * alt Missing dependencies
47
+ * Command->>Command: Add to missing list
48
+ * end
49
+ * Note over Command: If missing.length > 0, handle missing dependencies
50
+ */
51
+ protected checkRequirements(): Promise<void>;
52
+ /**
53
+ * @protected
54
+ * @description Provides help information for the command.
55
+ * @summary This method should be overridden in derived classes to provide specific help information.
56
+ * @param {ParseArgsResult} args - The parsed command-line arguments.
57
+ * @returns {void}
58
+ */
59
+ protected help(args: ParseArgsResult): void;
60
+ /**
61
+ * @protected
62
+ * @abstract
63
+ * @description Runs the command with the provided arguments.
64
+ * @summary This method should be implemented in derived classes to define the command's behavior.
65
+ * @param {ParseArgsResult} answers - The parsed command-line arguments.
66
+ * @returns {Promise<R | string | void>} A promise that resolves with the command's result.
67
+ */
68
+ protected abstract run<R>(answers: LoggingConfig & typeof DefaultCommandValues & {
69
+ [k in keyof I]: unknown;
70
+ }): Promise<R | string | void>;
71
+ /**
72
+ * @async
73
+ * @description Executes the command.
74
+ * @summary This method handles the overall execution flow of the command, including parsing arguments,
75
+ * setting up logging, checking for version or help requests, and running the command.
76
+ * @returns {Promise<R | string | void>} A promise that resolves with the command's result.
77
+ *
78
+ * @mermaid
79
+ * sequenceDiagram
80
+ * participant Command
81
+ * participant UserInput
82
+ * participant Logging
83
+ * participant getPackageVersion
84
+ * participant printBanner
85
+ * Command->>UserInput: parseArgs(inputs)
86
+ * UserInput-->>Command: Return ParseArgsResult
87
+ * Command->>Command: Process options
88
+ * Command->>Logging: setConfig(options)
89
+ * alt version requested
90
+ * Command->>getPackageVersion: Call
91
+ * getPackageVersion-->>Command: Return version
92
+ * else help requested
93
+ * Command->>Command: help(args)
94
+ * else banner requested
95
+ * Command->>printBanner: Call
96
+ * end
97
+ * Command->>Command: run(args)
98
+ * alt error occurs
99
+ * Command->>Command: Log error
100
+ * end
101
+ * Command-->>Command: Return result
102
+ */
103
+ execute(): Promise<R | string | void>;
104
+ }
@@ -0,0 +1,104 @@
1
+ import { ParseArgsResult } from "../input/types.js";
2
+ import { CommandOptions } from "./types.js";
3
+ import { DefaultCommandValues } from "./constants.js";
4
+ import { LoggedClass, Logger, LoggingConfig } from "@decaf-ts/logging";
5
+ /**
6
+ * @class Command
7
+ * @abstract
8
+ * @template I - The type of input options for the command.
9
+ * @template R - The return type of the command execution.
10
+ * @memberOf module:utils
11
+ * @description Abstract base class for command implementation.
12
+ * @summary Provides a structure for creating command-line interface commands with input handling, logging, and execution flow.
13
+ *
14
+ * @param {string} name - The name of the command.
15
+ * @param {CommandOptions<I>} [inputs] - The input options for the command.
16
+ * @param {string[]} [requirements] - The list of required dependencies for the command.
17
+ */
18
+ export declare abstract class Command<I, R> extends LoggedClass {
19
+ protected name: string;
20
+ protected inputs: CommandOptions<I>;
21
+ protected requirements: string[];
22
+ /**
23
+ * @static
24
+ * @description Static logger for the Command class.
25
+ * @type {Logger}
26
+ */
27
+ static log: Logger;
28
+ protected constructor(name: string, inputs?: CommandOptions<I>, requirements?: string[]);
29
+ /**
30
+ * @protected
31
+ * @async
32
+ * @description Checks if all required dependencies are present.
33
+ * @summary Retrieves the list of dependencies and compares it against the required dependencies for the command.
34
+ * @returns {Promise<void>} A promise that resolves when the check is complete.
35
+ *
36
+ * @mermaid
37
+ * sequenceDiagram
38
+ * participant Command
39
+ * participant getDependencies
40
+ * participant Set
41
+ * Command->>getDependencies: Call
42
+ * getDependencies-->>Command: Return {prod, dev, peer}
43
+ * Command->>Set: Create Set from prod, dev, peer
44
+ * Set-->>Command: Return unique dependencies
45
+ * Command->>Command: Compare against requirements
46
+ * alt Missing dependencies
47
+ * Command->>Command: Add to missing list
48
+ * end
49
+ * Note over Command: If missing.length > 0, handle missing dependencies
50
+ */
51
+ protected checkRequirements(): Promise<void>;
52
+ /**
53
+ * @protected
54
+ * @description Provides help information for the command.
55
+ * @summary This method should be overridden in derived classes to provide specific help information.
56
+ * @param {ParseArgsResult} args - The parsed command-line arguments.
57
+ * @returns {void}
58
+ */
59
+ protected help(args: ParseArgsResult): void;
60
+ /**
61
+ * @protected
62
+ * @abstract
63
+ * @description Runs the command with the provided arguments.
64
+ * @summary This method should be implemented in derived classes to define the command's behavior.
65
+ * @param {ParseArgsResult} answers - The parsed command-line arguments.
66
+ * @returns {Promise<R | string | void>} A promise that resolves with the command's result.
67
+ */
68
+ protected abstract run<R>(answers: LoggingConfig & typeof DefaultCommandValues & {
69
+ [k in keyof I]: unknown;
70
+ }): Promise<R | string | void>;
71
+ /**
72
+ * @async
73
+ * @description Executes the command.
74
+ * @summary This method handles the overall execution flow of the command, including parsing arguments,
75
+ * setting up logging, checking for version or help requests, and running the command.
76
+ * @returns {Promise<R | string | void>} A promise that resolves with the command's result.
77
+ *
78
+ * @mermaid
79
+ * sequenceDiagram
80
+ * participant Command
81
+ * participant UserInput
82
+ * participant Logging
83
+ * participant getPackageVersion
84
+ * participant printBanner
85
+ * Command->>UserInput: parseArgs(inputs)
86
+ * UserInput-->>Command: Return ParseArgsResult
87
+ * Command->>Command: Process options
88
+ * Command->>Logging: setConfig(options)
89
+ * alt version requested
90
+ * Command->>getPackageVersion: Call
91
+ * getPackageVersion-->>Command: Return version
92
+ * else help requested
93
+ * Command->>Command: help(args)
94
+ * else banner requested
95
+ * Command->>printBanner: Call
96
+ * end
97
+ * Command->>Command: run(args)
98
+ * alt error occurs
99
+ * Command->>Command: Log error
100
+ * end
101
+ * Command-->>Command: Return result
102
+ */
103
+ execute(): Promise<R | string | void>;
104
+ }
@@ -0,0 +1,148 @@
1
+ import { Command } from "../command.cjs";
2
+ import { CommandOptions } from "../types.cjs";
3
+ import { DefaultCommandValues } from "../constants.cjs";
4
+ import { LoggingConfig } from "@decaf-ts/logging";
5
+ declare module "@rollup/plugin-terser";
6
+ export declare function parseList(input?: string | string[]): string[];
7
+ export declare function packageToGlobal(name: string): string;
8
+ export declare function getPackageDependencies(): string[];
9
+ declare enum Modes {
10
+ CJS = "commonjs",
11
+ ESM = "es2022"
12
+ }
13
+ declare enum BuildMode {
14
+ BUILD = "build",
15
+ BUNDLE = "bundle",
16
+ ALL = "all"
17
+ }
18
+ declare const options: {
19
+ prod: {
20
+ type: string;
21
+ default: boolean;
22
+ };
23
+ dev: {
24
+ type: string;
25
+ default: boolean;
26
+ };
27
+ buildMode: {
28
+ type: string;
29
+ default: BuildMode;
30
+ };
31
+ includes: {
32
+ type: string;
33
+ default: string;
34
+ };
35
+ externals: {
36
+ type: string;
37
+ default: string;
38
+ };
39
+ docs: {
40
+ type: string;
41
+ default: boolean;
42
+ };
43
+ commands: {
44
+ type: string;
45
+ default: boolean;
46
+ };
47
+ entry: {
48
+ type: string;
49
+ default: string;
50
+ };
51
+ banner: {
52
+ type: string;
53
+ default: boolean;
54
+ };
55
+ validateNodeNext: {
56
+ type: string;
57
+ default: boolean;
58
+ };
59
+ };
60
+ /**
61
+ * @description A command-line script for building and bundling TypeScript projects.
62
+ * @summary This class provides a comprehensive build script that handles TypeScript compilation,
63
+ * bundling with Rollup, and documentation generation. It supports different build modes
64
+ * (development, production), module formats (CJS, ESM), and can be extended with custom
65
+ * configurations.
66
+ * @class BuildScripts
67
+ */
68
+ export declare class BuildScripts extends Command<CommandOptions<typeof options>, void> {
69
+ private replacements;
70
+ private readonly pkgVersion;
71
+ private readonly pkgName;
72
+ constructor();
73
+ /**
74
+ * @description Patches files with version and package name.
75
+ * @summary This method reads all files in a directory, finds placeholders for version
76
+ * and package name, and replaces them with the actual values from package.json.
77
+ * @param {string} p - The path to the directory containing the files to patch.
78
+ */
79
+ patchFiles(p: string): void;
80
+ private reportDiagnostics;
81
+ private formatDiagnostics;
82
+ private readConfigFile;
83
+ private evalDiagnostics;
84
+ private preCheckDiagnostics;
85
+ private checkTsDiagnostics;
86
+ private buildTs;
87
+ private build;
88
+ private rewriteRelativeJsSpecifiersToCjs;
89
+ private buildCjsFromEsm;
90
+ private applyTsConfigProfile;
91
+ private checkNodeNextCompatibility;
92
+ private buildTypes;
93
+ private rewriteRelativeDeclarationSpecifiers;
94
+ private emitDualDeclarationFiles;
95
+ private updatePackageJsonDualTypeExports;
96
+ /**
97
+ * @description Copies assets to the build output directory.
98
+ * @summary This method checks for the existence of an 'assets' directory in the source
99
+ * and copies it to the appropriate build output directory (lib or dist).
100
+ * @param {Modes} mode - The build mode (CJS or ESM).
101
+ */
102
+ copyAssets(mode: Modes): void;
103
+ /**
104
+ * @description Bundles the project using Rollup.
105
+ * @summary This method configures and runs Rollup to bundle the project. It handles
106
+ * different module formats, development and production builds, and external dependencies.
107
+ * @param {Modes} mode - The module format (CJS or ESM).
108
+ * @param {boolean} isDev - Whether it's a development build.
109
+ * @param {boolean} isLib - Whether it's a library build.
110
+ * @param {string} [entryFile="src/index.ts"] - The entry file for the bundle.
111
+ * @param {string} [nameOverride=this.pkgName] - The name of the output bundle.
112
+ * @param {string|string[]} [externalsArg] - A list of external dependencies.
113
+ * @param {string|string[]} [includeArg] - A list of dependencies to include.
114
+ * @returns {Promise<void>}
115
+ */
116
+ bundle(mode: Modes, isDev: boolean, isLib: boolean, entryFile?: string, nameOverride?: string, externalsArg?: string | string[], includeArg?: string | string[]): Promise<void>;
117
+ private buildByEnv;
118
+ /**
119
+ * @description Builds the project for development.
120
+ * @summary This method runs the build process with development-specific configurations.
121
+ * @param {BuildMode} [mode=BuildMode.ALL] - The build mode (build, bundle, or all).
122
+ * @param {string|string[]} [includesArg] - A list of dependencies to include.
123
+ * @param {string|string[]} [externalsArg] - A list of external dependencies.
124
+ * @returns {Promise<void>}
125
+ */
126
+ buildDev(entryFile?: string, mode?: BuildMode, validateNodeNext?: boolean, includesArg?: string | string[], externalsArg?: string | string[]): Promise<void>;
127
+ /**
128
+ * @description Builds the project for production.
129
+ * @summary This method runs the build process with production-specific configurations,
130
+ * including minification and other optimizations.
131
+ * @param {BuildMode} [mode=BuildMode.ALL] - The build mode (build, bundle, or all).
132
+ * @param {string|string[]} [includesArg] - A list of dependencies to include.
133
+ * @param {string|string[]} [externalsArg] - A list of external dependencies.
134
+ * @returns {Promise<void>}
135
+ */
136
+ buildProd(entryFile?: string, mode?: BuildMode, validateNodeNext?: boolean, includesArg?: string | string[], externalsArg?: string | string[]): Promise<void>;
137
+ /**
138
+ * @description Generates the project documentation.
139
+ * @summary This method uses JSDoc and other tools to generate HTML documentation for the project.
140
+ * It also patches the README.md file with version and package size information.
141
+ * @returns {Promise<void>}
142
+ */
143
+ buildDocs(): Promise<void>;
144
+ protected run<R>(answers: LoggingConfig & typeof DefaultCommandValues & {
145
+ [k in keyof typeof options]: unknown;
146
+ }): Promise<string | void | R>;
147
+ }
148
+ export {};
@@ -0,0 +1,148 @@
1
+ import { Command } from "../command.js";
2
+ import { CommandOptions } from "../types.js";
3
+ import { DefaultCommandValues } from "../constants.js";
4
+ import { LoggingConfig } from "@decaf-ts/logging";
5
+ declare module "@rollup/plugin-terser";
6
+ export declare function parseList(input?: string | string[]): string[];
7
+ export declare function packageToGlobal(name: string): string;
8
+ export declare function getPackageDependencies(): string[];
9
+ declare enum Modes {
10
+ CJS = "commonjs",
11
+ ESM = "es2022"
12
+ }
13
+ declare enum BuildMode {
14
+ BUILD = "build",
15
+ BUNDLE = "bundle",
16
+ ALL = "all"
17
+ }
18
+ declare const options: {
19
+ prod: {
20
+ type: string;
21
+ default: boolean;
22
+ };
23
+ dev: {
24
+ type: string;
25
+ default: boolean;
26
+ };
27
+ buildMode: {
28
+ type: string;
29
+ default: BuildMode;
30
+ };
31
+ includes: {
32
+ type: string;
33
+ default: string;
34
+ };
35
+ externals: {
36
+ type: string;
37
+ default: string;
38
+ };
39
+ docs: {
40
+ type: string;
41
+ default: boolean;
42
+ };
43
+ commands: {
44
+ type: string;
45
+ default: boolean;
46
+ };
47
+ entry: {
48
+ type: string;
49
+ default: string;
50
+ };
51
+ banner: {
52
+ type: string;
53
+ default: boolean;
54
+ };
55
+ validateNodeNext: {
56
+ type: string;
57
+ default: boolean;
58
+ };
59
+ };
60
+ /**
61
+ * @description A command-line script for building and bundling TypeScript projects.
62
+ * @summary This class provides a comprehensive build script that handles TypeScript compilation,
63
+ * bundling with Rollup, and documentation generation. It supports different build modes
64
+ * (development, production), module formats (CJS, ESM), and can be extended with custom
65
+ * configurations.
66
+ * @class BuildScripts
67
+ */
68
+ export declare class BuildScripts extends Command<CommandOptions<typeof options>, void> {
69
+ private replacements;
70
+ private readonly pkgVersion;
71
+ private readonly pkgName;
72
+ constructor();
73
+ /**
74
+ * @description Patches files with version and package name.
75
+ * @summary This method reads all files in a directory, finds placeholders for version
76
+ * and package name, and replaces them with the actual values from package.json.
77
+ * @param {string} p - The path to the directory containing the files to patch.
78
+ */
79
+ patchFiles(p: string): void;
80
+ private reportDiagnostics;
81
+ private formatDiagnostics;
82
+ private readConfigFile;
83
+ private evalDiagnostics;
84
+ private preCheckDiagnostics;
85
+ private checkTsDiagnostics;
86
+ private buildTs;
87
+ private build;
88
+ private rewriteRelativeJsSpecifiersToCjs;
89
+ private buildCjsFromEsm;
90
+ private applyTsConfigProfile;
91
+ private checkNodeNextCompatibility;
92
+ private buildTypes;
93
+ private rewriteRelativeDeclarationSpecifiers;
94
+ private emitDualDeclarationFiles;
95
+ private updatePackageJsonDualTypeExports;
96
+ /**
97
+ * @description Copies assets to the build output directory.
98
+ * @summary This method checks for the existence of an 'assets' directory in the source
99
+ * and copies it to the appropriate build output directory (lib or dist).
100
+ * @param {Modes} mode - The build mode (CJS or ESM).
101
+ */
102
+ copyAssets(mode: Modes): void;
103
+ /**
104
+ * @description Bundles the project using Rollup.
105
+ * @summary This method configures and runs Rollup to bundle the project. It handles
106
+ * different module formats, development and production builds, and external dependencies.
107
+ * @param {Modes} mode - The module format (CJS or ESM).
108
+ * @param {boolean} isDev - Whether it's a development build.
109
+ * @param {boolean} isLib - Whether it's a library build.
110
+ * @param {string} [entryFile="src/index.ts"] - The entry file for the bundle.
111
+ * @param {string} [nameOverride=this.pkgName] - The name of the output bundle.
112
+ * @param {string|string[]} [externalsArg] - A list of external dependencies.
113
+ * @param {string|string[]} [includeArg] - A list of dependencies to include.
114
+ * @returns {Promise<void>}
115
+ */
116
+ bundle(mode: Modes, isDev: boolean, isLib: boolean, entryFile?: string, nameOverride?: string, externalsArg?: string | string[], includeArg?: string | string[]): Promise<void>;
117
+ private buildByEnv;
118
+ /**
119
+ * @description Builds the project for development.
120
+ * @summary This method runs the build process with development-specific configurations.
121
+ * @param {BuildMode} [mode=BuildMode.ALL] - The build mode (build, bundle, or all).
122
+ * @param {string|string[]} [includesArg] - A list of dependencies to include.
123
+ * @param {string|string[]} [externalsArg] - A list of external dependencies.
124
+ * @returns {Promise<void>}
125
+ */
126
+ buildDev(entryFile?: string, mode?: BuildMode, validateNodeNext?: boolean, includesArg?: string | string[], externalsArg?: string | string[]): Promise<void>;
127
+ /**
128
+ * @description Builds the project for production.
129
+ * @summary This method runs the build process with production-specific configurations,
130
+ * including minification and other optimizations.
131
+ * @param {BuildMode} [mode=BuildMode.ALL] - The build mode (build, bundle, or all).
132
+ * @param {string|string[]} [includesArg] - A list of dependencies to include.
133
+ * @param {string|string[]} [externalsArg] - A list of external dependencies.
134
+ * @returns {Promise<void>}
135
+ */
136
+ buildProd(entryFile?: string, mode?: BuildMode, validateNodeNext?: boolean, includesArg?: string | string[], externalsArg?: string | string[]): Promise<void>;
137
+ /**
138
+ * @description Generates the project documentation.
139
+ * @summary This method uses JSDoc and other tools to generate HTML documentation for the project.
140
+ * It also patches the README.md file with version and package size information.
141
+ * @returns {Promise<void>}
142
+ */
143
+ buildDocs(): Promise<void>;
144
+ protected run<R>(answers: LoggingConfig & typeof DefaultCommandValues & {
145
+ [k in keyof typeof options]: unknown;
146
+ }): Promise<string | void | R>;
147
+ }
148
+ export {};
@@ -85,9 +85,14 @@ export declare class BuildScripts extends Command<CommandOptions<typeof options>
85
85
  private checkTsDiagnostics;
86
86
  private buildTs;
87
87
  private build;
88
+ private rewriteRelativeJsSpecifiersToCjs;
89
+ private buildCjsFromEsm;
88
90
  private applyTsConfigProfile;
89
91
  private checkNodeNextCompatibility;
90
92
  private buildTypes;
93
+ private rewriteRelativeDeclarationSpecifiers;
94
+ private emitDualDeclarationFiles;
95
+ private updatePackageJsonDualTypeExports;
91
96
  /**
92
97
  * @description Copies assets to the build output directory.
93
98
  * @summary This method checks for the existence of an 'assets' directory in the source
@@ -0,0 +1,3 @@
1
+ export * from "./build-scripts.cjs";
2
+ export * from "./tag-release.cjs";
3
+ export * from "./release-chain.cjs";
@@ -0,0 +1,3 @@
1
+ export * from "./build-scripts.js";
2
+ export * from "./tag-release.js";
3
+ export * from "./release-chain.js";
@@ -0,0 +1,62 @@
1
+ import { Command } from "../command.cjs";
2
+ import { CommandOptions } from "../types.cjs";
3
+ import { DefaultCommandValues } from "../constants.cjs";
4
+ import { LoggingConfig } from "@decaf-ts/logging";
5
+ declare const releaseChainArgs: {
6
+ meta: {
7
+ type: string;
8
+ default: string;
9
+ };
10
+ branch: {
11
+ type: string;
12
+ default: string;
13
+ };
14
+ current: {
15
+ type: string;
16
+ default: string;
17
+ };
18
+ package: {
19
+ type: string;
20
+ default: string;
21
+ };
22
+ token: {
23
+ type: string;
24
+ default: string;
25
+ };
26
+ submoduleFile: {
27
+ type: string;
28
+ default: string;
29
+ };
30
+ submodulePath: {
31
+ type: string;
32
+ default: string;
33
+ };
34
+ workflow: {
35
+ type: string;
36
+ default: string;
37
+ };
38
+ repo: {
39
+ type: string;
40
+ default: string;
41
+ };
42
+ ref: {
43
+ type: string;
44
+ default: string;
45
+ };
46
+ targetBase: {
47
+ type: string;
48
+ default: string;
49
+ };
50
+ };
51
+ type ReleaseChainAnswerMap = {
52
+ [K in keyof typeof releaseChainArgs]: unknown;
53
+ };
54
+ export declare class ReleaseChainCommand extends Command<CommandOptions<typeof releaseChainArgs>, void> {
55
+ constructor();
56
+ protected run(options: LoggingConfig & typeof DefaultCommandValues & ReleaseChainAnswerMap): Promise<void>;
57
+ }
58
+ export declare class ReleaseChainDispatchCommand extends Command<CommandOptions<typeof releaseChainArgs>, void> {
59
+ constructor();
60
+ protected run(options: LoggingConfig & typeof DefaultCommandValues & ReleaseChainAnswerMap): Promise<void>;
61
+ }
62
+ export {};