express-project-builder 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/index.d.ts +3 -0
- package/dist/bin/index.d.ts.map +1 -0
- package/dist/bin/index.js +177 -0
- package/dist/bin/index.js.map +1 -0
- package/dist/lib/config/createEnvExample.d.ts +3 -0
- package/dist/lib/config/createEnvExample.d.ts.map +1 -0
- package/dist/lib/config/createEnvExample.js +39 -0
- package/dist/lib/config/createEnvExample.js.map +1 -0
- package/dist/lib/config/createEslintConfig.d.ts +2 -0
- package/dist/lib/config/createEslintConfig.d.ts.map +1 -0
- package/dist/lib/config/createEslintConfig.js +48 -0
- package/dist/lib/config/createEslintConfig.js.map +1 -0
- package/dist/lib/config/createGitignore.d.ts +3 -0
- package/dist/lib/config/createGitignore.d.ts.map +1 -0
- package/dist/lib/config/createGitignore.js +51 -0
- package/dist/lib/config/createGitignore.js.map +1 -0
- package/dist/lib/config/createPackageJson.d.ts +3 -0
- package/dist/lib/config/createPackageJson.d.ts.map +1 -0
- package/dist/lib/config/createPackageJson.js +74 -0
- package/dist/lib/config/createPackageJson.js.map +1 -0
- package/dist/lib/config/createPrettierConfig.d.ts +2 -0
- package/dist/lib/config/createPrettierConfig.d.ts.map +1 -0
- package/dist/lib/config/createPrettierConfig.js +30 -0
- package/dist/lib/config/createPrettierConfig.js.map +1 -0
- package/dist/lib/config/createTsConfig.d.ts +2 -0
- package/dist/lib/config/createTsConfig.d.ts.map +1 -0
- package/dist/lib/config/createTsConfig.js +133 -0
- package/dist/lib/config/createTsConfig.js.map +1 -0
- package/dist/lib/prisma/create_Schema.Prisma.d.ts +3 -0
- package/dist/lib/prisma/create_Schema.Prisma.d.ts.map +1 -0
- package/dist/lib/prisma/create_Schema.Prisma.js +36 -0
- package/dist/lib/prisma/create_Schema.Prisma.js.map +1 -0
- package/dist/lib/src/builders/create_QueryBuilder_Helpers.d.ts +3 -0
- package/dist/lib/src/builders/create_QueryBuilder_Helpers.d.ts.map +1 -0
- package/dist/lib/src/builders/create_QueryBuilder_Helpers.js +292 -0
- package/dist/lib/src/builders/create_QueryBuilder_Helpers.js.map +1 -0
- package/dist/lib/src/config/create_Config_Index.d.ts +9 -0
- package/dist/lib/src/config/create_Config_Index.d.ts.map +1 -0
- package/dist/lib/src/config/create_Config_Index.js +92 -0
- package/dist/lib/src/config/create_Config_Index.js.map +1 -0
- package/dist/lib/src/constants/create_UserRole_Constant.d.ts +7 -0
- package/dist/lib/src/constants/create_UserRole_Constant.d.ts.map +1 -0
- package/dist/lib/src/constants/create_UserRole_Constant.js +39 -0
- package/dist/lib/src/constants/create_UserRole_Constant.js.map +1 -0
- package/dist/lib/src/createAppFile.d.ts +2 -0
- package/dist/lib/src/createAppFile.d.ts.map +1 -0
- package/dist/lib/src/createAppFile.js +122 -0
- package/dist/lib/src/createAppFile.js.map +1 -0
- package/dist/lib/src/createServerFile.d.ts +3 -0
- package/dist/lib/src/createServerFile.d.ts.map +1 -0
- package/dist/lib/src/createServerFile.js +75 -0
- package/dist/lib/src/createServerFile.js.map +1 -0
- package/dist/lib/src/createSrcStructure.d.ts +2 -0
- package/dist/lib/src/createSrcStructure.d.ts.map +1 -0
- package/dist/lib/src/createSrcStructure.js +50 -0
- package/dist/lib/src/createSrcStructure.js.map +1 -0
- package/dist/lib/src/errors/create_AppError_Class.d.ts +7 -0
- package/dist/lib/src/errors/create_AppError_Class.d.ts.map +1 -0
- package/dist/lib/src/errors/create_AppError_Class.js +65 -0
- package/dist/lib/src/errors/create_AppError_Class.js.map +1 -0
- package/dist/lib/src/errors/create_HandleCastError.d.ts +9 -0
- package/dist/lib/src/errors/create_HandleCastError.d.ts.map +1 -0
- package/dist/lib/src/errors/create_HandleCastError.js +101 -0
- package/dist/lib/src/errors/create_HandleCastError.js.map +1 -0
- package/dist/lib/src/errors/create_HandleDB_ValidationError.d.ts +9 -0
- package/dist/lib/src/errors/create_HandleDB_ValidationError.d.ts.map +1 -0
- package/dist/lib/src/errors/create_HandleDB_ValidationError.js +119 -0
- package/dist/lib/src/errors/create_HandleDB_ValidationError.js.map +1 -0
- package/dist/lib/src/errors/create_HandleDuplicateError.d.ts +9 -0
- package/dist/lib/src/errors/create_HandleDuplicateError.d.ts.map +1 -0
- package/dist/lib/src/errors/create_HandleDuplicateError.js +99 -0
- package/dist/lib/src/errors/create_HandleDuplicateError.js.map +1 -0
- package/dist/lib/src/errors/create_HandleZodValidationError.d.ts +7 -0
- package/dist/lib/src/errors/create_HandleZodValidationError.d.ts.map +1 -0
- package/dist/lib/src/errors/create_HandleZodValidationError.js +50 -0
- package/dist/lib/src/errors/create_HandleZodValidationError.js.map +1 -0
- package/dist/lib/src/interfaces/create_EmailFomat_type.d.ts +7 -0
- package/dist/lib/src/interfaces/create_EmailFomat_type.d.ts.map +1 -0
- package/dist/lib/src/interfaces/create_EmailFomat_type.js +34 -0
- package/dist/lib/src/interfaces/create_EmailFomat_type.js.map +1 -0
- package/dist/lib/src/interfaces/create_Errors_type.d.ts +7 -0
- package/dist/lib/src/interfaces/create_Errors_type.d.ts.map +1 -0
- package/dist/lib/src/interfaces/create_Errors_type.js +43 -0
- package/dist/lib/src/interfaces/create_Errors_type.js.map +1 -0
- package/dist/lib/src/interfaces/create_Index_d_type.d.ts +9 -0
- package/dist/lib/src/interfaces/create_Index_d_type.d.ts.map +1 -0
- package/dist/lib/src/interfaces/create_Index_d_type.js +45 -0
- package/dist/lib/src/interfaces/create_Index_d_type.js.map +1 -0
- package/dist/lib/src/interfaces/create_JWT_Token_type.d.ts +9 -0
- package/dist/lib/src/interfaces/create_JWT_Token_type.d.ts.map +1 -0
- package/dist/lib/src/interfaces/create_JWT_Token_type.js +33 -0
- package/dist/lib/src/interfaces/create_JWT_Token_type.js.map +1 -0
- package/dist/lib/src/interfaces/create_UserRole_type.d.ts +7 -0
- package/dist/lib/src/interfaces/create_UserRole_type.d.ts.map +1 -0
- package/dist/lib/src/interfaces/create_UserRole_type.js +33 -0
- package/dist/lib/src/interfaces/create_UserRole_type.js.map +1 -0
- package/dist/lib/src/middlewares/create_Auth_Gurad.d.ts +9 -0
- package/dist/lib/src/middlewares/create_Auth_Gurad.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_Auth_Gurad.js +99 -0
- package/dist/lib/src/middlewares/create_Auth_Gurad.js.map +1 -0
- package/dist/lib/src/middlewares/create_BigIntSerializer_Guard.d.ts +7 -0
- package/dist/lib/src/middlewares/create_BigIntSerializer_Guard.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_BigIntSerializer_Guard.js +64 -0
- package/dist/lib/src/middlewares/create_BigIntSerializer_Guard.js.map +1 -0
- package/dist/lib/src/middlewares/create_FormDataToSetJSONformatData_Guard.d.ts +7 -0
- package/dist/lib/src/middlewares/create_FormDataToSetJSONformatData_Guard.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_FormDataToSetJSONformatData_Guard.js +63 -0
- package/dist/lib/src/middlewares/create_FormDataToSetJSONformatData_Guard.js.map +1 -0
- package/dist/lib/src/middlewares/create_Global_ErrorHandler_Guard.d.ts +12 -0
- package/dist/lib/src/middlewares/create_Global_ErrorHandler_Guard.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_Global_ErrorHandler_Guard.js +375 -0
- package/dist/lib/src/middlewares/create_Global_ErrorHandler_Guard.js.map +1 -0
- package/dist/lib/src/middlewares/create_Handle_File_Upload_Middleware.d.ts +7 -0
- package/dist/lib/src/middlewares/create_Handle_File_Upload_Middleware.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_Handle_File_Upload_Middleware.js +260 -0
- package/dist/lib/src/middlewares/create_Handle_File_Upload_Middleware.js.map +1 -0
- package/dist/lib/src/middlewares/create_NotFound_Guard.d.ts +7 -0
- package/dist/lib/src/middlewares/create_NotFound_Guard.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_NotFound_Guard.js +47 -0
- package/dist/lib/src/middlewares/create_NotFound_Guard.js.map +1 -0
- package/dist/lib/src/middlewares/create_RateLimiting_Handler_Guard.d.ts +7 -0
- package/dist/lib/src/middlewares/create_RateLimiting_Handler_Guard.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_RateLimiting_Handler_Guard.js +270 -0
- package/dist/lib/src/middlewares/create_RateLimiting_Handler_Guard.js.map +1 -0
- package/dist/lib/src/middlewares/create_ValidateRequest_Guard.d.ts +7 -0
- package/dist/lib/src/middlewares/create_ValidateRequest_Guard.d.ts.map +1 -0
- package/dist/lib/src/middlewares/create_ValidateRequest_Guard.js +104 -0
- package/dist/lib/src/middlewares/create_ValidateRequest_Guard.js.map +1 -0
- package/dist/lib/src/modules/create_DemoModules_SrcStructure.d.ts +7 -0
- package/dist/lib/src/modules/create_DemoModules_SrcStructure.d.ts.map +1 -0
- package/dist/lib/src/modules/create_DemoModules_SrcStructure.js +367 -0
- package/dist/lib/src/modules/create_DemoModules_SrcStructure.js.map +1 -0
- package/dist/lib/src/routers/create_Router_Index_Path.d.ts +7 -0
- package/dist/lib/src/routers/create_Router_Index_Path.d.ts.map +1 -0
- package/dist/lib/src/routers/create_Router_Index_Path.js +54 -0
- package/dist/lib/src/routers/create_Router_Index_Path.js.map +1 -0
- package/dist/lib/src/shared/create_Prisma_Shated.d.ts +9 -0
- package/dist/lib/src/shared/create_Prisma_Shated.d.ts.map +1 -0
- package/dist/lib/src/shared/create_Prisma_Shated.js +34 -0
- package/dist/lib/src/shared/create_Prisma_Shated.js.map +1 -0
- package/dist/lib/src/utils/createCatchAsync_Utils.d.ts +7 -0
- package/dist/lib/src/utils/createCatchAsync_Utils.d.ts.map +1 -0
- package/dist/lib/src/utils/createCatchAsync_Utils.js +59 -0
- package/dist/lib/src/utils/createCatchAsync_Utils.js.map +1 -0
- package/dist/lib/src/utils/createLoggerFile.d.ts +7 -0
- package/dist/lib/src/utils/createLoggerFile.d.ts.map +1 -0
- package/dist/lib/src/utils/createLoggerFile.js +35 -0
- package/dist/lib/src/utils/createLoggerFile.js.map +1 -0
- package/dist/lib/src/utils/create_Common_Utils.d.ts +9 -0
- package/dist/lib/src/utils/create_Common_Utils.d.ts.map +1 -0
- package/dist/lib/src/utils/create_Common_Utils.js +262 -0
- package/dist/lib/src/utils/create_Common_Utils.js.map +1 -0
- package/dist/lib/src/utils/create_Date_Time_Validation_Utils.d.ts +7 -0
- package/dist/lib/src/utils/create_Date_Time_Validation_Utils.d.ts.map +1 -0
- package/dist/lib/src/utils/create_Date_Time_Validation_Utils.js +181 -0
- package/dist/lib/src/utils/create_Date_Time_Validation_Utils.js.map +1 -0
- package/dist/lib/src/utils/create_Node_Cache_Utils.d.ts +7 -0
- package/dist/lib/src/utils/create_Node_Cache_Utils.d.ts.map +1 -0
- package/dist/lib/src/utils/create_Node_Cache_Utils.js +149 -0
- package/dist/lib/src/utils/create_Node_Cache_Utils.js.map +1 -0
- package/dist/lib/src/utils/create_Remove_Uploaded_Files_Utils.d.ts +7 -0
- package/dist/lib/src/utils/create_Remove_Uploaded_Files_Utils.d.ts.map +1 -0
- package/dist/lib/src/utils/create_Remove_Uploaded_Files_Utils.js +162 -0
- package/dist/lib/src/utils/create_Remove_Uploaded_Files_Utils.js.map +1 -0
- package/dist/lib/src/utils/create_SendEmail_Utils.d.ts +7 -0
- package/dist/lib/src/utils/create_SendEmail_Utils.d.ts.map +1 -0
- package/dist/lib/src/utils/create_SendEmail_Utils.js +140 -0
- package/dist/lib/src/utils/create_SendEmail_Utils.js.map +1 -0
- package/dist/lib/src/utils/create_sendResponse_Utils.d.ts +7 -0
- package/dist/lib/src/utils/create_sendResponse_Utils.d.ts.map +1 -0
- package/dist/lib/src/utils/create_sendResponse_Utils.js +95 -0
- package/dist/lib/src/utils/create_sendResponse_Utils.js.map +1 -0
- package/dist/lib/utils/helpers.d.ts +5 -0
- package/dist/lib/utils/helpers.d.ts.map +1 -0
- package/dist/lib/utils/helpers.js +31 -0
- package/dist/lib/utils/helpers.js.map +1 -0
- package/dist/lib/utils/types.d.ts +5 -0
- package/dist/lib/utils/types.d.ts.map +1 -0
- package/dist/lib/utils/types.js +2 -0
- package/dist/lib/utils/types.js.map +1 -0
- package/package.json +87 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { createFile } from "../utils/helpers.js";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
// Type-safe TypeScript config creation function
|
|
5
|
+
export const createTsConfig = async (projectPath) => {
|
|
6
|
+
try {
|
|
7
|
+
const tsConfigContent = `{
|
|
8
|
+
"compilerOptions": {
|
|
9
|
+
/* Visit https://aka.ms/tsconfig to read more about this file */
|
|
10
|
+
|
|
11
|
+
/* Projects */
|
|
12
|
+
// "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
|
|
13
|
+
// "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
|
|
14
|
+
// "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
|
|
15
|
+
// "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
|
|
16
|
+
// "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
|
|
17
|
+
// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
|
|
18
|
+
|
|
19
|
+
/* Language and Environment */
|
|
20
|
+
"target": "es2016" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
|
|
21
|
+
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
|
22
|
+
// "jsx": "preserve", /* Specify what JSX code is generated. */
|
|
23
|
+
// "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
|
|
24
|
+
// "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
|
|
25
|
+
// "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
|
|
26
|
+
// "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
|
|
27
|
+
// "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
|
|
28
|
+
// "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
|
|
29
|
+
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
|
30
|
+
// "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
|
31
|
+
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
|
32
|
+
|
|
33
|
+
/* Modules */
|
|
34
|
+
"module": "commonjs" /* Specify what module code is generated. */,
|
|
35
|
+
"rootDir": "./src" /* Specify the root folder within your source files. */,
|
|
36
|
+
// "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
|
|
37
|
+
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
|
38
|
+
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
|
39
|
+
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
|
40
|
+
"typeRoots": [
|
|
41
|
+
"src/app/types", // 👈 our custom types directory
|
|
42
|
+
"./node_modules/@types"
|
|
43
|
+
] /* Specify multiple folders that act like './node_modules/@types'. */,
|
|
44
|
+
// "types": [], /* Specify type package names to be included without being referenced in a source file. */
|
|
45
|
+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
|
46
|
+
// "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
|
|
47
|
+
// "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
|
|
48
|
+
// "rewriteRelativeImportExtensions": true, /* Rewrite '.ts', '.tsx', '.mts', and '.cts' file extensions in relative import paths to their JavaScript equivalent in output files. */
|
|
49
|
+
// "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
|
|
50
|
+
// "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
|
|
51
|
+
// "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
|
|
52
|
+
// "noUncheckedSideEffectImports": true, /* Check side effect imports. */
|
|
53
|
+
// "resolveJsonModule": true, /* Enable importing .json files. */
|
|
54
|
+
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
|
55
|
+
// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
|
|
56
|
+
|
|
57
|
+
/* JavaScript Support */
|
|
58
|
+
// "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
|
|
59
|
+
// "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
|
60
|
+
// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
|
|
61
|
+
|
|
62
|
+
/* Emit */
|
|
63
|
+
// "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
|
64
|
+
// "declarationMap": true, /* Create sourcemaps for d.ts files. */
|
|
65
|
+
// "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
|
|
66
|
+
// "sourceMap": true, /* Create source map files for emitted JavaScript files. */
|
|
67
|
+
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
|
|
68
|
+
// "noEmit": true, /* Disable emitting files from a compilation. */
|
|
69
|
+
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
|
|
70
|
+
"outDir": "./dist" /* Specify an output folder for all emitted files. */,
|
|
71
|
+
// "removeComments": true, /* Disable emitting comments. */
|
|
72
|
+
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
|
|
73
|
+
// "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
|
|
74
|
+
// "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
|
|
75
|
+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
|
76
|
+
// "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
|
|
77
|
+
// "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
|
|
78
|
+
// "newLine": "crlf", /* Set the newline character for emitting files. */
|
|
79
|
+
// "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
|
|
80
|
+
// "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
|
|
81
|
+
// "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
|
|
82
|
+
// "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
|
|
83
|
+
// "declarationDir": "./", /* Specify the output directory for generated declaration files. */
|
|
84
|
+
|
|
85
|
+
/* Interop Constraints */
|
|
86
|
+
// "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
|
|
87
|
+
// "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
|
|
88
|
+
// "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
|
|
89
|
+
// "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
|
|
90
|
+
"esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
|
|
91
|
+
// "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
|
|
92
|
+
"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
|
|
93
|
+
|
|
94
|
+
/* Type Checking */
|
|
95
|
+
"strict": true /* Enable all strict type-checking options. */,
|
|
96
|
+
// "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
|
|
97
|
+
// "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
|
|
98
|
+
// "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
|
|
99
|
+
// "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
|
|
100
|
+
// "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
|
|
101
|
+
// "strictBuiltinIteratorReturn": true, /* Built-in iterators are instantiated with a 'TReturn' type of 'undefined' instead of 'any'. */
|
|
102
|
+
// "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
|
|
103
|
+
// "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
|
|
104
|
+
// "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
|
|
105
|
+
// "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
|
|
106
|
+
// "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
|
|
107
|
+
// "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
|
|
108
|
+
// "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
|
|
109
|
+
// "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
|
|
110
|
+
// "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
|
|
111
|
+
// "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
|
|
112
|
+
// "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
|
|
113
|
+
// "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
|
|
114
|
+
// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
|
|
115
|
+
|
|
116
|
+
/* Completeness */
|
|
117
|
+
// "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
|
|
118
|
+
"skipLibCheck": true /* Skip type checking all .d.ts files. */
|
|
119
|
+
},
|
|
120
|
+
"include": ["src", "src/app/**/*", "src/app/interfaces/index.d.ts"], // which files to compile
|
|
121
|
+
"exclude": ["node_modules"] // which files to skip
|
|
122
|
+
}`;
|
|
123
|
+
await createFile(path.join(projectPath, "tsconfig.json"), tsConfigContent);
|
|
124
|
+
// Success message with green checkmark and text
|
|
125
|
+
console.log(chalk.green("✅ tsconfig.json file created successfully"));
|
|
126
|
+
}
|
|
127
|
+
catch (err) {
|
|
128
|
+
// Error message with red cross and text
|
|
129
|
+
console.error(chalk.red("❌ Error creating tsconfig.json file:"), err);
|
|
130
|
+
throw err;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
//# sourceMappingURL=createTsConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createTsConfig.js","sourceRoot":"","sources":["../../../src/lib/config/createTsConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,gDAAgD;AAChD,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,WAAmB,EAAiB,EAAE;IACzE,IAAI,CAAC;QACH,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmH1B,CAAC;QAEC,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,eAAe,CAAC,EAAE,eAAe,CAAC,CAAC;QAE3E,gDAAgD;QAChD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,2CAA2C,CAAC,CAAC,CAAC;IACxE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,wCAAwC;QACxC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC,EAAE,GAAG,CAAC,CAAC;QACtE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_Schema.Prisma.d.ts","sourceRoot":"","sources":["../../../src/lib/prisma/create_Schema.Prisma.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAG7C,eAAO,MAAM,kBAAkB,GAC7B,aAAa,MAAM,EACnB,SAAS,QAAQ,KAChB,OAAO,CAAC,IAAI,CAgCd,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { createDirectory, createFile } from "../utils/helpers.js";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
// Type-safe Prisma schema creation function
|
|
5
|
+
export const createSchemaPrisma = async (projectPath, answers) => {
|
|
6
|
+
try {
|
|
7
|
+
if (answers.database === "PostgreSQL with Prisma") {
|
|
8
|
+
const prismaPath = path.join(projectPath, "prisma");
|
|
9
|
+
await createDirectory(prismaPath);
|
|
10
|
+
const schemaPrisma = `// This is your Prisma schema file,
|
|
11
|
+
// learn more about it in the docs: https://pris.ly/d/prisma-schema
|
|
12
|
+
// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
|
|
13
|
+
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init
|
|
14
|
+
generator client {
|
|
15
|
+
provider = "prisma-client-js"
|
|
16
|
+
output = "../generated/prisma"
|
|
17
|
+
}
|
|
18
|
+
datasource db {
|
|
19
|
+
provider = "postgresql"
|
|
20
|
+
url = env("DATABASE_URL")
|
|
21
|
+
}
|
|
22
|
+
model User {
|
|
23
|
+
id String @id @default(uuid())
|
|
24
|
+
}`;
|
|
25
|
+
await createFile(path.join(prismaPath, "schema.prisma"), schemaPrisma);
|
|
26
|
+
// Success message with green checkmark and text
|
|
27
|
+
console.log(chalk.green("✅ Prisma schema file created successfully."));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
// Error message with red cross and text
|
|
32
|
+
console.error(chalk.red("❌ Error creating Prisma schema file:"), err);
|
|
33
|
+
throw err;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=create_Schema.Prisma.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_Schema.Prisma.js","sourceRoot":"","sources":["../../../src/lib/prisma/create_Schema.Prisma.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,4CAA4C;AAC5C,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,EACrC,WAAmB,EACnB,OAAiB,EACF,EAAE;IACjB,IAAI,CAAC;QACH,IAAI,OAAO,CAAC,QAAQ,KAAK,wBAAwB,EAAE,CAAC;YAClD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC;YACpD,MAAM,eAAe,CAAC,UAAU,CAAC,CAAC;YAElC,MAAM,YAAY,GAAG;;;;;;;;;;;;;;EAczB,CAAC;YAEG,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,YAAY,CAAC,CAAC;YAEvE,gDAAgD;YAChD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,4CAA4C,CAAC,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,wCAAwC;QACxC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC,EAAE,GAAG,CAAC,CAAC;QACtE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_QueryBuilder_Helpers.d.ts","sourceRoot":"","sources":["../../../../src/lib/src/builders/create_QueryBuilder_Helpers.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAGhD,eAAO,MAAM,2BAA2B,GACtC,aAAa,MAAM,EACnB,SAAS,QAAQ,KAChB,OAAO,CAAC,IAAI,CA0Sd,CAAC"}
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import path from "path";
|
|
2
|
+
import { createFile } from "../../utils/helpers.js";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
// Type-safe QueryBuilder helpers creation function
|
|
5
|
+
export const create_QueryBuilder_Helpers = async (projectPath, answers) => {
|
|
6
|
+
try {
|
|
7
|
+
// Create MongoDB QueryBuilder if MongoDB is selected
|
|
8
|
+
if (answers.database === "MongoDB with Mongoose") {
|
|
9
|
+
const mongoQueryBuilderTemplate = `import { FilterQuery, Query } from 'mongoose';
|
|
10
|
+
/**
|
|
11
|
+
* MongoDB Query Builder class for building complex queries with chaining methods
|
|
12
|
+
*/
|
|
13
|
+
class QueryBuilder<T> {
|
|
14
|
+
public modelQuery: Query<T[], T>;
|
|
15
|
+
public query: Record<string, unknown>;
|
|
16
|
+
constructor(modelQuery: Query<T[], T>, query: Record<string, unknown>) {
|
|
17
|
+
this.modelQuery = modelQuery;
|
|
18
|
+
this.query = query;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Add search functionality to the query
|
|
22
|
+
* @param searchableFields - Array of fields to search in
|
|
23
|
+
* @returns QueryBuilder instance for chaining
|
|
24
|
+
*/
|
|
25
|
+
search(searchableFields: string[]): this {
|
|
26
|
+
const searchTerm = this.query.search as string;
|
|
27
|
+
if (searchTerm) {
|
|
28
|
+
this.modelQuery = this.modelQuery.find({
|
|
29
|
+
$or: searchableFields.map(
|
|
30
|
+
field => ({
|
|
31
|
+
[field]: { $regex: searchTerm, $options: 'i' }
|
|
32
|
+
}) as FilterQuery<T>
|
|
33
|
+
)
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Add filtering to the query
|
|
40
|
+
* @returns QueryBuilder instance for chaining
|
|
41
|
+
*/
|
|
42
|
+
filter(): this {
|
|
43
|
+
const queryObj = { ...this.query };
|
|
44
|
+
const excludeFields = ['search', 'sort', 'page', 'limit', 'fields'];
|
|
45
|
+
excludeFields.forEach(el => delete queryObj[el]);
|
|
46
|
+
|
|
47
|
+
this.modelQuery = this.modelQuery.find(queryObj as FilterQuery<T>);
|
|
48
|
+
return this;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Add sorting to the query
|
|
52
|
+
* @returns QueryBuilder instance for chaining
|
|
53
|
+
*/
|
|
54
|
+
sort(): this {
|
|
55
|
+
const sortField = (this.query.sort as string)?.split(',')?.join(' ') || '-createdAt';
|
|
56
|
+
this.modelQuery = this.modelQuery.sort(sortField);
|
|
57
|
+
return this;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Add pagination to the query
|
|
61
|
+
* @returns QueryBuilder instance for chaining
|
|
62
|
+
*/
|
|
63
|
+
paginate(): this {
|
|
64
|
+
const page = Number(this.query.page) || 1;
|
|
65
|
+
const limit = Number(this.query.limit) || 10;
|
|
66
|
+
const skip = (page - 1) * limit;
|
|
67
|
+
|
|
68
|
+
this.modelQuery = this.modelQuery.skip(skip).limit(limit);
|
|
69
|
+
return this;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Field selection to include/exclude specific fields
|
|
73
|
+
* @returns QueryBuilder instance for chaining
|
|
74
|
+
*/
|
|
75
|
+
fields(): this {
|
|
76
|
+
const fields = (this.query.fields as string)?.split(',')?.join(' ') || '-__v';
|
|
77
|
+
this.modelQuery = this.modelQuery.select(fields);
|
|
78
|
+
return this;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Get total count and pagination metadata
|
|
82
|
+
* @returns Object with pagination metadata
|
|
83
|
+
*/
|
|
84
|
+
async countTotal(): Promise<{
|
|
85
|
+
page: number;
|
|
86
|
+
limit: number;
|
|
87
|
+
totalData: number;
|
|
88
|
+
totalPage: number;
|
|
89
|
+
}> {
|
|
90
|
+
const totalQueries = this.modelQuery.getFilter();
|
|
91
|
+
const totalData = await this.modelQuery.model.countDocuments(totalQueries);
|
|
92
|
+
const page = Number(this.query.page) || 1;
|
|
93
|
+
const limit = Number(this.query.limit) || 10;
|
|
94
|
+
const totalPage = Math.ceil(totalData / limit);
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
page,
|
|
98
|
+
limit,
|
|
99
|
+
totalData,
|
|
100
|
+
totalPage
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
export default QueryBuilder;
|
|
105
|
+
`;
|
|
106
|
+
await createFile(path.join(projectPath, "src/app/builder", "MongooseQueryBuilder.ts"), mongoQueryBuilderTemplate);
|
|
107
|
+
}
|
|
108
|
+
// Create Prisma QueryBuilder if PostgreSQL with Prisma is selected
|
|
109
|
+
if (answers.database === "PostgreSQL with Prisma") {
|
|
110
|
+
const prismaQueryBuilderTemplate = `/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
111
|
+
/**
|
|
112
|
+
* Prisma Query Builder class for building complex queries with chaining methods
|
|
113
|
+
* Similar pattern to the Mongoose QueryBuilder but adapted for Prisma
|
|
114
|
+
*/
|
|
115
|
+
class PrismaQueryBuilder<T extends Record<string, any>> {
|
|
116
|
+
private prismaModel: any
|
|
117
|
+
private query: Record<string, unknown>
|
|
118
|
+
private whereClause: any = {}
|
|
119
|
+
private orderBy: any[] = []
|
|
120
|
+
private selectFields: any = null
|
|
121
|
+
private skipValue: number | undefined
|
|
122
|
+
private takeValue: number | undefined
|
|
123
|
+
constructor(prismaModel: any, query: Record<string, unknown>) {
|
|
124
|
+
this.prismaModel = prismaModel
|
|
125
|
+
this.query = query
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Add search functionality to the query
|
|
129
|
+
* @param searchableFields - Array of fields to search in
|
|
130
|
+
* @returns PrismaQueryBuilder instance for chaining
|
|
131
|
+
*/
|
|
132
|
+
search(searchableFields: string[]): this {
|
|
133
|
+
const searchTerm = this.query.search as string
|
|
134
|
+
if (searchTerm) {
|
|
135
|
+
this.whereClause = {
|
|
136
|
+
...this.whereClause,
|
|
137
|
+
OR: searchableFields.map(field => ({
|
|
138
|
+
[field]: {
|
|
139
|
+
contains: searchTerm,
|
|
140
|
+
mode: 'insensitive'
|
|
141
|
+
}
|
|
142
|
+
}))
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return this
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Add filtering to the query
|
|
149
|
+
* @returns PrismaQueryBuilder instance for chaining
|
|
150
|
+
*/
|
|
151
|
+
filter(): this {
|
|
152
|
+
const queryObj = { ...this.query }
|
|
153
|
+
const excludeFields = ['search', 'sort', 'page', 'limit', 'fields']
|
|
154
|
+
excludeFields.forEach(el => delete queryObj[el])
|
|
155
|
+
// Add the remaining query parameters to the where clause
|
|
156
|
+
Object.entries(queryObj).forEach(([key, value]) => {
|
|
157
|
+
if (value !== undefined && value !== null) {
|
|
158
|
+
this.whereClause = {
|
|
159
|
+
...this.whereClause,
|
|
160
|
+
[key]: value
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
})
|
|
164
|
+
return this
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Add sorting to the query
|
|
168
|
+
* @returns PrismaQueryBuilder instance for chaining
|
|
169
|
+
*/
|
|
170
|
+
sort(): this {
|
|
171
|
+
const sortField = this.query.sort as string
|
|
172
|
+
if (sortField) {
|
|
173
|
+
const sortFields = sortField.split(',')
|
|
174
|
+
this.orderBy = sortFields.map(field => {
|
|
175
|
+
const isDescending = field.startsWith('-')
|
|
176
|
+
const fieldName = isDescending ? field.substring(1) : field
|
|
177
|
+
return {
|
|
178
|
+
[fieldName]: isDescending ? 'desc' : 'asc'
|
|
179
|
+
}
|
|
180
|
+
})
|
|
181
|
+
} else {
|
|
182
|
+
// Default sort by createdAt in descending order
|
|
183
|
+
this.orderBy = [{ createdAt: 'desc' }]
|
|
184
|
+
}
|
|
185
|
+
return this
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Add pagination to the query
|
|
189
|
+
* @returns PrismaQueryBuilder instance for chaining
|
|
190
|
+
*/
|
|
191
|
+
paginate(): this {
|
|
192
|
+
const page = Number(this.query.page) || 1
|
|
193
|
+
const limit = Number(this.query.limit) || 10
|
|
194
|
+
this.skipValue = (page - 1) * limit
|
|
195
|
+
this.takeValue = limit
|
|
196
|
+
return this
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Field selection to include specific fields
|
|
200
|
+
* @returns PrismaQueryBuilder instance for chaining
|
|
201
|
+
*/
|
|
202
|
+
fields(): this {
|
|
203
|
+
const fields = this.query.fields as string
|
|
204
|
+
if (fields) {
|
|
205
|
+
const fieldArray = fields.split(',')
|
|
206
|
+
this.selectFields = fieldArray.reduce((acc, field) => {
|
|
207
|
+
// Skip the __v field which doesn't exist in Prisma
|
|
208
|
+
if (field !== '__v') {
|
|
209
|
+
acc[field] = true
|
|
210
|
+
}
|
|
211
|
+
return acc
|
|
212
|
+
}, {} as any)
|
|
213
|
+
}
|
|
214
|
+
return this
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Execute the query and return results with metadata
|
|
218
|
+
* @returns Object with data and pagination metadata
|
|
219
|
+
*/
|
|
220
|
+
async execute(): Promise<{
|
|
221
|
+
data: T[]
|
|
222
|
+
meta: {
|
|
223
|
+
page: number
|
|
224
|
+
limit: number
|
|
225
|
+
totalData: number
|
|
226
|
+
totalPage: number
|
|
227
|
+
}
|
|
228
|
+
}> {
|
|
229
|
+
const page = Number(this.query.page) || 1
|
|
230
|
+
const limit = Number(this.query.limit) || 10
|
|
231
|
+
// Build the query parameters
|
|
232
|
+
const queryOptions: any = {
|
|
233
|
+
where: this.whereClause,
|
|
234
|
+
orderBy: this.orderBy.length > 0 ? this.orderBy : undefined,
|
|
235
|
+
skip: this.skipValue,
|
|
236
|
+
take: this.takeValue
|
|
237
|
+
}
|
|
238
|
+
// Add select if specified
|
|
239
|
+
if (this.selectFields) {
|
|
240
|
+
queryOptions.select = this.selectFields
|
|
241
|
+
}
|
|
242
|
+
// Get total count
|
|
243
|
+
const totalData = await this.prismaModel.count({ where: this.whereClause })
|
|
244
|
+
const totalPage = Math.ceil(totalData / limit)
|
|
245
|
+
// Get data
|
|
246
|
+
const data = await this.prismaModel.findMany(queryOptions)
|
|
247
|
+
return {
|
|
248
|
+
data,
|
|
249
|
+
meta: {
|
|
250
|
+
page,
|
|
251
|
+
limit,
|
|
252
|
+
totalData,
|
|
253
|
+
totalPage
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Get total count and pagination metadata without fetching data
|
|
259
|
+
* @returns Object with pagination metadata
|
|
260
|
+
*/
|
|
261
|
+
async countTotal(): Promise<{
|
|
262
|
+
page: number
|
|
263
|
+
limit: number
|
|
264
|
+
totalData: number
|
|
265
|
+
totalPage: number
|
|
266
|
+
}> {
|
|
267
|
+
const page = Number(this.query.page) || 1
|
|
268
|
+
const limit = Number(this.query.limit) || 10
|
|
269
|
+
const totalData = await this.prismaModel.count({ where: this.whereClause })
|
|
270
|
+
const totalPage = Math.ceil(totalData / limit)
|
|
271
|
+
return {
|
|
272
|
+
page,
|
|
273
|
+
limit,
|
|
274
|
+
totalData,
|
|
275
|
+
totalPage
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
export default PrismaQueryBuilder
|
|
280
|
+
`;
|
|
281
|
+
await createFile(path.join(projectPath, "src/app/builder", "PrismaQueryBuilder.ts"), prismaQueryBuilderTemplate);
|
|
282
|
+
}
|
|
283
|
+
// Success message with green checkmark and text
|
|
284
|
+
console.log(chalk.green("✅ QueryBuilder Helpers file created successfully"));
|
|
285
|
+
}
|
|
286
|
+
catch (err) {
|
|
287
|
+
// Error message with red cross and text
|
|
288
|
+
console.error(chalk.red("❌ Error creating QueryBuilder Helpers file:"), err);
|
|
289
|
+
throw err;
|
|
290
|
+
}
|
|
291
|
+
};
|
|
292
|
+
//# sourceMappingURL=create_QueryBuilder_Helpers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_QueryBuilder_Helpers.js","sourceRoot":"","sources":["../../../../src/lib/src/builders/create_QueryBuilder_Helpers.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,mDAAmD;AACnD,MAAM,CAAC,MAAM,2BAA2B,GAAG,KAAK,EAC9C,WAAmB,EACnB,OAAiB,EACF,EAAE;IACjB,IAAI,CAAC;QACH,qDAAqD;QACrD,IAAI,OAAO,CAAC,QAAQ,KAAK,uBAAuB,EAAE,CAAC;YACjD,MAAM,yBAAyB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgGvC,CAAC;YACI,MAAM,UAAU,CACd,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,iBAAiB,EAAE,yBAAyB,CAAC,EACpE,yBAAyB,CAC1B,CAAC;QACJ,CAAC;QAED,mEAAmE;QACnE,IAAI,OAAO,CAAC,QAAQ,KAAK,wBAAwB,EAAE,CAAC;YAClD,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0KxC,CAAC;YACI,MAAM,UAAU,CACd,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,iBAAiB,EAAE,uBAAuB,CAAC,EAClE,0BAA0B,CAC3B,CAAC;QACJ,CAAC;QAED,gDAAgD;QAChD,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CAAC,kDAAkD,CAAC,CAChE,CAAC;IACJ,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,wCAAwC;QACxC,OAAO,CAAC,KAAK,CACX,KAAK,CAAC,GAAG,CAAC,6CAA6C,CAAC,EACxD,GAAG,CACJ,CAAC;QACF,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TAnswers } from "../../utils/types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Creates a configuration index file with environment-based settings
|
|
4
|
+
* @param projectPath - Absolute path to the project root
|
|
5
|
+
* @param answers - User answers from CLI prompts
|
|
6
|
+
* @returns Promise that resolves when the config file is created
|
|
7
|
+
*/
|
|
8
|
+
export declare const create_Config_Configuration_Index_File: (projectPath: string, answers: TAnswers) => Promise<void>;
|
|
9
|
+
//# sourceMappingURL=create_Config_Index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_Config_Index.d.ts","sourceRoot":"","sources":["../../../../src/lib/src/config/create_Config_Index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAEhD;;;;;GAKG;AACH,eAAO,MAAM,sCAAsC,GACjD,aAAa,MAAM,EACnB,SAAS,QAAQ,KAChB,OAAO,CAAC,IAAI,CAwFd,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { createFile } from "../../utils/helpers.js";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
/**
|
|
5
|
+
* Creates a configuration index file with environment-based settings
|
|
6
|
+
* @param projectPath - Absolute path to the project root
|
|
7
|
+
* @param answers - User answers from CLI prompts
|
|
8
|
+
* @returns Promise that resolves when the config file is created
|
|
9
|
+
*/
|
|
10
|
+
export const create_Config_Configuration_Index_File = async (projectPath, answers) => {
|
|
11
|
+
try {
|
|
12
|
+
// Build configuration object conditionally based on user answers
|
|
13
|
+
let configContent = `import dotenv from 'dotenv';
|
|
14
|
+
import path from 'path';
|
|
15
|
+
|
|
16
|
+
// Load environment variables from .env file
|
|
17
|
+
dotenv.config({ path: path.join(process.cwd(), '.env') });
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Ensure environment variable is set
|
|
21
|
+
* @param key - Environment variable key
|
|
22
|
+
* @returns Environment variable value
|
|
23
|
+
* @throws Error if environment variable is not set
|
|
24
|
+
*/
|
|
25
|
+
function ensureEnv(key: string): string {
|
|
26
|
+
const value = process.env[key];
|
|
27
|
+
if (!value) {
|
|
28
|
+
throw new Error(\`Environment variable \${key} is required but not set.\`);
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Application configuration object
|
|
35
|
+
*/
|
|
36
|
+
const config = {
|
|
37
|
+
// Application settings
|
|
38
|
+
NODE_ENV: process.env.NODE_ENV || 'development',
|
|
39
|
+
port: Number(process.env.PORT) || 5000,
|
|
40
|
+
client_side_url: ensureEnv('CLIENT_SIDE_URL'),
|
|
41
|
+
`;
|
|
42
|
+
// Add database configuration based on user selection
|
|
43
|
+
if (answers.database === "MongoDB with Mongoose") {
|
|
44
|
+
configContent += `
|
|
45
|
+
// MongoDB configuration
|
|
46
|
+
mongo_database_url: ensureEnv('MONGO_DATABASE_URL'),
|
|
47
|
+
`;
|
|
48
|
+
}
|
|
49
|
+
else if (answers.database === "PostgreSQL with Prisma") {
|
|
50
|
+
configContent += `
|
|
51
|
+
// PostgreSQL configuration
|
|
52
|
+
database_url: ensureEnv('DATABASE_URL'),
|
|
53
|
+
`;
|
|
54
|
+
}
|
|
55
|
+
// Add authentication configuration if selected
|
|
56
|
+
if (answers.includeAuth) {
|
|
57
|
+
configContent += `
|
|
58
|
+
// Authentication configuration
|
|
59
|
+
bcrypt_salt_rounds: Number(ensureEnv('BCRYPT_SALT_ROUNDS')),
|
|
60
|
+
jwt_access_token_secret: ensureEnv('JWT_ACCESS_TOKEN_SECRET'),
|
|
61
|
+
jwt_refresh_token_secret: ensureEnv('JWT_REFRESH_TOKEN_SECRET'),
|
|
62
|
+
jwt_access_token_expires_in: ensureEnv('JWT_ACCESS_TOKEN_EXPIRES_IN'),
|
|
63
|
+
jwt_refresh_token_expires_in: ensureEnv('JWT_REFRESH_TOKEN_EXPIRES_IN'),
|
|
64
|
+
`;
|
|
65
|
+
}
|
|
66
|
+
// Always include email configuration
|
|
67
|
+
configContent += `
|
|
68
|
+
// Email configuration
|
|
69
|
+
email_host_provider_name: ensureEnv('EMAIL_HOST_PROVIDER_NAME'),
|
|
70
|
+
email_host_provider_port: Number(ensureEnv('EMAIL_HOST_PROVIDER_PORT')),
|
|
71
|
+
email_sender_email: ensureEnv('EMAIL_SENDER_EMAIL'),
|
|
72
|
+
email_sender_email_app_pass: ensureEnv('EMAIL_SENDER_EMAIL_APP_PASS'),
|
|
73
|
+
email_sender_name: process.env.EMAIL_SENDER_NAME || 'Your App Name',
|
|
74
|
+
email_reply_to: process.env.EMAIL_REPLY_TO,
|
|
75
|
+
email_test_recipient: process.env.EMAIL_TEST_RECIPIENT,
|
|
76
|
+
`;
|
|
77
|
+
// Close the configuration object
|
|
78
|
+
configContent += `};
|
|
79
|
+
|
|
80
|
+
export default config;
|
|
81
|
+
`;
|
|
82
|
+
await createFile(path.join(projectPath, "src/app/config", "index.ts"), configContent);
|
|
83
|
+
// Success message with green checkmark and text
|
|
84
|
+
console.log(chalk.green("✅ Config index file created successfully"));
|
|
85
|
+
}
|
|
86
|
+
catch (err) {
|
|
87
|
+
// Error message with red cross and text
|
|
88
|
+
console.error(chalk.red("❌ Error creating config index file:"), err);
|
|
89
|
+
throw err;
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
//# sourceMappingURL=create_Config_Index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_Config_Index.js","sourceRoot":"","sources":["../../../../src/lib/src/config/create_Config_Index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,sCAAsC,GAAG,KAAK,EACzD,WAAmB,EACnB,OAAiB,EACF,EAAE;IACjB,IAAI,CAAC;QACH,iEAAiE;QACjE,IAAI,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BvB,CAAC;QAEE,qDAAqD;QACrD,IAAI,OAAO,CAAC,QAAQ,KAAK,uBAAuB,EAAE,CAAC;YACjD,aAAa,IAAI;;;CAGtB,CAAC;QACE,CAAC;aAAM,IAAI,OAAO,CAAC,QAAQ,KAAK,wBAAwB,EAAE,CAAC;YACzD,aAAa,IAAI;;;CAGtB,CAAC;QACE,CAAC;QAED,+CAA+C;QAC/C,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;YACxB,aAAa,IAAI;;;;;;;CAOtB,CAAC;QACE,CAAC;QAED,qCAAqC;QACrC,aAAa,IAAI;;;;;;;;;CASpB,CAAC;QAEE,iCAAiC;QACjC,aAAa,IAAI;;;CAGpB,CAAC;QAEE,MAAM,UAAU,CACd,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,gBAAgB,EAAE,UAAU,CAAC,EACpD,aAAa,CACd,CAAC;QAEF,gDAAgD;QAChD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,wCAAwC;QACxC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,qCAAqC,CAAC,EAAE,GAAG,CAAC,CAAC;QACrE,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a user role constant file with predefined roles
|
|
3
|
+
* @param projectPath - Absolute path to the project root
|
|
4
|
+
* @returns Promise that resolves when the user role constant file is created
|
|
5
|
+
*/
|
|
6
|
+
export declare const create_UserRole_Constant: (projectPath: string) => Promise<void>;
|
|
7
|
+
//# sourceMappingURL=create_UserRole_Constant.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create_UserRole_Constant.d.ts","sourceRoot":"","sources":["../../../../src/lib/src/constants/create_UserRole_Constant.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,GACnC,aAAa,MAAM,KAClB,OAAO,CAAC,IAAI,CAiCd,CAAC"}
|