directory-lint 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -32,29 +32,23 @@ var index_exports = {};
32
32
  __export(index_exports, {
33
33
  DirectoryLint: () => DirectoryLint,
34
34
  FileSystemBackend: () => FileSystemBackend,
35
- InvalidItemType: () => InvalidItemType,
36
- InvalidLint: () => InvalidLint,
37
- NotFoundRequiredItem: () => NotFoundRequiredItem
35
+ angular: () => angular,
36
+ astro: () => astro,
37
+ electron: () => electron,
38
+ express: () => express,
39
+ gatsby: () => gatsby,
40
+ monorepo: () => monorepo,
41
+ nestjs: () => nestjs,
42
+ nextjs: () => nextjs,
43
+ nuxt: () => nuxt,
44
+ react: () => react,
45
+ remix: () => remix,
46
+ svelte: () => svelte,
47
+ vite: () => vite,
48
+ vue: () => vue
38
49
  });
39
50
  module.exports = __toCommonJS(index_exports);
40
51
 
41
- // src/errors.ts
42
- var InvalidLint = class extends Error {
43
- constructor(path) {
44
- super(`Invalid Lint detected in path: ${path}`);
45
- }
46
- };
47
- var NotFoundRequiredItem = class extends Error {
48
- constructor(item) {
49
- super(`Not found required item: ${item}`);
50
- }
51
- };
52
- var InvalidItemType = class extends Error {
53
- constructor(item) {
54
- super(`Invalid item type (file or dir): ${item}`);
55
- }
56
- };
57
-
58
52
  // src/core/lint.ts
59
53
  var import_path = require("path");
60
54
 
