@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 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(new Folder(rootPath).subitem([
1044
- ConfigFile.Instance.data.rootFolder,
1045
- 'presentation',
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(new Folder(rootPath).subitem([
1014
- ConfigFile.Instance.data.rootFolder,
1015
- 'presentation',
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
  }
@@ -8,4 +8,5 @@ export * from './scaffold-new-error';
8
8
  export * from './scaffold-new-handlers-rest-endpoint';
9
9
  export * from './scaffold-new-query';
10
10
  export * from './scaffold-new-use-case';
11
+ export * from './scaffold-react-page';
11
12
  export * from './scaffold-react-widget';
@@ -0,0 +1,2 @@
1
+ import type { Folder } from '../file-system';
2
+ export declare const scaffoldReactPage: (presentationReactFolder: Folder) => Promise<void>;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@domain-first/project-structure",
3
3
  "description": "Build and manage your Domain-First project structure with CLI",
4
- "version": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "type": "module",
6
6
  "repository": {
7
7
  "type": "git",