zova-module-a-bean 5.1.7 → 5.1.8

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.
@@ -154,7 +154,7 @@ async function generateRestComponent(
154
154
  ) {
155
155
  const { cli, moduleName, modulePath } = options;
156
156
  // const { className } = globFile;
157
- const { name, nameCapitalize, hasProps, nameProps, hasModels, nameModels, controllerExtJs } = controllerInfo;
157
+ const { name, nameCapitalize, hasProps, nameProps, hasModels, nameModels } = controllerInfo;
158
158
  // TypeControllerPublicProps
159
159
  const typeControllerPublicPropsName = `TypeController${nameCapitalize}PublicProps`;
160
160
  let contentTypeControllerPublicProps = `type ${typeControllerPublicPropsName}${genericDeclare} = TypeRenderComponentJsxPropsPublic`;
@@ -180,21 +180,19 @@ async function generateRestComponent(
180
180
  }
181
181
  contentImports.push("import type { TypeRenderComponentJsxPropsPublic } from 'zova-jsx';");
182
182
  if (_contentImportTypeController.length > 0) {
183
- contentImports.push(
184
- `import type { ${_contentImportTypeController.join(', ')} } from '../../src/component/${name}/controller${controllerExtJs}';`,
185
- );
183
+ contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from 'zova-module-${moduleName}';`);
186
184
  }
187
185
  // component
188
186
  let componentNamePrefix;
189
187
  let componentName;
190
188
  if (name !== 'formField' && name.startsWith('formField')) {
191
- componentNamePrefix = 'FF';
189
+ componentNamePrefix = 'BBF';
192
190
  componentName = toLowerCaseFirstChar(name.substring('formField'.length));
193
191
  } else if (name.startsWith('restPage')) {
194
- componentNamePrefix = 'PP';
192
+ componentNamePrefix = 'BBP';
195
193
  componentName = toLowerCaseFirstChar(name.substring('restPage'.length));
196
194
  } else {
197
- componentNamePrefix = 'ZZ';
195
+ componentNamePrefix = 'BBZ';
198
196
  componentName = name;
199
197
  }
200
198
  const componentNameFull = `${componentNamePrefix}${toUpperCaseFirstChar(combineResourceName(componentName, moduleName, true, true))}`;
@@ -8,6 +8,8 @@ import path from 'node:path';
8
8
 
9
9
  import type { IControllerInfo } from './types.ts';
10
10
 
11
+ import { generateRestIndex } from './utils.ts';
12
+
11
13
  export async function generateMetaPage(options: IMetadataCustomGenerateOptions, globFiles: [IGlobBeanFile, IControllerInfo][]) {
12
14
  if (globFiles.length === 0) return '';
13
15
  const { moduleName } = options;
@@ -113,15 +115,16 @@ declare module 'zova-module-${moduleName}' {
113
115
  return content;
114
116
  }
115
117
 
116
- async function generateRestMetaPage(options: IMetadataCustomGenerateOptions, contentImportsRest: string[], contentPathRecordsRest: string[]) {
118
+ async function generateRestMetaPage(options: IMetadataCustomGenerateOptions, _contentImportsRest: string[], contentPathRecordsRest: string[]) {
117
119
  if (contentPathRecordsRest.length === 0) return;
118
- const { modulePath } = options;
119
- const contentPagesImport = contentImportsRest.join('\n');
120
- const filePagesImport = path.join(modulePath, 'rest/pagesImport.txt');
121
- await fse.outputFile(filePagesImport, contentPagesImport);
122
- const contentPagesRecord = contentPathRecordsRest.join('\n');
123
- const filePagesRecord = path.join(modulePath, 'rest/pagesRecord.txt');
124
- await fse.outputFile(filePagesRecord, contentPagesRecord);
120
+ const { moduleName, modulePath } = options;
121
+ // pages
122
+ const contentPages = `import 'zova-module-${moduleName}';\n`;
123
+ const filePages = path.join(modulePath, 'rest/pages.ts');
124
+ await fse.outputFile(filePages, contentPages);
125
+ // index
126
+ const exportIndexContent = "export * from './pages.js';";
127
+ await generateRestIndex(options, modulePath, exportIndexContent);
125
128
  }
126
129
 
127
130
  function _combineModuleNameControllerName(moduleName: string, className: string) {
@@ -120,7 +120,7 @@ ${contentComponent}
120
120
  async function generateRestComponent(options, _globFile, controllerInfo, genericDeclare, genericArguments, _contentImportTypeController) {
121
121
  const { cli, moduleName, modulePath } = options;
122
122
  // const { className } = globFile;
123
- const { name, nameCapitalize, hasProps, nameProps, hasModels, nameModels, controllerExtJs } = controllerInfo;
123
+ const { name, nameCapitalize, hasProps, nameProps, hasModels, nameModels } = controllerInfo;
124
124
  // TypeControllerPublicProps
125
125
  const typeControllerPublicPropsName = `TypeController${nameCapitalize}PublicProps`;
126
126
  let contentTypeControllerPublicProps = `type ${typeControllerPublicPropsName}${genericDeclare} = TypeRenderComponentJsxPropsPublic`;
@@ -147,21 +147,21 @@ async function generateRestComponent(options, _globFile, controllerInfo, generic
147
147
  }
148
148
  contentImports.push("import type { TypeRenderComponentJsxPropsPublic } from 'zova-jsx';");
149
149
  if (_contentImportTypeController.length > 0) {
150
- contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from '../../src/component/${name}/controller${controllerExtJs}';`);
150
+ contentImports.push(`import type { ${_contentImportTypeController.join(', ')} } from 'zova-module-${moduleName}';`);
151
151
  }
