@stacksjs/path 0.66.0 → 0.68.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/src/index.ts DELETED
@@ -1,1596 +0,0 @@
1
- import os from 'node:os'
2
- import {
3
- basename,
4
- delimiter,
5
- dirname,
6
- extname,
7
- isAbsolute,
8
- join,
9
- normalize,
10
- parse,
11
- type ParsedPath,
12
- relative,
13
- resolve,
14
- sep,
15
- toNamespacedPath,
16
- } from 'node:path'
17
- import process from 'node:process'
18
- import { runCommandSync } from '@stacksjs/cli'
19
- import { log } from '@stacksjs/logging'
20
-
21
- /**
22
- * Returns the path to the `actions` directory. The `actions` directory
23
- * contains the core Stacks' actions.
24
- *
25
- * @param path - The relative path to the file or directory.
26
- * @returns The absolute path to the file or directory.
27
- * @example
28
- * ```ts
29
- * import { actionsPath } from '@stacksjs/path'
30
- *
31
- * console.log(actionsPath('path/to/action.ts')) // Outputs the absolute path to 'path/to/action.ts' within the `actions` directory
32
- * ```
33
- */
34
- export function actionsPath(path?: string): string {
35
- return corePath(`actions/${path || ''}`)
36
- }
37
-
38
- export function relativeActionsPath(path?: string): string {
39
- return relative(projectPath(), actionsPath(path))
40
- }
41
-
42
- export function userActionsPath(path?: string, options?: { relative: true }): string {
43
- const absolutePath = appPath(`Actions/${path || ''}`)
44
-
45
- if (options?.relative)
46
- return relative(process.cwd(), absolutePath)
47
-
48
- return absolutePath
49
- }
50
-
51
- export function builtUserActionsPath(path?: string, options?: { relative: boolean }): string {
52
- const absolutePath = frameworkPath(`actions/${path || ''}`)
53
-
54
- if (options?.relative)
55
- return relative(process.cwd(), absolutePath)
56
-
57
- return absolutePath
58
- }
59
-
60
- export function userComponentsPath(path?: string): string {
61
- return libsPath(`components/${path || ''}`)
62
- }
63
-
64
- export function userViewsPath(path?: string): string {
65
- return resourcesPath(`views/${path || ''}`)
66
- }
67
-
68
- export function userFunctionsPath(path?: string): string {
69
- return resourcesPath(`functions/${path || ''}`)
70
- }
71
-
72
- /**
73
- * Returns the path to the user-defined `Jobs` directory.
74
- *
75
- * @param path - The relative path to the file or directory within the `Jobs` directory.
76
- * @returns The absolute path to the specified file or directory within the user-defined `Jobs` directory.
77
- * @example
78
- * ```ts
79
- * import { userJobsPath } from '@stacksjs/path'
80
- *
81
- * console.log(userJobsPath('MyJob.ts')) // Outputs the absolute path to 'MyJob.ts' within the user-defined `Jobs` directory.
82
- * ```
83
- */
84
- export function userJobsPath(path?: string): string {
85
- return appPath(`Jobs/${path || ''}`)
86
- }
87
-
88
- /**
89
- * Returns the path to the user-defined `Listeners` directory.
90
- *
91
- * @param path - The relative path to the file or directory within the `Listeners` directory.
92
- * @returns The absolute path to the specified file or directory within the user-defined `Listeners` directory.
93
- * @example
94
- * ```ts
95
- * import { userListenersPath } from '@stacksjs/path'
96
- *
97
- * console.log(userListenersPath('MyListener.ts')) // Outputs the absolute path to 'MyListener.ts' within the user-defined `Listeners` directory.
98
- * ```
99
- */
100
- export function userListenersPath(path?: string): string {
101
- return appPath(`Listeners/${path || ''}`)
102
- }
103
-
104
- /**
105
- * Returns the path to the user-defined `Middleware` directory.
106
- *
107
- * @param path - The relative path to the file or directory within the Middleware directory.
108
- * @returns The absolute path to the specified file or directory within the user-defined Middleware directory.
109
- * @example
110
- * ```ts
111
- * import { userMiddlewarePath } from '@stacksjs/path'
112
- *
113
- * console.log(userMiddlewarePath('MyMiddleware.ts')) // Outputs the absolute path to 'MyMiddleware.ts' within the user-defined Middleware directory.
114
- * ```
115
- */
116
- export function userMiddlewarePath(path?: string): string {
117
- return appPath(`Middleware/${path || ''}`)
118
- }
119
-
120
- /**
121
- * Returns the path to the user-defined `Models` directory.
122
- *
123
- * @param path - The relative path to the file or directory within the `Models` directory.
124
- * @returns The absolute path to the specified file or directory within the user-defined `Models` directory.
125
- * @example
126
- * ```ts
127
- * import { userModelsPath } from '@stacksjs/path'
128
- *
129
- * console.log(userModelsPath('MyModel.ts')) // Outputs the absolute path to 'MyModel.ts' within the user-defined `Models` directory.
130
- * ```
131
- */
132
- export function userModelsPath(path?: string): string {
133
- return appPath(`Models/${path || ''}`)
134
- }
135
-
136
- /**
137
- * Returns the path to the user-defined `Notifications` directory.
138
- *
139
- * @param path - The relative path to the file or directory within the `Notifications` directory.
140
- * @returns The absolute path to the specified file or directory within the user-defined `Notifications` directory.
141
- * @example
142
- * ```ts
143
- * import { userNotificationsPath } from '@stacksjs/path'
144
- *
145
- * console.log(userNotificationsPath('MyNotification.ts')) // Outputs the absolute path to 'MyNotification.ts' within the user-defined `Notifications` directory.
146
- * ```
147
- */
148
- export function userNotificationsPath(path?: string): string {
149
- return appPath(`Notifications/${path || ''}`)
150
- }
151
-
152
- export function userDatabasePath(path?: string): string {
153
- return projectPath(`database/${path || ''}`)
154
- }
155
-
156
- export function userMigrationsPath(path?: string): string {
157
- return userDatabasePath(`migrations/${path || ''}`)
158
- }
159
-
160
- /**
161
- * Returns the path to the user-defined `Events.ts` file.
162
- *
163
- * @returns The absolute path to the `Events.ts` file within the user-defined directory.
164
- * @example
165
- * ```ts
166
- * import { userEventsPath } from '@stacksjs/path'
167
- *
168
- * console.log(userEventsPath()) // Outputs the absolute path to 'Events.ts' within the user-defined directory.
169
- * ```
170
- */
171
- export function userEventsPath(): string {
172
- return appPath(`Events.ts`)
173
- }
174
-
175
- /**
176
- * Returns the path to the `ai` directory. The AI directory
177
- * contains the core Stacks' AI logic which currently
178
- * is a wrapper of the OpenAI API.
179
- *
180
- * @param path - relative path to the file or directory
181
- * @returns string - absolute path to the file or directory
182
- *
183
- * @example
184
- * ```ts
185
- * import { aiPath } from '@stacksjs/path'
186
- *
187
- * console.log(aiPath('src/drivers/example.ts')) // Outputs the absolute path to 'openai.ts' within the AI directory
188
- * ```
189
- */
190
- export function aiPath(path?: string): string {
191
- return corePath(`ai/${path || ''}`)
192
- }
193
-
194
- /**
195
- * Returns the path to the `assets` directory within the `resources` directory.
196
- *
197
- * @param path - The relative path to the file or directory within the `assets` directory.
198
- * @returns The absolute path to the specified file or directory within the `assets` directory.
199
- * @example
200
- * ```ts
201
- * import { assetsPath } from '@stacksjs/path'
202
- *
203
- * console.log(assetsPath('images/logo.png')) // Outputs the absolute path to 'images/logo.png' within the `assets` directory.
204
- * ```
205
- */
206
- export function assetsPath(path?: string): string {
207
- return resourcesPath(`assets/${path || ''}`)
208
- }
209
-
210
- /**
211
- * Returns the path to the `alias` directory within the core directory.
212
- *
213
- * @returns The absolute path to the `alias` directory.
214
- * @example
215
- * ```ts
216
- * import { aliasPath } from '@stacksjs/path'
217
- *
218
- * console.log(aliasPath()) // Outputs the absolute path to the `alias` directory.
219
- * ```
220
- */
221
- export function aliasPath(): string {
222
- return corePath('alias/src/index.ts')
223
- }
224
-
225
- /**
226
- * Returns the path to the `buddy` directory, optionally relative to the current working directory.
227
- *
228
- * @param path - The relative path to the file or directory within the buddy directory.
229
- * @param options - Optional. An object containing configuration settings.
230
- * @param options.relative - If true, returns the path relative to the current working directory.
231
- * @returns The absolute or relative path to the specified file or directory within the buddy * @returns The absolute or relative path to the specified file or directory within the buddy directory.
232
- * @example
233
- * ```ts
234
- * import { buddyPath } from '@stacksjs/path'
235
- *
236
- * console.log(buddyPath('config/buddy.json')) // Outputs the absolute path to 'config/buddy.json' within the buddy directory.
237
- * console.log(buddyPath('config/buddy.json', { relative: true })) // Outputs the relative path to 'config/buddy.json' within the buddy directory.
238
- * ```
239
- */
240
- export function buddyPath(path?: string, options?: { relative?: boolean }): string {
241
- const absolutePath = corePath(`buddy/${path || ''}`)
242
-
243
- if (options?.relative)
244
- return relative(process.cwd(), absolutePath)
245
-
246
- return absolutePath
247
- }
248
-
249
- /**
250
- * Returns the path to the `runtime` directory within the framework directory.
251
- *
252
- * @param path - The relative path to the file or directory within the runtime directory.
253
- * @returns The absolute path to the specified file or directory within the runtime directory.
254
- * @example
255
- * ```ts
256
- * import { runtimePath } from '@stacksjs/path'
257
- *
258
- * console.log(runtimePath('runtime-config.json')) // Outputs the absolute path to 'runtime-config.json' within the runtime directory.
259
- * ```
260
- */
261
- export function runtimePath(path?: string): string {
262
- return frameworkPath(`buddy/${path || ''}`)
263
- }
264
-
265
- /**
266
- * Returns the path to the `analytics` directory within the core directory.
267
- *
268
- * @param path - The relative path to the file or directory within the `analytics` directory.
269
- * @returns The absolute path to the specified file or directory within the `analytics` directory.
270
- * @example
271
- * ```ts
272
- * import { analyticsPath } from '@stacksjs/path'
273
- *
274
- * console.log(analyticsPath('data/report.csv')) // Outputs the absolute path to 'data/report.csv' within the `analytics` directory.
275
- * ```
276
- */
277
- export function analyticsPath(path?: string): string {
278
- return corePath(`analytics/${path || ''}`)
279
- }
280
-
281
- /**
282
- * Returns the path to the `arrays` directory within the core directory.
283
- *
284
- * @param path - The relative path to the file or directory within the `arrays` directory.
285
- * @returns The absolute path to the specified file or directory within the `arrays` directory.
286
- * @example
287
- * ```ts
288
- * import { arraysPath } from '@stacksjs/path'
289
- *
290
- * console.log(arraysPath('list.txt')) // Outputs the absolute path to 'list.txt' within the `arrays` directory.
291
- * ```
292
- */
293
- export function arraysPath(path?: string): string {
294
- return corePath(`arrays/${path || ''}`)
295
- }
296
-
297
- /**
298
- * Returns the path to the `app` directory, optionally relative to the project directory.
299
- *
300
- * @param path - The relative path to the file or directory within the app directory.
301
- * @returns The absolute path to the specified file or directory within the app directory.
302
- * @example
303
- * ```ts
304
- * import { appPath } from '@stacksjs/path'
305
- *
306
- * console.log(appPath('Actions/DummyAction.ts')) // Outputs the absolute path to 'Actions/DummyAction.ts' within the app directory.
307
- * ```
308
- */
309
- export function appPath(path?: string): string {
310
- return projectPath(`app/${path || ''}`)
311
- }
312
-
313
- /**
314
- * Returns the path to the `auth` directory within the core directory.
315
- *
316
- * @param path - The relative path to the file or directory within the auth directory.
317
- * @returns The absolute path to the specified file or directory within the auth directory.
318
- * @example
319
- * ```ts
320
- * import { authPath } from '@stacksjs/path'
321
- *
322
- * console.log(authPath('login.ts')) // Outputs the absolute path to 'login.ts' within the auth directory.
323
- * ```
324
- */
325
- export function authPath(path?: string): string {
326
- return corePath(`auth/${path || ''}`)
327
- }
328
-
329
- /**
330
- * Returns the path to the `auth` directory within the core directory.
331
- *
332
- * @param path - The relative path to the file or directory within the auth directory.
333
- * @returns The absolute path to the specified file or directory within the auth directory.
334
- * @example
335
- * ```ts
336
- * import { coreApiPath } from '@stacksjs/path'
337
- *
338
- * console.log(coreApiPath('login.ts')) // Outputs the absolute path to 'login.ts' within the auth directory.
339
- * ```
340
- */
341
- export function coreApiPath(path?: string): string {
342
- return corePath(`api/${path || ''}`)
343
- }
344
-
345
- /**
346
- * Returns the path to the build directory. The build directory
347
- * contains Stacks' build engine & its tooling integrations.
348
- *
349
- * @param path string - relative path to the file or directory
350
- * @returns string - absolute path to the file or directory
351
- * @example
352
- * ```ts
353
- * buildPath('functions.stx')
354
- * buildPath('components.ts')
355
- * ```
356
- */
357
- export function buildPath(path?: string): string {
358
- return corePath(`build/${path || ''}`)
359
- }
360
-
361
- /**
362
- * Returns the path to the build engine directory.
363
- *
364
- * @param path - The relative path to the file or directory within the build engine directory.
365
- * @returns The absolute path to the specified file or directory within the build engine directory.
366
- */
367
- export function buildEnginePath(path?: string): string {
368
- return buildPath(`${path || ''}`)
369
- }
370
-
371
- /**
372
- * Returns the path to the `libs` directory within the framework directory.
373
- *
374
- * @param path - The relative path to the file or directory within the `libs` directory.
375
- * @returns The absolute path to the specified file or directory within the `libs` directory.
376
- */
377
- export function libsPath(path?: string): string {
378
- return frameworkPath(`libs/${path || ''}`)
379
- }
380
-
381
- /**
382
- * Returns the path to the user `libs` directory within the root project directory.
383
- *
384
- * @param path - The relative path to the file or directory within the `libs` directory.
385
- * @returns The absolute path to the specified file or directory within the `libs` directory.
386
- */
387
- export function userLibsPath(path?: 'components' | 'functions' | string): string {
388
- return resourcesPath(`${path || ''}`)
389
- }
390
-
391
- /**
392
- * Returns the path to the `entries` directory within the `libs` directory.
393
- *
394
- * @param path - The relative path to the file or directory within the `entries` directory.
395
- * @returns The absolute path to the specified file or directory within the `entries` directory.
396
- */
397
- export function libsEntriesPath(path?: string): string {
398
- return libsPath(`entries/${path || ''}`)
399
- }
400
-
401
- /**
402
- * Returns the path to the `cache` directory within the core directory.
403
- *
404
- * @param path - The relative path to the file or directory within the cache directory.
405
- * @returns The absolute path to the specified file or directory within the cache directory.
406
- */
407
- export function cachePath(path?: string): string {
408
- return corePath(`cache/${path || ''}`)
409
- }
410
-
411
- /**
412
- * Returns the path to the `chat` directory within the core directory.
413
- *
414
- * @param path - The relative path to the file or directory within the chat directory.
415
- * @returns The absolute path to the specified file or directory within the chat directory.
416
- */
417
- export function chatPath(path?: string): string {
418
- return corePath(`chat/${path || ''}`)
419
- }
420
-
421
- /**
422
- * Returns the path to the `cli` directory within the core directory.
423
- *
424
- * @param path - The relative path to the file or directory within the cli directory.
425
- * @returns The absolute path to the specified file or directory within the cli directory.
426
- */
427
- export function cliPath(path?: string): string {
428
- return corePath(`cli/${path || ''}`)
429
- }
430
-
431
- /**
432
- * Returns the path to the `cloud` directory within the core directory.
433
- *
434
- * @param path - The relative path to the file or directory within the cloud directory.
435
- * @returns The absolute path to the specified file or directory within the cloud directory.
436
- */
437
- export function cloudPath(path?: string): string {
438
- return corePath(`cloud/${path || ''}`)
439
- }
440
-
441
- /**
442
- * Returns the path to the `cloud` directory within the framework directory.
443
- *
444
- * @param path - The relative path to the file or directory within the framework cloud directory.
445
- * @returns The absolute path to the specified file or directory within the framework cloud directory.
446
- */
447
- export function frameworkCloudPath(path?: string): string {
448
- return frameworkPath(`cloud/${path || ''}`)
449
- }
450
-
451
- /**
452
- * Returns the path to the `collections` directory within the core directory.
453
- *
454
- * @param path - The relative path to the file or directory within the `collections` directory.
455
- * @returns The absolute path to the specified file or directory within the `collections` directory.
456
- */
457
- export function collectionsPath(path?: string): string {
458
- return corePath(`collections/${path || ''}`)
459
- }
460
-
461
- /**
462
- * Returns the path to the `Commands` directory within the app directory.
463
- *
464
- * @param path - The relative path to the file or directory within the `Commands` directory.
465
- * @returns The absolute path to the specified file or directory within the `Commands` directory.
466
- */
467
- export function commandsPath(path?: string): string {
468
- return appPath(`Commands/${path || ''}`)
469
- }
470
-
471
- /**
472
- * Returns the path to the `components` directory within the `resources` directory.
473
- *
474
- * @param path - The relative path to the file or directory within the `components` directory.
475
- * @returns The absolute path to the specified file or directory within the `components` directory.
476
- */
477
- export function componentsPath(path?: string): string {
478
- return userLibsPath(`components/${path || ''}`)
479
- }
480
-
481
- /**
482
- * Returns the path to the `config` directory within the core directory.
483
- *
484
- * @param path - The relative path to the file or directory within the config directory.
485
- * @returns The absolute path to the specified file or directory within the config directory.
486
- */
487
- export function configPath(path?: string): string {
488
- return corePath(`config/${path || ''}`)
489
- }
490
-
491
- /**
492
- * Returns the path to the `core` directory within the framework directory.
493
- *
494
- * @param path - The relative path to the file or directory within the core directory.
495
- * @returns The absolute path to the specified file or directory within the core directory.
496
- */
497
- export function corePath(path?: string): string {
498
- return frameworkPath(`core/${path || ''}`)
499
- }
500
-
501
- /**
502
- * Returns the absolute path to the `custom-elements.json` file within the core directory.
503
- *
504
- * @returns The absolute path to the `custom-elements.json` file.
505
- */
506
- export function customElementsDataPath(): string {
507
- return frameworkPath('core/custom-elements.json')
508
- }
509
-
510
- /**
511
- * Returns the path to the `database` directory within the core directory.
512
- *
513
- * @param path - The relative path to the file or directory within the database directory.
514
- * @returns The absolute path to the specified file or directory within the database directory.
515
- */
516
- export function databasePath(path?: string): string {
517
- return corePath(`database/${path || ''}`)
518
- }
519
-
520
- /**
521
- * Returns the path to the `datetime` directory within the core directory.
522
- *
523
- * @param path - The relative path to the file or directory within the datetime directory.
524
- * @returns The absolute path to the specified file or directory within the datetime directory.
525
- */
526
- export function datetimePath(path?: string): string {
527
- return corePath(`datetime/${path || ''}`)
528
- }
529
-
530
- /**
531
- * Returns the path to the `development` directory within the core directory.
532
- *
533
- * @param path - The relative path to the file or directory within the development directory.
534
- * @returns The absolute path to the specified file or directory within the development directory.
535
- */
536
- export function developmentPath(path?: string): string {
537
- return corePath(`development/${path || ''}`)
538
- }
539
-
540
- /**
541
- * Returns the path to the `desktop` directory within the core directory.
542
- *
543
- * @param path - The relative path to the file or directory within the desktop directory.
544
- * @returns The absolute path to the specified file or directory within the desktop directory.
545
- */
546
- export function desktopPath(path?: string): string {
547
- return corePath(`desktop/${path || ''}`)
548
- }
549
-
550
- /**
551
- * Returns the path to the `docs` directory within the core directory.
552
- *
553
- * @param path - The relative path to the file or directory within the `docs` directory.
554
- * @returns The absolute path to the specified file or directory within the `docs` directory.
555
- */
556
- export function docsPath(path?: string): string {
557
- return corePath(`docs/${path || ''}`)
558
- }
559
-
560
- /**
561
- * Returns the path to the `domains` directory within the core directory.
562
- *
563
- * @param path - The relative path to the file or directory within the `domains` directory.
564
- * @returns The absolute path to the specified file or directory within the `domains` directory.
565
- */
566
- export function dnsPath(path?: string): string {
567
- return corePath(`domains/${path || ''}`)
568
- }
569
-
570
- /**
571
- * Returns the path to the `email` directory within the `notifications` directory.
572
- *
573
- * @param path - The relative path to the file or directory within the email directory.
574
- * @returns The absolute path to the specified file or directory within the email directory.
575
- */
576
- export function emailPath(path?: string): string {
577
- return notificationsPath(`email/${path || ''}`)
578
- }
579
-
580
- /**
581
- * Returns the path to the `enums` directory within the core directory.
582
- *
583
- * @param path - The relative path to the file or directory within the `enums` directory.
584
- * @returns The absolute path to the specified file or directory within the `enums` directory.
585
- */
586
- export function enumsPath(path?: string): string {
587
- return corePath(`enums/${path || ''}`)
588
- }
589
-
590
- /**
591
- * Returns the path to the `eslint-plugin` directory within the core directory.
592
- *
593
- * @param path - The relative path to the file or directory within the eslint-plugin directory.
594
- * @returns The absolute path to the specified file or directory within the eslint-plugin directory.
595
- */
596
- export function eslintPluginPath(path?: string): string {
597
- return corePath(`eslint-plugin/${path || ''}`)
598
- }
599
-
600
- /**
601
- * Returns the path to the `error-handling` directory within the core directory.
602
- *
603
- * @param path - The relative path to the file or directory within the error-handling directory.
604
- * @returns The absolute path to the specified file or directory within the error-handling directory.
605
- */
606
- export function errorHandlingPath(path?: string): string {
607
- return corePath(`error-handling/${path || ''}`)
608
- }
609
-
610
- /**
611
- * Returns the path to the `events` directory within the core directory.
612
- *
613
- * @param path - The relative path to the file or directory within the `events` directory.
614
- * @returns The absolute path to the specified file or directory within the `events` directory.
615
- */
616
- export function eventsPath(path?: string): string {
617
- return corePath(`events/${path || ''}`)
618
- }
619
-
620
- /**
621
- * Returns the path to the `env` directory within the core directory.
622
- *
623
- * @param path - The relative path to the file or directory within the env directory.
624
- * @returns The absolute path to the specified file or directory within the env directory.
625
- */
626
- export function coreEnvPath(path?: string): string {
627
- return corePath(`env/${path || ''}`)
628
- }
629
-
630
- /**
631
- * Returns the path to the `examples` directory within the framework directory, filtered by type.
632
- *
633
- * @param type - The type of examples to filter by ('vue-components' or 'web-components').
634
- * @returns The absolute path to the specified type of examples within the `examples` directory.
635
- */
636
- export function examplesPath(type?: 'vue-components' | 'web-components'): string {
637
- return frameworkPath(`examples/${type || ''}`)
638
- }
639
-
640
- /**
641
- * Returns the path to the `faker` directory within the core directory.
642
- *
643
- * @param path - The relative path to the file or directory within the faker directory.
644
- * @returns The absolute path to the specified file or directory within the faker directory.
645
- */
646
- export function fakerPath(path?: string): string {
647
- return corePath(`faker/${path || ''}`)
648
- }
649
-
650
- /**
651
- * Returns the path to the framework directory, optionally relative to the current working directory.
652
- *
653
- * @param path - The relative path to the file or directory within the framework directory.
654
- * @param options - Optional. An object containing configuration settings.
655
- * @param options.relative - If true, returns the path relative to the current working directory.
656
- * @param options.cwd - Specifies a custom working directory.
657
- * @returns The absolute or relative path to the specified file or directory within the framework directory.
658
- */
659
- export function frameworkPath(path?: string, options?: { relative?: boolean, cwd?: string }): string {
660
- const absolutePath = storagePath(`framework/${path || ''}`)
661
-
662
- if (options?.relative)
663
- return relative(options.cwd || process.cwd(), absolutePath)
664
-
665
- return absolutePath
666
- }
667
-
668
- /**
669
- * Returns the path to the `frontend` directory within the core directory.
670
- *
671
- * @param path - The relative path to the file or directory within the health directory.
672
- * @returns The absolute path to the specified file or directory within the health directory.
673
- */
674
- export function browserPath(path?: string): string {
675
- return corePath(`browser/${path || ''}`)
676
- }
677
-
678
- /**
679
- * Returns the path to the `health` directory within the core directory.
680
- *
681
- * @param path - The relative path to the file or directory within the health directory.
682
- * @returns The absolute path to the specified file or directory within the health directory.
683
- */
684
- export function healthPath(path?: string): string {
685
- return corePath(`health/${path || ''}`)
686
- }
687
-
688
- /**
689
- * Returns the path to the `functions` directory within the `resources` directory.
690
- *
691
- * @param path - The relative path to the file or directory within the `functions` directory.
692
- * @returns The absolute path to the specified file or directory within the `functions` directory.
693
- */
694
- export function functionsPath(path?: string): string {
695
- return userLibsPath(`functions/${path || ''}`)
696
- }
697
-
698
- /**
699
- * Returns the path to the `git` directory within the core directory.
700
- *
701
- * @param path - The relative path to the file or directory within the git directory.
702
- * @returns The absolute path to the specified file or directory within the git directory.
703
- */
704
- export function gitPath(path?: string): string {
705
- return corePath(`git/${path || ''}`)
706
- }
707
-
708
- /**
709
- * Returns the path to the `lang` directory, optionally relative to the project directory.
710
- *
711
- * @param path - The relative path to the file or directory within the lang directory.
712
- * @returns The absolute path to the specified file or directory within the lang directory.
713
- */
714
- export function langPath(path?: string): string {
715
- return resourcesPath(`lang/${path || ''}`)
716
- }
717
-
718
- /**
719
- * Returns the path to the `layouts` directory within the `resources` directory, optionally relative to the current working directory.
720
- *
721
- * @param path - The relative path to the file or directory within the `layouts` directory.
722
- * @param options - Optional. An object containing configuration settings.
723
- * @param options.relative - If true, returns the path relative to the current working directory.
724
- * @returns The absolute or relative path to the specified file or directory within the `layouts` directory.
725
- */
726
- export function layoutsPath(path?: string, options?: { relative?: boolean }): string {
727
- const absolutePath = resourcesPath(`layouts/${path || ''}`)
728
-
729
- if (options?.relative)
730
- return relative(process.cwd(), absolutePath)
731
-
732
- return absolutePath
733
- }
734
-
735
- /**
736
- * Returns the path to the library entry file, filtered by library type.
737
- *
738
- * @param type - The type of library ('vue-components', 'web-components', or 'functions').
739
- * @returns The absolute path to the specified library entry file.
740
- */
741
- export type LibraryType = 'vue-components' | 'web-components' | 'functions'
742
- export function libraryEntryPath(type: LibraryType): string {
743
- return libsEntriesPath(`${type}.ts`)
744
- }
745
-
746
- /**
747
- * Returns the path to the `lint` directory within the core directory.
748
- *
749
- * @param path - The relative path to the file or directory within the lint directory.
750
- * @returns The absolute path to the specified file or directory within the lint directory.
751
- */
752
- export function lintPath(path?: string): string {
753
- return corePath(`lint/${path || ''}`)
754
- }
755
-
756
- /**
757
- * Returns the path to the `listeners` directory within the app directory.
758
- *
759
- * @param path - The relative path to the file or directory within the `listeners` directory.
760
- * @returns The absolute path to the specified file or directory within the `listeners` directory.
761
- */
762
- export function listenersPath(path?: string): string {
763
- return appPath(`Listeners/${path || ''}`)
764
- }
765
-
766
- /**
767
- * Returns the path to the `jobs` directory within the app directory.
768
- *
769
- * @param path - The relative path to the file or directory within the `jobs` directory.
770
- * @returns The absolute path to the specified file or directory within the `jobs` directory.
771
- */
772
- export function jobsPath(path?: string): string {
773
- return appPath(`Jobs/${path || ''}`)
774
- }
775
-
776
- /**
777
- * Returns the path to the `logging` directory within the core directory.
778
- *
779
- * @param path - The relative path to the file or directory within the logging directory.
780
- * @returns The absolute path to the specified file or directory within the logging directory.
781
- */
782
- export function loggingPath(path?: string): string {
783
- return corePath(`logging/${path || ''}`)
784
- }
785
-
786
- /**
787
- * Returns the path to the `logs` directory within the project storage directory.
788
- *
789
- * @param path - The relative path to the file or directory within the `logs` directory.
790
- * @returns The absolute path to the specified file or directory within the `logs` directory.
791
- */
792
- export function logsPath(path?: string): string {
793
- return storagePath(`logs/${path || ''}`)
794
- }
795
-
796
- /**
797
- * Returns the path to the `models` directory within the app directory.
798
- *
799
- * @param path - The relative path to the file or directory within the `models` directory.
800
- * @returns The absolute path to the specified file or directory within the `models` directory.
801
- */
802
- export function modelsPath(path?: string): string {
803
- return appPath(`models/${path || ''}`)
804
- }
805
-
806
- /**
807
- * Returns the path to the `modules` directory within the `resources` directory.
808
- *
809
- * @param path - The relative path to the file or directory within the `modules` directory.
810
- * @returns The absolute path to the specified file or directory within the `modules` directory.
811
- */
812
- export function modulesPath(path?: string): string {
813
- return resourcesPath(`modules/${path || ''}`)
814
- }
815
-
816
- /**
817
- * Returns the path to the `notifications` directory within the core directory.
818
- *
819
- * @param path - The relative path to the file or directory within the `notifications` directory.
820
- * @returns The absolute path to the specified file or directory within the `notifications` directory.
821
- */
822
- export function notificationsPath(path?: string): string {
823
- return corePath(`notifications/${path || ''}`)
824
- }
825
-
826
- /**
827
- * Returns the path to the `orm` directory within the core directory.
828
- *
829
- * @param path - The relative path to the file or directory within the orm directory.
830
- * @returns The absolute path to the specified file or directory within the orm directory.
831
- */
832
- export function ormPath(path?: string): string {
833
- return corePath(`orm/${path || ''}`)
834
- }
835
-
836
- /**
837
- * Returns the path to the `objects` directory within the core directory.
838
- *
839
- * @param path - The relative path to the file or directory within the `objects` directory.
840
- * @returns The absolute path to the specified file or directory within the `objects` directory.
841
- */
842
- export function objectsPath(path?: string): string {
843
- return corePath(`objects/${path || ''}`)
844
- }
845
-
846
- /**
847
- * Returns the default path to the onboarding views within the project directory, or a specified path.
848
- *
849
- * @param path - The relative path to the file or directory within the project directory. Defaults to 'views/dashboard/onboarding'.
850
- * @returns The absolute path to the specified file or directory within the project directory.
851
- */
852
- export function onboardingPath(path?: string): string {
853
- return projectPath(`${path || 'views/dashboard/onboarding'}`)
854
- }
855
-
856
- /**
857
- * Returns the path to the `package.json` file of a specified library type within the framework directory.
858
- *
859
- * @param type - The type of the library ('vue-components', 'web-components', or 'functions') for which to return the package.json path.
860
- * @returns The absolute path to the specified package.json file within the framework directory.
861
- */
862
- export function packageJsonPath(type: LibraryType): string {
863
- if (type === 'vue-components')
864
- return frameworkPath('libs/components/vue/package.json')
865
- if (type === 'web-components')
866
- return frameworkPath('libs/components/web/package.json')
867
-
868
- return frameworkPath(`libs/${type}/package.json`)
869
- }
870
-
871
- /**
872
- * Returns the path to the `views` directory within the `resources` directory.
873
- *
874
- * @param path - The relative path to the file or directory within the `views` directory.
875
- * @returns The absolute path to the specified file or directory within the `views` directory.
876
- */
877
- export function viewsPath(path?: string): string {
878
- return resourcesPath(`views/${path || ''}`)
879
- }
880
-
881
- /**
882
- * Returns the path to the `path` directory within the core directory.
883
- *
884
- * @param path - The relative path to the file or directory within the path directory.
885
- * @returns The absolute path to the specified file or directory within the path directory.
886
- */
887
- export function pathPath(path?: string): string {
888
- return corePath(`path/${path || ''}`)
889
- }
890
-
891
- /**
892
- * Returns the path to the `payments` directory within the core directory.
893
- *
894
- * @param path - The relative path to the file or directory within the `payments` directory.
895
- * @returns The absolute path to the specified file or directory within the `payments` directory.
896
- */
897
- export function paymentsPath(path?: string): string {
898
- return corePath(`payments/${path || ''}`)
899
- }
900
-
901
- /**
902
- * Returns the project path, resolving from the current working directory and moving up until the storage directory is no longer part of the path.
903
- *
904
- * @param filePath - The relative path to append to the project path. Defaults to an empty string.
905
- * @returns The absolute path to the specified file or directory within the project directory.
906
- */
907
- export function projectPath(filePath = '', options?: { relative: boolean }): string {
908
- let path = process.cwd()
909
-
910
- while (path.includes('storage')) path = resolve(path, '..')
911
-
912
- const finalPath = resolve(path, filePath)
913
-
914
- // If the `relative` option is true, return the path relative to the current working directory
915
- if (options?.relative)
916
- return relative(process.cwd(), finalPath)
917
-
918
- return finalPath
919
- }
920
-
921
- /**
922
- * Finds and returns the absolute path of a specified project by name.
923
- *
924
- * @param project - The name of the project to find.
925
- * @returns The absolute path to the specified project.
926
- * @throws Error if the project with the specified name cannot be found.
927
- */
928
- export async function findProjectPath(project: string): Promise<string> {
929
- const projectList = await runCommandSync('buddy projects:list --quiet')
930
- log.debug(`ProjectList in findProjectPath ${projectList}`)
931
-
932
- // get the list of all Stacks project paths (on the system)
933
- const projects = projectList
934
- .split('\n')
935
- .filter((line: string) => line.startsWith(' - '))
936
- .map((line: string) => line.trim().substring(4))
937
-
938
- log.debug(`Projects in findProjectPath ${projects}`)
939
-
940
- // since we are targeting a specific project, find its path
941
- const projectPath = projects.find((proj: string) => proj.includes(project))
942
-
943
- if (!projectPath)
944
- throw new Error(`Could not find project with name: ${project}`)
945
-
946
- return projectPath.startsWith('/') ? projectPath : `/${projectPath}`
947
- }
948
-
949
- /**
950
- * Returns the path to the `config` directory within the project directory.
951
- *
952
- * @param path - The relative path to the file or directory within the config directory.
953
- * @returns The absolute path to the specified file or directory within the config directory.
954
- */
955
- export function projectConfigPath(path?: string): string {
956
- return projectPath(`config/${path || ''}`)
957
- }
958
-
959
- /**
960
- * Returns the path to the `storage` directory within the project directory.
961
- *
962
- * @param path - The relative path to the file or directory within the storage directory.
963
- * @returns The absolute path to the specified file or directory within the storage directory.
964
- */
965
- export function storagePath(path?: string): string {
966
- return projectPath(`storage/${path || ''}`)
967
- }
968
-
969
- /**
970
- * Returns the path to the `public` directory within the project directory.
971
- *
972
- * @param path - The relative path to the file or directory within the public directory.
973
- * @returns The absolute path to the specified file or directory within the public directory.
974
- */
975
- export function publicPath(path?: string): string {
976
- return projectPath(`public/${path || ''}`)
977
- }
978
-
979
- /**
980
- * Returns the path to the `push` directory within the `notifications` directory.
981
- *
982
- * @param path - The relative path to the file or directory within the push directory.
983
- * @returns The absolute path to the specified file or directory within the push directory.
984
- */
985
- export function pushPath(path?: string): string {
986
- return notificationsPath(`push/${path || ''}`)
987
- }
988
-
989
- /**
990
- * Returns the path to the `query-builder` directory within the core directory.
991
- *
992
- * @param path - The relative path to the file or directory within the query-builder directory.
993
- * @returns The absolute path to the specified file or directory within the query-builder directory.
994
- */
995
- export function queryBuilderPath(path?: string): string {
996
- return corePath(`query-builder/${path || ''}`)
997
- }
998
-
999
- /**
1000
- * Returns the path to the `queue` directory within the core directory.
1001
- *
1002
- * @param path - The relative path to the file or directory within the queue directory.
1003
- * @returns The absolute path to the specified file or directory within the queue directory.
1004
- */
1005
- export function queuePath(path?: string): string {
1006
- return corePath(`queue/${path || ''}`)
1007
- }
1008
-
1009
- /**
1010
- * Returns the path to the `realtime` directory within the core directory.
1011
- *
1012
- * @param path - The relative path to the file or directory within the realtime directory.
1013
- * @returns The absolute path to the specified file or directory within the realtime directory.
1014
- */
1015
- export function realtimePath(path?: string): string {
1016
- return corePath(`realtime/${path || ''}`)
1017
- }
1018
-
1019
- /**
1020
- * Returns the path to the `resources` directory within the project storage directory, with an option for relative paths.
1021
- *
1022
- * @param path - The relative path to the file or directory within the `resources` directory.
1023
- * @param options - Optional. An object containing configuration settings.
1024
- * @param options.relative - If true, returns the path relative to the current working directory.
1025
- * @returns The absolute or relative path to the specified file or directory within the `resources` directory.
1026
- */
1027
- export function resourcesPath(path?: string, options?: { relative?: boolean }): string {
1028
- if (options?.relative) {
1029
- const absolutePath = projectPath(`resources/${path || ''}`)
1030
- return relative(process.cwd(), absolutePath)
1031
- }
1032
-
1033
- return projectPath(`resources/${path || ''}`)
1034
- }
1035
-
1036
- /**
1037
- * Returns the path to the `repl` directory within the core directory.
1038
- *
1039
- * @param path - The relative path to the file or directory within the repl directory.
1040
- * @returns The absolute path to the specified file or directory within the repl directory.
1041
- */
1042
- export function replPath(path?: string): string {
1043
- return corePath(`repl/${path || ''}`)
1044
- }
1045
-
1046
- /**
1047
- * Returns the path to the `router` directory within the core directory.
1048
- *
1049
- * @param path - The relative path to the file or directory within the router directory.
1050
- * @returns The absolute path to the specified file or directory within the router directory.
1051
- */
1052
- export function routerPath(path?: string): string {
1053
- return corePath(`router/${path || ''}`)
1054
- }
1055
-
1056
- /**
1057
- * Returns the path to the `routes` directory within the `resources` directory, with an option for relative paths.
1058
- *
1059
- * @param path - The relative path to the file or directory within the `routes` directory.
1060
- * @param options - Optional. An object containing configuration settings.
1061
- * @param options.relative - If true, returns the path relative to the current working directory.
1062
- * @returns The absolute or relative path to the specified file or directory within the `routes` directory.
1063
- */
1064
- export function routesPath(path?: string, options?: { relative?: boolean }): string {
1065
- const absolutePath = resourcesPath(`routes/${path || ''}`)
1066
-
1067
- if (options?.relative)
1068
- return relative(process.cwd(), absolutePath)
1069
-
1070
- return projectPath(`routes/${path || ''}`)
1071
- }
1072
-
1073
- /**
1074
- * Returns the path to the `search-engine` directory within the core directory.
1075
- *
1076
- * @param path - The relative path to the file or directory within the search-engine directory.
1077
- * @returns The absolute path to the specified file or directory within the search-engine directory.
1078
- */
1079
- export function searchEnginePath(path?: string): string {
1080
- return corePath(`search-engine/${path || ''}`)
1081
- }
1082
-
1083
- /**
1084
- * Returns the path to the `settings` directory within the project directory, defaulting to the views/dashboard/settings directory.
1085
- *
1086
- * @param path - The relative path to the file or directory within the `settings` directory.
1087
- * @returns The absolute path to the specified file or directory within the `settings` directory.
1088
- */
1089
- export function settingsPath(path?: string): string {
1090
- return projectPath(`${path || 'views/dashboard/settings'}`)
1091
- }
1092
-
1093
- /**
1094
- * Returns the path to the `scripts` directory within the framework directory.
1095
- *
1096
- * @param path - The relative path to the file or directory within the `scripts` directory.
1097
- * @returns The absolute path to the specified file or directory within the `scripts` directory.
1098
- */
1099
- export function scriptsPath(path?: string): string {
1100
- return frameworkPath(`scripts/${path || ''}`)
1101
- }
1102
-
1103
- /**
1104
- * Returns the path to the `scheduler` directory within the core directory.
1105
- *
1106
- * @param path - The relative path to the file or directory within the scheduler directory.
1107
- * @returns The absolute path to the specified file or directory within the scheduler directory.
1108
- */
1109
- export function schedulerPath(path?: string): string {
1110
- return corePath(`scheduler/${path || ''}`)
1111
- }
1112
-
1113
- /**
1114
- * Returns the path to the `slug` directory within the core directory.
1115
- *
1116
- * @param path - The relative path to the file or directory within the slug directory.
1117
- * @returns The absolute path to the specified file or directory within the slug directory.
1118
- */
1119
- export function slugPath(path?: string): string {
1120
- return corePath(`slug/${path || ''}`)
1121
- }
1122
-
1123
- /**
1124
- * Returns the path to the `sms` directory within the `notifications` directory.
1125
- *
1126
- * @param path - The relative path to the file or directory within the `sms` directory.
1127
- * @returns The absolute path to the specified file or directory within the `sms` directory.
1128
- */
1129
- export function smsPath(path?: string): string {
1130
- return notificationsPath(`sms/${path || ''}`)
1131
- }
1132
-
1133
- /**
1134
- * Returns the path to the `storage` directory within the core directory.
1135
- *
1136
- * @param path - The relative path to the file or directory within the storage directory.
1137
- * @returns The absolute path to the specified file or directory within the storage directory.
1138
- */
1139
- export function coreStoragePath(path?: string): string {
1140
- return corePath(`storage/${path || ''}`)
1141
- }
1142
-
1143
- /**
1144
- * Returns the path to the `stores` directory within the `resources` directory.
1145
- *
1146
- * @param path - The relative path to the file or directory within the `stores` directory.
1147
- * @returns The absolute path to the specified file or directory within the `stores` directory.
1148
- */
1149
- export function storesPath(path?: string): string {
1150
- return resourcesPath(`stores/${path || ''}`)
1151
- }
1152
-
1153
- /**
1154
- * Returns the path to the `security` directory within the core directory.
1155
- *
1156
- * @param path - The relative path to the file or directory within the security directory.
1157
- * @returns The absolute path to the specified file or directory within the security directory.
1158
- */
1159
- export function securityPath(path?: string): string {
1160
- return corePath(`security/${path || ''}`)
1161
- }
1162
-
1163
- /**
1164
- * Returns the path to the `server` directory within the core directory.
1165
- *
1166
- * @param path - The relative path to the file or directory within the server directory.
1167
- * @returns The absolute path to the specified file or directory within the server directory.
1168
- */
1169
- export function serverPath(path?: string): string {
1170
- return corePath(`server/${path || ''}`)
1171
- }
1172
-
1173
- export function userServerPath(path?: string): string {
1174
- return frameworkPath(`server/${path || ''}`)
1175
- }
1176
-
1177
- /**
1178
- * Returns the path to the `serverless` directory within the core directory.
1179
- *
1180
- * @param path - The relative path to the file or directory within the `serverless` directory.
1181
- * @returns The absolute path to the specified file or directory within the `serverless` directory.
1182
- */
1183
- export function serverlessPath(path?: string): string {
1184
- return corePath(`serverless/${path || ''}`)
1185
- }
1186
-
1187
- /**
1188
- * Returns the path to the specified directory or file within the framework's `src` directory.
1189
- *
1190
- * @param path - The relative path to the file or directory within the framework's `src` directory.
1191
- * @returns The absolute path to the specified file or directory within the framework's `src` directory.
1192
- */
1193
- export function stacksPath(path?: string): string {
1194
- return frameworkPath(`src/${path || ''}`)
1195
- }
1196
-
1197
- /**
1198
- * Returns the path to the `shell` directory within the core directory.
1199
- *
1200
- * @param path - The relative path to the file or directory within the shell directory.
1201
- * @returns The absolute path to the specified file or directory within the shell directory.
1202
- */
1203
- export function shellPath(path?: string): string {
1204
- return corePath(`shell/${path || ''}`)
1205
- }
1206
-
1207
- /**
1208
- * Returns the path to the `strings` directory within the core directory.
1209
- *
1210
- * @param path - The relative path to the file or directory within the `strings` directory.
1211
- * @returns The absolute path to the specified file or directory within the `strings` directory.
1212
- */
1213
- export function stringsPath(path?: string): string {
1214
- return corePath(`strings/${path || ''}`)
1215
- }
1216
-
1217
- /**
1218
- * Returns the path to the `testing` directory within the core directory.
1219
- *
1220
- * @param path - The relative path to the file or directory within the testing directory.
1221
- * @returns The absolute path to the specified file or directory within the testing directory.
1222
- */
1223
- export function testingPath(path?: string): string {
1224
- return corePath(`testing/${path || ''}`)
1225
- }
1226
-
1227
- /**
1228
- * Returns the path to the `tinker` directory within the core directory.
1229
- *
1230
- * @param path - The relative path to the file or directory within the tinker directory.
1231
- * @returns The absolute path to the specified file or directory within the tinker directory.
1232
- */
1233
- export function tinkerPath(path?: string): string {
1234
- return corePath(`tinker/${path || ''}`)
1235
- }
1236
-
1237
- /**
1238
- * Returns the path to the `tests` directory within the framework directory.
1239
- *
1240
- * @param path - The relative path to the file or directory within the `tests` directory.
1241
- * @returns The absolute path to the specified file or directory within the `tests` directory.
1242
- */
1243
- export function testsPath(path?: string): string {
1244
- return frameworkPath(`tests/${path || ''}`)
1245
- }
1246
-
1247
- /**
1248
- * Returns the path to the `types` directory within the core directory.
1249
- *
1250
- * @param path - The relative path to the file or directory within the `types` directory.
1251
- * @returns The absolute path to the specified file or directory within the `types` directory.
1252
- */
1253
- export function typesPath(path?: string): string {
1254
- return corePath(`types/${path || ''}`)
1255
- }
1256
-
1257
- /**
1258
- * Returns the path to the `ui` directory within the core directory.
1259
- *
1260
- * @param path - The relative path to the file or directory within the ui directory.
1261
- * @returns The absolute path to the specified file or directory within the ui directory.
1262
- */
1263
- export function uiPath(path?: string, options?: { relative?: boolean }): string {
1264
- const absolutePath = corePath(`ui/${path || ''}`)
1265
-
1266
- if (options?.relative)
1267
- return relative(process.cwd(), absolutePath)
1268
-
1269
- return absolutePath
1270
- }
1271
-
1272
- /**
1273
- * Returns the path to the `utils` directory within the core directory.
1274
- *
1275
- * @param path - The relative path to the file or directory within the `utils` directory.
1276
- * @returns The absolute path to the specified file or directory within the `utils` directory.
1277
- */
1278
- export function utilsPath(path?: string): string {
1279
- return corePath(`utils/${path || ''}`)
1280
- }
1281
-
1282
- /**
1283
- * Returns the path to the `validation` directory within the core directory.
1284
- *
1285
- * @param path - The relative path to the file or directory within the validation directory.
1286
- * @returns The absolute path to the specified file or directory within the validation directory.
1287
- */
1288
- export function validationPath(path?: string): string {
1289
- return corePath(`validation/${path || ''}`)
1290
- }
1291
-
1292
- /**
1293
- * Returns the path to the `vite-config` directory within the core directory.
1294
- *
1295
- * @param path - The relative path to the file or directory within the vite-config directory.
1296
- * @returns The absolute path to the specified file or directory within the vite-config directory.
1297
- */
1298
- export function viteConfigPath(path?: string): string {
1299
- return corePath(`vite-config/${path || ''}`)
1300
- }
1301
-
1302
- /**
1303
- * Returns the path to the `vite-plugin` directory within the core directory.
1304
- *
1305
- * @param path - The relative path to the file or directory within the vite directory.
1306
- * @returns The absolute path to the specified file or directory within the vite directory.
1307
- */
1308
- export function vitePluginPath(path?: string): string {
1309
- return corePath(`vite-plugin/${path || ''}`)
1310
- }
1311
-
1312
- /**
1313
- * Returns the path to the `x-ray` directory within the `stacks` directory of the framework.
1314
- *
1315
- * @param path - The relative path to the file or directory within the x-ray directory.
1316
- * @returns The absolute path to the specified file or directory within the x-ray directory.
1317
- */
1318
- export function xRayPath(path?: string): string {
1319
- return frameworkPath(`stacks/x-ray/${path || ''}`)
1320
- }
1321
-
1322
- /**
1323
- * Returns the path to the home directory, optionally appending a given path.
1324
- *
1325
- * @param path - The relative path to append to the home directory path.
1326
- * @returns The absolute path to the specified file or directory within the home directory.
1327
- */
1328
- export function homeDir(path?: string): string {
1329
- return os.homedir() + (path ? (path.startsWith('/') ? '' : '/') + path : '~')
1330
- }
1331
-
1332
- export interface Path {
1333
- actionsPath: (path?: string) => string
1334
- userActionsPath: (path?: string) => string
1335
- builtUserActionsPath: (path?: string, option?: { relative: boolean }) => string
1336
- userComponentsPath: (path?: string) => string
1337
- userViewsPath: (path?: string) => string
1338
- userFunctionsPath: (path?: string) => string
1339
- aiPath: (path?: string) => string
1340
- assetsPath: (path?: string) => string
1341
- relativeActionsPath: (path?: string) => string
1342
- aliasPath: (path?: string) => string
1343
- analyticsPath: (path?: string) => string
1344
- arraysPath: (path?: string) => string
1345
- appPath: (path?: string) => string
1346
- authPath: (path?: string) => string
1347
- coreApiPath: (path?: string) => string
1348
- buddyPath: (path?: string) => string
1349
- buildEnginePath: (path?: string) => string
1350
- libsEntriesPath: (path?: string) => string
1351
- buildPath: (path?: string) => string
1352
- cachePath: (path?: string) => string
1353
- chatPath: (path?: string) => string
1354
- cliPath: (path?: string) => string
1355
- cloudPath: (path?: string) => string
1356
- frameworkCloudPath: (path?: string) => string
1357
- collectionsPath: (path?: string) => string
1358
- commandsPath: (path?: string) => string
1359
- componentsPath: (path?: string) => string
1360
- configPath: (path?: string) => string
1361
- projectConfigPath: (path?: string) => string
1362
- corePath: (path?: string) => string
1363
- customElementsDataPath: (path?: string) => string
1364
- databasePath: (path?: string) => string
1365
- datetimePath: (path?: string) => string
1366
- developmentPath: (path?: string) => string
1367
- desktopPath: (path?: string) => string
1368
- docsPath: (path?: string) => string
1369
- dnsPath: (path?: string) => string
1370
- emailPath: (path?: string) => string
1371
- enumsPath: (path?: string) => string
1372
- eslintPluginPath: (path?: string) => string
1373
- errorHandlingPath: (path?: string) => string
1374
- eventsPath: (path?: string) => string
1375
- coreEnvPath: (path?: string) => string
1376
- healthPath: (path?: string) => string
1377
- examplesPath: (type?: 'vue-components' | 'web-components') => string
1378
- fakerPath: (path?: string) => string
1379
- frameworkPath: (path?: string) => string
1380
- browserPath: (path?: string) => string
1381
- storagePath: (path?: string) => string
1382
- functionsPath: (path?: string) => string
1383
- gitPath: (path?: string) => string
1384
- langPath: (path?: string) => string
1385
- layoutsPath: (path?: string, options?: { relative?: boolean }) => string
1386
- libsPath: (path?: string) => string
1387
- userLibsPath: (path?: string) => string
1388
- libraryEntryPath: (type: LibraryType) => string
1389
- lintPath: (path?: string) => string
1390
- listenersPath: (path?: string) => string
1391
- loggingPath: (path?: string) => string
1392
- logsPath: (path?: string) => string
1393
- jobsPath: (path?: string) => string
1394
- modulesPath: (path?: string) => string
1395
- ormPath: (path?: string) => string
1396
- objectsPath: (path?: string) => string
1397
- onboardingPath: (path?: string) => string
1398
- notificationsPath: (path?: string) => string
1399
- packageJsonPath: (type: LibraryType) => string
1400
- viewsPath: (path?: string) => string
1401
- pathPath: (path?: string) => string
1402
- paymentsPath: (path?: string) => string
1403
- projectPath: (path?: string) => string
1404
- findProjectPath: (project: string) => Promise<string>
1405
- coreStoragePath: (path?: string) => string
1406
- publicPath: (path?: string) => string
1407
- pushPath: (path?: string) => string
1408
- queryBuilderPath: (path?: string) => string
1409
- queuePath: (path?: string) => string
1410
- realtimePath: (path?: string) => string
1411
- resourcesPath: (path?: string) => string
1412
- replPath: (path?: string) => string
1413
- routerPath: (path?: string) => string
1414
- routesPath: (path?: string) => string
1415
- runtimePath: (path?: string) => string
1416
- searchEnginePath: (path?: string) => string
1417
- schedulerPath: (path?: string) => string
1418
- settingsPath: (path?: string) => string
1419
- smsPath: (path?: string) => string
1420
- slugPath: (path?: string) => string
1421
- scriptsPath: (path?: string) => string
1422
- securityPath: (path?: string) => string
1423
- serverPath: (path?: string) => string
1424
- userServerPath: (path?: string) => string
1425
- serverlessPath: (path?: string) => string
1426
- stacksPath: (path?: string) => string
1427
- stringsPath: (path?: string) => string
1428
- shellPath: (path?: string) => string
1429
- storesPath: (path?: string) => string
1430
- testingPath: (path?: string) => string
1431
- testsPath: (path?: string) => string
1432
- tinkerPath: (path?: string) => string
1433
- typesPath: (path?: string) => string
1434
- uiPath: (path?: string, options?: { relative?: boolean }) => string
1435
- userDatabasePath: (path?: string) => string
1436
- userMigrationsPath: (path?: string) => string
1437
- userEventsPath: (path?: string) => string
1438
- userJobsPath: (path?: string) => string
1439
- userListenersPath: (path?: string) => string
1440
- userMiddlewarePath: (path?: string) => string
1441
- userModelsPath: (path?: string) => string
1442
- userNotificationsPath: (path?: string) => string
1443
- utilsPath: (path?: string) => string
1444
- validationPath: (path?: string) => string
1445
- viteConfigPath: (path?: string) => string
1446
- vitePluginPath: (path?: string) => string
1447
- xRayPath: (path?: string) => string
1448
- homeDir: (path?: string) => string
1449
- basename: (path: string) => string
1450
- delimiter: () => ';' | ':'
1451
- dirname: (path: string) => string
1452
- extname: (path: string) => string
1453
- isAbsolute: (path: string) => boolean
1454
- join: (...paths: string[]) => string
1455
- normalize: (path: string) => string
1456
- relative: (from: string, to: string) => string
1457
- resolve: (...paths: string[]) => string
1458
- parse: (path: string) => ParsedPath
1459
- sep: () => '/' | '\\'
1460
- toNamespacedPath: (path: string) => string
1461
- }
1462
-
1463
- export const path: Path = {
1464
- actionsPath,
1465
- userActionsPath,
1466
- builtUserActionsPath,
1467
- userComponentsPath,
1468
- userViewsPath,
1469
- userFunctionsPath,
1470
- aiPath,
1471
- assetsPath,
1472
- relativeActionsPath,
1473
- aliasPath,
1474
- analyticsPath,
1475
- arraysPath,
1476
- appPath,
1477
- authPath,
1478
- coreApiPath,
1479
- buddyPath,
1480
- buildEnginePath,
1481
- libsEntriesPath,
1482
- buildPath,
1483
- cachePath,
1484
- chatPath,
1485
- cliPath,
1486
- cloudPath,
1487
- frameworkCloudPath,
1488
- collectionsPath,
1489
- commandsPath,
1490
- componentsPath,
1491
- configPath,
1492
- projectConfigPath,
1493
- corePath,
1494
- customElementsDataPath,
1495
- databasePath,
1496
- datetimePath,
1497
- developmentPath,
1498
- desktopPath,
1499
- docsPath,
1500
- dnsPath,
1501
- emailPath,
1502
- enumsPath,
1503
- eslintPluginPath,
1504
- errorHandlingPath,
1505
- eventsPath,
1506
- coreEnvPath,
1507
- healthPath,
1508
- examplesPath,
1509
- fakerPath,
1510
- frameworkPath,
1511
- browserPath,
1512
- storagePath,
1513
- functionsPath,
1514
- gitPath,
1515
- langPath,
1516
- layoutsPath,
1517
- libsPath,
1518
- userLibsPath,
1519
- libraryEntryPath,
1520
- lintPath,
1521
- listenersPath,
1522
- loggingPath,
1523
- logsPath,
1524
- jobsPath,
1525
- modulesPath,
1526
- ormPath,
1527
- objectsPath,
1528
- onboardingPath,
1529
- notificationsPath,
1530
- packageJsonPath,
1531
- viewsPath,
1532
- pathPath,
1533
- paymentsPath,
1534
- projectPath,
1535
- findProjectPath,
1536
- coreStoragePath,
1537
- publicPath,
1538
- pushPath,
1539
- queryBuilderPath,
1540
- queuePath,
1541
- realtimePath,
1542
- resourcesPath,
1543
- replPath,
1544
- routerPath,
1545
- routesPath,
1546
- runtimePath,
1547
- searchEnginePath,
1548
- schedulerPath,
1549
- settingsPath,
1550
- smsPath,
1551
- slugPath,
1552
- scriptsPath,
1553
- securityPath,
1554
- serverPath,
1555
- userServerPath,
1556
- serverlessPath,
1557
- stacksPath,
1558
- stringsPath,
1559
- shellPath,
1560
- storesPath,
1561
- testingPath,
1562
- testsPath,
1563
- tinkerPath,
1564
- typesPath,
1565
- uiPath,
1566
- userDatabasePath,
1567
- userMigrationsPath,
1568
- userEventsPath,
1569
- userJobsPath,
1570
- userListenersPath,
1571
- userMiddlewarePath,
1572
- userModelsPath,
1573
- userNotificationsPath,
1574
- utilsPath,
1575
- validationPath,
1576
- viteConfigPath,
1577
- vitePluginPath,
1578
- xRayPath,
1579
- homeDir,
1580
-
1581
- // path utils
1582
- basename,
1583
- delimiter: () => delimiter,
1584
- dirname,
1585
- extname,
1586
- isAbsolute,
1587
- join,
1588
- normalize,
1589
- relative,
1590
- resolve,
1591
- parse,
1592
- sep: () => sep,
1593
- toNamespacedPath,
1594
- }
1595
-
1596
- export { basename, delimiter, dirname, extname, isAbsolute, join, normalize, relative, resolve, sep, toNamespacedPath }