arkos 1.3.1-beta → 1.3.2-beta
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/cjs/app.js +139 -1
- package/dist/cjs/exports/auth/index.js +6 -1
- package/dist/cjs/exports/controllers/index.js +11 -1
- package/dist/cjs/exports/error-handler/index.js +11 -1
- package/dist/cjs/exports/index.js +12 -1
- package/dist/cjs/exports/middlewares/index.js +7 -1
- package/dist/cjs/exports/prisma/index.js +13 -1
- package/dist/cjs/exports/services/index.js +48 -1
- package/dist/cjs/exports/utils/index.js +44 -1
- package/dist/cjs/exports/validation/index.js +11 -1
- package/dist/cjs/modules/auth/auth.controller.js +229 -1
- package/dist/cjs/modules/auth/auth.controller.js.map +1 -1
- package/dist/cjs/modules/auth/auth.router.js +82 -1
- package/dist/cjs/modules/auth/auth.router.js.map +1 -1
- package/dist/cjs/modules/auth/auth.service.js +226 -1
- package/dist/cjs/modules/auth/utils/auth-error-objects.js +10 -1
- package/dist/cjs/modules/auth/utils/helpers/auth.controller.helpers.js +83 -1
- package/dist/cjs/modules/auth/utils/services/auth-action.service.js +92 -1
- package/dist/cjs/modules/auth/utils/services/auth-action.service.js.map +1 -1
- package/dist/cjs/modules/base/base.controller.js +172 -1
- package/dist/cjs/modules/base/base.middlewares.js +92 -1
- package/dist/cjs/modules/base/base.router.js +22 -1
- package/dist/cjs/modules/base/base.service.js +507 -1
- package/dist/cjs/modules/base/base.service.js.map +1 -1
- package/dist/cjs/modules/base/types/base.service.types.js +3 -1
- package/dist/cjs/modules/base/types/base.service.types.js.map +1 -1
- package/dist/cjs/modules/base/utils/helpers/base.controller.helpers.js +80 -1
- package/dist/cjs/modules/base/utils/helpers/base.middlewares.helpers.js +50 -1
- package/dist/cjs/modules/base/utils/helpers/base.router.helpers.js +104 -1
- package/dist/cjs/modules/base/utils/helpers/base.service.helpers.js +208 -1
- package/dist/cjs/modules/base/utils/router-validator.js +16 -1
- package/dist/cjs/modules/base/utils/service-hooks-manager.js +19 -1
- package/dist/cjs/modules/email/email.service.js +104 -1
- package/dist/cjs/modules/error-handler/error-handler.controller.js +146 -4
- package/dist/cjs/modules/error-handler/utils/app-error.js +17 -1
- package/dist/cjs/modules/error-handler/utils/catch-async.js +21 -1
- package/dist/cjs/modules/error-handler/utils/error-handler.helpers.js +205 -3
- package/dist/cjs/modules/file-upload/file-upload.controller.js +233 -1
- package/dist/cjs/modules/file-upload/file-upload.router.js +60 -1
- package/dist/cjs/modules/file-upload/file-upload.service.js +322 -1
- package/dist/cjs/modules/file-upload/utils/helpers/file-upload.helpers.js +97 -1
- package/dist/cjs/modules/swagger/swagger.router.js +38 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +338 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-swagger-default-configs.js +64 -1
- package/dist/cjs/modules/swagger/utils/helpers/get-system-json-schema-paths.js +37 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +48 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +32 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-system-json-schemas.js +49 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.js +34 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +471 -1
- package/dist/cjs/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.js +572 -1
- package/dist/cjs/modules/swagger/utils/helpers/missing-json-schemas-generator.js +260 -1
- package/dist/cjs/modules/swagger/utils/helpers/swagger.router.helpers.js +112 -1
- package/dist/cjs/paths.js +9 -1
- package/dist/cjs/server.js +94 -5
- package/dist/cjs/types/arkos-config.js +3 -1
- package/dist/cjs/types/arkos-config.js.map +1 -1
- package/dist/cjs/types/auth.js +3 -1
- package/dist/cjs/types/index.js +11 -1
- package/dist/cjs/types/router-config.js +3 -1
- package/dist/cjs/utils/arkos-env.js +9 -1
- package/dist/cjs/utils/cli/build.js +214 -5
- package/dist/cjs/utils/cli/dev.js +154 -3
- package/dist/cjs/utils/cli/generate.js +109 -1
- package/dist/cjs/utils/cli/index.js +104 -1
- package/dist/cjs/utils/cli/index.js.map +1 -1
- package/dist/cjs/utils/cli/prisma-generate.js +120 -0
- package/dist/cjs/utils/cli/prisma-generate.js.map +1 -0
- package/dist/cjs/utils/cli/start.js +103 -1
- package/dist/cjs/utils/cli/utils/cli.helpers.js +24 -1
- package/dist/cjs/utils/cli/utils/smart-fs-watcher.js +73 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/auth-configs-template.js +36 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/auth-configs-template.js.map +1 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/controller-template.js +21 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/controller-template.js.map +1 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/hooks-template.js +201 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/hooks-template.js.map +1 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/middlewares-template.js +288 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/{generate-middlewares.js.map → middlewares-template.js.map} +1 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/query-options-template.js +64 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/query-options-template.js.map +1 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js +45 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/router-template.js.map +1 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/service-template.js +29 -0
- package/dist/cjs/utils/cli/utils/template-generator/templates/service-template.js.map +1 -0
- package/dist/cjs/utils/cli/utils/template-generators.js +34 -2
- package/dist/cjs/utils/cli/utils/template-generators.js.map +1 -1
- package/dist/cjs/utils/cli/utils/watermark-stamper.js +17 -3
- package/dist/cjs/utils/dotenv.helpers.js +43 -1
- package/dist/cjs/utils/dynamic-loader.js +270 -9
- package/dist/cjs/utils/features/api.features.js +169 -1
- package/dist/cjs/utils/features/change-case.features.js +67 -1
- package/dist/cjs/utils/features/port-and-host-allocator.js +105 -1
- package/dist/cjs/utils/helpers/api.features.helpers.js +112 -1
- package/dist/cjs/utils/helpers/change-case.helpers.js +177 -1
- package/dist/cjs/utils/helpers/deepmerge.helper.js +115 -1
- package/dist/cjs/utils/helpers/dynamic-loader.helpers.js +76 -1
- package/dist/cjs/utils/helpers/fs.helpers.js +57 -1
- package/dist/cjs/utils/helpers/global.helpers.js +94 -1
- package/dist/cjs/utils/helpers/prisma.helpers.js +40 -1
- package/dist/cjs/utils/helpers/query-parser.helpers.js +45 -1
- package/dist/cjs/utils/helpers/routers.helpers.js +37 -1
- package/dist/cjs/utils/helpers/text.helpers.js +28 -1
- package/dist/cjs/utils/prisma/prisma-json-schema-generator.js +455 -1
- package/dist/cjs/utils/prisma/prisma-schema-parser.js +216 -4
- package/dist/cjs/utils/prisma/types.js +3 -1
- package/dist/cjs/utils/sheu.js +120 -1
- package/dist/cjs/utils/validate-dto.js +17 -1
- package/dist/cjs/utils/validate-schema.js +15 -1
- package/dist/esm/app.js +132 -1
- package/dist/esm/exports/auth/index.js +2 -1
- package/dist/esm/exports/controllers/index.js +4 -1
- package/dist/esm/exports/error-handler/index.js +4 -1
- package/dist/esm/exports/index.js +8 -1
- package/dist/esm/exports/middlewares/index.js +2 -1
- package/dist/esm/exports/prisma/index.js +6 -1
- package/dist/esm/exports/services/index.js +9 -1
- package/dist/esm/exports/utils/index.js +4 -1
- package/dist/esm/exports/validation/index.js +4 -1
- package/dist/esm/modules/auth/auth.controller.js +222 -1
- package/dist/esm/modules/auth/auth.controller.js.map +1 -1
- package/dist/esm/modules/auth/auth.router.js +76 -1
- package/dist/esm/modules/auth/auth.router.js.map +1 -1
- package/dist/esm/modules/auth/auth.service.js +219 -1
- package/dist/esm/modules/auth/utils/auth-error-objects.js +4 -1
- package/dist/esm/modules/auth/utils/helpers/auth.controller.helpers.js +73 -1
- package/dist/esm/modules/auth/utils/services/auth-action.service.js +90 -1
- package/dist/esm/modules/auth/utils/services/auth-action.service.js.map +1 -1
- package/dist/esm/modules/base/base.controller.js +165 -1
- package/dist/esm/modules/base/base.middlewares.js +81 -1
- package/dist/esm/modules/base/base.router.js +15 -1
- package/dist/esm/modules/base/base.service.js +500 -1
- package/dist/esm/modules/base/base.service.js.map +1 -1
- package/dist/esm/modules/base/types/base.service.types.js +2 -1
- package/dist/esm/modules/base/types/base.service.types.js.map +1 -1
- package/dist/esm/modules/base/utils/helpers/base.controller.helpers.js +76 -1
- package/dist/esm/modules/base/utils/helpers/base.middlewares.helpers.js +44 -1
- package/dist/esm/modules/base/utils/helpers/base.router.helpers.js +96 -1
- package/dist/esm/modules/base/utils/helpers/base.service.helpers.js +198 -1
- package/dist/esm/modules/base/utils/router-validator.js +14 -1
- package/dist/esm/modules/base/utils/service-hooks-manager.js +17 -1
- package/dist/esm/modules/email/email.service.js +97 -1
- package/dist/esm/modules/error-handler/error-handler.controller.js +107 -4
- package/dist/esm/modules/error-handler/utils/app-error.js +15 -1
- package/dist/esm/modules/error-handler/utils/catch-async.js +19 -1
- package/dist/esm/modules/error-handler/utils/error-handler.helpers.js +163 -3
- package/dist/esm/modules/file-upload/file-upload.controller.js +228 -1
- package/dist/esm/modules/file-upload/file-upload.router.js +54 -1
- package/dist/esm/modules/file-upload/file-upload.service.js +314 -1
- package/dist/esm/modules/file-upload/utils/helpers/file-upload.helpers.js +87 -1
- package/dist/esm/modules/swagger/swagger.router.js +32 -1
- package/dist/esm/modules/swagger/utils/helpers/get-authentication-json-schema-paths.js +333 -1
- package/dist/esm/modules/swagger/utils/helpers/get-swagger-default-configs.js +58 -1
- package/dist/esm/modules/swagger/utils/helpers/get-system-json-schema-paths.js +34 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-class-validator-json-schemas.js +42 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-prisma-json-schemas.js +26 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-system-json-schemas.js +46 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/generate-zod-json-schemas.js +28 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-main-routes-paths.js +465 -1
- package/dist/esm/modules/swagger/utils/helpers/json-schema-generators/prisma-models/generate-prisma-model-parent-routes-paths.js +566 -1
- package/dist/esm/modules/swagger/utils/helpers/missing-json-schemas-generator.js +255 -1
- package/dist/esm/modules/swagger/utils/helpers/swagger.router.helpers.js +101 -1
- package/dist/esm/paths.js +3 -1
- package/dist/esm/server.js +85 -5
- package/dist/esm/types/arkos-config.js +2 -1
- package/dist/esm/types/arkos-config.js.map +1 -1
- package/dist/esm/types/auth.js +2 -1
- package/dist/esm/types/index.js +8 -1
- package/dist/esm/types/router-config.js +2 -1
- package/dist/esm/utils/arkos-env.js +7 -1
- package/dist/esm/utils/cli/build.js +208 -5
- package/dist/esm/utils/cli/dev.js +147 -3
- package/dist/esm/utils/cli/generate.js +103 -1
- package/dist/esm/utils/cli/index.js +94 -1
- package/dist/esm/utils/cli/index.js.map +1 -1
- package/dist/esm/utils/cli/prisma-generate.js +114 -0
- package/dist/esm/utils/cli/prisma-generate.js.map +1 -0
- package/dist/esm/utils/cli/start.js +96 -1
- package/dist/esm/utils/cli/utils/cli.helpers.js +16 -1
- package/dist/esm/utils/cli/utils/smart-fs-watcher.js +68 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/auth-configs-template.js +33 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/auth-configs-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/controller-template.js +18 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/controller-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/hooks-template.js +198 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/hooks-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/middlewares-template.js +285 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/{generate-middlewares.js.map → middlewares-template.js.map} +1 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/query-options-template.js +61 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/query-options-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js +39 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/router-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/service-template.js +26 -0
- package/dist/esm/utils/cli/utils/template-generator/templates/service-template.js.map +1 -0
- package/dist/esm/utils/cli/utils/template-generators.js +28 -2
- package/dist/esm/utils/cli/utils/template-generators.js.map +1 -1
- package/dist/esm/utils/cli/utils/watermark-stamper.js +15 -3
- package/dist/esm/utils/dotenv.helpers.js +37 -1
- package/dist/esm/utils/dynamic-loader.js +254 -9
- package/dist/esm/utils/features/api.features.js +162 -1
- package/dist/esm/utils/features/change-case.features.js +31 -1
- package/dist/esm/utils/features/port-and-host-allocator.js +67 -1
- package/dist/esm/utils/helpers/api.features.helpers.js +106 -1
- package/dist/esm/utils/helpers/change-case.helpers.js +161 -1
- package/dist/esm/utils/helpers/deepmerge.helper.js +113 -1
- package/dist/esm/utils/helpers/dynamic-loader.helpers.js +69 -1
- package/dist/esm/utils/helpers/fs.helpers.js +48 -1
- package/dist/esm/utils/helpers/global.helpers.js +51 -1
- package/dist/esm/utils/helpers/prisma.helpers.js +32 -1
- package/dist/esm/utils/helpers/query-parser.helpers.js +40 -1
- package/dist/esm/utils/helpers/routers.helpers.js +29 -1
- package/dist/esm/utils/helpers/text.helpers.js +22 -1
- package/dist/esm/utils/prisma/prisma-json-schema-generator.js +448 -1
- package/dist/esm/utils/prisma/prisma-schema-parser.js +209 -4
- package/dist/esm/utils/prisma/types.js +2 -1
- package/dist/esm/utils/sheu.js +118 -1
- package/dist/esm/utils/validate-dto.js +11 -1
- package/dist/esm/utils/validate-schema.js +9 -1
- package/dist/types/modules/auth/utils/services/auth-action.service.d.ts +1 -1
- package/dist/types/modules/base/types/base.service.types.d.ts +12 -9
- package/dist/types/types/arkos-config.d.ts +3 -2
- package/dist/types/utils/cli/prisma-generate.d.ts +1 -0
- package/package.json +2 -2
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js +0 -21
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js.map +0 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-controller-template.js +0 -12
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-controller-template.js.map +0 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-hooks-template.js +0 -144
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-hooks-template.js.map +0 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-middlewares.js +0 -256
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js +0 -36
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js.map +0 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-router-template.js +0 -18
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-router-template.js.map +0 -1
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-service-template.js +0 -9
- package/dist/cjs/utils/cli/utils/template-generator/templates/generate-service-template.js.map +0 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js +0 -21
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-auth-configs-template.js.map +0 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-controller-template.js +0 -12
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-controller-template.js.map +0 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-hooks-template.js +0 -144
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-hooks-template.js.map +0 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-middlewares.js +0 -256
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js +0 -36
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-prisma-query-options.js.map +0 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-router-template.js +0 -18
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-router-template.js.map +0 -1
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-service-template.js +0 -9
- package/dist/esm/utils/cli/utils/template-generator/templates/generate-service-template.js.map +0 -1
- /package/dist/types/utils/cli/utils/template-generator/templates/{generate-auth-configs-template.d.ts → auth-configs-template.d.ts} +0 -0
- /package/dist/types/utils/cli/utils/template-generator/templates/{generate-controller-template.d.ts → controller-template.d.ts} +0 -0
- /package/dist/types/utils/cli/utils/template-generator/templates/{generate-hooks-template.d.ts → hooks-template.d.ts} +0 -0
- /package/dist/types/utils/cli/utils/template-generator/templates/{generate-middlewares.d.ts → middlewares-template.d.ts} +0 -0
- /package/dist/types/utils/cli/utils/template-generator/templates/{generate-prisma-query-options.d.ts → query-options-template.d.ts} +0 -0
- /package/dist/types/utils/cli/utils/template-generator/templates/{generate-router-template.d.ts → router-template.d.ts} +0 -0
- /package/dist/types/utils/cli/utils/template-generator/templates/{generate-service-template.d.ts → service-template.d.ts} +0 -0
package/dist/esm/types/index.js
CHANGED
|
@@ -1 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
export var AuthPermissionAction;
|
|
2
|
+
(function (AuthPermissionAction) {
|
|
3
|
+
AuthPermissionAction["Create"] = "Create";
|
|
4
|
+
AuthPermissionAction["View"] = "View";
|
|
5
|
+
AuthPermissionAction["Update"] = "Update";
|
|
6
|
+
AuthPermissionAction["Delete"] = "Delete";
|
|
7
|
+
})(AuthPermissionAction || (AuthPermissionAction = {}));
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
2
|
+
//# sourceMappingURL=router-config.js.map
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
const arkosEnv = {
|
|
2
|
+
JWT_SECRET: "13a9279eedb286f756212511267152e9585055809ec0606ea9f7eb98a87660c1616fbd39c44d4238a82f29df90b529e24bfdf72a480d1149d79c991c863a22b5ae0fb3ae6f5323bfd6664faef99792637477c38da488e7aa0d39b83ba99aba8e8a20efde7fd5c7ba21a6c938e17a9f99f73226dc61e89cd63f159257841194323f100d1a49b88ce4fdcdf2b066a5f32f88ee12f6487b55b4b5687d7c0caffdd8524e2adc4b941cf52e948f5b330f527eb1354341c876eed12dfa92cef3c341d030d05e6beb1e0a7f6d3e08e7b1aac045130457fd3a53ee469fecdd20fdd2c7a6a72b07cbcb1157c5b1cc581e6767bea32be8e125016a48951e85c7bdb961d9c9fab28444499ce063664fe0bd1a05d60294323bdd69af6d6ff1a2533dac8d4a869f76dbc746ee12f144e0af41029f620471817843140c23d036e731f3ebee21a70ff1549e97486fdf9cbef132ff2ced59fde9be35dd04b358c9a25ec4fd9cc0e36dae651e626d8c13b0c6d2a21f237517a05059680173e71817597062c792ea9c66030ca0d8ed82987e29189947692a0be5fffac4c988ca33f14ce96349661ef850dbff6909c7797676c90a5e47655346f59759482ef8a3a948e97e30f889bd4571610fd19e8ea4818651d37f6529cf32f0fc805bc053e911f0fe96f52b4420d54bd1f40739a95f5853b036c86ab9a51bed57fa9bd48607b5302e88db00900adf",
|
|
3
|
+
JWT_EXPIRES_IN: "30d",
|
|
4
|
+
PRISMA_SCHEMA_PATH: `./prisma/schema`,
|
|
5
|
+
};
|
|
6
|
+
export default arkosEnv;
|
|
7
|
+
//# sourceMappingURL=arkos-env.js.map
|
|
@@ -1,5 +1,208 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import path from "path";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import { execSync } from "child_process";
|
|
4
|
+
import { fullCleanCwd, getUserFileExtension } from "../helpers/fs.helpers.js";
|
|
5
|
+
import { loadEnvironmentVariables } from "../dotenv.helpers.js";
|
|
6
|
+
import { getVersion } from "./utils/cli.helpers.js";
|
|
7
|
+
import { detectPackageManagerFromUserAgent } from "../helpers/global.helpers.js";
|
|
8
|
+
import sheu from "../sheu.js";
|
|
9
|
+
const BUILD_DIR = ".build";
|
|
10
|
+
const MODULE_TYPES = ["cjs", "esm"];
|
|
11
|
+
export function buildCommand(options = {}) {
|
|
12
|
+
const fileExt = getUserFileExtension();
|
|
13
|
+
process.env.NODE_ENV = "production";
|
|
14
|
+
process.env.NODE_ENV = "true";
|
|
15
|
+
const envFiles = loadEnvironmentVariables();
|
|
16
|
+
const moduleType = validateModuleType(options.module);
|
|
17
|
+
try {
|
|
18
|
+
console.info(` \x1b[1m\x1b[36m Arkos.js ${getVersion()}\x1b[0m`);
|
|
19
|
+
console.info(` - Environments: ${fullCleanCwd(envFiles?.join(", ") || "")
|
|
20
|
+
.replaceAll(`${process.cwd()}/`, "")
|
|
21
|
+
.replaceAll("/", "")}`);
|
|
22
|
+
console.info(`\n Creating an optimized production build...`);
|
|
23
|
+
ensureBuildDir();
|
|
24
|
+
if (fileExt === "ts") {
|
|
25
|
+
buildTypeScriptProject(options, moduleType);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
buildJavaScriptProject(options, moduleType);
|
|
29
|
+
}
|
|
30
|
+
const packageManger = detectPackageManagerFromUserAgent();
|
|
31
|
+
console.info(`\n\x1b[1m\x1b[32m Build complete!\x1b[0m\n`);
|
|
32
|
+
console.info(` \x1b[1mNext step:\x1b[0m`);
|
|
33
|
+
console.info(` Run it using \x1b[1m\x1b[36m${packageManger} run start\x1b[0m\n`);
|
|
34
|
+
}
|
|
35
|
+
catch (err) {
|
|
36
|
+
console.info("");
|
|
37
|
+
sheu.error(`Build failed: ${err?.message}`);
|
|
38
|
+
console.error(err);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function validateModuleType(moduleType) {
|
|
43
|
+
if (!moduleType)
|
|
44
|
+
return "cjs";
|
|
45
|
+
const normalizedType = moduleType.toLowerCase();
|
|
46
|
+
if (normalizedType === "cjs" || normalizedType === "commonjs") {
|
|
47
|
+
return "cjs";
|
|
48
|
+
}
|
|
49
|
+
else if (["esm", "es", "es2020", "esnext", "module"].includes(normalizedType)) {
|
|
50
|
+
return "esm";
|
|
51
|
+
}
|
|
52
|
+
console.warn(`⚠️ Unrecognized module type "${moduleType}", defaulting to "cjs"`);
|
|
53
|
+
return "cjs";
|
|
54
|
+
}
|
|
55
|
+
function ensureBuildDir() {
|
|
56
|
+
if (!fs.existsSync(BUILD_DIR)) {
|
|
57
|
+
fs.mkdirSync(BUILD_DIR, { recursive: true });
|
|
58
|
+
}
|
|
59
|
+
for (const moduleType of MODULE_TYPES) {
|
|
60
|
+
const moduleDir = path.join(BUILD_DIR, moduleType);
|
|
61
|
+
if (!fs.existsSync(moduleDir)) {
|
|
62
|
+
fs.mkdirSync(moduleDir, { recursive: true });
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function buildTypeScriptProject(options, moduleType) {
|
|
67
|
+
const tsconfigPath = path.join(process.cwd(), options.config || "tsconfig.json");
|
|
68
|
+
let tsconfig = {};
|
|
69
|
+
try {
|
|
70
|
+
if (fs.existsSync(tsconfigPath)) {
|
|
71
|
+
const tsconfigContent = fs.readFileSync(tsconfigPath, "utf8");
|
|
72
|
+
tsconfig = JSON.parse(tsconfigContent);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
console.error("❌ Error reading tsconfig.json:", error);
|
|
77
|
+
}
|
|
78
|
+
const tempTsconfig = {
|
|
79
|
+
...tsconfig,
|
|
80
|
+
compilerOptions: {
|
|
81
|
+
...(tsconfig.compilerOptions || {}),
|
|
82
|
+
rootDir: ".",
|
|
83
|
+
outDir: path.join(`./${BUILD_DIR}`),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
const tempTsconfigPath = path.join(process.cwd(), `tsconfig.arkos-build.json`);
|
|
87
|
+
fs.writeFileSync(tempTsconfigPath, JSON.stringify(tempTsconfig, null, 2));
|
|
88
|
+
try {
|
|
89
|
+
execSync(`npx rimraf ${BUILD_DIR} && npx tsc -p ${tempTsconfigPath}`, {
|
|
90
|
+
stdio: "inherit",
|
|
91
|
+
cwd: process.cwd(),
|
|
92
|
+
});
|
|
93
|
+
copyAllNonSourceFiles(moduleType, [".ts", ".tsx"]);
|
|
94
|
+
cleanupTempConfig(tempTsconfigPath);
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
cleanupTempConfig(tempTsconfigPath);
|
|
98
|
+
throw error;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
function buildJavaScriptProject(_, moduleType) {
|
|
102
|
+
const targetDir = path.join(BUILD_DIR);
|
|
103
|
+
try {
|
|
104
|
+
if (moduleType === "esm") {
|
|
105
|
+
execSync(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.mjs" ${targetDir}`, {
|
|
106
|
+
stdio: "inherit",
|
|
107
|
+
cwd: process.cwd(),
|
|
108
|
+
});
|
|
109
|
+
console.info("Note: .cjs files are skipped in ESM build");
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
execSync(`npx copyfiles -u 0 "src/**/*.js" "src/**/*.jsx" "src/**/*.cjs" "src/**/*.mjs" ${targetDir}`, {
|
|
113
|
+
stdio: "inherit",
|
|
114
|
+
cwd: process.cwd(),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
copyAllNonSourceFiles(moduleType, [
|
|
118
|
+
".js",
|
|
119
|
+
".jsx",
|
|
120
|
+
".mjs",
|
|
121
|
+
".cjs",
|
|
122
|
+
".ts",
|
|
123
|
+
".tsx",
|
|
124
|
+
]);
|
|
125
|
+
createModulePackageJson(moduleType);
|
|
126
|
+
}
|
|
127
|
+
catch (error) {
|
|
128
|
+
console.error("❌ Error building JavaScript project:", error);
|
|
129
|
+
throw error;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
function copyAllNonSourceFiles(_, skipExtensions) {
|
|
133
|
+
const targetDir = path.join(BUILD_DIR);
|
|
134
|
+
const sourceDir = "src";
|
|
135
|
+
try {
|
|
136
|
+
function copyDirRecursive(dir) {
|
|
137
|
+
if (!fs.existsSync(dir))
|
|
138
|
+
return;
|
|
139
|
+
const items = fs.readdirSync(dir);
|
|
140
|
+
for (const item of items) {
|
|
141
|
+
const sourcePath = path.join(dir, item);
|
|
142
|
+
const targetPath = path.join(targetDir, dir.replace(sourceDir, ""), item);
|
|
143
|
+
const stats = fs.statSync(sourcePath);
|
|
144
|
+
if (stats.isDirectory()) {
|
|
145
|
+
if (!fs.existsSync(targetPath)) {
|
|
146
|
+
fs.mkdirSync(targetPath, { recursive: true });
|
|
147
|
+
}
|
|
148
|
+
copyDirRecursive(sourcePath);
|
|
149
|
+
}
|
|
150
|
+
else if (stats.isFile()) {
|
|
151
|
+
const ext = path.extname(item).toLowerCase();
|
|
152
|
+
if (!skipExtensions.includes(ext)) {
|
|
153
|
+
const targetDir = path.dirname(targetPath);
|
|
154
|
+
if (!fs.existsSync(targetDir)) {
|
|
155
|
+
fs.mkdirSync(targetDir, { recursive: true });
|
|
156
|
+
}
|
|
157
|
+
fs.copyFileSync(sourcePath, targetPath);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
copyDirRecursive(sourceDir);
|
|
163
|
+
const rootFilesToCopy = ["README.md", "LICENSE"];
|
|
164
|
+
for (const file of rootFilesToCopy) {
|
|
165
|
+
if (fs.existsSync(path.join(process.cwd(), file))) {
|
|
166
|
+
fs.copyFileSync(path.join(process.cwd(), file), path.join(targetDir, file));
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch (error) {
|
|
171
|
+
console.warn("Warning: Error copying project files:", error);
|
|
172
|
+
console.error(error);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
function createModulePackageJson(moduleType) {
|
|
176
|
+
const packageJsonPath = path.join(process.cwd(), "package.json");
|
|
177
|
+
if (!fs.existsSync(packageJsonPath)) {
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
try {
|
|
181
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
182
|
+
const buildPackageJson = {
|
|
183
|
+
name: packageJson.name,
|
|
184
|
+
version: packageJson.version,
|
|
185
|
+
description: packageJson.description,
|
|
186
|
+
main: "index.js",
|
|
187
|
+
dependencies: packageJson.dependencies,
|
|
188
|
+
};
|
|
189
|
+
if (moduleType === "esm") {
|
|
190
|
+
buildPackageJson.type = "module";
|
|
191
|
+
}
|
|
192
|
+
const targetDir = path.join(BUILD_DIR, moduleType);
|
|
193
|
+
fs.writeFileSync(path.join(targetDir, "package.json"), JSON.stringify(buildPackageJson, null, 2));
|
|
194
|
+
}
|
|
195
|
+
catch (error) {
|
|
196
|
+
console.warn("Warning: Failed to create module-specific package.json", error);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
function cleanupTempConfig(configPath) {
|
|
200
|
+
try {
|
|
201
|
+
if (fs.existsSync(configPath))
|
|
202
|
+
fs.unlinkSync(configPath);
|
|
203
|
+
}
|
|
204
|
+
catch (error) {
|
|
205
|
+
console.warn("Warning: Error cleaning up temporary config:", error);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=build.js.map
|
|
@@ -1,3 +1,147 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { spawn } from "child_process";
|
|
2
|
+
import chokidar from "chokidar";
|
|
3
|
+
import { fullCleanCwd, getUserFileExtension } from "../helpers/fs.helpers.js";
|
|
4
|
+
import { getVersion } from "./utils/cli.helpers.js";
|
|
5
|
+
import { loadEnvironmentVariables } from "../dotenv.helpers.js";
|
|
6
|
+
import fs from "fs";
|
|
7
|
+
import path from "path";
|
|
8
|
+
import sheu from "../sheu.js";
|
|
9
|
+
import portAndHostAllocator from "../features/port-and-host-allocator.js";
|
|
10
|
+
let child = null;
|
|
11
|
+
let envFiles;
|
|
12
|
+
export async function devCommand(options = {}) {
|
|
13
|
+
process.env.NODE_ENV = "development";
|
|
14
|
+
envFiles = loadEnvironmentVariables();
|
|
15
|
+
child = null;
|
|
16
|
+
let restartTimeout = null;
|
|
17
|
+
try {
|
|
18
|
+
const { port, host } = options;
|
|
19
|
+
let isRestarting = false;
|
|
20
|
+
let restartingFiles = new Set();
|
|
21
|
+
const fileExt = getUserFileExtension();
|
|
22
|
+
const entryPoint = path.resolve(process.cwd(), `src/app.${fileExt}`);
|
|
23
|
+
if (!fs.existsSync(entryPoint)) {
|
|
24
|
+
console.error(`Could not find application entry point at ${entryPoint}`);
|
|
25
|
+
process.exit(1);
|
|
26
|
+
}
|
|
27
|
+
const getEnv = () => ({
|
|
28
|
+
NODE_ENV: "development",
|
|
29
|
+
...process.env,
|
|
30
|
+
...(port && { CLI_PORT: port }),
|
|
31
|
+
...(host && { CLI_HOST: host }),
|
|
32
|
+
});
|
|
33
|
+
const startServer = () => {
|
|
34
|
+
if (child) {
|
|
35
|
+
child.kill();
|
|
36
|
+
child = null;
|
|
37
|
+
}
|
|
38
|
+
const env = getEnv();
|
|
39
|
+
if (fileExt === "ts") {
|
|
40
|
+
child = spawn("npx", ["tsx-strict", "--watch", entryPoint], {
|
|
41
|
+
stdio: "inherit",
|
|
42
|
+
env,
|
|
43
|
+
shell: true,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
child = spawn("npx", ["tsx-strict", "--no-type-check", "--watch", entryPoint], {
|
|
48
|
+
stdio: "inherit",
|
|
49
|
+
env,
|
|
50
|
+
shell: true,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
if (child) {
|
|
54
|
+
child.on("error", (error) => {
|
|
55
|
+
console.error("Failed to start server:", error);
|
|
56
|
+
});
|
|
57
|
+
child.on("exit", (code, signal) => {
|
|
58
|
+
if (!isRestarting && signal !== "SIGTERM" && signal !== "SIGINT") {
|
|
59
|
+
console.info(`Server exited with code ${code}, restarting...`);
|
|
60
|
+
startServer();
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
const scheduleRestart = (reason, filePath) => {
|
|
66
|
+
if (filePath)
|
|
67
|
+
restartingFiles.add(filePath);
|
|
68
|
+
if (restartTimeout)
|
|
69
|
+
clearTimeout(restartTimeout);
|
|
70
|
+
const now = new Date();
|
|
71
|
+
const time = now.toTimeString().split(" ")[0];
|
|
72
|
+
isRestarting = true;
|
|
73
|
+
if (child) {
|
|
74
|
+
child.kill();
|
|
75
|
+
child = null;
|
|
76
|
+
}
|
|
77
|
+
restartTimeout = setTimeout(() => {
|
|
78
|
+
sheu.info(`\x1b[90m${time}\x1b[0m Restarting: ${reason.toLowerCase()}`);
|
|
79
|
+
startServer();
|
|
80
|
+
isRestarting = false;
|
|
81
|
+
restartTimeout = null;
|
|
82
|
+
if (filePath)
|
|
83
|
+
restartingFiles.delete(filePath);
|
|
84
|
+
}, 1000);
|
|
85
|
+
};
|
|
86
|
+
const setupEnvWatcher = () => {
|
|
87
|
+
const envWatcher = chokidar.watch(fullCleanCwd(envFiles?.join(",") || "")
|
|
88
|
+
.replaceAll("/", "")
|
|
89
|
+
.split(",") || [], {
|
|
90
|
+
ignoreInitial: true,
|
|
91
|
+
persistent: true,
|
|
92
|
+
});
|
|
93
|
+
envWatcher.on("all", (_, filePath) => {
|
|
94
|
+
try {
|
|
95
|
+
envFiles = loadEnvironmentVariables();
|
|
96
|
+
scheduleRestart("Environment files changed", "env-files");
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
console.error(`Error reloading ${filePath}:`, error);
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
return envWatcher;
|
|
103
|
+
};
|
|
104
|
+
startServer();
|
|
105
|
+
const envWatcher = setupEnvWatcher();
|
|
106
|
+
const env = getEnv();
|
|
107
|
+
const hostAndPort = await portAndHostAllocator.getHostAndAvailablePort(env, { logWarning: true });
|
|
108
|
+
console.info(`\n \x1b[1m\x1b[36m Arkos.js ${getVersion()}\x1b[0m`);
|
|
109
|
+
console.info(` - Local: http://${hostAndPort?.host}:${hostAndPort?.port}`);
|
|
110
|
+
console.info(` - Environments: ${fullCleanCwd(envFiles?.join(", ") || "")
|
|
111
|
+
.replaceAll(`${process.cwd()}/`, "")
|
|
112
|
+
.replaceAll("/", "")}\n`);
|
|
113
|
+
const cleanup = () => {
|
|
114
|
+
if (restartTimeout)
|
|
115
|
+
clearTimeout(restartTimeout);
|
|
116
|
+
if (envWatcher)
|
|
117
|
+
envWatcher.close();
|
|
118
|
+
if (child) {
|
|
119
|
+
child.kill("SIGTERM");
|
|
120
|
+
setTimeout(() => {
|
|
121
|
+
if (child && !child.killed)
|
|
122
|
+
child.kill("SIGKILL");
|
|
123
|
+
}, 5000);
|
|
124
|
+
}
|
|
125
|
+
process.exit(0);
|
|
126
|
+
};
|
|
127
|
+
process.on("SIGINT", cleanup);
|
|
128
|
+
process.on("SIGTERM", cleanup);
|
|
129
|
+
process.on("uncaughtException", (error) => {
|
|
130
|
+
console.error("Uncaught Exception:", error);
|
|
131
|
+
cleanup();
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
catch (error) {
|
|
135
|
+
console.error("Development server failed to start:", error);
|
|
136
|
+
if (child) {
|
|
137
|
+
child?.kill?.();
|
|
138
|
+
child = null;
|
|
139
|
+
}
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
export function killDevelopmentServerChildProcess() {
|
|
144
|
+
child?.kill?.();
|
|
145
|
+
child = null;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=dev.js.map
|
|
@@ -1 +1,103 @@
|
|
|
1
|
-
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { generateTemplate } from "./utils/template-generators.js";
|
|
4
|
+
import { ensureDirectoryExists } from "./utils/cli.helpers.js";
|
|
5
|
+
import { camelCase, kebabCase, pascalCase, } from "../helpers/change-case.helpers.js";
|
|
6
|
+
import { fullCleanCwd, getUserFileExtension } from "../helpers/fs.helpers.js";
|
|
7
|
+
import sheu from "../sheu.js";
|
|
8
|
+
const generateFile = async (options, config) => {
|
|
9
|
+
const modelName = options.model;
|
|
10
|
+
if (!modelName) {
|
|
11
|
+
sheu.error("Module name is required!");
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
if (config.customValidation) {
|
|
15
|
+
config.customValidation(modelName);
|
|
16
|
+
}
|
|
17
|
+
const { path: customPath = "src/modules" } = options;
|
|
18
|
+
const names = {
|
|
19
|
+
pascal: pascalCase(modelName),
|
|
20
|
+
camel: camelCase(modelName),
|
|
21
|
+
kebab: kebabCase(modelName),
|
|
22
|
+
};
|
|
23
|
+
const ext = getUserFileExtension();
|
|
24
|
+
const modulePath = path.join(process.cwd(), customPath, names.kebab);
|
|
25
|
+
const filePath = path.join(modulePath, `${names.kebab}.${config.fileSuffix}.${ext}`);
|
|
26
|
+
const humamReadableTemplateName = config.templateName.charAt(0).toUpperCase() +
|
|
27
|
+
config.templateName.slice(1).replaceAll("-", " ");
|
|
28
|
+
try {
|
|
29
|
+
ensureDirectoryExists(modulePath);
|
|
30
|
+
const templateData = {
|
|
31
|
+
modelName: names,
|
|
32
|
+
...(config.customImports && { imports: config.customImports(names) }),
|
|
33
|
+
};
|
|
34
|
+
const content = generateTemplate(config.templateName, templateData);
|
|
35
|
+
fs.writeFileSync(filePath, content);
|
|
36
|
+
sheu.done(`${humamReadableTemplateName} for ${options.model} generated under ${fullCleanCwd(filePath)}`);
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
sheu.error(`${sheu.bold(`Failed to generate ${humamReadableTemplateName.toLowerCase()}`)} for ${options.model} ${filePath ? "under " + fullCleanCwd(filePath) + "." : "."}`);
|
|
40
|
+
process.exit(1);
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
export const generateCommand = {
|
|
44
|
+
controller: async (options) => {
|
|
45
|
+
await generateFile(options, {
|
|
46
|
+
templateName: "controller",
|
|
47
|
+
fileSuffix: "controller",
|
|
48
|
+
customImports: () => ({
|
|
49
|
+
baseController: "arkos/controllers",
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
},
|
|
53
|
+
service: async (options) => {
|
|
54
|
+
await generateFile(options, {
|
|
55
|
+
templateName: "service",
|
|
56
|
+
fileSuffix: "service",
|
|
57
|
+
customImports: () => ({
|
|
58
|
+
baseService: "arkos/services",
|
|
59
|
+
}),
|
|
60
|
+
});
|
|
61
|
+
},
|
|
62
|
+
router: async (options) => {
|
|
63
|
+
await generateFile(options, {
|
|
64
|
+
templateName: "router",
|
|
65
|
+
fileSuffix: "router",
|
|
66
|
+
customImports: (names) => ({
|
|
67
|
+
baseRouter: "arkos",
|
|
68
|
+
controller: `./${names.kebab}.controller`,
|
|
69
|
+
}),
|
|
70
|
+
});
|
|
71
|
+
},
|
|
72
|
+
interceptors: async (options) => {
|
|
73
|
+
await generateFile(options, {
|
|
74
|
+
templateName: "interceptors",
|
|
75
|
+
fileSuffix: "middlewares",
|
|
76
|
+
});
|
|
77
|
+
},
|
|
78
|
+
authConfigs: async (options) => {
|
|
79
|
+
await generateFile(options, {
|
|
80
|
+
templateName: "auth-configs",
|
|
81
|
+
fileSuffix: "auth",
|
|
82
|
+
});
|
|
83
|
+
},
|
|
84
|
+
hooks: async (options) => {
|
|
85
|
+
await generateFile(options, {
|
|
86
|
+
templateName: "hooks",
|
|
87
|
+
fileSuffix: "hooks",
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
queryOptions: async (options) => {
|
|
91
|
+
await generateFile(options, {
|
|
92
|
+
templateName: "query-options",
|
|
93
|
+
fileSuffix: "query",
|
|
94
|
+
customValidation: (modelName) => {
|
|
95
|
+
if (modelName === "file-upload") {
|
|
96
|
+
sheu.error("Prisma query options are not available to file-upload resource");
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
},
|
|
102
|
+
};
|
|
103
|
+
//# sourceMappingURL=generate.js.map
|
|
@@ -1 +1,94 @@
|
|
|
1
|
-
|
|
1
|
+
import { Command } from "commander";
|
|
2
|
+
import { buildCommand } from "./build.js";
|
|
3
|
+
import { devCommand } from "./dev.js";
|
|
4
|
+
import { startCommand } from "./start.js";
|
|
5
|
+
import { generateCommand } from "./generate.js";
|
|
6
|
+
import { getVersion } from "./utils/cli.helpers.js";
|
|
7
|
+
import prismaGenerateCommand from "./prisma-generate.js";
|
|
8
|
+
const program = new Command();
|
|
9
|
+
program.name("arkos").description("Arkos.js CLI").version(getVersion());
|
|
10
|
+
program
|
|
11
|
+
.command("build")
|
|
12
|
+
.description("Build your Arkos project")
|
|
13
|
+
.option("-m, --module <type>", "Module type (cjs or esm)", "cjs")
|
|
14
|
+
.action(buildCommand);
|
|
15
|
+
program
|
|
16
|
+
.command("dev")
|
|
17
|
+
.description("Run development server")
|
|
18
|
+
.option("-p, --port <number>", "Port number")
|
|
19
|
+
.option("-h, --host <host>", "Host to bind to")
|
|
20
|
+
.action(devCommand);
|
|
21
|
+
program
|
|
22
|
+
.command("start")
|
|
23
|
+
.description("Run production server")
|
|
24
|
+
.option("-p, --port <number>", "Port number")
|
|
25
|
+
.option("-h, --host <host>", "Host to bind to")
|
|
26
|
+
.action(startCommand);
|
|
27
|
+
const generate = program
|
|
28
|
+
.command("generate")
|
|
29
|
+
.alias("g")
|
|
30
|
+
.description("Generate arkos components");
|
|
31
|
+
generate
|
|
32
|
+
.command("controller")
|
|
33
|
+
.alias("c")
|
|
34
|
+
.description("Generate a new controller")
|
|
35
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
36
|
+
.option("-p, --path <path>", "Custom path for the controller", "src/modules")
|
|
37
|
+
.action(generateCommand.controller);
|
|
38
|
+
generate
|
|
39
|
+
.command("service")
|
|
40
|
+
.alias("s")
|
|
41
|
+
.description("Generate a new service")
|
|
42
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
43
|
+
.option("-p, --path <path>", "Custom path for the service", "src/modules")
|
|
44
|
+
.action(generateCommand.service);
|
|
45
|
+
generate
|
|
46
|
+
.command("router")
|
|
47
|
+
.alias("r")
|
|
48
|
+
.description("Generate a new router")
|
|
49
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
50
|
+
.option("-p, --path <path>", "Custom path for the router", "src/modules")
|
|
51
|
+
.action(generateCommand.router);
|
|
52
|
+
generate
|
|
53
|
+
.command("auth-configs")
|
|
54
|
+
.alias("a")
|
|
55
|
+
.description("Generate auth configuration")
|
|
56
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
57
|
+
.option("-p, --path <path>", "Custom path for the router", "src/modules")
|
|
58
|
+
.action(generateCommand.authConfigs);
|
|
59
|
+
generate
|
|
60
|
+
.command("query-options")
|
|
61
|
+
.alias("q")
|
|
62
|
+
.description("Generate prisma query options")
|
|
63
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
64
|
+
.option("-p, --path <path>", "Custom path for query options", "src/modules")
|
|
65
|
+
.action(generateCommand.queryOptions);
|
|
66
|
+
generate
|
|
67
|
+
.command("middlewares")
|
|
68
|
+
.alias("m")
|
|
69
|
+
.description("Generate a new middleware file")
|
|
70
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
71
|
+
.option("-p, --path <path>", "Custom path for middleware", "src/modules")
|
|
72
|
+
.action(generateCommand.interceptors);
|
|
73
|
+
generate
|
|
74
|
+
.command("interceptors")
|
|
75
|
+
.alias("i")
|
|
76
|
+
.description("Generate a new interceptors file")
|
|
77
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
78
|
+
.option("-p, --path <path>", "Custom path for interceptors", "src/modules")
|
|
79
|
+
.action(generateCommand.interceptors);
|
|
80
|
+
generate
|
|
81
|
+
.command("hooks")
|
|
82
|
+
.alias("h")
|
|
83
|
+
.description("Generate a new service hooks file")
|
|
84
|
+
.requiredOption("-m, --model <name>", "Module name")
|
|
85
|
+
.option("-p, --path <path>", "Custom path for hooks", "src/modules")
|
|
86
|
+
.action(generateCommand.hooks);
|
|
87
|
+
program
|
|
88
|
+
.command("prisma")
|
|
89
|
+
.command("generate")
|
|
90
|
+
.description("Generate your @prisma/client and BaseService class types")
|
|
91
|
+
.action(prismaGenerateCommand);
|
|
92
|
+
program.parse(process.argv);
|
|
93
|
+
export { program, buildCommand, devCommand, startCommand, generateCommand };
|
|
94
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/cli/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/utils/cli/index.ts"],"names":[],"mappings":"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","sourcesContent":["import { Command } from \"commander\";\nimport { buildCommand } from \"./build\";\nimport { devCommand } from \"./dev\";\nimport { startCommand } from \"./start\";\nimport { generateCommand } from \"./generate\";\nimport { getVersion } from \"./utils/cli.helpers\";\nimport prismaGenerateCommand from \"./prisma-generate\";\n\nconst program = new Command();\n\nprogram.name(\"arkos\").description(\"Arkos.js CLI\").version(getVersion());\n\nprogram\n .command(\"build\")\n .description(\"Build your Arkos project\")\n .option(\"-m, --module <type>\", \"Module type (cjs or esm)\", \"cjs\")\n .action(buildCommand);\n\nprogram\n .command(\"dev\")\n .description(\"Run development server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(devCommand);\n\nprogram\n .command(\"start\")\n .description(\"Run production server\")\n .option(\"-p, --port <number>\", \"Port number\")\n .option(\"-h, --host <host>\", \"Host to bind to\")\n .action(startCommand);\n\nconst generate = program\n .command(\"generate\")\n .alias(\"g\")\n .description(\"Generate arkos components\");\n\ngenerate\n .command(\"controller\")\n .alias(\"c\")\n .description(\"Generate a new controller\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for the controller\", \"src/modules\")\n .action(generateCommand.controller);\n\ngenerate\n .command(\"service\")\n .alias(\"s\")\n .description(\"Generate a new service\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for the service\", \"src/modules\")\n .action(generateCommand.service);\n\ngenerate\n .command(\"router\")\n .alias(\"r\")\n .description(\"Generate a new router\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for the router\", \"src/modules\")\n .action(generateCommand.router);\n\ngenerate\n .command(\"auth-configs\")\n .alias(\"a\")\n .description(\"Generate auth configuration\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for the router\", \"src/modules\")\n .action(generateCommand.authConfigs);\n\ngenerate\n .command(\"query-options\")\n .alias(\"q\")\n .description(\"Generate prisma query options\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for query options\", \"src/modules\")\n .action(generateCommand.queryOptions);\n\ngenerate\n .command(\"middlewares\")\n .alias(\"m\")\n .description(\"Generate a new middleware file\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for middleware\", \"src/modules\")\n .action(generateCommand.interceptors);\n\ngenerate\n .command(\"interceptors\")\n .alias(\"i\")\n .description(\"Generate a new interceptors file\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for interceptors\", \"src/modules\")\n .action(generateCommand.interceptors);\n\ngenerate\n .command(\"hooks\")\n .alias(\"h\")\n .description(\"Generate a new service hooks file\")\n .requiredOption(\"-m, --model <name>\", \"Module name\")\n .option(\"-p, --path <path>\", \"Custom path for hooks\", \"src/modules\")\n .action(generateCommand.hooks);\n\nprogram\n .command(\"prisma\")\n .command(\"generate\")\n .description(\"Generate your @prisma/client and BaseService class types\")\n .action(prismaGenerateCommand);\n\nprogram.parse(process.argv);\n\nexport { program, buildCommand, devCommand, startCommand, generateCommand };\n"]}
|