152
152
  // component
153
153
  let componentNamePrefix;
154
154
  let componentName;
155
155
  if (name !== 'formField' && name.startsWith('formField')) {
156
- componentNamePrefix = 'FF';
156
+ componentNamePrefix = 'BBF';
157
157
  componentName = toLowerCaseFirstChar(name.substring('formField'.length));
158
158
  }
159
159
  else if (name.startsWith('restPage')) {
160
- componentNamePrefix = 'PP';
160
+ componentNamePrefix = 'BBP';
161
161
  componentName = toLowerCaseFirstChar(name.substring('restPage'.length));
162
162
  }
163
163
  else {
164
- componentNamePrefix = 'ZZ';
164
+ componentNamePrefix = 'BBZ';
165
165
  componentName = name;
166
166
  }
167
167
  const componentNameFull = `${componentNamePrefix}${toUpperCaseFirstChar(combineResourceName(componentName, moduleName, true, true))}`;
@@ -2,6 +2,7 @@ import { combineResourceName } from '@cabloy/utils';
2
2
  import { toUpperCaseFirstChar } from '@cabloy/word-utils';
3
3
  import fse from 'fs-extra';
4
4
  import path from 'node:path';
5
+ import { generateRestIndex } from "./utils.js";
5
6
  export async function generateMetaPage(options, globFiles) {
6
7
  if (globFiles.length === 0)
7
8
  return '';
@@ -111,16 +112,17 @@ declare module 'zova-module-${moduleName}' {
111
112
  await generateRestMetaPage(options, contentImportsRest, contentPathRecordsRest);
112
113
  return content;
113
114
  }
114
- async function generateRestMetaPage(options, contentImportsRest, contentPathRecordsRest) {
115
+ async function generateRestMetaPage(options, _contentImportsRest, contentPathRecordsRest) {
115
116
  if (contentPathRecordsRest.length === 0)
116
117
  return;
117
- const { modulePath } = options;
118
- const contentPagesImport = contentImportsRest.join('\n');
119
- const filePagesImport = path.join(modulePath, 'rest/pagesImport.txt');
120
- await fse.outputFile(filePagesImport, contentPagesImport);
121
- const contentPagesRecord = contentPathRecordsRest.join('\n');
122
- const filePagesRecord = path.join(modulePath, 'rest/pagesRecord.txt');
123
- await fse.outputFile(filePagesRecord, contentPagesRecord);
118
+ const { moduleName, modulePath } = options;
119
+ // pages
120
+ const contentPages = `import 'zova-module-${moduleName}';\n`;
121
+ const filePages = path.join(modulePath, 'rest/pages.ts');
122
+ await fse.outputFile(filePages, contentPages);
123
+ // index
124
+ const exportIndexContent = "export * from './pages.js';";
125
+ await generateRestIndex(options, modulePath, exportIndexContent);
124
126
  }
125
127
  function _combineModuleNameControllerName(moduleName, className) {
126
128
  return `NS${toUpperCaseFirstChar(combineResourceName(className, moduleName, false, false))}`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zova-module-a-bean",
3
- "version": "5.1.7",
4
- "gitHead": "761a9baced655ccf3197e756c1d046ed651fafd5",
3
+ "version": "5.1.8",
4
+ "gitHead": "4caf955ae46d889cab5dd7efc981f562b3b54aa2",
5
5
  "description": "",
6
6
  "keywords": [
7
7
  "Zova Module"