@@ -70,8 +64,11 @@ var FileSystemBackend = {
70
64
  writeFile(path, content) {
71
65
  fs.writeFileSync(path, content, { encoding: "utf-8" });
72
66
  },
73
- makeDirectory(path) {
74
- fs.mkdirSync(path);
67
+ readFile(path) {
68
+ return fs.readFileSync(path, { encoding: "utf-8" });
69
+ },
70
+ makeDirectory(path, recursive) {
71
+ fs.mkdirSync(path, { recursive });
75
72
  },
76
73
  exists(path) {
77
74
  return fs.existsSync(path);
@@ -83,19 +80,27 @@ var DirectoryLint = class {
83
80
  constructor(backend = FileSystemBackend) {
84
81
  this.backend = backend;
85
82
  }
86
- generate(path, schema) {
87
- if (!this.backend.exists(path)) this.backend.makeDirectory(path);
83
+ async generate(path, schema, options) {
84
+ const result = {
85
+ warnings: []
86
+ };
87
+ if (!this.backend.exists(path)) this.backend.makeDirectory(path, options?.recursive);
88
88
  for (const [pattern, node] of Object.entries(schema)) {
89
89
  const isRegexLiteral = pattern.startsWith("/") && pattern.endsWith("/");
90
90
  const name = node.example || (isRegexLiteral ? null : pattern.replace(/\*/g, ""));
91
91
  if (!name) {
92
92
  console.warn(`[Warn] No example field setted to: ${pattern}.`);
93
+ result.warnings.push({
94
+ type: "missing",
95
+ path: (0, import_path.join)(path, name ?? pattern),
96
+ message: `No example field setted ${pattern}`
97
+ });
93
98
  continue;
94
99
  }
95
100
  const fullPath = (0, import_path.join)(path, name);
96
101
  if (node.type === "dir") {
97
102
  if (!this.backend.exists(fullPath)) {
98
- this.backend.makeDirectory(fullPath);
103
+ this.backend.makeDirectory(fullPath, options?.recursive);
99
104
  }
100
105
  if (node.children) {
101
106
  this.generate(fullPath, node.children);
@@ -103,43 +108,2002 @@ var DirectoryLint = class {
103
108
  } else if (node.type === "file") {
104
109
  if (!this.backend.exists(fullPath)) {
105
110
  this.backend.writeFile(fullPath, "");
111
+ } else {
112
+ if (options?.overwrite) {
113
+ this.backend.writeFile(
114
+ fullPath,
115
+ (typeof node.template === "function" ? node.template() : node.template) ?? ""
116
+ );
117
+ }
106
118
  }
107
119
  }
108
120
  }
121
+ return result;
109
122
  }
110
- validate(path, schema) {
111
- this.recursiveValidate(path, schema);
123
+ async validate(path, schema, options) {
124
+ const result = {
125
+ valid: false,
126
+ errors: [],
127
+ warnings: []
128
+ };
129
+ this.recursiveValidate(path, schema, result, options);
130
+ return result;
112
131
  }
113
132
  patternToRegex(pattern) {
114
133
  if (pattern.startsWith("/") && pattern.endsWith("/")) {
115
- return new RegExp(pattern.slice(1 - 1));
134
+ return new RegExp(pattern.slice(1, -1));
116
135
  }
117
136
  const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*");
118
137
  return new RegExp(`^${escaped}$`);
119
138
  }
120
- recursiveValidate(path, schema) {
139
+ async recursiveValidate(path, schema, result, options) {
121
140
  const items = this.backend.getAllItems(path);
122
141
  for (const [pattern, node] of Object.entries(schema)) {
123
142
  const regex = this.patternToRegex(pattern);
124
143
  const matchedItems = items.filter((item) => regex.test(item.name));
125
- if (matchedItems.length === 0 && node.required !== false) throw new NotFoundRequiredItem(pattern);
144
+ if (matchedItems.length === 0 && node.required !== false) {
145
+ result.errors.push({
146
+ type: "missing",
147
+ message: `not found item with pattern: ${pattern}`,
148
+ path: (0, import_path.join)(path, pattern)
149
+ });
150
+ result.valid = false;
151
+ continue;
152
+ }
126
153
  for (const { name, type } of matchedItems) {
154
+ if (options?.ignore.includes(name)) continue;
127
155
  const fullPath = (0, import_path.join)(path, name);
128
156
  if (node.type === "dir") {
129
- if (type !== "dir") throw new InvalidItemType(name);
130
- else if (node.children) {
131
- this.recursiveValidate(fullPath, node.children);
157
+ if (type !== "dir") {
158
+ result.errors.push({
159
+ type: "invalid-type",
160
+ message: "Inconsistent types found",
161
+ path: fullPath
162
+ });
163
+ result.valid = false;
164
+ continue;
165
+ } else if (node.children) {
166
+ this.recursiveValidate(fullPath, node.children, result, options);
132
167
  }
133
- } else if (node.type === "file" && type !== "file") throw new InvalidItemType(name);
168
+ } else if (node.type === "file") {
169
+ if (type !== "file") {
170
+ result.errors.push({
171
+ type: "invalid-type",
172
+ message: "Inconsistent types found",
173
+ path: fullPath
174
+ });
175
+ result.valid = false;
176
+ continue;
177
+ }
178
+ const content = this.backend.readFile(fullPath);
179
+ if (!(await node.validate ? content : true)) {
180
+ result.errors.push({
181
+ type: "custom",
182
+ message: `custom validation error in ${name}`,
183
+ path: fullPath
184
+ });
185
+ }
186
+ }
134
187
  }
135
188
  }
136
189
  }
137
190
  };
191
+
192
+ // src/presets/vite.ts
193
+ function vite(options = {}) {
194
+ const {
195
+ withTypeScript = true,
196
+ withReact = false,
197
+ withVue = false,
198
+ withSvelte = false,
199
+ withTailwind = false,
200
+ withVitest = false
201
+ } = options;
202
+ const schema = {
203
+ "src": {
204
+ type: "dir",
205
+ required: true,
206
+ children: {
207
+ "main.ts": {
208
+ type: "file",
209
+ required: !withTypeScript
210
+ },
211
+ "main.tsx": {
212
+ type: "file",
213
+ required: withTypeScript && withReact
214
+ },
215
+ "App.tsx": {
216
+ type: "file",
217
+ required: withReact
218
+ },
219
+ "App.vue": {
220
+ type: "file",
221
+ required: withVue
222
+ },
223
+ "App.svelte": {
224
+ type: "file",
225
+ required: withSvelte
226
+ },
227
+ "index.css": {
228
+ type: "file",
229
+ required: false
230
+ },
231
+ "assets": {
232
+ type: "dir",
233
+ required: false
234
+ },
235
+ "components": {
236
+ type: "dir",
237
+ required: false
238
+ }
239
+ }
240
+ },
241
+ "public": {
242
+ type: "dir",
243
+ required: true
244
+ },
245
+ "index.html": {
246
+ type: "file",
247
+ required: true
248
+ },
249
+ "package.json": {
250
+ type: "file",
251
+ required: true
252
+ },
253
+ "vite.config.ts": {
254
+ type: "file",
255
+ required: withTypeScript
256
+ },
257
+ "vite.config.js": {
258
+ type: "file",
259
+ required: !withTypeScript
260
+ },
261
+ "tsconfig.json": {
262
+ type: "file",
263
+ required: withTypeScript
264
+ },
265
+ "tsconfig.node.json": {
266
+ type: "file",
267
+ required: withTypeScript
268
+ },
269
+ "tailwind.config.js": {
270
+ type: "file",
271
+ required: withTailwind
272
+ },
273
+ "postcss.config.js": {
274
+ type: "file",
275
+ required: withTailwind
276
+ },
277
+ "vitest.config.ts": {
278
+ type: "file",
279
+ required: withVitest
280
+ },
281
+ ".gitignore": {
282
+ type: "file",
283
+ required: true
284
+ },
285
+ "README.md": {
286
+ type: "file",
287
+ required: false
288
+ }
289
+ };
290
+ return schema;
291
+ }
292
+
293
+ // src/presets/nextjs.ts
294
+ function nextjs(options = {}) {
295
+ const {
296
+ appRouter = true,
297
+ withTypeScript = true,
298
+ withTailwind = false,
299
+ withSrcDir = false,
300
+ withESLint = true
301
+ } = options;
302
+ const ext = withTypeScript ? "tsx" : "jsx";
303
+ const configExt = withTypeScript ? "ts" : "js";
304
+ const baseDir = withSrcDir ? "src" : "";
305
+ const appDirectory = {
306
+ [`layout.${ext}`]: {
307
+ type: "file",
308
+ required: true
309
+ },
310
+ [`page.${ext}`]: {
311
+ type: "file",
312
+ required: true
313
+ },
314
+ "globals.css": {
315
+ type: "file",
316
+ required: false
317
+ },
318
+ "api": {
319
+ type: "dir",
320
+ required: false,
321
+ children: {
322
+ "*": {
323
+ type: "dir",
324
+ example: "users",
325
+ children: {
326
+ [`route.${configExt}`]: {
327
+ type: "file",
328
+ required: true
329
+ }
330
+ }
331
+ }
332
+ }
333
+ }
334
+ };
335
+ const pagesDirectory = {
336
+ [`_app.${ext}`]: {
337
+ type: "file",
338
+ required: true
339
+ },
340
+ [`_document.${ext}`]: {
341
+ type: "file",
342
+ required: false
343
+ },
344
+ [`index.${ext}`]: {
345
+ type: "file",
346
+ required: true
347
+ },
348
+ "api": {
349
+ type: "dir",
350
+ required: false,
351
+ children: {
352
+ "*.ts": {
353
+ type: "file",
354
+ required: false,
355
+ example: "hello.ts"
356
+ }
357
+ }
358
+ }
359
+ };
360
+ const schema = {
361
+ "package.json": {
362
+ type: "file",
363
+ required: true
364
+ },
365
+ [`next.config.${configExt}`]: {
366
+ type: "file",
367
+ required: true
368
+ },
369
+ "tsconfig.json": {
370
+ type: "file",
371
+ required: withTypeScript
372
+ },
373
+ ".eslintrc.json": {
374
+ type: "file",
375
+ required: withESLint
376
+ },
377
+ "tailwind.config.js": {
378
+ type: "file",
379
+ required: withTailwind
380
+ },
381
+ "postcss.config.js": {
382
+ type: "file",
383
+ required: withTailwind
384
+ },
385
+ "public": {
386
+ type: "dir",
387
+ required: true
388
+ },
389
+ ".gitignore": {
390
+ type: "file",
391
+ required: true
392
+ },
393
+ "README.md": {
394
+ type: "file",
395
+ required: false
396
+ }
397
+ };
398
+ if (withSrcDir) {
399
+ schema["src"] = {
400
+ type: "dir",
401
+ required: true,
402
+ children: {
403
+ [appRouter ? "app" : "pages"]: {
404
+ type: "dir",
405
+ required: true,
406
+ children: appRouter ? appDirectory : pagesDirectory
407
+ },
408
+ "components": {
409
+ type: "dir",
410
+ required: false
411
+ }
412
+ }
413
+ };
414
+ } else {
415
+ schema[appRouter ? "app" : "pages"] = {
416
+ type: "dir",
417
+ required: true,
418
+ children: appRouter ? appDirectory : pagesDirectory
419
+ };
420
+ schema["components"] = {
421
+ type: "dir",
422
+ required: false
423
+ };
424
+ }
425
+ return schema;
426
+ }
427
+
428
+ // src/presets/nestjs.ts
429
+ function nestjs(options = {}) {
430
+ const {
431
+ withMicroservices = false,
432
+ withGraphQL = false,
433
+ withPrisma = false,
434
+ withTypeORM = false,
435
+ withSwagger = false,
436
+ withTesting = true
437
+ } = options;
438
+ const schema = {
439
+ "src": {
440
+ type: "dir",
441
+ required: true,
442
+ children: {
443
+ "main.ts": {
444
+ type: "file",
445
+ required: true
446
+ },
447
+ "app.module.ts": {
448
+ type: "file",
449
+ required: true
450
+ },
451
+ "app.controller.ts": {
452
+ type: "file",
453
+ required: true
454
+ },
455
+ "app.controller.spec.ts": {
456
+ type: "file",
457
+ required: withTesting
458
+ },
459
+ "app.service.ts": {
460
+ type: "file",
461
+ required: true
462
+ },
463
+ "*": {
464
+ type: "dir",
465
+ example: "users",
466
+ required: false,
467
+ children: {
468
+ "*.module.ts": {
469
+ type: "file",
470
+ required: false,
471
+ example: "users.module.ts"
472
+ },
473
+ "*.controller.ts": {
474
+ type: "file",
475
+ required: false,
476
+ example: "users.controller.ts"
477
+ },
478
+ "*.service.ts": {
479
+ type: "file",
480
+ required: false,
481
+ example: "users.service.ts"
482
+ },
483
+ "*.controller.spec.ts": {
484
+ type: "file",
485
+ required: false,
486
+ example: "users.controller.spec.ts"
487
+ },
488
+ "*.service.spec.ts": {
489
+ type: "file",
490
+ required: false,
491
+ example: "users.service.spec.ts"
492
+ },
493
+ "dto": {
494
+ type: "dir",
495
+ required: false,
496
+ children: {
497
+ "*.dto.ts": {
498
+ type: "file",
499
+ required: false,
500
+ example: "create-user.dto.ts"
501
+ }
502
+ }
503
+ },
504
+ "entities": {
505
+ type: "dir",
506
+ required: false,
507
+ children: {
508
+ "*.entity.ts": {
509
+ type: "file",
510
+ required: false,
511
+ example: "user.entity.ts"
512
+ }
513
+ }
514
+ }
515
+ }
516
+ },
517
+ "common": {
518
+ type: "dir",
519
+ required: false,
520
+ children: {
521
+ "filters": {
522
+ type: "dir",
523
+ required: false
524
+ },
525
+ "guards": {
526
+ type: "dir",
527
+ required: false
528
+ },
529
+ "interceptors": {
530
+ type: "dir",
531
+ required: false
532
+ },
533
+ "pipes": {
534
+ type: "dir",
535
+ required: false
536
+ },
537
+ "decorators": {
538
+ type: "dir",
539
+ required: false
540
+ }
541
+ }
542
+ },
543
+ "config": {
544
+ type: "dir",
545
+ required: false
546
+ }
547
+ }
548
+ },
549
+ "test": {
550
+ type: "dir",
551
+ required: withTesting,
552
+ children: {
553
+ "app.e2e-spec.ts": {
554
+ type: "file",
555
+ required: true
556
+ },
557
+ "jest-e2e.json": {
558
+ type: "file",
559
+ required: true
560
+ }
561
+ }
562
+ },
563
+ "package.json": {
564
+ type: "file",
565
+ required: true
566
+ },
567
+ "tsconfig.json": {
568
+ type: "file",
569
+ required: true
570
+ },
571
+ "tsconfig.build.json": {
572
+ type: "file",
573
+ required: true
574
+ },
575
+ "nest-cli.json": {
576
+ type: "file",
577
+ required: true
578
+ },
579
+ ".eslintrc.js": {
580
+ type: "file",
581
+ required: true
582
+ },
583
+ ".prettierrc": {
584
+ type: "file",
585
+ required: true
586
+ },
587
+ ".gitignore": {
588
+ type: "file",
589
+ required: true
590
+ },
591
+ "README.md": {
592
+ type: "file",
593
+ required: false
594
+ }
595
+ };
596
+ if (withPrisma) {
597
+ schema["prisma"] = {
598
+ type: "dir",
599
+ required: true,
600
+ children: {
601
+ "schema.prisma": {
602
+ type: "file",
603
+ required: true
604
+ },
605
+ "migrations": {
606
+ type: "dir",
607
+ required: false
608
+ }
609
+ }
610
+ };
611
+ }
612
+ if (withGraphQL && schema.src?.type === "dir" && schema.src.children) {
613
+ schema.src.children["schema.gql"] = {
614
+ type: "file",
615
+ required: true
616
+ };
617
+ schema.src.children["*.resolver.ts"] = {
618
+ type: "file",
619
+ required: false,
620
+ example: "users.resolver.ts"
621
+ };
622
+ }
623
+ if (withMicroservices && schema.src?.type === "dir" && schema.src.children) {
624
+ schema.src.children["microservices"] = {
625
+ type: "dir",
626
+ required: false
627
+ };
628
+ }
629
+ return schema;
630
+ }
631
+
632
+ // src/presets/react.ts
633
+ function react(options = {}) {
634
+ const {
635
+ withTypeScript = true,
636
+ withRedux = false,
637
+ withRouter = false,
638
+ withTesting = true
639
+ } = options;
640
+ const ext = withTypeScript ? "tsx" : "jsx";
641
+ const testExt = withTypeScript ? "tsx" : "js";
642
+ const schema = {
643
+ "src": {
644
+ type: "dir",
645
+ required: true,
646
+ children: {
647
+ [`App.${ext}`]: {
648
+ type: "file",
649
+ required: true
650
+ },
651
+ [`App.test.${testExt}`]: {
652
+ type: "file",
653
+ required: withTesting
654
+ },
655
+ "App.css": {
656
+ type: "file",
657
+ required: false
658
+ },
659
+ [`index.${ext}`]: {
660
+ type: "file",
661
+ required: true
662
+ },
663
+ "index.css": {
664
+ type: "file",
665
+ required: false
666
+ },
667
+ "components": {
668
+ type: "dir",
669
+ required: false
670
+ },
671
+ "hooks": {
672
+ type: "dir",
673
+ required: false
674
+ },
675
+ "utils": {
676
+ type: "dir",
677
+ required: false
678
+ },
679
+ "assets": {
680
+ type: "dir",
681
+ required: false
682
+ }
683
+ }
684
+ },
685
+ "public": {
686
+ type: "dir",
687
+ required: true,
688
+ children: {
689
+ "index.html": {
690
+ type: "file",
691
+ required: true
692
+ },
693
+ "favicon.ico": {
694
+ type: "file",
695
+ required: false
696
+ },
697
+ "manifest.json": {
698
+ type: "file",
699
+ required: false
700
+ }
701
+ }
702
+ },
703
+ "package.json": {
704
+ type: "file",
705
+ required: true
706
+ },
707
+ "tsconfig.json": {
708
+ type: "file",
709
+ required: withTypeScript
710
+ },
711
+ ".gitignore": {
712
+ type: "file",
713
+ required: true
714
+ },
715
+ "README.md": {
716
+ type: "file",
717
+ required: false
718
+ }
719
+ };
720
+ if (withRedux && schema.src?.type === "dir" && schema.src.children) {
721
+ schema.src.children["store"] = {
722
+ type: "dir",
723
+ required: true,
724
+ children: {
725
+ [`index.${withTypeScript ? "ts" : "js"}`]: {
726
+ type: "file",
727
+ required: true
728
+ },
729
+ "slices": {
730
+ type: "dir",
731
+ required: false
732
+ }
733
+ }
734
+ };
735
+ }
736
+ if (withRouter && schema.src?.type === "dir" && schema.src.children) {
737
+ schema.src.children["pages"] = {
738
+ type: "dir",
739
+ required: false
740
+ };
741
+ schema.src.children["routes"] = {
742
+ type: "dir",
743
+ required: false
744
+ };
745
+ }
746
+ return schema;
747
+ }
748
+
749
+ // src/presets/express.ts
750
+ function express(options = {}) {
751
+ const {
752
+ withTypeScript = true,
753
+ withMongoDB = false,
754
+ withPostgreSQL = false,
755
+ withPrisma = false,
756
+ withAuthentication = false,
757
+ withTesting = false
758
+ } = options;
759
+ const ext = withTypeScript ? "ts" : "js";
760
+ const schema = {
761
+ "src": {
762
+ type: "dir",
763
+ required: true,
764
+ children: {
765
+ [`index.${ext}`]: {
766
+ type: "file",
767
+ required: true
768
+ },
769
+ [`app.${ext}`]: {
770
+ type: "file",
771
+ required: true
772
+ },
773
+ "routes": {
774
+ type: "dir",
775
+ required: true,
776
+ children: {
777
+ [`*.${ext}`]: {
778
+ type: "file",
779
+ required: false,
780
+ example: `users.${ext}`
781
+ }
782
+ }
783
+ },
784
+ "controllers": {
785
+ type: "dir",
786
+ required: true,
787
+ children: {
788
+ [`*.${ext}`]: {
789
+ type: "file",
790
+ required: false,
791
+ example: `user.controller.${ext}`
792
+ }
793
+ }
794
+ },
795
+ "services": {
796
+ type: "dir",
797
+ required: false,
798
+ children: {
799
+ [`*.${ext}`]: {
800
+ type: "file",
801
+ required: false,
802
+ example: `user.service.${ext}`
803
+ }
804
+ }
805
+ },
806
+ "models": {
807
+ type: "dir",
808
+ required: withMongoDB || withPostgreSQL,
809
+ children: {
810
+ [`*.${ext}`]: {
811
+ type: "file",
812
+ required: false,
813
+ example: `user.model.${ext}`
814
+ }
815
+ }
816
+ },
817
+ "middlewares": {
818
+ type: "dir",
819
+ required: false,
820
+ children: {
821
+ [`*.${ext}`]: {
822
+ type: "file",
823
+ required: false,
824
+ example: `auth.middleware.${ext}`
825
+ }
826
+ }
827
+ },
828
+ "utils": {
829
+ type: "dir",
830
+ required: false
831
+ },
832
+ "config": {
833
+ type: "dir",
834
+ required: false,
835
+ children: {
836
+ [`database.${ext}`]: {
837
+ type: "file",
838
+ required: withMongoDB || withPostgreSQL
839
+ }
840
+ }
841
+ }
842
+ }
843
+ },
844
+ "tests": {
845
+ type: "dir",
846
+ required: withTesting,
847
+ children: {
848
+ [`*.test.${ext}`]: {
849
+ type: "file",
850
+ required: false,
851
+ example: `user.test.${ext}`
852
+ }
853
+ }
854
+ },
855
+ "package.json": {
856
+ type: "file",
857
+ required: true
858
+ },
859
+ "tsconfig.json": {
860
+ type: "file",
861
+ required: withTypeScript
862
+ },
863
+ ".env": {
864
+ type: "file",
865
+ required: false
866
+ },
867
+ ".env.example": {
868
+ type: "file",
869
+ required: false
870
+ },
871
+ ".gitignore": {
872
+ type: "file",
873
+ required: true
874
+ },
875
+ "README.md": {
876
+ type: "file",
877
+ required: false
878
+ }
879
+ };
880
+ if (withPrisma) {
881
+ schema["prisma"] = {
882
+ type: "dir",
883
+ required: true,
884
+ children: {
885
+ "schema.prisma": {
886
+ type: "file",
887
+ required: true
888
+ },
889
+ "migrations": {
890
+ type: "dir",
891
+ required: false
892
+ }
893
+ }
894
+ };
895
+ }
896
+ if (withAuthentication && schema.src?.type === "dir" && schema.src.children) {
897
+ schema.src.children["auth"] = {
898
+ type: "dir",
899
+ required: true,
900
+ children: {
901
+ [`auth.controller.${ext}`]: {
902
+ type: "file",
903
+ required: true
904
+ },
905
+ [`auth.service.${ext}`]: {
906
+ type: "file",
907
+ required: true
908
+ }
909
+ }
910
+ };
911
+ }
912
+ return schema;
913
+ }
914
+
915
+ // src/presets/vue.ts
916
+ function vue(options = {}) {
917
+ const {
918
+ withTypeScript = true,
919
+ withPinia = false,
920
+ withRouter = false,
921
+ withVuetify = false,
922
+ withTesting = false
923
+ } = options;
924
+ const ext = withTypeScript ? "ts" : "js";
925
+ const schema = {
926
+ "src": {
927
+ type: "dir",
928
+ required: true,
929
+ children: {
930
+ [`main.${ext}`]: {
931
+ type: "file",
932
+ required: true
933
+ },
934
+ "App.vue": {
935
+ type: "file",
936
+ required: true
937
+ },
938
+ "components": {
939
+ type: "dir",
940
+ required: false,
941
+ children: {
942
+ "*.vue": {
943
+ type: "file",
944
+ required: false,
945
+ example: "HelloWorld.vue"
946
+ }
947
+ }
948
+ },
949
+ "views": {
950
+ type: "dir",
951
+ required: withRouter,
952
+ children: {
953
+ "*.vue": {
954
+ type: "file",
955
+ required: false,
956
+ example: "HomeView.vue"
957
+ }
958
+ }
959
+ },
960
+ "composables": {
961
+ type: "dir",
962
+ required: false
963
+ },
964
+ "assets": {
965
+ type: "dir",
966
+ required: false
967
+ }
968
+ }
969
+ },
970
+ "public": {
971
+ type: "dir",
972
+ required: true
973
+ },
974
+ "package.json": {
975
+ type: "file",
976
+ required: true
977
+ },
978
+ "vite.config.ts": {
979
+ type: "file",
980
+ required: withTypeScript
981
+ },
982
+ "vite.config.js": {
983
+ type: "file",
984
+ required: !withTypeScript
985
+ },
986
+ "tsconfig.json": {
987
+ type: "file",
988
+ required: withTypeScript
989
+ },
990
+ "tsconfig.app.json": {
991
+ type: "file",
992
+ required: withTypeScript
993
+ },
994
+ "tsconfig.node.json": {
995
+ type: "file",
996
+ required: withTypeScript
997
+ },
998
+ ".gitignore": {
999
+ type: "file",
1000
+ required: true
1001
+ },
1002
+ "README.md": {
1003
+ type: "file",
1004
+ required: false
1005
+ }
1006
+ };
1007
+ if (withPinia && schema.src?.type === "dir" && schema.src.children) {
1008
+ schema.src.children["stores"] = {
1009
+ type: "dir",
1010
+ required: true,
1011
+ children: {
1012
+ [`*.${ext}`]: {
1013
+ type: "file",
1014
+ required: false,
1015
+ example: `counter.${ext}`
1016
+ }
1017
+ }
1018
+ };
1019
+ }
1020
+ if (withRouter && schema.src?.type === "dir" && schema.src.children) {
1021
+ schema.src.children["router"] = {
1022
+ type: "dir",
1023
+ required: true,
1024
+ children: {
1025
+ [`index.${ext}`]: {
1026
+ type: "file",
1027
+ required: true
1028
+ }
1029
+ }
1030
+ };
1031
+ }
1032
+ if (withTesting) {
1033
+ schema["tests"] = {
1034
+ type: "dir",
1035
+ required: true,
1036
+ children: {
1037
+ "unit": {
1038
+ type: "dir",
1039
+ required: false
1040
+ },
1041
+ "e2e": {
1042
+ type: "dir",
1043
+ required: false
1044
+ }
1045
+ }
1046
+ };
1047
+ schema["vitest.config.ts"] = {
1048
+ type: "file",
1049
+ required: withTypeScript
1050
+ };
1051
+ }
1052
+ return schema;
1053
+ }
1054
+
1055
+ // src/presets/angular.ts
1056
+ function angular(options = {}) {
1057
+ const {
1058
+ withStandalone = true,
1059
+ withNgrx = false,
1060
+ withMaterial = false,
1061
+ withTesting = true
1062
+ } = options;
1063
+ const schema = {
1064
+ "src": {
1065
+ type: "dir",
1066
+ required: true,
1067
+ children: {
1068
+ "main.ts": {
1069
+ type: "file",
1070
+ required: true
1071
+ },
1072
+ "index.html": {
1073
+ type: "file",
1074
+ required: true
1075
+ },
1076
+ "styles.css": {
1077
+ type: "file",
1078
+ required: false
1079
+ },
1080
+ "app": {
1081
+ type: "dir",
1082
+ required: true,
1083
+ children: {
1084
+ "app.component.ts": {
1085
+ type: "file",
1086
+ required: true
1087
+ },
1088
+ "app.component.html": {
1089
+ type: "file",
1090
+ required: true
1091
+ },
1092
+ "app.component.css": {
1093
+ type: "file",
1094
+ required: false
1095
+ },
1096
+ "app.component.spec.ts": {
1097
+ type: "file",
1098
+ required: withTesting
1099
+ },
1100
+ "app.config.ts": {
1101
+ type: "file",
1102
+ required: withStandalone
1103
+ },
1104
+ "app.module.ts": {
1105
+ type: "file",
1106
+ required: !withStandalone
1107
+ },
1108
+ "app.routes.ts": {
1109
+ type: "file",
1110
+ required: withStandalone
1111
+ },
1112
+ "app-routing.module.ts": {
1113
+ type: "file",
1114
+ required: !withStandalone
1115
+ },
1116
+ "components": {
1117
+ type: "dir",
1118
+ required: false
1119
+ },
1120
+ "services": {
1121
+ type: "dir",
1122
+ required: false
1123
+ },
1124
+ "models": {
1125
+ type: "dir",
1126
+ required: false
1127
+ },
1128
+ "guards": {
1129
+ type: "dir",
1130
+ required: false
1131
+ },
1132
+ "interceptors": {
1133
+ type: "dir",
1134
+ required: false
1135
+ }
1136
+ }
1137
+ },
1138
+ "assets": {
1139
+ type: "dir",
1140
+ required: false
1141
+ },
1142
+ "environments": {
1143
+ type: "dir",
1144
+ required: false,
1145
+ children: {
1146
+ "environment.ts": {
1147
+ type: "file",
1148
+ required: true
1149
+ },
1150
+ "environment.development.ts": {
1151
+ type: "file",
1152
+ required: false
1153
+ }
1154
+ }
1155
+ }
1156
+ }
1157
+ },
1158
+ "angular.json": {
1159
+ type: "file",
1160
+ required: true
1161
+ },
1162
+ "package.json": {
1163
+ type: "file",
1164
+ required: true
1165
+ },
1166
+ "tsconfig.json": {
1167
+ type: "file",
1168
+ required: true
1169
+ },
1170
+ "tsconfig.app.json": {
1171
+ type: "file",
1172
+ required: true
1173
+ },
1174
+ "tsconfig.spec.json": {
1175
+ type: "file",
1176
+ required: withTesting
1177
+ },
1178
+ ".editorconfig": {
1179
+ type: "file",
1180
+ required: false
1181
+ },
1182
+ ".gitignore": {
1183
+ type: "file",
1184
+ required: true
1185
+ },
1186
+ "README.md": {
1187
+ type: "file",
1188
+ required: false
1189
+ }
1190
+ };
1191
+ if (withNgrx && schema.src?.type === "dir" && schema.src.children?.app?.type === "dir" && schema.src.children.app.children) {
1192
+ schema.src.children.app.children["store"] = {
1193
+ type: "dir",
1194
+ required: true,
1195
+ children: {
1196
+ "actions": {
1197
+ type: "dir",
1198
+ required: false
1199
+ },
1200
+ "reducers": {
1201
+ type: "dir",
1202
+ required: false
1203
+ },
1204
+ "effects": {
1205
+ type: "dir",
1206
+ required: false
1207
+ },
1208
+ "selectors": {
1209
+ type: "dir",
1210
+ required: false
1211
+ }
1212
+ }
1213
+ };
1214
+ }
1215
+ return schema;
1216
+ }
1217
+
1218
+ // src/presets/nuxt.ts
1219
+ function nuxt(options = {}) {
1220
+ const {
1221
+ withTypeScript = true,
1222
+ withPinia = false,
1223
+ withTailwind = false,
1224
+ withContent = false
1225
+ } = options;
1226
+ const ext = withTypeScript ? "ts" : "js";
1227
+ const schema = {
1228
+ "pages": {
1229
+ type: "dir",
1230
+ required: false,
1231
+ children: {
1232
+ "index.vue": {
1233
+ type: "file",
1234
+ required: false
1235
+ },
1236
+ "*.vue": {
1237
+ type: "file",
1238
+ required: false,
1239
+ example: "about.vue"
1240
+ }
1241
+ }
1242
+ },
1243
+ "components": {
1244
+ type: "dir",
1245
+ required: false,
1246
+ children: {
1247
+ "*.vue": {
1248
+ type: "file",
1249
+ required: false,
1250
+ example: "TheHeader.vue"
1251
+ }
1252
+ }
1253
+ },
1254
+ "layouts": {
1255
+ type: "dir",
1256
+ required: false,
1257
+ children: {
1258
+ "default.vue": {
1259
+ type: "file",
1260
+ required: false
1261
+ }
1262
+ }
1263
+ },
1264
+ "composables": {
1265
+ type: "dir",
1266
+ required: false
1267
+ },
1268
+ "plugins": {
1269
+ type: "dir",
1270
+ required: false
1271
+ },
1272
+ "middleware": {
1273
+ type: "dir",
1274
+ required: false
1275
+ },
1276
+ "server": {
1277
+ type: "dir",
1278
+ required: false,
1279
+ children: {
1280
+ "api": {
1281
+ type: "dir",
1282
+ required: false
1283
+ },
1284
+ "routes": {
1285
+ type: "dir",
1286
+ required: false
1287
+ },
1288
+ "middleware": {
1289
+ type: "dir",
1290
+ required: false
1291
+ }
1292
+ }
1293
+ },
1294
+ "assets": {
1295
+ type: "dir",
1296
+ required: false,
1297
+ children: {
1298
+ "css": {
1299
+ type: "dir",
1300
+ required: false
1301
+ }
1302
+ }
1303
+ },
1304
+ "public": {
1305
+ type: "dir",
1306
+ required: false
1307
+ },
1308
+ "app.vue": {
1309
+ type: "file",
1310
+ required: false
1311
+ },
1312
+ [`nuxt.config.${ext}`]: {
1313
+ type: "file",
1314
+ required: true
1315
+ },
1316
+ "package.json": {
1317
+ type: "file",
1318
+ required: true
1319
+ },
1320
+ "tsconfig.json": {
1321
+ type: "file",
1322
+ required: withTypeScript
1323
+ },
1324
+ ".gitignore": {
1325
+ type: "file",
1326
+ required: true
1327
+ },
1328
+ "README.md": {
1329
+ type: "file",
1330
+ required: false
1331
+ }
1332
+ };
1333
+ if (withPinia) {
1334
+ schema["stores"] = {
1335
+ type: "dir",
1336
+ required: false,
1337
+ children: {
1338
+ [`*.${ext}`]: {
1339
+ type: "file",
1340
+ required: false,
1341
+ example: `counter.${ext}`
1342
+ }
1343
+ }
1344
+ };
1345
+ }
1346
+ if (withTailwind) {
1347
+ schema["tailwind.config.js"] = {
1348
+ type: "file",
1349
+ required: true
1350
+ };
1351
+ }
1352
+ if (withContent) {
1353
+ schema["content"] = {
1354
+ type: "dir",
1355
+ required: true,
1356
+ children: {
1357
+ "*.md": {
1358
+ type: "file",
1359
+ required: false,
1360
+ example: "index.md"
1361
+ }
1362
+ }
1363
+ };
1364
+ }
1365
+ return schema;
1366
+ }
1367
+
1368
+ // src/presets/astro.ts
1369
+ function astro(options = {}) {
1370
+ const {
1371
+ withTypeScript = true,
1372
+ withReact = false,
1373
+ withVue = false,
1374
+ withSvelte = false,
1375
+ withTailwind = false,
1376
+ withMDX = false
1377
+ } = options;
1378
+ const configExt = withTypeScript ? "mjs" : "mjs";
1379
+ const schema = {
1380
+ "src": {
1381
+ type: "dir",
1382
+ required: true,
1383
+ children: {
1384
+ "pages": {
1385
+ type: "dir",
1386
+ required: true,
1387
+ children: {
1388
+ "index.astro": {
1389
+ type: "file",
1390
+ required: true
1391
+ },
1392
+ "*.astro": {
1393
+ type: "file",
1394
+ required: false,
1395
+ example: "about.astro"
1396
+ }
1397
+ }
1398
+ },
1399
+ "components": {
1400
+ type: "dir",
1401
+ required: false,
1402
+ children: {
1403
+ "*.astro": {
1404
+ type: "file",
1405
+ required: false,
1406
+ example: "Card.astro"
1407
+ }
1408
+ }
1409
+ },
1410
+ "layouts": {
1411
+ type: "dir",
1412
+ required: false,
1413
+ children: {
1414
+ "*.astro": {
1415
+ type: "file",
1416
+ required: false,
1417
+ example: "Layout.astro"
1418
+ }
1419
+ }
1420
+ },
1421
+ "content": {
1422
+ type: "dir",
1423
+ required: false,
1424
+ children: {
1425
+ "config.ts": {
1426
+ type: "file",
1427
+ required: false
1428
+ }
1429
+ }
1430
+ },
1431
+ "styles": {
1432
+ type: "dir",
1433
+ required: false
1434
+ },
1435
+ "assets": {
1436
+ type: "dir",
1437
+ required: false
1438
+ }
1439
+ }
1440
+ },
1441
+ "public": {
1442
+ type: "dir",
1443
+ required: true
1444
+ },
1445
+ [`astro.config.${configExt}`]: {
1446
+ type: "file",
1447
+ required: true
1448
+ },
1449
+ "package.json": {
1450
+ type: "file",
1451
+ required: true
1452
+ },
1453
+ "tsconfig.json": {
1454
+ type: "file",
1455
+ required: withTypeScript
1456
+ },
1457
+ ".gitignore": {
1458
+ type: "file",
1459
+ required: true
1460
+ },
1461
+ "README.md": {
1462
+ type: "file",
1463
+ required: false
1464
+ }
1465
+ };
1466
+ if (withTailwind) {
1467
+ schema["tailwind.config.cjs"] = {
1468
+ type: "file",
1469
+ required: true
1470
+ };
1471
+ }
1472
+ if (withMDX && schema.src?.type === "dir" && schema.src.children?.pages?.type === "dir" && schema.src.children.pages.children) {
1473
+ schema.src.children.pages.children["*.mdx"] = {
1474
+ type: "file",
1475
+ required: false,
1476
+ example: "blog.mdx"
1477
+ };
1478
+ }
1479
+ return schema;
1480
+ }
1481
+
1482
+ // src/presets/svelte.ts
1483
+ function svelte(options = {}) {
1484
+ const {
1485
+ withSvelteKit = true,
1486
+ withTypeScript = true,
1487
+ withTailwind = false,
1488
+ withAdapter = "auto"
1489
+ } = options;
1490
+ const ext = withTypeScript ? "ts" : "js";
1491
+ if (withSvelteKit) {
1492
+ const schema = {
1493
+ "src": {
1494
+ type: "dir",
1495
+ required: true,
1496
+ children: {
1497
+ "routes": {
1498
+ type: "dir",
1499
+ required: true,
1500
+ children: {
1501
+ "+page.svelte": {
1502
+ type: "file",
1503
+ required: true
1504
+ },
1505
+ "+layout.svelte": {
1506
+ type: "file",
1507
+ required: false
1508
+ },
1509
+ [`+page.${ext}`]: {
1510
+ type: "file",
1511
+ required: false
1512
+ },
1513
+ [`+layout.${ext}`]: {
1514
+ type: "file",
1515
+ required: false
1516
+ }
1517
+ }
1518
+ },
1519
+ "lib": {
1520
+ type: "dir",
1521
+ required: false,
1522
+ children: {
1523
+ "components": {
1524
+ type: "dir",
1525
+ required: false
1526
+ },
1527
+ [`index.${ext}`]: {
1528
+ type: "file",
1529
+ required: false
1530
+ }
1531
+ }
1532
+ },
1533
+ "app.html": {
1534
+ type: "file",
1535
+ required: true
1536
+ },
1537
+ "app.css": {
1538
+ type: "file",
1539
+ required: false
1540
+ }
1541
+ }
1542
+ },
1543
+ "static": {
1544
+ type: "dir",
1545
+ required: true
1546
+ },
1547
+ "package.json": {
1548
+ type: "file",
1549
+ required: true
1550
+ },
1551
+ [`svelte.config.${ext === "ts" ? "js" : "js"}`]: {
1552
+ type: "file",
1553
+ required: true
1554
+ },
1555
+ [`vite.config.${ext}`]: {
1556
+ type: "file",
1557
+ required: true
1558
+ },
1559
+ "tsconfig.json": {
1560
+ type: "file",
1561
+ required: withTypeScript
1562
+ },
1563
+ ".gitignore": {
1564
+ type: "file",
1565
+ required: true
1566
+ },
1567
+ "README.md": {
1568
+ type: "file",
1569
+ required: false
1570
+ }
1571
+ };
1572
+ if (withTailwind) {
1573
+ schema["tailwind.config.js"] = {
1574
+ type: "file",
1575
+ required: true
1576
+ };
1577
+ schema["postcss.config.js"] = {
1578
+ type: "file",
1579
+ required: true
1580
+ };
1581
+ }
1582
+ return schema;
1583
+ } else {
1584
+ const schema = {
1585
+ "src": {
1586
+ type: "dir",
1587
+ required: true,
1588
+ children: {
1589
+ "App.svelte": {
1590
+ type: "file",
1591
+ required: true
1592
+ },
1593
+ [`main.${ext}`]: {
1594
+ type: "file",
1595
+ required: true
1596
+ },
1597
+ "lib": {
1598
+ type: "dir",
1599
+ required: false
1600
+ },
1601
+ "assets": {
1602
+ type: "dir",
1603
+ required: false
1604
+ }
1605
+ }
1606
+ },
1607
+ "public": {
1608
+ type: "dir",
1609
+ required: true
1610
+ },
1611
+ "package.json": {
1612
+ type: "file",
1613
+ required: true
1614
+ },
1615
+ [`vite.config.${ext}`]: {
1616
+ type: "file",
1617
+ required: true
1618
+ },
1619
+ [`svelte.config.${ext === "ts" ? "js" : "js"}`]: {
1620
+ type: "file",
1621
+ required: true
1622
+ },
1623
+ "tsconfig.json": {
1624
+ type: "file",
1625
+ required: withTypeScript
1626
+ },
1627
+ ".gitignore": {
1628
+ type: "file",
1629
+ required: true
1630
+ },
1631
+ "README.md": {
1632
+ type: "file",
1633
+ required: false
1634
+ }
1635
+ };
1636
+ return schema;
1637
+ }
1638
+ }
1639
+
1640
+ // src/presets/remix.ts
1641
+ function remix(options = {}) {
1642
+ const {
1643
+ withTypeScript = true,
1644
+ withTailwind = false,
1645
+ withPrisma = false
1646
+ } = options;
1647
+ const ext = withTypeScript ? "tsx" : "jsx";
1648
+ const configExt = withTypeScript ? "ts" : "js";
1649
+ const schema = {
1650
+ "app": {
1651
+ type: "dir",
1652
+ required: true,
1653
+ children: {
1654
+ [`entry.client.${ext}`]: {
1655
+ type: "file",
1656
+ required: true
1657
+ },
1658
+ [`entry.server.${ext}`]: {
1659
+ type: "file",
1660
+ required: true
1661
+ },
1662
+ [`root.${ext}`]: {
1663
+ type: "file",
1664
+ required: true
1665
+ },
1666
+ "routes": {
1667
+ type: "dir",
1668
+ required: true,
1669
+ children: {
1670
+ [`_index.${ext}`]: {
1671
+ type: "file",
1672
+ required: true
1673
+ },
1674
+ [`*.${ext}`]: {
1675
+ type: "file",
1676
+ required: false,
1677
+ example: `about.${ext}`
1678
+ }
1679
+ }
1680
+ },
1681
+ "components": {
1682
+ type: "dir",
1683
+ required: false
1684
+ },
1685
+ "utils": {
1686
+ type: "dir",
1687
+ required: false
1688
+ },
1689
+ "styles": {
1690
+ type: "dir",
1691
+ required: false,
1692
+ children: {
1693
+ "*.css": {
1694
+ type: "file",
1695
+ required: false,
1696
+ example: "global.css"
1697
+ }
1698
+ }
1699
+ }
1700
+ }
1701
+ },
1702
+ "public": {
1703
+ type: "dir",
1704
+ required: true,
1705
+ children: {
1706
+ "favicon.ico": {
1707
+ type: "file",
1708
+ required: false
1709
+ }
1710
+ }
1711
+ },
1712
+ "package.json": {
1713
+ type: "file",
1714
+ required: true
1715
+ },
1716
+ [`remix.config.${configExt}`]: {
1717
+ type: "file",
1718
+ required: true
1719
+ },
1720
+ "tsconfig.json": {
1721
+ type: "file",
1722
+ required: withTypeScript
1723
+ },
1724
+ ".gitignore": {
1725
+ type: "file",
1726
+ required: true
1727
+ },
1728
+ "README.md": {
1729
+ type: "file",
1730
+ required: false
1731
+ }
1732
+ };
1733
+ if (withTailwind) {
1734
+ schema["tailwind.config.js"] = {
1735
+ type: "file",
1736
+ required: true
1737
+ };
1738
+ schema["postcss.config.js"] = {
1739
+ type: "file",
1740
+ required: true
1741
+ };
1742
+ }
1743
+ if (withPrisma) {
1744
+ schema["prisma"] = {
1745
+ type: "dir",
1746
+ required: true,
1747
+ children: {
1748
+ "schema.prisma": {
1749
+ type: "file",
1750
+ required: true
1751
+ },
1752
+ "migrations": {
1753
+ type: "dir",
1754
+ required: false
1755
+ }
1756
+ }
1757
+ };
1758
+ }
1759
+ return schema;
1760
+ }
1761
+
1762
+ // src/presets/gatsby.ts
1763
+ function gatsby(options = {}) {
1764
+ const {
1765
+ withTypeScript = true,
1766
+ withContentful = false,
1767
+ withMDX = false,
1768
+ withTailwind = false
1769
+ } = options;
1770
+ const ext = withTypeScript ? "tsx" : "jsx";
1771
+ const configExt = withTypeScript ? "ts" : "js";
1772
+ const schema = {
1773
+ "src": {
1774
+ type: "dir",
1775
+ required: true,
1776
+ children: {
1777
+ "pages": {
1778
+ type: "dir",
1779
+ required: true,
1780
+ children: {
1781
+ [`index.${ext}`]: {
1782
+ type: "file",
1783
+ required: true
1784
+ },
1785
+ [`404.${ext}`]: {
1786
+ type: "file",
1787
+ required: false
1788
+ },
1789
+ [`*.${ext}`]: {
1790
+ type: "file",
1791
+ required: false,
1792
+ example: `about.${ext}`
1793
+ }
1794
+ }
1795
+ },
1796
+ "components": {
1797
+ type: "dir",
1798
+ required: false,
1799
+ children: {
1800
+ [`*.${ext}`]: {
1801
+ type: "file",
1802
+ required: false,
1803
+ example: `layout.${ext}`
1804
+ }
1805
+ }
1806
+ },
1807
+ "templates": {
1808
+ type: "dir",
1809
+ required: false,
1810
+ children: {
1811
+ [`*.${ext}`]: {
1812
+ type: "file",
1813
+ required: false,
1814
+ example: `blog-post.${ext}`
1815
+ }
1816
+ }
1817
+ },
1818
+ "images": {
1819
+ type: "dir",
1820
+ required: false
1821
+ },
1822
+ "styles": {
1823
+ type: "dir",
1824
+ required: false
1825
+ }
1826
+ }
1827
+ },
1828
+ "static": {
1829
+ type: "dir",
1830
+ required: false
1831
+ },
1832
+ "content": {
1833
+ type: "dir",
1834
+ required: withMDX,
1835
+ children: {
1836
+ "*.mdx": {
1837
+ type: "file",
1838
+ required: false,
1839
+ example: "hello-world.mdx"
1840
+ }
1841
+ }
1842
+ },
1843
+ "package.json": {
1844
+ type: "file",
1845
+ required: true
1846
+ },
1847
+ [`gatsby-config.${configExt}`]: {
1848
+ type: "file",
1849
+ required: true
1850
+ },
1851
+ [`gatsby-node.${configExt}`]: {
1852
+ type: "file",
1853
+ required: false
1854
+ },
1855
+ [`gatsby-browser.${configExt}`]: {
1856
+ type: "file",
1857
+ required: false
1858
+ },
1859
+ [`gatsby-ssr.${configExt}`]: {
1860
+ type: "file",
1861
+ required: false
1862
+ },
1863
+ "tsconfig.json": {
1864
+ type: "file",
1865
+ required: withTypeScript
1866
+ },
1867
+ ".gitignore": {
1868
+ type: "file",
1869
+ required: true
1870
+ },
1871
+ "README.md": {
1872
+ type: "file",
1873
+ required: false
1874
+ }
1875
+ };
1876
+ if (withTailwind) {
1877
+ schema["tailwind.config.js"] = {
1878
+ type: "file",
1879
+ required: true
1880
+ };
1881
+ schema["postcss.config.js"] = {
1882
+ type: "file",
1883
+ required: true
1884
+ };
1885
+ }
1886
+ return schema;
1887
+ }
1888
+
1889
+ // src/presets/electron.ts
1890
+ function electron(options = {}) {
1891
+ const {
1892
+ withTypeScript = true,
1893
+ withReact = false,
1894
+ withVue = false,
1895
+ withVite = false
1896
+ } = options;
1897
+ const ext = withTypeScript ? "ts" : "js";
1898
+ const uiExt = withReact ? "tsx" : withVue ? "vue" : withTypeScript ? "ts" : "js";
1899
+ const schema = {
1900
+ "src": {
1901
+ type: "dir",
1902
+ required: true,
1903
+ children: {
1904
+ "main": {
1905
+ type: "dir",
1906
+ required: true,
1907
+ children: {
1908
+ [`main.${ext}`]: {
1909
+ type: "file",
1910
+ required: true
1911
+ },
1912
+ [`preload.${ext}`]: {
1913
+ type: "file",
1914
+ required: true
1915
+ }
1916
+ }
1917
+ },
1918
+ "renderer": {
1919
+ type: "dir",
1920
+ required: true,
1921
+ children: {
1922
+ "index.html": {
1923
+ type: "file",
1924
+ required: true
1925
+ },
1926
+ [`index.${uiExt}`]: {
1927
+ type: "file",
1928
+ required: true
1929
+ },
1930
+ "components": {
1931
+ type: "dir",
1932
+ required: false
1933
+ },
1934
+ "assets": {
1935
+ type: "dir",
1936
+ required: false
1937
+ }
1938
+ }
1939
+ }
1940
+ }
1941
+ },
1942
+ "package.json": {
1943
+ type: "file",
1944
+ required: true
1945
+ },
1946
+ "tsconfig.json": {
1947
+ type: "file",
1948
+ required: withTypeScript
1949
+ },
1950
+ "electron-builder.json": {
1951
+ type: "file",
1952
+ required: false
1953
+ },
1954
+ ".gitignore": {
1955
+ type: "file",
1956
+ required: true
1957
+ },
1958
+ "README.md": {
1959
+ type: "file",
1960
+ required: false
1961
+ }
1962
+ };
1963
+ if (withVite) {
1964
+ schema[`vite.config.${ext}`] = {
1965
+ type: "file",
1966
+ required: true
1967
+ };
1968
+ }
1969
+ return schema;
1970
+ }
1971
+
1972
+ // src/presets/monorepo.ts
1973
+ function monorepo(options = {}) {
1974
+ const {
1975
+ withTypeScript = true,
1976
+ packageManager = "pnpm",
1977
+ withTurborepo = true,
1978
+ withNx = false,
1979
+ withLerna = false
1980
+ } = options;
1981
+ const schema = {
1982
+ "packages": {
1983
+ type: "dir",
1984
+ required: true,
1985
+ children: {
1986
+ "*": {
1987
+ type: "dir",
1988
+ example: "web",
1989
+ required: false,
1990
+ children: {
1991
+ "package.json": {
1992
+ type: "file",
1993
+ required: true
1994
+ },
1995
+ "src": {
1996
+ type: "dir",
1997
+ required: false
1998
+ },
1999
+ "tsconfig.json": {
2000
+ type: "file",
2001
+ required: withTypeScript
2002
+ }
2003
+ }
2004
+ }
2005
+ }
2006
+ },
2007
+ "apps": {
2008
+ type: "dir",
2009
+ required: false,
2010
+ children: {
2011
+ "*": {
2012
+ type: "dir",
2013
+ example: "web",
2014
+ required: false,
2015
+ children: {
2016
+ "package.json": {
2017
+ type: "file",
2018
+ required: true
2019
+ },
2020
+ "src": {
2021
+ type: "dir",
2022
+ required: false
2023
+ }
2024
+ }
2025
+ }
2026
+ }
2027
+ },
2028
+ "package.json": {
2029
+ type: "file",
2030
+ required: true
2031
+ },
2032
+ "tsconfig.json": {
2033
+ type: "file",
2034
+ required: withTypeScript
2035
+ },
2036
+ ".gitignore": {
2037
+ type: "file",
2038
+ required: true
2039
+ },
2040
+ "README.md": {
2041
+ type: "file",
2042
+ required: false
2043
+ }
2044
+ };
2045
+ if (packageManager === "pnpm") {
2046
+ schema["pnpm-workspace.yaml"] = {
2047
+ type: "file",
2048
+ required: true
2049
+ };
2050
+ schema["pnpm-lock.yaml"] = {
2051
+ type: "file",
2052
+ required: false
2053
+ };
2054
+ }
2055
+ if (packageManager === "yarn") {
2056
+ schema["yarn.lock"] = {
2057
+ type: "file",
2058
+ required: false
2059
+ };
2060
+ }
2061
+ if (packageManager === "npm") {
2062
+ schema["package-lock.json"] = {
2063
+ type: "file",
2064
+ required: false
2065
+ };
2066
+ }
2067
+ if (withTurborepo) {
2068
+ schema["turbo.json"] = {
2069
+ type: "file",
2070
+ required: true
2071
+ };
2072
+ }
2073
+ if (withNx) {
2074
+ schema["nx.json"] = {
2075
+ type: "file",
2076
+ required: true
2077
+ };
2078
+ schema[".nxignore"] = {
2079
+ type: "file",
2080
+ required: false
2081
+ };
2082
+ }
2083
+ if (withLerna) {
2084
+ schema["lerna.json"] = {
2085
+ type: "file",
2086
+ required: true
2087
+ };
2088
+ }
2089
+ return schema;
2090
+ }
138
2091
  // Annotate the CommonJS export names for ESM import in node:
139
2092
  0 && (module.exports = {
140
2093
  DirectoryLint,
141
2094
  FileSystemBackend,
142
- InvalidItemType,
143
- InvalidLint,
144
- NotFoundRequiredItem
2095
+ angular,
2096
+ astro,
2097
+ electron,
2098
+ express,
2099
+ gatsby,
2100
+ monorepo,
2101
+ nestjs,
2102
+ nextjs,
2103
+ nuxt,
2104
+ react,
2105
+ remix,
2106
+ svelte,
2107
+ vite,
2108
+ vue
145
2109
  });