wlmaker 1.2.3 → 1.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +120 -281
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -170,7 +170,7 @@ var TIER_PATTERNS = {
|
|
|
170
170
|
atom: ["single-public", "single-factory"],
|
|
171
171
|
molecule: ["single", "subdirectory-parts", "subdirectory-widgets"],
|
|
172
172
|
organism: ["subdirectory-show", "single"],
|
|
173
|
-
template: ["simple"
|
|
173
|
+
template: ["simple"]
|
|
174
174
|
};
|
|
175
175
|
var TIER_PLURAL = {
|
|
176
176
|
atom: "atoms",
|
|
@@ -190,9 +190,8 @@ var PATTERN_LABELS = {
|
|
|
190
190
|
"subdirectory-parts": "Subdirectory with part files",
|
|
191
191
|
single: "Single file",
|
|
192
192
|
"subdirectory-widgets": "Subdirectory with widgets/ and utils/",
|
|
193
|
-
"subdirectory-show": "Subdirectory with
|
|
194
|
-
simple: "Template simple (i18n +
|
|
195
|
-
"config-data-callbacks": "Template with Config/Data/Callbacks"
|
|
193
|
+
"subdirectory-show": "Subdirectory with factories + variant/i18n/skeleton parts",
|
|
194
|
+
simple: "Template simple (i18n + skeleton)"
|
|
196
195
|
};
|
|
197
196
|
function normalizeTier(input) {
|
|
198
197
|
const normalized = input.toLowerCase().replace(/s$/, "");
|
|
@@ -459,13 +458,13 @@ class Wl${pascal} extends StatelessWidget {
|
|
|
459
458
|
super.key,
|
|
460
459
|
});
|
|
461
460
|
|
|
462
|
-
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
463
|
-
|
|
464
461
|
@override
|
|
465
462
|
Widget build(BuildContext context) {
|
|
466
463
|
final theme = context.theme;
|
|
467
464
|
return const SizedBox.shrink();
|
|
468
465
|
}
|
|
466
|
+
|
|
467
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
469
468
|
}
|
|
470
469
|
|
|
471
470
|
class _Wl${pascal}SkeletonFactory {
|
|
@@ -480,7 +479,7 @@ function moleculeTemplateB(name, pascal) {
|
|
|
480
479
|
main: `import 'package:design_system/design_system.dart';
|
|
481
480
|
import 'package:flutter/material.dart';
|
|
482
481
|
|
|
483
|
-
part '${name}_type.dart';
|
|
482
|
+
part 'wl_${name}_type.dart';
|
|
484
483
|
|
|
485
484
|
class Wl${pascal} extends StatelessWidget {
|
|
486
485
|
final Wl${pascal}Variant variant;
|
|
@@ -490,13 +489,13 @@ class Wl${pascal} extends StatelessWidget {
|
|
|
490
489
|
super.key,
|
|
491
490
|
});
|
|
492
491
|
|
|
493
|
-
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
494
|
-
|
|
495
492
|
@override
|
|
496
493
|
Widget build(BuildContext context) {
|
|
497
494
|
final theme = context.theme;
|
|
498
495
|
return const SizedBox.shrink();
|
|
499
496
|
}
|
|
497
|
+
|
|
498
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
500
499
|
}
|
|
501
500
|
|
|
502
501
|
class _Wl${pascal}SkeletonFactory {
|
|
@@ -505,7 +504,7 @@ class _Wl${pascal}SkeletonFactory {
|
|
|
505
504
|
Widget call({Key? key}) => const SizedBox.shrink();
|
|
506
505
|
}
|
|
507
506
|
`,
|
|
508
|
-
type: `part of '${name}.dart';
|
|
507
|
+
type: `part of 'wl_${name}.dart';
|
|
509
508
|
|
|
510
509
|
enum Wl${pascal}Variant {
|
|
511
510
|
primary,
|
|
@@ -525,13 +524,13 @@ import 'package:flutter/material.dart';
|
|
|
525
524
|
class Wl${pascal} extends StatelessWidget {
|
|
526
525
|
const Wl${pascal}({super.key});
|
|
527
526
|
|
|
528
|
-
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
529
|
-
|
|
530
527
|
@override
|
|
531
528
|
Widget build(BuildContext context) {
|
|
532
529
|
final theme = context.theme;
|
|
533
530
|
return const SizedBox.shrink();
|
|
534
531
|
}
|
|
532
|
+
|
|
533
|
+
static const skeleton = _Wl${pascal}SkeletonFactory();
|
|
535
534
|
}
|
|
536
535
|
|
|
537
536
|
class _Wl${pascal}SkeletonFactory {
|
|
@@ -546,28 +545,82 @@ function organismTemplateA(name, pascal) {
|
|
|
546
545
|
main: `import 'package:design_system/design_system.dart';
|
|
547
546
|
import 'package:flutter/material.dart';
|
|
548
547
|
|
|
549
|
-
part '${name}
|
|
548
|
+
part 'wl_${name}_variant.dart';
|
|
549
|
+
part 'wl_${name}_i18n.dart';
|
|
550
|
+
part 'wl_${name}_skeleton.dart';
|
|
550
551
|
|
|
551
|
-
class Wl${pascal} {
|
|
552
|
-
Wl${pascal}
|
|
552
|
+
class Wl${pascal} extends StatelessWidget {
|
|
553
|
+
factory Wl${pascal}({
|
|
554
|
+
required Wl${pascal}I18n i18n,
|
|
555
|
+
Key? key,
|
|
556
|
+
}) {
|
|
557
|
+
return Wl${pascal}._(
|
|
558
|
+
key: key,
|
|
559
|
+
variant: Wl${pascal}Variant.primary,
|
|
560
|
+
i18n: i18n,
|
|
561
|
+
);
|
|
562
|
+
}
|
|
553
563
|
|
|
554
|
-
|
|
555
|
-
required
|
|
564
|
+
factory Wl${pascal}.secondary({
|
|
565
|
+
required Wl${pascal}I18n i18n,
|
|
566
|
+
Key? key,
|
|
556
567
|
}) {
|
|
557
|
-
return
|
|
558
|
-
|
|
559
|
-
|
|
568
|
+
return Wl${pascal}._(
|
|
569
|
+
key: key,
|
|
570
|
+
variant: Wl${pascal}Variant.secondary,
|
|
571
|
+
i18n: i18n,
|
|
560
572
|
);
|
|
561
573
|
}
|
|
574
|
+
|
|
575
|
+
const Wl${pascal}._({
|
|
576
|
+
required this.variant,
|
|
577
|
+
required this.i18n,
|
|
578
|
+
super.key,
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
final Wl${pascal}Variant variant;
|
|
582
|
+
final Wl${pascal}I18n i18n;
|
|
583
|
+
|
|
584
|
+
@override
|
|
585
|
+
Widget build(BuildContext context) {
|
|
586
|
+
final theme = context.theme;
|
|
587
|
+
return const SizedBox.shrink();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
`,
|
|
591
|
+
variant: `part of 'wl_${name}.dart';
|
|
592
|
+
|
|
593
|
+
enum Wl${pascal}Variant {
|
|
594
|
+
primary,
|
|
595
|
+
secondary,
|
|
562
596
|
}
|
|
563
597
|
`,
|
|
564
|
-
|
|
598
|
+
i18n: `part of 'wl_${name}.dart';
|
|
599
|
+
|
|
600
|
+
class Wl${pascal}I18n {
|
|
601
|
+
const Wl${pascal}I18n({
|
|
602
|
+
this.title = '',
|
|
603
|
+
this.subtitle = '',
|
|
604
|
+
});
|
|
605
|
+
|
|
606
|
+
final String title;
|
|
607
|
+
final String subtitle;
|
|
608
|
+
}
|
|
609
|
+
`,
|
|
610
|
+
skeleton: `part of 'wl_${name}.dart';
|
|
611
|
+
|
|
612
|
+
class Wl${pascal}Skeleton extends StatelessWidget {
|
|
613
|
+
const Wl${pascal}Skeleton({super.key});
|
|
565
614
|
|
|
566
|
-
class _Wl${pascal}Content extends StatelessWidget {
|
|
567
615
|
@override
|
|
568
616
|
Widget build(BuildContext context) {
|
|
569
617
|
final theme = context.theme;
|
|
570
|
-
|
|
618
|
+
|
|
619
|
+
return WlSkeleton(
|
|
620
|
+
width: double.infinity,
|
|
621
|
+
height: 120,
|
|
622
|
+
radius: theme.borderRadius.radiusL,
|
|
623
|
+
);
|
|
571
624
|
}
|
|
572
625
|
}
|
|
573
626
|
`
|
|
@@ -606,232 +659,51 @@ function templateA(name, pascal) {
|
|
|
606
659
|
main: `import 'package:design_system/design_system.dart';
|
|
607
660
|
import 'package:flutter/material.dart';
|
|
608
661
|
|
|
609
|
-
part '${name}_i18n.dart';
|
|
610
|
-
part '${name}
|
|
611
|
-
part '${name}_skeleton.dart';
|
|
612
|
-
|
|
613
|
-
class Wl${pascal}Template extends StatefulWidget {
|
|
614
|
-
const Wl${pascal}Template({super.key});
|
|
615
|
-
|
|
616
|
-
@override
|
|
617
|
-
State<Wl${pascal}Template> createState() => _Wl${pascal}TemplateState();
|
|
618
|
-
}
|
|
619
|
-
|
|
620
|
-
class _Wl${pascal}TemplateState extends State<Wl${pascal}Template> {
|
|
621
|
-
bool _isLoading = true;
|
|
622
|
-
|
|
623
|
-
@override
|
|
624
|
-
void initState() {
|
|
625
|
-
super.initState();
|
|
626
|
-
_loadData();
|
|
627
|
-
}
|
|
628
|
-
|
|
629
|
-
Future<void> _loadData() async {
|
|
630
|
-
// TODO: Load data
|
|
631
|
-
setState(() => _isLoading = false);
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
@override
|
|
635
|
-
Widget build(BuildContext context) {
|
|
636
|
-
return Scaffold(
|
|
637
|
-
appBar: AppBar(title: Text(Wl${pascal}I18n.title)),
|
|
638
|
-
body: AnimatedSwitcher(
|
|
639
|
-
duration: const Duration(milliseconds: 300),
|
|
640
|
-
child: _isLoading
|
|
641
|
-
? const _Wl${pascal}Skeleton()
|
|
642
|
-
: const _Wl${pascal}Body(),
|
|
643
|
-
),
|
|
644
|
-
);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
`,
|
|
648
|
-
i18n: `part of '${name}_template.dart';
|
|
649
|
-
|
|
650
|
-
class Wl${pascal}I18n extends Equatable {
|
|
651
|
-
final String title;
|
|
652
|
-
|
|
653
|
-
const Wl${pascal}I18n({
|
|
654
|
-
this.title = '',
|
|
655
|
-
});
|
|
656
|
-
|
|
657
|
-
static const empty = Wl${pascal}I18n();
|
|
658
|
-
|
|
659
|
-
@override
|
|
660
|
-
List<Object?> get props => [title];
|
|
661
|
-
}
|
|
662
|
-
`,
|
|
663
|
-
body: `part of '${name}_template.dart';
|
|
664
|
-
|
|
665
|
-
class _Wl${pascal}Body extends StatelessWidget {
|
|
666
|
-
const _Wl${pascal}Body();
|
|
667
|
-
|
|
668
|
-
@override
|
|
669
|
-
Widget build(BuildContext context) {
|
|
670
|
-
final theme = context.theme;
|
|
671
|
-
return const SizedBox.shrink();
|
|
672
|
-
}
|
|
673
|
-
}
|
|
674
|
-
`,
|
|
675
|
-
skeleton: `part of '${name}_template.dart';
|
|
676
|
-
|
|
677
|
-
class _Wl${pascal}Skeleton extends StatelessWidget {
|
|
678
|
-
const _Wl${pascal}Skeleton();
|
|
679
|
-
|
|
680
|
-
@override
|
|
681
|
-
Widget build(BuildContext context) {
|
|
682
|
-
return const Center(
|
|
683
|
-
child: CircularProgressIndicator(),
|
|
684
|
-
);
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
`
|
|
688
|
-
};
|
|
689
|
-
}
|
|
690
|
-
function templateB(name, pascal) {
|
|
691
|
-
return {
|
|
692
|
-
main: `import 'package:design_system/design_system.dart';
|
|
693
|
-
import 'package:flutter/material.dart';
|
|
694
|
-
|
|
695
|
-
import 'contracts/${name}_callbacks.dart';
|
|
696
|
-
import 'contracts/${name}_config.dart';
|
|
697
|
-
import 'contracts/${name}_data.dart';
|
|
698
|
-
|
|
699
|
-
part '${name}_i18n.dart';
|
|
700
|
-
part '${name}_body.dart';
|
|
701
|
-
part '${name}_skeleton.dart';
|
|
702
|
-
|
|
703
|
-
class Wl${pascal}Template extends StatefulWidget {
|
|
704
|
-
final Wl${pascal}Config config;
|
|
705
|
-
final Wl${pascal}Callbacks callbacks;
|
|
662
|
+
part 'wl_${name}_i18n.dart';
|
|
663
|
+
part 'wl_${name}_skeleton.dart';
|
|
706
664
|
|
|
665
|
+
class Wl${pascal}Template extends StatelessWidget {
|
|
707
666
|
const Wl${pascal}Template({
|
|
708
|
-
required this.
|
|
709
|
-
|
|
667
|
+
required this.i18n,
|
|
668
|
+
this.isLoading = false,
|
|
710
669
|
super.key,
|
|
711
670
|
});
|
|
712
671
|
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
}
|
|
716
|
-
|
|
717
|
-
class _Wl${pascal}TemplateState extends State<Wl${pascal}Template> {
|
|
718
|
-
Wl${pascal}Data _data = const Wl${pascal}Data();
|
|
719
|
-
bool _isLoading = true;
|
|
720
|
-
|
|
721
|
-
@override
|
|
722
|
-
void initState() {
|
|
723
|
-
super.initState();
|
|
724
|
-
_loadData();
|
|
725
|
-
}
|
|
726
|
-
|
|
727
|
-
Future<void> _loadData() async {
|
|
728
|
-
// TODO: Load data
|
|
729
|
-
setState(() => _isLoading = false);
|
|
730
|
-
}
|
|
672
|
+
final Wl${pascal}I18n i18n;
|
|
673
|
+
final bool isLoading;
|
|
731
674
|
|
|
732
675
|
@override
|
|
733
676
|
Widget build(BuildContext context) {
|
|
734
677
|
return Scaffold(
|
|
735
|
-
appBar:
|
|
736
|
-
body:
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
? const _Wl${pascal}Skeleton()
|
|
740
|
-
: _Wl${pascal}Body(
|
|
741
|
-
data: _data,
|
|
742
|
-
callbacks: widget.callbacks,
|
|
743
|
-
),
|
|
744
|
-
),
|
|
678
|
+
appBar: WlTopBar(title: i18n.title),
|
|
679
|
+
body: isLoading
|
|
680
|
+
? const Wl${pascal}Skeleton()
|
|
681
|
+
: const SizedBox.shrink(),
|
|
745
682
|
);
|
|
746
683
|
}
|
|
747
684
|
}
|
|
748
685
|
`,
|
|
749
|
-
i18n: `part of '${name}_template.dart';
|
|
686
|
+
i18n: `part of 'wl_${name}_template.dart';
|
|
750
687
|
|
|
751
|
-
class Wl${pascal}I18n
|
|
688
|
+
class Wl${pascal}I18n {
|
|
689
|
+
const Wl${pascal}I18n({this.title = ''});
|
|
752
690
|
final String title;
|
|
753
|
-
|
|
754
|
-
const Wl${pascal}I18n({
|
|
755
|
-
this.title = '',
|
|
756
|
-
});
|
|
757
|
-
|
|
758
|
-
static const empty = Wl${pascal}I18n();
|
|
759
|
-
|
|
760
|
-
@override
|
|
761
|
-
List<Object?> get props => [title];
|
|
762
|
-
}
|
|
763
|
-
`,
|
|
764
|
-
body: `part of '${name}_template.dart';
|
|
765
|
-
|
|
766
|
-
class _Wl${pascal}Body extends StatelessWidget {
|
|
767
|
-
final Wl${pascal}Data data;
|
|
768
|
-
final Wl${pascal}Callbacks callbacks;
|
|
769
|
-
|
|
770
|
-
const _Wl${pascal}Body({
|
|
771
|
-
required this.data,
|
|
772
|
-
required this.callbacks,
|
|
773
|
-
});
|
|
774
|
-
|
|
775
|
-
@override
|
|
776
|
-
Widget build(BuildContext context) {
|
|
777
|
-
final theme = context.theme;
|
|
778
|
-
return const SizedBox.shrink();
|
|
779
|
-
}
|
|
780
691
|
}
|
|
781
692
|
`,
|
|
782
|
-
skeleton: `part of '${name}_template.dart';
|
|
783
|
-
|
|
784
|
-
class _Wl${pascal}Skeleton extends StatelessWidget {
|
|
785
|
-
const _Wl${pascal}Skeleton();
|
|
693
|
+
skeleton: `part of 'wl_${name}_template.dart';
|
|
786
694
|
|
|
695
|
+
class Wl${pascal}Skeleton extends StatelessWidget {
|
|
696
|
+
const Wl${pascal}Skeleton({super.key});
|
|
787
697
|
@override
|
|
788
698
|
Widget build(BuildContext context) {
|
|
789
|
-
return const
|
|
790
|
-
child: CircularProgressIndicator(),
|
|
791
|
-
);
|
|
699
|
+
return const WlSkeleton(width: double.infinity, height: 200);
|
|
792
700
|
}
|
|
793
701
|
}
|
|
794
|
-
`,
|
|
795
|
-
callbacks: `import 'package:flutter/material.dart';
|
|
796
|
-
|
|
797
|
-
class Wl${pascal}Callbacks {
|
|
798
|
-
final VoidCallback onBack;
|
|
799
|
-
final VoidCallback onRetry;
|
|
800
|
-
|
|
801
|
-
const Wl${pascal}Callbacks({
|
|
802
|
-
required this.onBack,
|
|
803
|
-
required this.onRetry,
|
|
804
|
-
});
|
|
805
|
-
}
|
|
806
|
-
`,
|
|
807
|
-
config: `import 'package:flutter/material.dart';
|
|
808
|
-
import '../${name}_template.dart';
|
|
809
|
-
|
|
810
|
-
class Wl${pascal}Config extends Equatable {
|
|
811
|
-
final Wl${pascal}I18n i18n;
|
|
812
|
-
final bool showAppBar;
|
|
813
|
-
|
|
814
|
-
const Wl${pascal}Config({
|
|
815
|
-
this.i18n = Wl${pascal}I18n.empty,
|
|
816
|
-
this.showAppBar = true,
|
|
817
|
-
});
|
|
818
|
-
|
|
819
|
-
@override
|
|
820
|
-
List<Object?> get props => [i18n, showAppBar];
|
|
821
|
-
}
|
|
822
|
-
`,
|
|
823
|
-
data: `import 'package:flutter/material.dart';
|
|
824
|
-
|
|
825
|
-
class Wl${pascal}Data extends Equatable {
|
|
826
|
-
const Wl${pascal}Data();
|
|
827
|
-
|
|
828
|
-
@override
|
|
829
|
-
List<Object?> get props => [];
|
|
830
|
-
}
|
|
831
702
|
`
|
|
832
703
|
};
|
|
833
704
|
}
|
|
834
|
-
function useCaseTemplate(name, pascal, tierPlural3) {
|
|
705
|
+
function useCaseTemplate(name, pascal, tierPlural3, tier) {
|
|
706
|
+
const widgetCall = tier === "organism" || tier === "template" ? `const Wl${pascal}(i18n: Wl${pascal}I18n())` : `const Wl${pascal}()`;
|
|
835
707
|
return `import 'package:design_system/design_system.dart';
|
|
836
708
|
import 'package:flutter/material.dart';
|
|
837
709
|
import 'package:widgetbook/widgetbook.dart';
|
|
@@ -843,7 +715,7 @@ import 'package:widgetbook_annotation/widgetbook_annotation.dart' as widgetbook;
|
|
|
843
715
|
path: 'wl_design_system/${tierPlural3}/wl_${name}',
|
|
844
716
|
)
|
|
845
717
|
Widget useCaseWl${pascal}(BuildContext context) {
|
|
846
|
-
return
|
|
718
|
+
return ${widgetCall};
|
|
847
719
|
}
|
|
848
720
|
`;
|
|
849
721
|
}
|
|
@@ -895,7 +767,8 @@ async function createWidget(name, tierInput, options) {
|
|
|
895
767
|
break;
|
|
896
768
|
}
|
|
897
769
|
const barrelFileName = `${plural}.dart`;
|
|
898
|
-
const
|
|
770
|
+
const isSubdirectory = tier === "molecule" && pattern === "subdirectory-parts" || tier === "molecule" && pattern === "subdirectory-widgets" || tier === "organism" && pattern === "subdirectory-show";
|
|
771
|
+
const exportLine = tier === "template" ? `export '${cleanName}/wl_${cleanName}_template.dart';` : isSubdirectory ? `export '${fileName}/${fileName}.dart';` : `export '${fileName}.dart';`;
|
|
899
772
|
updateSortedBarrelFile(tierDir, barrelFileName, exportLine);
|
|
900
773
|
console.log(chalk2.green(`Widget "Wl${pascal}" created in ${plural}/`));
|
|
901
774
|
}
|
|
@@ -962,8 +835,13 @@ function createOrganismFiles(tierDir, name, pascal, fileName, pattern) {
|
|
|
962
835
|
const tpl = organismTemplateA(name, pascal);
|
|
963
836
|
fs6.writeFileSync(path6.join(dir, `${fileName}.dart`), tpl.main);
|
|
964
837
|
fs6.writeFileSync(
|
|
965
|
-
path6.join(dir, `${fileName}
|
|
966
|
-
tpl.
|
|
838
|
+
path6.join(dir, `${fileName}_variant.dart`),
|
|
839
|
+
tpl.variant
|
|
840
|
+
);
|
|
841
|
+
fs6.writeFileSync(path6.join(dir, `${fileName}_i18n.dart`), tpl.i18n);
|
|
842
|
+
fs6.writeFileSync(
|
|
843
|
+
path6.join(dir, `${fileName}_skeleton.dart`),
|
|
844
|
+
tpl.skeleton
|
|
967
845
|
);
|
|
968
846
|
break;
|
|
969
847
|
}
|
|
@@ -981,58 +859,19 @@ function createOrganismFiles(tierDir, name, pascal, fileName, pattern) {
|
|
|
981
859
|
function createTemplateFiles(tierDir, name, pascal, fileName, pattern) {
|
|
982
860
|
const dir = path6.join(tierDir, name);
|
|
983
861
|
fs6.mkdirSync(dir, { recursive: true });
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
path6.join(dir, `wl_${name}_skeleton.dart`),
|
|
998
|
-
tpl.skeleton
|
|
999
|
-
);
|
|
1000
|
-
break;
|
|
1001
|
-
}
|
|
1002
|
-
case "config-data-callbacks": {
|
|
1003
|
-
const tpl = templateB(name, pascal);
|
|
1004
|
-
fs6.writeFileSync(
|
|
1005
|
-
path6.join(dir, `wl_${name}_template.dart`),
|
|
1006
|
-
tpl.main
|
|
1007
|
-
);
|
|
1008
|
-
fs6.writeFileSync(
|
|
1009
|
-
path6.join(dir, `wl_${name}_i18n.dart`),
|
|
1010
|
-
tpl.i18n
|
|
1011
|
-
);
|
|
1012
|
-
fs6.writeFileSync(path6.join(dir, `wl_${name}_body.dart`), tpl.body);
|
|
1013
|
-
fs6.writeFileSync(
|
|
1014
|
-
path6.join(dir, `wl_${name}_skeleton.dart`),
|
|
1015
|
-
tpl.skeleton
|
|
1016
|
-
);
|
|
1017
|
-
const contractsDir = path6.join(dir, "contracts");
|
|
1018
|
-
fs6.mkdirSync(contractsDir, { recursive: true });
|
|
1019
|
-
fs6.writeFileSync(
|
|
1020
|
-
path6.join(contractsDir, `wl_${name}_callbacks.dart`),
|
|
1021
|
-
tpl.callbacks
|
|
1022
|
-
);
|
|
1023
|
-
fs6.writeFileSync(
|
|
1024
|
-
path6.join(contractsDir, `wl_${name}_config.dart`),
|
|
1025
|
-
tpl.config
|
|
1026
|
-
);
|
|
1027
|
-
fs6.writeFileSync(
|
|
1028
|
-
path6.join(contractsDir, `wl_${name}_data.dart`),
|
|
1029
|
-
tpl.data
|
|
1030
|
-
);
|
|
1031
|
-
break;
|
|
1032
|
-
}
|
|
1033
|
-
default:
|
|
1034
|
-
throw new Error(`Unknown template pattern: ${pattern}`);
|
|
1035
|
-
}
|
|
862
|
+
const tpl = templateA(name, pascal);
|
|
863
|
+
fs6.writeFileSync(
|
|
864
|
+
path6.join(dir, `wl_${name}_template.dart`),
|
|
865
|
+
tpl.main
|
|
866
|
+
);
|
|
867
|
+
fs6.writeFileSync(
|
|
868
|
+
path6.join(dir, `wl_${name}_i18n.dart`),
|
|
869
|
+
tpl.i18n
|
|
870
|
+
);
|
|
871
|
+
fs6.writeFileSync(
|
|
872
|
+
path6.join(dir, `wl_${name}_skeleton.dart`),
|
|
873
|
+
tpl.skeleton
|
|
874
|
+
);
|
|
1036
875
|
}
|
|
1037
876
|
|
|
1038
877
|
// src/core/create-usecase.ts
|
|
@@ -1086,7 +925,7 @@ async function createUseCase(name, tierInput, options) {
|
|
|
1086
925
|
}
|
|
1087
926
|
fs7.writeFileSync(
|
|
1088
927
|
useCasePath,
|
|
1089
|
-
useCaseTemplate(cleanName, pascal, plural)
|
|
928
|
+
useCaseTemplate(cleanName, pascal, plural, tier)
|
|
1090
929
|
);
|
|
1091
930
|
console.log(
|
|
1092
931
|
chalk3.green(
|