@domain-first/project-structure 2.0.1 → 2.1.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/dist/index.cjs +27 -6
- package/dist/index.js +27 -6
- package/dist/use-cases/index.d.ts +1 -0
- package/dist/use-cases/scaffold-react-page.d.ts +2 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -895,6 +895,23 @@ export const wire${naming.ClassName}UseCase = wireClass(
|
|
|
895
895
|
|
|
896
896
|
`.trim());
|
|
897
897
|
};
|
|
898
|
+
const scaffoldReactPage = async (presentationReactFolder)=>{
|
|
899
|
+
const name = await (0, prompts_namespaceObject.input)({
|
|
900
|
+
message: 'Provide name:'
|
|
901
|
+
});
|
|
902
|
+
const { ClassName, fileName } = new UnknownFormatNaming(name);
|
|
903
|
+
presentationReactFolder.subitem([
|
|
904
|
+
'pages'
|
|
905
|
+
]).createFile(`${fileName}-page.tsx`, `
|
|
906
|
+
import { type FC } from 'react'
|
|
907
|
+
|
|
908
|
+
export type ${ClassName}PageProps = {}
|
|
909
|
+
|
|
910
|
+
export const ${ClassName}Page: FC<${ClassName}PageProps> = (props) => {
|
|
911
|
+
return <></>
|
|
912
|
+
}
|
|
913
|
+
`.trim());
|
|
914
|
+
};
|
|
898
915
|
const scaffoldReactWidget = async (presentationReactFolder)=>{
|
|
899
916
|
const widgetName = await (0, prompts_namespaceObject.input)({
|
|
900
917
|
message: 'Name: '
|
|
@@ -1032,19 +1049,23 @@ const main = async ()=>{
|
|
|
1032
1049
|
switch(action){
|
|
1033
1050
|
case 'Scaffold React module':
|
|
1034
1051
|
{
|
|
1052
|
+
const reactFolder = new Folder(rootPath).subitem([
|
|
1053
|
+
ConfigFile.Instance.data.rootFolder,
|
|
1054
|
+
'presentation',
|
|
1055
|
+
'react'
|
|
1056
|
+
]);
|
|
1035
1057
|
const action = await (0, prompts_namespaceObject.select)({
|
|
1036
1058
|
message: 'Module: ',
|
|
1037
1059
|
choices: [
|
|
1038
|
-
'New widget'
|
|
1060
|
+
'New widget',
|
|
1061
|
+
'New page'
|
|
1039
1062
|
]
|
|
1040
1063
|
});
|
|
1041
1064
|
switch(action){
|
|
1042
1065
|
case 'New widget':
|
|
1043
|
-
return void await scaffoldReactWidget(
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
'react'
|
|
1047
|
-
]));
|
|
1066
|
+
return void await scaffoldReactWidget(reactFolder);
|
|
1067
|
+
case 'New page':
|
|
1068
|
+
return void await scaffoldReactPage(reactFolder);
|
|
1048
1069
|
default:
|
|
1049
1070
|
return;
|
|
1050
1071
|
}
|
package/dist/index.js
CHANGED
|
@@ -865,6 +865,23 @@ export const wire${naming.ClassName}UseCase = wireClass(
|
|
|
865
865
|
|
|
866
866
|
`.trim());
|
|
867
867
|
};
|
|
868
|
+
const scaffoldReactPage = async (presentationReactFolder)=>{
|
|
869
|
+
const name = await input({
|
|
870
|
+
message: 'Provide name:'
|
|
871
|
+
});
|
|
872
|
+
const { ClassName, fileName } = new UnknownFormatNaming(name);
|
|
873
|
+
presentationReactFolder.subitem([
|
|
874
|
+
'pages'
|
|
875
|
+
]).createFile(`${fileName}-page.tsx`, `
|
|
876
|
+
import { type FC } from 'react'
|
|
877
|
+
|
|
878
|
+
export type ${ClassName}PageProps = {}
|
|
879
|
+
|
|
880
|
+
export const ${ClassName}Page: FC<${ClassName}PageProps> = (props) => {
|
|
881
|
+
return <></>
|
|
882
|
+
}
|
|
883
|
+
`.trim());
|
|
884
|
+
};
|
|
868
885
|
const scaffoldReactWidget = async (presentationReactFolder)=>{
|
|
869
886
|
const widgetName = await input({
|
|
870
887
|
message: 'Name: '
|
|
@@ -1002,19 +1019,23 @@ const main = async ()=>{
|
|
|
1002
1019
|
switch(action){
|
|
1003
1020
|
case 'Scaffold React module':
|
|
1004
1021
|
{
|
|
1022
|
+
const reactFolder = new Folder(rootPath).subitem([
|
|
1023
|
+
ConfigFile.Instance.data.rootFolder,
|
|
1024
|
+
'presentation',
|
|
1025
|
+
'react'
|
|
1026
|
+
]);
|
|
1005
1027
|
const action = await prompts_select({
|
|
1006
1028
|
message: 'Module: ',
|
|
1007
1029
|
choices: [
|
|
1008
|
-
'New widget'
|
|
1030
|
+
'New widget',
|
|
1031
|
+
'New page'
|
|
1009
1032
|
]
|
|
1010
1033
|
});
|
|
1011
1034
|
switch(action){
|
|
1012
1035
|
case 'New widget':
|
|
1013
|
-
return void await scaffoldReactWidget(
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
'react'
|
|
1017
|
-
]));
|
|
1036
|
+
return void await scaffoldReactWidget(reactFolder);
|
|
1037
|
+
case 'New page':
|
|
1038
|
+
return void await scaffoldReactPage(reactFolder);
|
|
1018
1039
|
default:
|
|
1019
1040
|
return;
|
|
1020
1041
|
}
|