@carlonicora/nextjs-jsonapi 1.2.0 → 1.3.1
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/{BlockNoteEditor-CNXQ3WL3.js → BlockNoteEditor-7WYPN34K.js} +17 -17
- package/dist/{BlockNoteEditor-CNXQ3WL3.js.map → BlockNoteEditor-7WYPN34K.js.map} +1 -1
- package/dist/{BlockNoteEditor-DC33K4IF.mjs → BlockNoteEditor-V625C23O.mjs} +7 -7
- package/dist/{JsonApiRequest-O7BGUMFO.mjs → JsonApiRequest-6UR7DIAR.mjs} +4 -2
- package/dist/JsonApiRequest-UJ7FGIVI.js +25 -0
- package/dist/JsonApiRequest-UJ7FGIVI.js.map +1 -0
- package/dist/{chunk-EZK3H6EJ.js → chunk-5IET37O4.js} +206 -206
- package/dist/{chunk-EZK3H6EJ.js.map → chunk-5IET37O4.js.map} +1 -1
- package/dist/{chunk-Y4XI3AZR.mjs → chunk-5QC7A6BL.mjs} +32 -20
- package/dist/chunk-5QC7A6BL.mjs.map +1 -0
- package/dist/{chunk-LJRD4SRV.js → chunk-DEYKTLA3.js} +6 -6
- package/dist/{chunk-LJRD4SRV.js.map → chunk-DEYKTLA3.js.map} +1 -1
- package/dist/{chunk-NPPQNSXN.mjs → chunk-FMBQZAIP.mjs} +3 -3
- package/dist/{chunk-MHVXFWZY.mjs → chunk-HTLEKZND.mjs} +3 -3
- package/dist/{chunk-74F6BBHH.mjs → chunk-IKBA4AHN.mjs} +2 -1
- package/dist/chunk-IKBA4AHN.mjs.map +1 -0
- package/dist/{chunk-JLN6UWII.mjs → chunk-JGFWIT2E.mjs} +2 -2
- package/dist/{chunk-KDFDGXCX.js → chunk-K2ANOT66.js} +576 -564
- package/dist/chunk-K2ANOT66.js.map +1 -0
- package/dist/{chunk-X53MF5ZN.mjs → chunk-P2F54I7Q.mjs} +2 -2
- package/dist/{chunk-5ZEADNNP.js → chunk-PMXG5WBC.js} +3 -2
- package/dist/chunk-PMXG5WBC.js.map +1 -0
- package/dist/{chunk-L6LH7WA4.js → chunk-PO5Q3H5I.js} +190 -190
- package/dist/{chunk-L6LH7WA4.js.map → chunk-PO5Q3H5I.js.map} +1 -1
- package/dist/{chunk-WZJDLITG.js → chunk-Q4FXESVT.js} +3 -3
- package/dist/{chunk-WZJDLITG.js.map → chunk-Q4FXESVT.js.map} +1 -1
- package/dist/client/index.js +7 -7
- package/dist/client/index.mjs +6 -6
- package/dist/components/index.js +7 -7
- package/dist/components/index.mjs +6 -6
- package/dist/contexts/index.js +7 -7
- package/dist/contexts/index.mjs +6 -6
- package/dist/core/index.js +2 -2
- package/dist/core/index.mjs +1 -1
- package/dist/features/index.js +4 -4
- package/dist/features/index.mjs +3 -3
- package/dist/hooks/index.js +7 -7
- package/dist/hooks/index.mjs +6 -6
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -2
- package/dist/scripts/generate-web-module/generator.d.ts +15 -0
- package/dist/scripts/generate-web-module/generator.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/generator.js +320 -0
- package/dist/scripts/generate-web-module/generator.js.map +1 -0
- package/dist/scripts/generate-web-module/index.d.ts +16 -0
- package/dist/scripts/generate-web-module/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/index.js +80 -0
- package/dist/scripts/generate-web-module/index.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/container.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/container.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/container.template.js +124 -0
- package/dist/scripts/generate-web-module/templates/components/container.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/content.template.d.ts +15 -0
- package/dist/scripts/generate-web-module/templates/components/content.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/content.template.js +39 -0
- package/dist/scripts/generate-web-module/templates/components/content.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/deleter.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/deleter.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/deleter.template.js +51 -0
- package/dist/scripts/generate-web-module/templates/components/deleter.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/details.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/details.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/details.template.js +109 -0
- package/dist/scripts/generate-web-module/templates/components/details.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/editor.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/editor.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/editor.template.js +459 -0
- package/dist/scripts/generate-web-module/templates/components/editor.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/index.d.ts +15 -0
- package/dist/scripts/generate-web-module/templates/components/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/index.js +29 -0
- package/dist/scripts/generate-web-module/templates/components/index.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/list-container.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/list-container.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/list-container.template.js +30 -0
- package/dist/scripts/generate-web-module/templates/components/list-container.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/list.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/list.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/list.template.js +84 -0
- package/dist/scripts/generate-web-module/templates/components/list.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/multi-selector.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/multi-selector.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/multi-selector.template.js +184 -0
- package/dist/scripts/generate-web-module/templates/components/multi-selector.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/selector.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/components/selector.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/components/selector.template.js +199 -0
- package/dist/scripts/generate-web-module/templates/components/selector.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/context.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/context.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/context.template.js +121 -0
- package/dist/scripts/generate-web-module/templates/context.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/fields.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/data/fields.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/fields.template.js +55 -0
- package/dist/scripts/generate-web-module/templates/data/fields.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/index.d.ts +10 -0
- package/dist/scripts/generate-web-module/templates/data/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/index.js +26 -0
- package/dist/scripts/generate-web-module/templates/data/index.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/interface.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/data/interface.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/interface.template.js +116 -0
- package/dist/scripts/generate-web-module/templates/data/interface.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/model.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/data/model.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/model.template.js +274 -0
- package/dist/scripts/generate-web-module/templates/data/model.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/service.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/data/service.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/data/service.template.js +168 -0
- package/dist/scripts/generate-web-module/templates/data/service.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/index.d.ts +12 -0
- package/dist/scripts/generate-web-module/templates/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/index.js +37 -0
- package/dist/scripts/generate-web-module/templates/index.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/module.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/module.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/module.template.js +64 -0
- package/dist/scripts/generate-web-module/templates/module.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/pages/detail-page.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/pages/detail-page.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/pages/detail-page.template.js +65 -0
- package/dist/scripts/generate-web-module/templates/pages/detail-page.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/pages/index.d.ts +8 -0
- package/dist/scripts/generate-web-module/templates/pages/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/pages/index.js +13 -0
- package/dist/scripts/generate-web-module/templates/pages/index.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/pages/list-page.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/pages/list-page.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/pages/list-page.template.js +37 -0
- package/dist/scripts/generate-web-module/templates/pages/list-page.template.js.map +1 -0
- package/dist/scripts/generate-web-module/templates/table-hook.template.d.ts +14 -0
- package/dist/scripts/generate-web-module/templates/table-hook.template.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/templates/table-hook.template.js +174 -0
- package/dist/scripts/generate-web-module/templates/table-hook.template.js.map +1 -0
- package/dist/scripts/generate-web-module/transformers/field-mapper.d.ts +55 -0
- package/dist/scripts/generate-web-module/transformers/field-mapper.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/transformers/field-mapper.js +179 -0
- package/dist/scripts/generate-web-module/transformers/field-mapper.js.map +1 -0
- package/dist/scripts/generate-web-module/transformers/i18n-generator.d.ts +78 -0
- package/dist/scripts/generate-web-module/transformers/i18n-generator.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/transformers/i18n-generator.js +182 -0
- package/dist/scripts/generate-web-module/transformers/i18n-generator.js.map +1 -0
- package/dist/scripts/generate-web-module/transformers/import-resolver.d.ts +106 -0
- package/dist/scripts/generate-web-module/transformers/import-resolver.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/transformers/import-resolver.js +193 -0
- package/dist/scripts/generate-web-module/transformers/import-resolver.js.map +1 -0
- package/dist/scripts/generate-web-module/transformers/index.d.ts +12 -0
- package/dist/scripts/generate-web-module/transformers/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/transformers/index.js +28 -0
- package/dist/scripts/generate-web-module/transformers/index.js.map +1 -0
- package/dist/scripts/generate-web-module/transformers/name-transformer.d.ts +60 -0
- package/dist/scripts/generate-web-module/transformers/name-transformer.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/transformers/name-transformer.js +115 -0
- package/dist/scripts/generate-web-module/transformers/name-transformer.js.map +1 -0
- package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts +57 -0
- package/dist/scripts/generate-web-module/transformers/parent-detector.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/transformers/parent-detector.js +88 -0
- package/dist/scripts/generate-web-module/transformers/parent-detector.js.map +1 -0
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts +68 -0
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.js +219 -0
- package/dist/scripts/generate-web-module/transformers/relationship-resolver.js.map +1 -0
- package/dist/scripts/generate-web-module/types/field-mapping.types.d.ts +68 -0
- package/dist/scripts/generate-web-module/types/field-mapping.types.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/types/field-mapping.types.js +129 -0
- package/dist/scripts/generate-web-module/types/field-mapping.types.js.map +1 -0
- package/dist/scripts/generate-web-module/types/index.d.ts +9 -0
- package/dist/scripts/generate-web-module/types/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/types/index.js +25 -0
- package/dist/scripts/generate-web-module/types/index.js.map +1 -0
- package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts +40 -0
- package/dist/scripts/generate-web-module/types/json-schema.interface.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/types/json-schema.interface.js +10 -0
- package/dist/scripts/generate-web-module/types/json-schema.interface.js.map +1 -0
- package/dist/scripts/generate-web-module/types/template-data.interface.d.ts +128 -0
- package/dist/scripts/generate-web-module/types/template-data.interface.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/types/template-data.interface.js +9 -0
- package/dist/scripts/generate-web-module/types/template-data.interface.js.map +1 -0
- package/dist/scripts/generate-web-module/utils/bootstrapper-updater.d.ts +29 -0
- package/dist/scripts/generate-web-module/utils/bootstrapper-updater.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/utils/bootstrapper-updater.js +153 -0
- package/dist/scripts/generate-web-module/utils/bootstrapper-updater.js.map +1 -0
- package/dist/scripts/generate-web-module/utils/file-writer.d.ts +38 -0
- package/dist/scripts/generate-web-module/utils/file-writer.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/utils/file-writer.js +126 -0
- package/dist/scripts/generate-web-module/utils/file-writer.js.map +1 -0
- package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts +28 -0
- package/dist/scripts/generate-web-module/utils/i18n-updater.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/utils/i18n-updater.js +122 -0
- package/dist/scripts/generate-web-module/utils/i18n-updater.js.map +1 -0
- package/dist/scripts/generate-web-module/utils/index.d.ts +9 -0
- package/dist/scripts/generate-web-module/utils/index.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/utils/index.js +20 -0
- package/dist/scripts/generate-web-module/utils/index.js.map +1 -0
- package/dist/scripts/generate-web-module/validators/json-schema-validator.d.ts +46 -0
- package/dist/scripts/generate-web-module/validators/json-schema-validator.d.ts.map +1 -0
- package/dist/scripts/generate-web-module/validators/json-schema-validator.js +265 -0
- package/dist/scripts/generate-web-module/validators/json-schema-validator.js.map +1 -0
- package/dist/shadcnui/index.js +4 -4
- package/dist/shadcnui/index.mjs +3 -3
- package/dist/utils/index.js +3 -3
- package/dist/utils/index.mjs +2 -2
- package/package.json +27 -21
- package/scripts/generate-web-module/generator.ts +363 -0
- package/scripts/generate-web-module/index.ts +49 -0
- package/scripts/generate-web-module/templates/components/container.template.ts +129 -0
- package/scripts/generate-web-module/templates/components/content.template.ts +40 -0
- package/scripts/generate-web-module/templates/components/deleter.template.ts +51 -0
- package/scripts/generate-web-module/templates/components/details.template.ts +115 -0
- package/scripts/generate-web-module/templates/components/editor.template.ts +495 -0
- package/scripts/generate-web-module/templates/components/index.ts +18 -0
- package/scripts/generate-web-module/templates/components/list-container.template.ts +30 -0
- package/scripts/generate-web-module/templates/components/list.template.ts +91 -0
- package/scripts/generate-web-module/templates/components/multi-selector.template.ts +184 -0
- package/scripts/generate-web-module/templates/components/selector.template.ts +199 -0
- package/scripts/generate-web-module/templates/context.template.ts +121 -0
- package/scripts/generate-web-module/templates/data/fields.template.ts +64 -0
- package/scripts/generate-web-module/templates/data/index.ts +10 -0
- package/scripts/generate-web-module/templates/data/interface.template.ts +136 -0
- package/scripts/generate-web-module/templates/data/model.template.ts +327 -0
- package/scripts/generate-web-module/templates/data/service.template.ts +185 -0
- package/scripts/generate-web-module/templates/index.ts +34 -0
- package/scripts/generate-web-module/templates/module.template.ts +69 -0
- package/scripts/generate-web-module/templates/pages/detail-page.template.ts +65 -0
- package/scripts/generate-web-module/templates/pages/index.ts +8 -0
- package/scripts/generate-web-module/templates/pages/list-page.template.ts +37 -0
- package/scripts/generate-web-module/templates/table-hook.template.ts +182 -0
- package/scripts/generate-web-module/transformers/field-mapper.ts +201 -0
- package/scripts/generate-web-module/transformers/i18n-generator.ts +199 -0
- package/scripts/generate-web-module/transformers/import-resolver.ts +250 -0
- package/scripts/generate-web-module/transformers/index.ts +12 -0
- package/scripts/generate-web-module/transformers/name-transformer.ts +115 -0
- package/scripts/generate-web-module/transformers/parent-detector.ts +87 -0
- package/scripts/generate-web-module/transformers/relationship-resolver.ts +221 -0
- package/scripts/generate-web-module/tsconfig.json +24 -0
- package/scripts/generate-web-module/types/field-mapping.types.ts +141 -0
- package/scripts/generate-web-module/types/index.ts +9 -0
- package/scripts/generate-web-module/types/json-schema.interface.ts +42 -0
- package/scripts/generate-web-module/types/template-data.interface.ts +164 -0
- package/scripts/generate-web-module/utils/bootstrapper-updater.ts +145 -0
- package/scripts/generate-web-module/utils/file-writer.ts +115 -0
- package/scripts/generate-web-module/utils/i18n-updater.ts +108 -0
- package/scripts/generate-web-module/utils/index.ts +9 -0
- package/scripts/generate-web-module/validators/json-schema-validator.ts +306 -0
- package/src/components/errors/ErrorDetails.tsx +2 -2
- package/src/features/auth/components/containers/AuthContainer.tsx +1 -1
- package/src/features/auth/components/details/LandingComponent.tsx +20 -1
- package/src/features/auth/components/forms/AcceptInvitation.tsx +1 -1
- package/src/features/auth/components/forms/ActivateAccount.tsx +1 -1
- package/src/features/auth/components/forms/ForgotPassword.tsx +1 -1
- package/src/features/auth/components/forms/Login.tsx +1 -1
- package/src/features/auth/components/forms/Register.tsx +1 -1
- package/src/features/auth/components/forms/ResetPassword.tsx +1 -1
- package/src/features/company/components/forms/CompanyLicense.tsx +1 -8
- package/src/unified/JsonApiRequest.ts +2 -2
- package/dist/JsonApiRequest-VARLNKAF.js +0 -23
- package/dist/JsonApiRequest-VARLNKAF.js.map +0 -1
- package/dist/chunk-5ZEADNNP.js.map +0 -1
- package/dist/chunk-74F6BBHH.mjs.map +0 -1
- package/dist/chunk-KDFDGXCX.js.map +0 -1
- package/dist/chunk-Y4XI3AZR.mjs.map +0 -1
- /package/dist/{BlockNoteEditor-DC33K4IF.mjs.map → BlockNoteEditor-V625C23O.mjs.map} +0 -0
- /package/dist/{JsonApiRequest-O7BGUMFO.mjs.map → JsonApiRequest-6UR7DIAR.mjs.map} +0 -0
- /package/dist/{chunk-NPPQNSXN.mjs.map → chunk-FMBQZAIP.mjs.map} +0 -0
- /package/dist/{chunk-MHVXFWZY.mjs.map → chunk-HTLEKZND.mjs.map} +0 -0
- /package/dist/{chunk-JLN6UWII.mjs.map → chunk-JGFWIT2E.mjs.map} +0 -0
- /package/dist/{chunk-X53MF5ZN.mjs.map → chunk-P2F54I7Q.mjs.map} +0 -0
package/dist/index.mjs
CHANGED
|
@@ -10,9 +10,10 @@ import {
|
|
|
10
10
|
JsonApiPost,
|
|
11
11
|
JsonApiPut,
|
|
12
12
|
configureJsonApi,
|
|
13
|
+
getApiUrl,
|
|
13
14
|
getAppUrl,
|
|
14
15
|
getTrackablePages
|
|
15
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-IKBA4AHN.mjs";
|
|
16
17
|
import {
|
|
17
18
|
configureRoles,
|
|
18
19
|
getRoleId,
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
rehydrate,
|
|
33
34
|
rehydrateList,
|
|
34
35
|
setGlobalErrorHandler
|
|
35
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-FMBQZAIP.mjs";
|
|
36
37
|
import {
|
|
37
38
|
DataClassRegistry,
|
|
38
39
|
JsonApiDataFactory,
|
|
@@ -71,6 +72,7 @@ export {
|
|
|
71
72
|
configureJsonApi,
|
|
72
73
|
configureRoles,
|
|
73
74
|
createJsonApiInclusion,
|
|
75
|
+
getApiUrl,
|
|
74
76
|
getAppUrl,
|
|
75
77
|
getGlobalErrorHandler,
|
|
76
78
|
getRoleId,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Frontend Module Generator
|
|
3
|
+
*
|
|
4
|
+
* Main orchestrator for generating frontend modules from JSON schema.
|
|
5
|
+
*/
|
|
6
|
+
import { GenerateWebModuleOptions } from "./types";
|
|
7
|
+
/**
|
|
8
|
+
* Generate all frontend module files from JSON schema
|
|
9
|
+
*
|
|
10
|
+
* @param options - Generator options
|
|
11
|
+
* @returns True if generation succeeded
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateWebModule(options: GenerateWebModuleOptions): Promise<boolean>;
|
|
14
|
+
export default generateWebModule;
|
|
15
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../../scripts/generate-web-module/generator.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EAIL,wBAAwB,EACzB,MAAM,SAAS,CAAC;AA8BjB;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,wBAAwB,GAAG,OAAO,CAAC,OAAO,CAAC,CA4E3F;AA6OD,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Frontend Module Generator
|
|
4
|
+
*
|
|
5
|
+
* Main orchestrator for generating frontend modules from JSON schema.
|
|
6
|
+
*/
|
|
7
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
8
|
+
if (k2 === undefined) k2 = k;
|
|
9
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
10
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
11
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
12
|
+
}
|
|
13
|
+
Object.defineProperty(o, k2, desc);
|
|
14
|
+
}) : (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
}));
|
|
18
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
19
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
20
|
+
}) : function(o, v) {
|
|
21
|
+
o["default"] = v;
|
|
22
|
+
});
|
|
23
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
24
|
+
var ownKeys = function(o) {
|
|
25
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
26
|
+
var ar = [];
|
|
27
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
28
|
+
return ar;
|
|
29
|
+
};
|
|
30
|
+
return ownKeys(o);
|
|
31
|
+
};
|
|
32
|
+
return function (mod) {
|
|
33
|
+
if (mod && mod.__esModule) return mod;
|
|
34
|
+
var result = {};
|
|
35
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
36
|
+
__setModuleDefault(result, mod);
|
|
37
|
+
return result;
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
|
+
exports.generateWebModule = generateWebModule;
|
|
42
|
+
const fs = __importStar(require("fs"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const name_transformer_1 = require("./transformers/name-transformer");
|
|
45
|
+
const parent_detector_1 = require("./transformers/parent-detector");
|
|
46
|
+
const field_mapper_1 = require("./transformers/field-mapper");
|
|
47
|
+
const relationship_resolver_1 = require("./transformers/relationship-resolver");
|
|
48
|
+
const import_resolver_1 = require("./transformers/import-resolver");
|
|
49
|
+
const i18n_generator_1 = require("./transformers/i18n-generator");
|
|
50
|
+
const json_schema_validator_1 = require("./validators/json-schema-validator");
|
|
51
|
+
const templates_1 = require("./templates");
|
|
52
|
+
const utils_1 = require("./utils");
|
|
53
|
+
/**
|
|
54
|
+
* Generate all frontend module files from JSON schema
|
|
55
|
+
*
|
|
56
|
+
* @param options - Generator options
|
|
57
|
+
* @returns True if generation succeeded
|
|
58
|
+
*/
|
|
59
|
+
async function generateWebModule(options) {
|
|
60
|
+
const { jsonPath, dryRun = false, force = false, noRegister = false } = options;
|
|
61
|
+
console.log(`\n🔧 Frontend Module Generator`);
|
|
62
|
+
console.log(` JSON Schema: ${jsonPath}`);
|
|
63
|
+
console.log(` Dry Run: ${dryRun}`);
|
|
64
|
+
console.log(` Force: ${force}`);
|
|
65
|
+
console.log(` No Register: ${noRegister}`);
|
|
66
|
+
// Step 1: Validate JSON schema
|
|
67
|
+
console.log("\n📋 Validating JSON schema...");
|
|
68
|
+
const validation = (0, json_schema_validator_1.parseAndValidate)(jsonPath);
|
|
69
|
+
if (!(0, json_schema_validator_1.validationPassed)(validation)) {
|
|
70
|
+
console.error("\n❌ Validation failed:");
|
|
71
|
+
validation.errors.forEach((e) => console.error(` - ${e}`));
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (validation.warnings.length > 0) {
|
|
75
|
+
console.log("\n⚠️ Validation warnings (non-blocking):");
|
|
76
|
+
validation.warnings.forEach((w) => console.log(` - ${w}`));
|
|
77
|
+
}
|
|
78
|
+
const schema = validation.data;
|
|
79
|
+
console.log(` ✅ Schema valid: ${schema.moduleName}`);
|
|
80
|
+
// Step 2: Build template data
|
|
81
|
+
console.log("\n🔨 Building template data...");
|
|
82
|
+
const templateData = buildTemplateData(schema);
|
|
83
|
+
console.log(` Module: ${templateData.names.pascalCase}`);
|
|
84
|
+
console.log(` Target: ${templateData.targetDir}`);
|
|
85
|
+
console.log(` Extends Content: ${templateData.extendsContent}`);
|
|
86
|
+
console.log(` Fields: ${templateData.fields.length}`);
|
|
87
|
+
console.log(` Relationships: ${templateData.relationships.length}`);
|
|
88
|
+
// Step 3: Generate all files
|
|
89
|
+
console.log("\n📝 Generating files...");
|
|
90
|
+
const files = generateAllFiles(templateData, schema);
|
|
91
|
+
console.log(` Generated ${files.length} file templates`);
|
|
92
|
+
// Step 4: Determine web base path
|
|
93
|
+
const webBasePath = findWebBasePath(jsonPath);
|
|
94
|
+
if (!webBasePath) {
|
|
95
|
+
console.error("\n❌ Could not determine web app base path");
|
|
96
|
+
return false;
|
|
97
|
+
}
|
|
98
|
+
console.log(` Web base path: ${webBasePath}`);
|
|
99
|
+
// Step 5: Write files
|
|
100
|
+
console.log("\n💾 Writing files...");
|
|
101
|
+
const results = (0, utils_1.writeFiles)(files, { dryRun, force });
|
|
102
|
+
(0, utils_1.printResults)(results);
|
|
103
|
+
// Step 6: Update Bootstrapper (unless --no-register)
|
|
104
|
+
if (!noRegister) {
|
|
105
|
+
console.log("\n🔧 Updating Bootstrapper.ts...");
|
|
106
|
+
const bootstrapResult = (0, utils_1.updateBootstrapper)(templateData, webBasePath, dryRun);
|
|
107
|
+
console.log(` ${bootstrapResult.success ? "✅" : "❌"} ${bootstrapResult.message}`);
|
|
108
|
+
}
|
|
109
|
+
// Step 7: Update i18n (unless --no-register)
|
|
110
|
+
if (!noRegister) {
|
|
111
|
+
console.log("\n🌐 Updating messages/en.json...");
|
|
112
|
+
const i18nResult = (0, utils_1.updateI18n)(templateData, webBasePath, dryRun);
|
|
113
|
+
console.log(` ${i18nResult.success ? "✅" : "❌"} ${i18nResult.message}`);
|
|
114
|
+
}
|
|
115
|
+
console.log("\n✅ Generation complete!");
|
|
116
|
+
if (dryRun) {
|
|
117
|
+
console.log("\n📝 This was a dry run. No files were actually written.");
|
|
118
|
+
console.log(" Remove --dry-run to generate files.");
|
|
119
|
+
}
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Build template data from JSON schema
|
|
124
|
+
*/
|
|
125
|
+
function buildTemplateData(schema) {
|
|
126
|
+
const names = (0, name_transformer_1.transformNames)(schema.moduleName, schema.endpointName);
|
|
127
|
+
const targetDir = schema.targetDir;
|
|
128
|
+
const extendsContent = (0, parent_detector_1.detectExtendsContent)(schema.fields);
|
|
129
|
+
// Map fields
|
|
130
|
+
const allFields = (0, field_mapper_1.mapFields)(schema.fields, names.camelCase);
|
|
131
|
+
// Get inherited fields to filter out for forms (Content fields are handled specially)
|
|
132
|
+
const inheritedFields = extendsContent ? ["name", "tldr", "abstract", "content"] : [];
|
|
133
|
+
const fields = (0, field_mapper_1.filterInheritedFields)(allFields, inheritedFields);
|
|
134
|
+
// Resolve relationships
|
|
135
|
+
const relationships = (0, relationship_resolver_1.resolveRelationships)(schema.relationships);
|
|
136
|
+
const relationshipServiceMethods = (0, relationship_resolver_1.generateServiceMethods)(relationships);
|
|
137
|
+
// Build imports
|
|
138
|
+
const imports = (0, import_resolver_1.buildImportStatements)(relationships, extendsContent);
|
|
139
|
+
// Generate i18n keys
|
|
140
|
+
const i18nKeys = (0, i18n_generator_1.generateI18nKeys)(names, fields, relationships);
|
|
141
|
+
// Build table field names
|
|
142
|
+
const tableFieldNames = buildTableFieldNames(schema, extendsContent);
|
|
143
|
+
return {
|
|
144
|
+
names,
|
|
145
|
+
moduleId: schema.moduleId,
|
|
146
|
+
endpoint: schema.endpointName,
|
|
147
|
+
targetDir,
|
|
148
|
+
extendsContent,
|
|
149
|
+
fields: allFields, // Keep all fields for interface generation
|
|
150
|
+
relationships,
|
|
151
|
+
i18nKeys,
|
|
152
|
+
imports,
|
|
153
|
+
tableFieldNames,
|
|
154
|
+
relationshipServiceMethods,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Build field names for table display
|
|
159
|
+
*/
|
|
160
|
+
function buildTableFieldNames(schema, extendsContent) {
|
|
161
|
+
const fieldNames = [`${(0, name_transformer_1.toCamelCase)(schema.moduleName)}Id`];
|
|
162
|
+
// Add name for all modules
|
|
163
|
+
fieldNames.push("name");
|
|
164
|
+
// Add authors for content modules
|
|
165
|
+
if (extendsContent) {
|
|
166
|
+
fieldNames.push("authors");
|
|
167
|
+
}
|
|
168
|
+
// Add custom fields (excluding certain ones)
|
|
169
|
+
schema.fields.forEach((f) => {
|
|
170
|
+
if (!["id", "name", "tldr", "abstract", "content", "createdAt", "updatedAt"].includes(f.name)) {
|
|
171
|
+
fieldNames.push(f.name);
|
|
172
|
+
}
|
|
173
|
+
});
|
|
174
|
+
// Add standard date fields
|
|
175
|
+
fieldNames.push("createdAt", "updatedAt");
|
|
176
|
+
return fieldNames;
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Generate all module files
|
|
180
|
+
*/
|
|
181
|
+
function generateAllFiles(data, schema) {
|
|
182
|
+
const files = [];
|
|
183
|
+
const paths = (0, import_resolver_1.buildFilePaths)(data, findWebBasePath(""));
|
|
184
|
+
// Data layer (4 files)
|
|
185
|
+
files.push({
|
|
186
|
+
path: paths.interface,
|
|
187
|
+
content: (0, templates_1.generateInterfaceTemplate)(data),
|
|
188
|
+
type: "data",
|
|
189
|
+
});
|
|
190
|
+
files.push({
|
|
191
|
+
path: paths.model,
|
|
192
|
+
content: (0, templates_1.generateModelTemplate)(data),
|
|
193
|
+
type: "data",
|
|
194
|
+
});
|
|
195
|
+
files.push({
|
|
196
|
+
path: paths.service,
|
|
197
|
+
content: (0, templates_1.generateServiceTemplate)(data),
|
|
198
|
+
type: "data",
|
|
199
|
+
});
|
|
200
|
+
files.push({
|
|
201
|
+
path: paths.fields,
|
|
202
|
+
content: (0, templates_1.generateFieldsTemplate)(data),
|
|
203
|
+
type: "data",
|
|
204
|
+
});
|
|
205
|
+
// Form components (4 files)
|
|
206
|
+
files.push({
|
|
207
|
+
path: paths.editor,
|
|
208
|
+
content: (0, templates_1.generateEditorTemplate)(data),
|
|
209
|
+
type: "component",
|
|
210
|
+
});
|
|
211
|
+
files.push({
|
|
212
|
+
path: paths.deleter,
|
|
213
|
+
content: (0, templates_1.generateDeleterTemplate)(data),
|
|
214
|
+
type: "component",
|
|
215
|
+
});
|
|
216
|
+
files.push({
|
|
217
|
+
path: paths.selector,
|
|
218
|
+
content: (0, templates_1.generateSelectorTemplate)(data),
|
|
219
|
+
type: "component",
|
|
220
|
+
});
|
|
221
|
+
files.push({
|
|
222
|
+
path: paths.multiSelector,
|
|
223
|
+
content: (0, templates_1.generateMultiSelectorTemplate)(data),
|
|
224
|
+
type: "component",
|
|
225
|
+
});
|
|
226
|
+
// Display components (4-5 files)
|
|
227
|
+
files.push({
|
|
228
|
+
path: paths.list,
|
|
229
|
+
content: (0, templates_1.generateListTemplate)(data),
|
|
230
|
+
type: "component",
|
|
231
|
+
});
|
|
232
|
+
files.push({
|
|
233
|
+
path: paths.details,
|
|
234
|
+
content: (0, templates_1.generateDetailsTemplate)(data),
|
|
235
|
+
type: "component",
|
|
236
|
+
});
|
|
237
|
+
// Content component only for Content-extending modules
|
|
238
|
+
const contentTemplate = (0, templates_1.generateContentTemplate)(data);
|
|
239
|
+
if (contentTemplate) {
|
|
240
|
+
files.push({
|
|
241
|
+
path: paths.content,
|
|
242
|
+
content: contentTemplate,
|
|
243
|
+
type: "component",
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
files.push({
|
|
247
|
+
path: paths.container,
|
|
248
|
+
content: (0, templates_1.generateContainerTemplate)(data),
|
|
249
|
+
type: "component",
|
|
250
|
+
});
|
|
251
|
+
files.push({
|
|
252
|
+
path: paths.listContainer,
|
|
253
|
+
content: (0, templates_1.generateListContainerTemplate)(data),
|
|
254
|
+
type: "component",
|
|
255
|
+
});
|
|
256
|
+
// Context & hooks (2 files)
|
|
257
|
+
files.push({
|
|
258
|
+
path: paths.context,
|
|
259
|
+
content: (0, templates_1.generateContextTemplate)(data),
|
|
260
|
+
type: "context",
|
|
261
|
+
});
|
|
262
|
+
files.push({
|
|
263
|
+
path: paths.tableHook,
|
|
264
|
+
content: (0, templates_1.generateTableHookTemplate)(data),
|
|
265
|
+
type: "hook",
|
|
266
|
+
});
|
|
267
|
+
// Module (1 file)
|
|
268
|
+
files.push({
|
|
269
|
+
path: paths.module,
|
|
270
|
+
content: (0, templates_1.generateModuleTemplate)(data),
|
|
271
|
+
type: "module",
|
|
272
|
+
});
|
|
273
|
+
// Pages (2 files)
|
|
274
|
+
files.push({
|
|
275
|
+
path: paths.listPage,
|
|
276
|
+
content: (0, templates_1.generateListPageTemplate)(data),
|
|
277
|
+
type: "page",
|
|
278
|
+
});
|
|
279
|
+
files.push({
|
|
280
|
+
path: paths.detailPage,
|
|
281
|
+
content: (0, templates_1.generateDetailPageTemplate)(data),
|
|
282
|
+
type: "page",
|
|
283
|
+
});
|
|
284
|
+
return files;
|
|
285
|
+
}
|
|
286
|
+
/**
|
|
287
|
+
* Find the web app base path from the JSON path
|
|
288
|
+
* Assumes JSON is in /structure folder and web app is in /apps/web
|
|
289
|
+
*/
|
|
290
|
+
function findWebBasePath(jsonPath) {
|
|
291
|
+
// Try to find apps/web relative to current working directory
|
|
292
|
+
const cwd = process.cwd();
|
|
293
|
+
// Check if we're in the monorepo root
|
|
294
|
+
if (fs.existsSync(path.join(cwd, "apps/web"))) {
|
|
295
|
+
return cwd;
|
|
296
|
+
}
|
|
297
|
+
// Check if we're in packages/nextjs-jsonapi
|
|
298
|
+
if (fs.existsSync(path.join(cwd, "../../apps/web"))) {
|
|
299
|
+
return path.join(cwd, "../..");
|
|
300
|
+
}
|
|
301
|
+
// Try to derive from jsonPath
|
|
302
|
+
if (jsonPath) {
|
|
303
|
+
const resolved = path.resolve(jsonPath);
|
|
304
|
+
// Look for monorepo root by finding apps/web
|
|
305
|
+
let current = path.dirname(resolved);
|
|
306
|
+
for (let i = 0; i < 10; i++) {
|
|
307
|
+
if (fs.existsSync(path.join(current, "apps/web"))) {
|
|
308
|
+
return current;
|
|
309
|
+
}
|
|
310
|
+
const parent = path.dirname(current);
|
|
311
|
+
if (parent === current)
|
|
312
|
+
break;
|
|
313
|
+
current = parent;
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
// Default to current directory
|
|
317
|
+
return cwd;
|
|
318
|
+
}
|
|
319
|
+
exports.default = generateWebModule;
|
|
320
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.js","sourceRoot":"","sources":["../../../scripts/generate-web-module/generator.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CH,8CA4EC;AAvHD,uCAAyB;AACzB,2CAA6B;AAO7B,sEAAsG;AACtG,oEAAsE;AACtE,8DAA+E;AAC/E,g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AG,CAAC;AACb,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Frontend Module Generator CLI
|
|
4
|
+
*
|
|
5
|
+
* Generates Next.js frontend modules from JSON schema definitions.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* pnpm generate-web-module <json-path> [options]
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* --dry-run Preview without writing files
|
|
12
|
+
* --force Overwrite existing files
|
|
13
|
+
* --no-register Skip Bootstrapper and i18n updates
|
|
14
|
+
*/
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../scripts/generate-web-module/index.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;GAYG"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
"use strict";
|
|
3
|
+
/**
|
|
4
|
+
* Frontend Module Generator CLI
|
|
5
|
+
*
|
|
6
|
+
* Generates Next.js frontend modules from JSON schema definitions.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* pnpm generate-web-module <json-path> [options]
|
|
10
|
+
*
|
|
11
|
+
* Options:
|
|
12
|
+
* --dry-run Preview without writing files
|
|
13
|
+
* --force Overwrite existing files
|
|
14
|
+
* --no-register Skip Bootstrapper and i18n updates
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
28
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
29
|
+
}) : function(o, v) {
|
|
30
|
+
o["default"] = v;
|
|
31
|
+
});
|
|
32
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
33
|
+
var ownKeys = function(o) {
|
|
34
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
35
|
+
var ar = [];
|
|
36
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
37
|
+
return ar;
|
|
38
|
+
};
|
|
39
|
+
return ownKeys(o);
|
|
40
|
+
};
|
|
41
|
+
return function (mod) {
|
|
42
|
+
if (mod && mod.__esModule) return mod;
|
|
43
|
+
var result = {};
|
|
44
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
45
|
+
__setModuleDefault(result, mod);
|
|
46
|
+
return result;
|
|
47
|
+
};
|
|
48
|
+
})();
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
const commander_1 = require("commander");
|
|
51
|
+
const path = __importStar(require("path"));
|
|
52
|
+
const generator_1 = require("./generator");
|
|
53
|
+
const program = new commander_1.Command();
|
|
54
|
+
program
|
|
55
|
+
.name("generate-web-module")
|
|
56
|
+
.description("Generate Next.js frontend module from JSON schema")
|
|
57
|
+
.version("1.0.0")
|
|
58
|
+
.argument("<json-path>", "Path to JSON schema file (relative or absolute)")
|
|
59
|
+
.option("-d, --dry-run", "Preview files without writing them", false)
|
|
60
|
+
.option("-f, --force", "Overwrite existing files", false)
|
|
61
|
+
.option("-n, --no-register", "Skip Bootstrapper.ts and i18n updates", false)
|
|
62
|
+
.action(async (jsonPath, options) => {
|
|
63
|
+
// Resolve path
|
|
64
|
+
const resolvedPath = path.isAbsolute(jsonPath) ? jsonPath : path.resolve(process.cwd(), jsonPath);
|
|
65
|
+
try {
|
|
66
|
+
const success = await (0, generator_1.generateWebModule)({
|
|
67
|
+
jsonPath: resolvedPath,
|
|
68
|
+
dryRun: options.dryRun,
|
|
69
|
+
force: options.force,
|
|
70
|
+
noRegister: !options.register,
|
|
71
|
+
});
|
|
72
|
+
process.exit(success ? 0 : 1);
|
|
73
|
+
}
|
|
74
|
+
catch (error) {
|
|
75
|
+
console.error("\n❌ Error:", error instanceof Error ? error.message : error);
|
|
76
|
+
process.exit(1);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
program.parse();
|
|
80
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../scripts/generate-web-module/index.ts"],"names":[],"mappings":";;AACA;;;;;;;;;;;;GAYG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,yCAAoC;AACpC,2CAA6B;AAC7B,2CAAgD;AAEhD,MAAM,OAAO,GAAG,IAAI,mBAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,qBAAqB,CAAC;KAC3B,WAAW,CAAC,mDAAmD,CAAC;KAChE,OAAO,CAAC,OAAO,CAAC;KAChB,QAAQ,CAAC,aAAa,EAAE,iDAAiD,CAAC;KAC1E,MAAM,CAAC,eAAe,EAAE,oCAAoC,EAAE,KAAK,CAAC;KACpE,MAAM,CAAC,aAAa,EAAE,0BAA0B,EAAE,KAAK,CAAC;KACxD,MAAM,CAAC,mBAAmB,EAAE,uCAAuC,EAAE,KAAK,CAAC;KAC3E,MAAM,CAAC,KAAK,EAAE,QAAgB,EAAE,OAA+D,EAAE,EAAE;IAClG,eAAe;IACf,MAAM,YAAY,GAAG,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,QAAQ,CAAC,CAAC;IAElG,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,IAAA,6BAAiB,EAAC;YACtC,QAAQ,EAAE,YAAY;YACtB,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,UAAU,EAAE,CAAC,OAAO,CAAC,QAAQ;SAC9B,CAAC,CAAC;QAEH,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;QAC5E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Container Template
|
|
3
|
+
*
|
|
4
|
+
* Generates {Module}Container.tsx component for displaying item detail page.
|
|
5
|
+
*/
|
|
6
|
+
import { FrontendTemplateData } from "../../types/template-data.interface";
|
|
7
|
+
/**
|
|
8
|
+
* Generate the container component file content
|
|
9
|
+
*
|
|
10
|
+
* @param data - Frontend template data
|
|
11
|
+
* @returns Generated file content
|
|
12
|
+
*/
|
|
13
|
+
export declare function generateContainerTemplate(data: FrontendTemplateData): string;
|
|
14
|
+
//# sourceMappingURL=container.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.template.d.ts","sourceRoot":"","sources":["../../../../../scripts/generate-web-module/templates/components/container.template.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E;;;;;GAKG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAU5E"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Container Template
|
|
4
|
+
*
|
|
5
|
+
* Generates {Module}Container.tsx component for displaying item detail page.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.generateContainerTemplate = generateContainerTemplate;
|
|
9
|
+
/**
|
|
10
|
+
* Generate the container component file content
|
|
11
|
+
*
|
|
12
|
+
* @param data - Frontend template data
|
|
13
|
+
* @returns Generated file content
|
|
14
|
+
*/
|
|
15
|
+
function generateContainerTemplate(data) {
|
|
16
|
+
const { names, extendsContent } = data;
|
|
17
|
+
// Content-extending modules get full tabs with relevant content/users
|
|
18
|
+
if (extendsContent) {
|
|
19
|
+
return generateContentContainerTemplate(data);
|
|
20
|
+
}
|
|
21
|
+
// Non-content modules get simpler container
|
|
22
|
+
return generateSimpleContainerTemplate(data);
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Generate container for Content-extending modules
|
|
26
|
+
*/
|
|
27
|
+
function generateContentContainerTemplate(data) {
|
|
28
|
+
const { names } = data;
|
|
29
|
+
return `"use client";
|
|
30
|
+
|
|
31
|
+
import ${names.pascalCase}Content from "@/features/${data.targetDir}/${names.kebabCase}/components/details/${names.pascalCase}Content";
|
|
32
|
+
import ${names.pascalCase}Details from "@/features/${data.targetDir}/${names.kebabCase}/components/details/${names.pascalCase}Details";
|
|
33
|
+
import { use${names.pascalCase}Context } from "@/features/${data.targetDir}/${names.kebabCase}/contexts/${names.pascalCase}Context";
|
|
34
|
+
import { ${names.pascalCase}Interface } from "@/features/${data.targetDir}/${names.kebabCase}/data/${names.pascalCase}Interface";
|
|
35
|
+
import {
|
|
36
|
+
AllowedUsersDetails,
|
|
37
|
+
PageContentContainer,
|
|
38
|
+
RelevantContentsList,
|
|
39
|
+
RelevantUsersList,
|
|
40
|
+
} from "@carlonicora/nextjs-jsonapi/components";
|
|
41
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@carlonicora/nextjs-jsonapi/shadcnui";
|
|
42
|
+
import { useTranslations } from "next-intl";
|
|
43
|
+
|
|
44
|
+
type ${names.pascalCase}ContainerProps = {
|
|
45
|
+
${names.camelCase}: ${names.pascalCase}Interface;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
function ${names.pascalCase}ContainerInternal({ ${names.camelCase} }: ${names.pascalCase}ContainerProps) {
|
|
49
|
+
const t = useTranslations();
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<PageContentContainer
|
|
53
|
+
details={<${names.pascalCase}Details />}
|
|
54
|
+
footer={
|
|
55
|
+
<AllowedUsersDetails showTitle content={${names.camelCase}} />
|
|
56
|
+
}
|
|
57
|
+
content={
|
|
58
|
+
<Tabs defaultValue={\`${names.camelCase}\`}>
|
|
59
|
+
<TabsList className="mb-4">
|
|
60
|
+
<TabsTrigger value="${names.camelCase}">{t(\`types.${names.pluralCamel}\`, { count: 1 })}</TabsTrigger>
|
|
61
|
+
<TabsTrigger value="contents">{t(\`generic.relevant\`)}</TabsTrigger>
|
|
62
|
+
<TabsTrigger value="users">{t(\`generic.relevant_users\`)}</TabsTrigger>
|
|
63
|
+
</TabsList>
|
|
64
|
+
<TabsContent value="${names.camelCase}">
|
|
65
|
+
<${names.pascalCase}Content />
|
|
66
|
+
</TabsContent>
|
|
67
|
+
<TabsContent value="contents">
|
|
68
|
+
<RelevantContentsList id={${names.camelCase}.id} />
|
|
69
|
+
</TabsContent>
|
|
70
|
+
<TabsContent value="users">
|
|
71
|
+
<RelevantUsersList id={${names.camelCase}.id} />
|
|
72
|
+
</TabsContent>
|
|
73
|
+
</Tabs>
|
|
74
|
+
}
|
|
75
|
+
/>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export default function ${names.pascalCase}Container() {
|
|
80
|
+
const { ${names.camelCase} } = use${names.pascalCase}Context();
|
|
81
|
+
if (!${names.camelCase}) return null;
|
|
82
|
+
|
|
83
|
+
return <${names.pascalCase}ContainerInternal ${names.camelCase}={${names.camelCase}} />;
|
|
84
|
+
}
|
|
85
|
+
`;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Generate container for non-Content modules
|
|
89
|
+
*/
|
|
90
|
+
function generateSimpleContainerTemplate(data) {
|
|
91
|
+
const { names } = data;
|
|
92
|
+
return `"use client";
|
|
93
|
+
|
|
94
|
+
import ${names.pascalCase}Details from "@/features/${data.targetDir}/${names.kebabCase}/components/details/${names.pascalCase}Details";
|
|
95
|
+
import { use${names.pascalCase}Context } from "@/features/${data.targetDir}/${names.kebabCase}/contexts/${names.pascalCase}Context";
|
|
96
|
+
import { ${names.pascalCase}Interface } from "@/features/${data.targetDir}/${names.kebabCase}/data/${names.pascalCase}Interface";
|
|
97
|
+
import { PageContentContainer } from "@carlonicora/nextjs-jsonapi/components";
|
|
98
|
+
|
|
99
|
+
type ${names.pascalCase}ContainerProps = {
|
|
100
|
+
${names.camelCase}: ${names.pascalCase}Interface;
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
function ${names.pascalCase}ContainerInternal({ ${names.camelCase} }: ${names.pascalCase}ContainerProps) {
|
|
104
|
+
return (
|
|
105
|
+
<PageContentContainer
|
|
106
|
+
details={<${names.pascalCase}Details />}
|
|
107
|
+
content={
|
|
108
|
+
<div className="flex w-full flex-col gap-y-4">
|
|
109
|
+
{/* Add custom content sections here */}
|
|
110
|
+
</div>
|
|
111
|
+
}
|
|
112
|
+
/>
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export default function ${names.pascalCase}Container() {
|
|
117
|
+
const { ${names.camelCase} } = use${names.pascalCase}Context();
|
|
118
|
+
if (!${names.camelCase}) return null;
|
|
119
|
+
|
|
120
|
+
return <${names.pascalCase}ContainerInternal ${names.camelCase}={${names.camelCase}} />;
|
|
121
|
+
}
|
|
122
|
+
`;
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=container.template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"container.template.js","sourceRoot":"","sources":["../../../../../scripts/generate-web-module/templates/components/container.template.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AAUH,8DAUC;AAhBD;;;;;GAKG;AACH,SAAgB,yBAAyB,CAAC,IAA0B;IAClE,MAAM,EAAE,KAAK,EAAE,cAAc,EAAE,GAAG,IAAI,CAAC;IAEvC,sEAAsE;IACtE,IAAI,cAAc,EAAE,CAAC;QACnB,OAAO,gCAAgC,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,4CAA4C;IAC5C,OAAO,+BAA+B,CAAC,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED;;GAEG;AACH,SAAS,gCAAgC,CAAC,IAA0B;IAClE,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC;IAEvB,OAAO;;SAEA,KAAK,CAAC,UAAU,4BAA4B,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,uBAAuB,KAAK,CAAC,UAAU;SACpH,KAAK,CAAC,UAAU,4BAA4B,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,uBAAuB,KAAK,CAAC,UAAU;cAC/G,KAAK,CAAC,UAAU,8BAA8B,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,aAAa,KAAK,CAAC,UAAU;WAC/G,KAAK,CAAC,UAAU,gCAAgC,IAAI,CAAC,SAAS,IAAI,KAAK,CAAC,SAAS,SAAS,KAAK,CAAC,UAAU;;;;;;;;;;OAU9G,KAAK,CAAC,UAAU;IACnB,KAAK,CAAC,SAAS,KAAK,KAAK,CAA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C,KAAK,CAAC,SAAS;;YAEZ,KAAK,CAAC,UAAU,qBAAqB,KAAK,CAAC,SAAS,KAAK,KAAK,CAAC,SAAS;;CAEnF,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Content Template
|
|
3
|
+
*
|
|
4
|
+
* Generates {Module}Content.tsx component for displaying BlockNote content.
|
|
5
|
+
* Only generated for Content-extending modules.
|
|
6
|
+
*/
|
|
7
|
+
import { FrontendTemplateData } from "../../types/template-data.interface";
|
|
8
|
+
/**
|
|
9
|
+
* Generate the content display component file content
|
|
10
|
+
*
|
|
11
|
+
* @param data - Frontend template data
|
|
12
|
+
* @returns Generated file content or null if not Content-extending
|
|
13
|
+
*/
|
|
14
|
+
export declare function generateContentTemplate(data: FrontendTemplateData): string | null;
|
|
15
|
+
//# sourceMappingURL=content.template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.template.d.ts","sourceRoot":"","sources":["../../../../../scripts/generate-web-module/templates/components/content.template.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAE3E;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,GAAG,IAAI,CAwBjF"}
|