feat(infisical-pg: added services for project, project key and environment

This commit is contained in:
Akhil Mohan
2024-01-27 12:38:22 +05:30
parent 53bb3bc610
commit 76e5d61da5
33 changed files with 1469 additions and 28 deletions
+28
View File
@@ -11,6 +11,7 @@ console.log(`
Component List
--------------
1. Service component
2. DAL component
`);
const componentType = parseInt(prompt("Select a component: "), 10);
@@ -62,4 +63,31 @@ export const ${serviceName} = ({ ${camelCase}Dal }: ${serviceTypeName}Dep) => {
`
);
writeFileSync(path.join(dir, `${componentName}-types.ts`), "");
} else if (componentType === 2) {
const componentName = prompt("Enter service name: ");
const componentPath = prompt("Path wrt service folder: ");
const pascalCase = componentName
.split("-")
.map((el) => `${el[0].toUpperCase()}${el.slice(1)}`)
.join("");
const camelCase = componentName
.split("-")
.map((el, index) => (index === 0 ? el : `${el[0].toUpperCase()}${el.slice(1)}`))
.join("");
const dalTypeName = `T${pascalCase}DalFactory`;
const dalName = `${camelCase}DalFactory`;
writeFileSync(
path.join(__dirname, "../src/services", componentPath, `${componentName}-dal.ts`),
`import { TDbClient } from "@app/db";
import { TableName } from "@app/db/schemas";
export type ${dalTypeName} = ReturnType<typeof ${dalName}>;
export const ${dalName} = (db: TDbClient) => {
return { };
};
`
);
}