@rzl-zone/build-tools 0.0.5
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/LICENSE +21 -0
- package/dist/.references/index.d.cts +18 -0
- package/dist/.references/index.d.ts +18 -0
- package/dist/bundler/rolldown.cjs +32 -0
- package/dist/bundler/rolldown.cjs.map +1 -0
- package/dist/bundler/rolldown.d.cts +162 -0
- package/dist/bundler/rolldown.d.ts +162 -0
- package/dist/bundler/rolldown.js +25 -0
- package/dist/bundler/rolldown.js.map +1 -0
- package/dist/bundler/tsdown.cjs +132 -0
- package/dist/bundler/tsdown.cjs.map +1 -0
- package/dist/bundler/tsdown.d.cts +1165 -0
- package/dist/bundler/tsdown.d.ts +1165 -0
- package/dist/bundler/tsdown.js +124 -0
- package/dist/bundler/tsdown.js.map +1 -0
- package/dist/bundler/utils.cjs +24 -0
- package/dist/bundler/utils.cjs.map +1 -0
- package/dist/bundler/utils.d.cts +40 -0
- package/dist/bundler/utils.d.ts +40 -0
- package/dist/bundler/utils.js +21 -0
- package/dist/bundler/utils.js.map +1 -0
- package/dist/client-XhkdKJ4d.js +160 -0
- package/dist/client-XhkdKJ4d.js.map +1 -0
- package/dist/client-u8yLSxEI.cjs +221 -0
- package/dist/client-u8yLSxEI.cjs.map +1 -0
- package/dist/commander-kit/index.cjs +569 -0
- package/dist/commander-kit/index.cjs.map +1 -0
- package/dist/commander-kit/index.d.cts +1383 -0
- package/dist/commander-kit/index.d.ts +1383 -0
- package/dist/commander-kit/index.js +550 -0
- package/dist/commander-kit/index.js.map +1 -0
- package/dist/extra-CVuXMpEw.d.ts +994 -0
- package/dist/extra-CxDwtQEy.d.cts +994 -0
- package/dist/fast-globe-options-6r2aj6UC.d.ts +126 -0
- package/dist/fast-globe-options-BFt__e__.d.cts +126 -0
- package/dist/helper-BdjaR8Yv.js +215 -0
- package/dist/helper-BdjaR8Yv.js.map +1 -0
- package/dist/helper-DorgNsB9.cjs +377 -0
- package/dist/helper-DorgNsB9.cjs.map +1 -0
- package/dist/identity-BJ0QX7AJ.js +88 -0
- package/dist/identity-BJ0QX7AJ.js.map +1 -0
- package/dist/identity-CxR9DRMh.cjs +100 -0
- package/dist/identity-CxR9DRMh.cjs.map +1 -0
- package/dist/index-B-NeF7PU.d.cts +670 -0
- package/dist/index-CzxZta4Z.d.ts +356 -0
- package/dist/index-Idak1iwg.d.cts +356 -0
- package/dist/index-PXsb85LI.d.ts +670 -0
- package/dist/index.cjs +1689 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +2193 -0
- package/dist/index.d.ts +2193 -0
- package/dist/index.js +1641 -0
- package/dist/index.js.map +1 -0
- package/dist/package-banner-6RzEf-mV.cjs +54 -0
- package/dist/package-banner-6RzEf-mV.cjs.map +1 -0
- package/dist/package-banner-BzheZbxy.js +41 -0
- package/dist/package-banner-BzheZbxy.js.map +1 -0
- package/dist/server-B2hBoGDR.cjs +181 -0
- package/dist/server-B2hBoGDR.cjs.map +1 -0
- package/dist/server-CWrDd29Y.js +142 -0
- package/dist/server-CWrDd29Y.js.map +1 -0
- package/dist/utils/client.cjs +23 -0
- package/dist/utils/client.d.cts +887 -0
- package/dist/utils/client.d.ts +887 -0
- package/dist/utils/client.js +12 -0
- package/dist/utils/server.cjs +17 -0
- package/dist/utils/server.d.cts +124 -0
- package/dist/utils/server.d.ts +124 -0
- package/dist/utils/server.js +12 -0
- package/package.json +151 -0
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** ----------------------------------------------------------------
|
|
12
|
+
* * ***Options for generating a utility command title.***
|
|
13
|
+
* ----------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* Used by `CommandIdentity.utility()`.
|
|
16
|
+
*/
|
|
17
|
+
type CommandUtilityTitleOptions = {
|
|
18
|
+
/** ----------------------------------------------------------------
|
|
19
|
+
* * ***Command name displayed in the title.***
|
|
20
|
+
* ----------------------------------------------------------------
|
|
21
|
+
*
|
|
22
|
+
* Overrides the default command name provided in the constructor.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* { commandName: "fix-dts-react-import" }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
commandName?: string;
|
|
30
|
+
/** ----------------------------------------------------------------
|
|
31
|
+
* * ***Optional arrow icon override.***
|
|
32
|
+
* ----------------------------------------------------------------
|
|
33
|
+
*
|
|
34
|
+
* If provided, this icon replaces the generator's
|
|
35
|
+
* `defaultIconArrow` for this call only.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* { iconArrow: "⇒" }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
iconArrow?: string;
|
|
43
|
+
/** ----------------------------------------------------------------
|
|
44
|
+
* * ***Package name prefix.***
|
|
45
|
+
* ----------------------------------------------------------------
|
|
46
|
+
*
|
|
47
|
+
* Displayed at the beginning of every generated title.
|
|
48
|
+
*
|
|
49
|
+
* @default "@rzl-zone/build-tools"
|
|
50
|
+
*/
|
|
51
|
+
packageName?: string;
|
|
52
|
+
};
|
|
53
|
+
/** ----------------------------------------------------------------
|
|
54
|
+
* * ***Options for generating a CLI command title.***
|
|
55
|
+
* ----------------------------------------------------------------
|
|
56
|
+
*
|
|
57
|
+
* Used by `CommandIdentity.cli()`
|
|
58
|
+
*/
|
|
59
|
+
type CommandCliTitleOptions = Omit<CommandUtilityTitleOptions, "packageName"> & {
|
|
60
|
+
/** ----------------------------------------------------------------
|
|
61
|
+
* * ***Package name prefix.***
|
|
62
|
+
* ----------------------------------------------------------------
|
|
63
|
+
*
|
|
64
|
+
* Overrides the resolved CLI package name for this call only.
|
|
65
|
+
*
|
|
66
|
+
* @default "@rzl-zone/build-tools-cli"
|
|
67
|
+
*/
|
|
68
|
+
packageName?: string;
|
|
69
|
+
};
|
|
70
|
+
/** ----------------------------------------------------------------
|
|
71
|
+
* * ***Global configuration for command identity formatting.***
|
|
72
|
+
* ----------------------------------------------------------------
|
|
73
|
+
*
|
|
74
|
+
* Defines the default identity behavior applied to
|
|
75
|
+
* all generated CLI and utility titles.
|
|
76
|
+
*/
|
|
77
|
+
type CommandIdentityOptions = {
|
|
78
|
+
/** ----------------------------------------------------------------
|
|
79
|
+
* * ***Default command name.***
|
|
80
|
+
* ----------------------------------------------------------------
|
|
81
|
+
*
|
|
82
|
+
* Used when a command name is not provided in the respective in method `CommandIdentity.cli()` and `CommandIdentity.utility()` options.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* defaultCommandName: "fix-dts-react-import"
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
defaultCommandName: string;
|
|
90
|
+
/** ----------------------------------------------------------------
|
|
91
|
+
* * ***Package name prefix.***
|
|
92
|
+
* ----------------------------------------------------------------
|
|
93
|
+
*
|
|
94
|
+
* Optional base package name used for title generation.
|
|
95
|
+
*
|
|
96
|
+
* If not provided, an internal default will be resolved
|
|
97
|
+
* depending on the title type (`CLI` or `utility`).
|
|
98
|
+
*/
|
|
99
|
+
packageName?: string;
|
|
100
|
+
/** ----------------------------------------------------------------
|
|
101
|
+
* * ***Package version.***
|
|
102
|
+
* ----------------------------------------------------------------
|
|
103
|
+
*
|
|
104
|
+
* Optional version displayed alongside the package name
|
|
105
|
+
* in generated titles.
|
|
106
|
+
*
|
|
107
|
+
* If not provided, a default version will be resolved internally.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* version: "1.2.0"
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
version?: string;
|
|
115
|
+
/** ----------------------------------------------------------------
|
|
116
|
+
* * ***Label for CLI commands.***
|
|
117
|
+
* ----------------------------------------------------------------
|
|
118
|
+
*
|
|
119
|
+
* Optional label displayed between
|
|
120
|
+
* the package name and arrow icon for CLI titles.
|
|
121
|
+
*/
|
|
122
|
+
cliLabel?: string;
|
|
123
|
+
/** ----------------------------------------------------------------
|
|
124
|
+
* * ***Label for utility commands.***
|
|
125
|
+
* ----------------------------------------------------------------
|
|
126
|
+
*
|
|
127
|
+
* Optional label displayed between
|
|
128
|
+
* the package name and arrow icon for utility titles.
|
|
129
|
+
*/
|
|
130
|
+
utilityLabel?: string;
|
|
131
|
+
/** ----------------------------------------------------------------
|
|
132
|
+
* * ***Default arrow icon.***
|
|
133
|
+
* ----------------------------------------------------------------
|
|
134
|
+
*
|
|
135
|
+
* Icon displayed between the label and command name.
|
|
136
|
+
*
|
|
137
|
+
* @default
|
|
138
|
+
* "▶️"
|
|
139
|
+
* // or
|
|
140
|
+
* "▶"
|
|
141
|
+
*/
|
|
142
|
+
defaultIconArrow?: string;
|
|
143
|
+
};
|
|
144
|
+
/** ----------------------------------------------------------------
|
|
145
|
+
* * ***Command identity formatter with consistent CLI styling.***
|
|
146
|
+
* ----------------------------------------------------------------
|
|
147
|
+
*
|
|
148
|
+
* Responsible for generating formatted and colorized
|
|
149
|
+
* command titles for CLI and utility commands.
|
|
150
|
+
*
|
|
151
|
+
* - ***Each generated title may include:***
|
|
152
|
+
* - Package name.
|
|
153
|
+
* - Optional label (CLI / utility).
|
|
154
|
+
* - Arrow icon.
|
|
155
|
+
* - Command name.
|
|
156
|
+
* - Package version.
|
|
157
|
+
*
|
|
158
|
+
* ---
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const identity = new CommandIdentity({
|
|
163
|
+
* defaultCommandName: "fix-dts-react-import"
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* identity.cli();
|
|
167
|
+
* // => "@rzl-zone/build-tools-cli@<version> ➔ fix-dts-react-import"
|
|
168
|
+
*
|
|
169
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
170
|
+
* // => "@rzl-zone/build-tools@<version> ➔ clean-dist"
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* const identity = new CommandIdentity({
|
|
176
|
+
* defaultCommandName: "build",
|
|
177
|
+
* version: "2.1.0"
|
|
178
|
+
* });
|
|
179
|
+
*
|
|
180
|
+
* identity.cli();
|
|
181
|
+
* // => "@rzl-zone/build-tools-cli@2.1.0 ➔ build"
|
|
182
|
+
*
|
|
183
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
184
|
+
* // => "@rzl-zone/build-tools@2.1.0 ➔ clean-dist"
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
declare class CommandIdentity {
|
|
188
|
+
/** ----------------------------------------------------------------
|
|
189
|
+
* * ***Create a new command identity instance.***
|
|
190
|
+
* ----------------------------------------------------------------
|
|
191
|
+
*
|
|
192
|
+
* Initializes global identity configuration
|
|
193
|
+
* used by `CommandIdentity.cli()` and `CommandIdentity.utility()`.
|
|
194
|
+
*
|
|
195
|
+
* ---
|
|
196
|
+
*
|
|
197
|
+
* @param {CommandIdentityOptions} options - Global identity configuration.
|
|
198
|
+
* @throws {Error} If `options.defaultCommandName` is missing or empty.
|
|
199
|
+
*
|
|
200
|
+
* ---
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* const identity = new CommandIdentity({
|
|
205
|
+
* defaultCommandName: "fix-dts-react-import"
|
|
206
|
+
* });
|
|
207
|
+
*
|
|
208
|
+
* identity.cli();
|
|
209
|
+
* // => "@rzl-zone/build-tools-cli@<version> ➔ fix-dts-react-import"
|
|
210
|
+
*
|
|
211
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
212
|
+
* // => "@rzl-zone/build-tools@<version> ➔ clean-dist"
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const identity = new CommandIdentity({
|
|
218
|
+
* defaultCommandName: "build",
|
|
219
|
+
* version: "2.1.0"
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* identity.cli();
|
|
223
|
+
* // => "@rzl-zone/build-tools-cli@2.1.0 ➔ build"
|
|
224
|
+
*
|
|
225
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
226
|
+
* // => "@rzl-zone/build-tools@2.1.0 ➔ clean-dist"
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
constructor(options: CommandIdentityOptions);
|
|
230
|
+
/** ----------------------------------------------------------------
|
|
231
|
+
* * ***Generate a CLI command title.***
|
|
232
|
+
* ----------------------------------------------------------------
|
|
233
|
+
*
|
|
234
|
+
* Uses the CLI default package (unless overridden)
|
|
235
|
+
* and applies CLI-specific labeling.
|
|
236
|
+
*
|
|
237
|
+
* @param {CommandCliTitleOptions} options - CLI title configuration.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* identity.cli();
|
|
242
|
+
* identity.cli({ commandName: "build" });
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
cli(options?: CommandCliTitleOptions): string;
|
|
246
|
+
/** ----------------------------------------------------------------
|
|
247
|
+
* * ***Generate a utility command title.***
|
|
248
|
+
* ----------------------------------------------------------------
|
|
249
|
+
*
|
|
250
|
+
* Uses the utility default package (unless overridden)
|
|
251
|
+
* and applies utility-specific labeling.
|
|
252
|
+
*
|
|
253
|
+
* @param {CommandUtilityTitleOptions} options - Utility title configuration.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```ts
|
|
257
|
+
* identity.utility();
|
|
258
|
+
* identity.utility({ commandName: "clean-dist", iconArrow: "⇒" });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
utility(options?: CommandUtilityTitleOptions): string;
|
|
262
|
+
/** ----------------------------------------------------------------
|
|
263
|
+
* * ***Package name.***
|
|
264
|
+
* ----------------------------------------------------------------
|
|
265
|
+
*
|
|
266
|
+
* Returns the effective package name used for title generation.
|
|
267
|
+
*
|
|
268
|
+
* If a custom package name has been provided via the constructor
|
|
269
|
+
* or `CommandIdentity.setPackageName()`, that value will be returned.
|
|
270
|
+
* Otherwise, an internal default package name (as utility) is used.
|
|
271
|
+
*
|
|
272
|
+
* @readonly
|
|
273
|
+
*/
|
|
274
|
+
get packageName(): string;
|
|
275
|
+
/** ----------------------------------------------------------------
|
|
276
|
+
* * ***Set package name.***
|
|
277
|
+
* ----------------------------------------------------------------
|
|
278
|
+
*
|
|
279
|
+
* Assigns a custom package name to be used for title generation.
|
|
280
|
+
*
|
|
281
|
+
* - *This value overrides:*
|
|
282
|
+
* - Any package name provided in the constructor.
|
|
283
|
+
* - The internal default package name.
|
|
284
|
+
*
|
|
285
|
+
* Once set, this value will be returned by the `CommandIdentity.packageName`
|
|
286
|
+
* getter and used by `CommandIdentity.cli()` and
|
|
287
|
+
* `CommandIdentity.utility()` unless explicitly
|
|
288
|
+
* overridden per method call.
|
|
289
|
+
*
|
|
290
|
+
* @param value - The new package name to assign.
|
|
291
|
+
* @returns The current instance for fluent chaining.
|
|
292
|
+
*/
|
|
293
|
+
setPackageName(value: string): this;
|
|
294
|
+
/** ----------------------------------------------------------------
|
|
295
|
+
* * ***Command name.***
|
|
296
|
+
* ----------------------------------------------------------------
|
|
297
|
+
*
|
|
298
|
+
* Returns the current command name used for title generation.
|
|
299
|
+
*
|
|
300
|
+
* This value is initialized via the constructor and may be
|
|
301
|
+
* updated later using
|
|
302
|
+
* `CommandIdentity.setCommandName()`.
|
|
303
|
+
*
|
|
304
|
+
* @readonly
|
|
305
|
+
*/
|
|
306
|
+
get commandName(): string;
|
|
307
|
+
/** ----------------------------------------------------------------
|
|
308
|
+
* * ***Set command name.***
|
|
309
|
+
* ----------------------------------------------------------------
|
|
310
|
+
*
|
|
311
|
+
* Updates the command name used for title generation.
|
|
312
|
+
*
|
|
313
|
+
* This overrides the command name provided in the constructor
|
|
314
|
+
* and affects subsequent calls to
|
|
315
|
+
* `CommandIdentity.cli()`
|
|
316
|
+
* and `CommandIdentity.utility()`,
|
|
317
|
+
* unless a command name is explicitly provided per method call.
|
|
318
|
+
*
|
|
319
|
+
* @param value - The new command name to assign.
|
|
320
|
+
* @returns The current instance for fluent chaining.
|
|
321
|
+
*/
|
|
322
|
+
setCommandName(value: string): this;
|
|
323
|
+
/** ----------------------------------------------------------------
|
|
324
|
+
* * ***Package version.***
|
|
325
|
+
* ----------------------------------------------------------------
|
|
326
|
+
*
|
|
327
|
+
* Returns the effective version used for title generation.
|
|
328
|
+
*
|
|
329
|
+
* - *Resolution order:*
|
|
330
|
+
* 1. If a custom version has been provided via the constructor
|
|
331
|
+
* or `CommandIdentity.setVersion()`,
|
|
332
|
+
* that value will be returned.
|
|
333
|
+
* 2. Otherwise, the version falls back to the internally
|
|
334
|
+
* resolved default package version.
|
|
335
|
+
*
|
|
336
|
+
* A version value is always guaranteed to be present.
|
|
337
|
+
*
|
|
338
|
+
* @readonly
|
|
339
|
+
*/
|
|
340
|
+
get version(): string;
|
|
341
|
+
/** ----------------------------------------------------------------
|
|
342
|
+
* * ***Set package version.***
|
|
343
|
+
* ----------------------------------------------------------------
|
|
344
|
+
*
|
|
345
|
+
* Overrides the version used for title generation.
|
|
346
|
+
*
|
|
347
|
+
* If an empty or invalid value is provided,
|
|
348
|
+
* the version will remain unchanged.
|
|
349
|
+
*
|
|
350
|
+
* @param value - The new version to assign.
|
|
351
|
+
* @returns The current instance for fluent chaining.
|
|
352
|
+
*/
|
|
353
|
+
setVersion(value: string): this;
|
|
354
|
+
}
|
|
355
|
+
export { CommandIdentity as t };
|
|
356
|
+
//# sourceMappingURL=index-CzxZta4Z.d.ts.map
|
|
@@ -0,0 +1,356 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* ========================================================================
|
|
3
|
+
* @rzl-zone/build-tools
|
|
4
|
+
* ------------------------------------------------------------------------
|
|
5
|
+
* Version: `0.0.5`
|
|
6
|
+
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
+
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
+
* ========================================================================
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
/** ----------------------------------------------------------------
|
|
12
|
+
* * ***Options for generating a utility command title.***
|
|
13
|
+
* ----------------------------------------------------------------
|
|
14
|
+
*
|
|
15
|
+
* Used by `CommandIdentity.utility()`.
|
|
16
|
+
*/
|
|
17
|
+
type CommandUtilityTitleOptions = {
|
|
18
|
+
/** ----------------------------------------------------------------
|
|
19
|
+
* * ***Command name displayed in the title.***
|
|
20
|
+
* ----------------------------------------------------------------
|
|
21
|
+
*
|
|
22
|
+
* Overrides the default command name provided in the constructor.
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* { commandName: "fix-dts-react-import" }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
commandName?: string;
|
|
30
|
+
/** ----------------------------------------------------------------
|
|
31
|
+
* * ***Optional arrow icon override.***
|
|
32
|
+
* ----------------------------------------------------------------
|
|
33
|
+
*
|
|
34
|
+
* If provided, this icon replaces the generator's
|
|
35
|
+
* `defaultIconArrow` for this call only.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* { iconArrow: "⇒" }
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
iconArrow?: string;
|
|
43
|
+
/** ----------------------------------------------------------------
|
|
44
|
+
* * ***Package name prefix.***
|
|
45
|
+
* ----------------------------------------------------------------
|
|
46
|
+
*
|
|
47
|
+
* Displayed at the beginning of every generated title.
|
|
48
|
+
*
|
|
49
|
+
* @default "@rzl-zone/build-tools"
|
|
50
|
+
*/
|
|
51
|
+
packageName?: string;
|
|
52
|
+
};
|
|
53
|
+
/** ----------------------------------------------------------------
|
|
54
|
+
* * ***Options for generating a CLI command title.***
|
|
55
|
+
* ----------------------------------------------------------------
|
|
56
|
+
*
|
|
57
|
+
* Used by `CommandIdentity.cli()`
|
|
58
|
+
*/
|
|
59
|
+
type CommandCliTitleOptions = Omit<CommandUtilityTitleOptions, "packageName"> & {
|
|
60
|
+
/** ----------------------------------------------------------------
|
|
61
|
+
* * ***Package name prefix.***
|
|
62
|
+
* ----------------------------------------------------------------
|
|
63
|
+
*
|
|
64
|
+
* Overrides the resolved CLI package name for this call only.
|
|
65
|
+
*
|
|
66
|
+
* @default "@rzl-zone/build-tools-cli"
|
|
67
|
+
*/
|
|
68
|
+
packageName?: string;
|
|
69
|
+
};
|
|
70
|
+
/** ----------------------------------------------------------------
|
|
71
|
+
* * ***Global configuration for command identity formatting.***
|
|
72
|
+
* ----------------------------------------------------------------
|
|
73
|
+
*
|
|
74
|
+
* Defines the default identity behavior applied to
|
|
75
|
+
* all generated CLI and utility titles.
|
|
76
|
+
*/
|
|
77
|
+
type CommandIdentityOptions = {
|
|
78
|
+
/** ----------------------------------------------------------------
|
|
79
|
+
* * ***Default command name.***
|
|
80
|
+
* ----------------------------------------------------------------
|
|
81
|
+
*
|
|
82
|
+
* Used when a command name is not provided in the respective in method `CommandIdentity.cli()` and `CommandIdentity.utility()` options.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```ts
|
|
86
|
+
* defaultCommandName: "fix-dts-react-import"
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
defaultCommandName: string;
|
|
90
|
+
/** ----------------------------------------------------------------
|
|
91
|
+
* * ***Package name prefix.***
|
|
92
|
+
* ----------------------------------------------------------------
|
|
93
|
+
*
|
|
94
|
+
* Optional base package name used for title generation.
|
|
95
|
+
*
|
|
96
|
+
* If not provided, an internal default will be resolved
|
|
97
|
+
* depending on the title type (`CLI` or `utility`).
|
|
98
|
+
*/
|
|
99
|
+
packageName?: string;
|
|
100
|
+
/** ----------------------------------------------------------------
|
|
101
|
+
* * ***Package version.***
|
|
102
|
+
* ----------------------------------------------------------------
|
|
103
|
+
*
|
|
104
|
+
* Optional version displayed alongside the package name
|
|
105
|
+
* in generated titles.
|
|
106
|
+
*
|
|
107
|
+
* If not provided, a default version will be resolved internally.
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* ```ts
|
|
111
|
+
* version: "1.2.0"
|
|
112
|
+
* ```
|
|
113
|
+
*/
|
|
114
|
+
version?: string;
|
|
115
|
+
/** ----------------------------------------------------------------
|
|
116
|
+
* * ***Label for CLI commands.***
|
|
117
|
+
* ----------------------------------------------------------------
|
|
118
|
+
*
|
|
119
|
+
* Optional label displayed between
|
|
120
|
+
* the package name and arrow icon for CLI titles.
|
|
121
|
+
*/
|
|
122
|
+
cliLabel?: string;
|
|
123
|
+
/** ----------------------------------------------------------------
|
|
124
|
+
* * ***Label for utility commands.***
|
|
125
|
+
* ----------------------------------------------------------------
|
|
126
|
+
*
|
|
127
|
+
* Optional label displayed between
|
|
128
|
+
* the package name and arrow icon for utility titles.
|
|
129
|
+
*/
|
|
130
|
+
utilityLabel?: string;
|
|
131
|
+
/** ----------------------------------------------------------------
|
|
132
|
+
* * ***Default arrow icon.***
|
|
133
|
+
* ----------------------------------------------------------------
|
|
134
|
+
*
|
|
135
|
+
* Icon displayed between the label and command name.
|
|
136
|
+
*
|
|
137
|
+
* @default
|
|
138
|
+
* "▶️"
|
|
139
|
+
* // or
|
|
140
|
+
* "▶"
|
|
141
|
+
*/
|
|
142
|
+
defaultIconArrow?: string;
|
|
143
|
+
};
|
|
144
|
+
/** ----------------------------------------------------------------
|
|
145
|
+
* * ***Command identity formatter with consistent CLI styling.***
|
|
146
|
+
* ----------------------------------------------------------------
|
|
147
|
+
*
|
|
148
|
+
* Responsible for generating formatted and colorized
|
|
149
|
+
* command titles for CLI and utility commands.
|
|
150
|
+
*
|
|
151
|
+
* - ***Each generated title may include:***
|
|
152
|
+
* - Package name.
|
|
153
|
+
* - Optional label (CLI / utility).
|
|
154
|
+
* - Arrow icon.
|
|
155
|
+
* - Command name.
|
|
156
|
+
* - Package version.
|
|
157
|
+
*
|
|
158
|
+
* ---
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```ts
|
|
162
|
+
* const identity = new CommandIdentity({
|
|
163
|
+
* defaultCommandName: "fix-dts-react-import"
|
|
164
|
+
* });
|
|
165
|
+
*
|
|
166
|
+
* identity.cli();
|
|
167
|
+
* // => "@rzl-zone/build-tools-cli@<version> ➔ fix-dts-react-import"
|
|
168
|
+
*
|
|
169
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
170
|
+
* // => "@rzl-zone/build-tools@<version> ➔ clean-dist"
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* const identity = new CommandIdentity({
|
|
176
|
+
* defaultCommandName: "build",
|
|
177
|
+
* version: "2.1.0"
|
|
178
|
+
* });
|
|
179
|
+
*
|
|
180
|
+
* identity.cli();
|
|
181
|
+
* // => "@rzl-zone/build-tools-cli@2.1.0 ➔ build"
|
|
182
|
+
*
|
|
183
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
184
|
+
* // => "@rzl-zone/build-tools@2.1.0 ➔ clean-dist"
|
|
185
|
+
* ```
|
|
186
|
+
*/
|
|
187
|
+
declare class CommandIdentity {
|
|
188
|
+
/** ----------------------------------------------------------------
|
|
189
|
+
* * ***Create a new command identity instance.***
|
|
190
|
+
* ----------------------------------------------------------------
|
|
191
|
+
*
|
|
192
|
+
* Initializes global identity configuration
|
|
193
|
+
* used by `CommandIdentity.cli()` and `CommandIdentity.utility()`.
|
|
194
|
+
*
|
|
195
|
+
* ---
|
|
196
|
+
*
|
|
197
|
+
* @param {CommandIdentityOptions} options - Global identity configuration.
|
|
198
|
+
* @throws {Error} If `options.defaultCommandName` is missing or empty.
|
|
199
|
+
*
|
|
200
|
+
* ---
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* const identity = new CommandIdentity({
|
|
205
|
+
* defaultCommandName: "fix-dts-react-import"
|
|
206
|
+
* });
|
|
207
|
+
*
|
|
208
|
+
* identity.cli();
|
|
209
|
+
* // => "@rzl-zone/build-tools-cli@<version> ➔ fix-dts-react-import"
|
|
210
|
+
*
|
|
211
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
212
|
+
* // => "@rzl-zone/build-tools@<version> ➔ clean-dist"
|
|
213
|
+
* ```
|
|
214
|
+
*
|
|
215
|
+
* @example
|
|
216
|
+
* ```ts
|
|
217
|
+
* const identity = new CommandIdentity({
|
|
218
|
+
* defaultCommandName: "build",
|
|
219
|
+
* version: "2.1.0"
|
|
220
|
+
* });
|
|
221
|
+
*
|
|
222
|
+
* identity.cli();
|
|
223
|
+
* // => "@rzl-zone/build-tools-cli@2.1.0 ➔ build"
|
|
224
|
+
*
|
|
225
|
+
* identity.utility({ commandName: "clean-dist" });
|
|
226
|
+
* // => "@rzl-zone/build-tools@2.1.0 ➔ clean-dist"
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
constructor(options: CommandIdentityOptions);
|
|
230
|
+
/** ----------------------------------------------------------------
|
|
231
|
+
* * ***Generate a CLI command title.***
|
|
232
|
+
* ----------------------------------------------------------------
|
|
233
|
+
*
|
|
234
|
+
* Uses the CLI default package (unless overridden)
|
|
235
|
+
* and applies CLI-specific labeling.
|
|
236
|
+
*
|
|
237
|
+
* @param {CommandCliTitleOptions} options - CLI title configuration.
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```ts
|
|
241
|
+
* identity.cli();
|
|
242
|
+
* identity.cli({ commandName: "build" });
|
|
243
|
+
* ```
|
|
244
|
+
*/
|
|
245
|
+
cli(options?: CommandCliTitleOptions): string;
|
|
246
|
+
/** ----------------------------------------------------------------
|
|
247
|
+
* * ***Generate a utility command title.***
|
|
248
|
+
* ----------------------------------------------------------------
|
|
249
|
+
*
|
|
250
|
+
* Uses the utility default package (unless overridden)
|
|
251
|
+
* and applies utility-specific labeling.
|
|
252
|
+
*
|
|
253
|
+
* @param {CommandUtilityTitleOptions} options - Utility title configuration.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* ```ts
|
|
257
|
+
* identity.utility();
|
|
258
|
+
* identity.utility({ commandName: "clean-dist", iconArrow: "⇒" });
|
|
259
|
+
* ```
|
|
260
|
+
*/
|
|
261
|
+
utility(options?: CommandUtilityTitleOptions): string;
|
|
262
|
+
/** ----------------------------------------------------------------
|
|
263
|
+
* * ***Package name.***
|
|
264
|
+
* ----------------------------------------------------------------
|
|
265
|
+
*
|
|
266
|
+
* Returns the effective package name used for title generation.
|
|
267
|
+
*
|
|
268
|
+
* If a custom package name has been provided via the constructor
|
|
269
|
+
* or `CommandIdentity.setPackageName()`, that value will be returned.
|
|
270
|
+
* Otherwise, an internal default package name (as utility) is used.
|
|
271
|
+
*
|
|
272
|
+
* @readonly
|
|
273
|
+
*/
|
|
274
|
+
get packageName(): string;
|
|
275
|
+
/** ----------------------------------------------------------------
|
|
276
|
+
* * ***Set package name.***
|
|
277
|
+
* ----------------------------------------------------------------
|
|
278
|
+
*
|
|
279
|
+
* Assigns a custom package name to be used for title generation.
|
|
280
|
+
*
|
|
281
|
+
* - *This value overrides:*
|
|
282
|
+
* - Any package name provided in the constructor.
|
|
283
|
+
* - The internal default package name.
|
|
284
|
+
*
|
|
285
|
+
* Once set, this value will be returned by the `CommandIdentity.packageName`
|
|
286
|
+
* getter and used by `CommandIdentity.cli()` and
|
|
287
|
+
* `CommandIdentity.utility()` unless explicitly
|
|
288
|
+
* overridden per method call.
|
|
289
|
+
*
|
|
290
|
+
* @param value - The new package name to assign.
|
|
291
|
+
* @returns The current instance for fluent chaining.
|
|
292
|
+
*/
|
|
293
|
+
setPackageName(value: string): this;
|
|
294
|
+
/** ----------------------------------------------------------------
|
|
295
|
+
* * ***Command name.***
|
|
296
|
+
* ----------------------------------------------------------------
|
|
297
|
+
*
|
|
298
|
+
* Returns the current command name used for title generation.
|
|
299
|
+
*
|
|
300
|
+
* This value is initialized via the constructor and may be
|
|
301
|
+
* updated later using
|
|
302
|
+
* `CommandIdentity.setCommandName()`.
|
|
303
|
+
*
|
|
304
|
+
* @readonly
|
|
305
|
+
*/
|
|
306
|
+
get commandName(): string;
|
|
307
|
+
/** ----------------------------------------------------------------
|
|
308
|
+
* * ***Set command name.***
|
|
309
|
+
* ----------------------------------------------------------------
|
|
310
|
+
*
|
|
311
|
+
* Updates the command name used for title generation.
|
|
312
|
+
*
|
|
313
|
+
* This overrides the command name provided in the constructor
|
|
314
|
+
* and affects subsequent calls to
|
|
315
|
+
* `CommandIdentity.cli()`
|
|
316
|
+
* and `CommandIdentity.utility()`,
|
|
317
|
+
* unless a command name is explicitly provided per method call.
|
|
318
|
+
*
|
|
319
|
+
* @param value - The new command name to assign.
|
|
320
|
+
* @returns The current instance for fluent chaining.
|
|
321
|
+
*/
|
|
322
|
+
setCommandName(value: string): this;
|
|
323
|
+
/** ----------------------------------------------------------------
|
|
324
|
+
* * ***Package version.***
|
|
325
|
+
* ----------------------------------------------------------------
|
|
326
|
+
*
|
|
327
|
+
* Returns the effective version used for title generation.
|
|
328
|
+
*
|
|
329
|
+
* - *Resolution order:*
|
|
330
|
+
* 1. If a custom version has been provided via the constructor
|
|
331
|
+
* or `CommandIdentity.setVersion()`,
|
|
332
|
+
* that value will be returned.
|
|
333
|
+
* 2. Otherwise, the version falls back to the internally
|
|
334
|
+
* resolved default package version.
|
|
335
|
+
*
|
|
336
|
+
* A version value is always guaranteed to be present.
|
|
337
|
+
*
|
|
338
|
+
* @readonly
|
|
339
|
+
*/
|
|
340
|
+
get version(): string;
|
|
341
|
+
/** ----------------------------------------------------------------
|
|
342
|
+
* * ***Set package version.***
|
|
343
|
+
* ----------------------------------------------------------------
|
|
344
|
+
*
|
|
345
|
+
* Overrides the version used for title generation.
|
|
346
|
+
*
|
|
347
|
+
* If an empty or invalid value is provided,
|
|
348
|
+
* the version will remain unchanged.
|
|
349
|
+
*
|
|
350
|
+
* @param value - The new version to assign.
|
|
351
|
+
* @returns The current instance for fluent chaining.
|
|
352
|
+
*/
|
|
353
|
+
setVersion(value: string): this;
|
|
354
|
+
}
|
|
355
|
+
export { CommandIdentity as t };
|
|
356
|
+
//# sourceMappingURL=index-Idak1iwg.d.cts.map
|