From 79d5787e63dc2e6d8469b1294be422d50970fc22 Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:15:22 +0300 Subject: [PATCH 01/10] added typescript templates --- packages/yonode/src/index.js | 6 +- packages/yonode/src/lib/repoConditions.js | 145 +++++++++++++++++----- 2 files changed, 116 insertions(+), 35 deletions(-) diff --git a/packages/yonode/src/index.js b/packages/yonode/src/index.js index 6d4b9bf5..a2a1858a 100755 --- a/packages/yonode/src/index.js +++ b/packages/yonode/src/index.js @@ -2,7 +2,7 @@ /** * Yonode - * A Web Server Framework for Node.js + * The Node.js Toolkit for Rapid Development. * * @author Mr Sharafdin */ @@ -123,12 +123,8 @@ function main() { inquirer .prompt(languageType) .then((answer) => { - if (answer.language_type === 'JavaScript') { options.language_type = answer.language_type databaseType() - } else { - console.log('sorry, typescript is not available'); - } }) .catch((error) => { if (error.isTtyError) { diff --git a/packages/yonode/src/lib/repoConditions.js b/packages/yonode/src/lib/repoConditions.js index 66e683d3..8f5c202c 100644 --- a/packages/yonode/src/lib/repoConditions.js +++ b/packages/yonode/src/lib/repoConditions.js @@ -1,34 +1,119 @@ import { cloneRepo, options, projectName } from "../index.js"; export const repoConditions = () => { + switch (true) { + // JavaScript - switch (true) { - // MongoDB - case options.language_type === 'JavaScript' && options.database_type === 'MongoDB' && options.orm_type === 'Mongoose' && options.auth === false: - cloneRepo(projectName, 'JS-MongoDB-Mongoose-NoAuth-Template'); - break; - case options.language_type === 'JavaScript' && options.database_type === 'MongoDB' && options.orm_type === 'Prisma' && options.auth === false: - cloneRepo(projectName, 'JS-MongoDB-Prisma-NoAuth-Template'); - break; - case options.language_type === 'JavaScript' && options.database_type === 'MongoDB' && options.orm_type === 'TypeORM' && options.auth === false: - cloneRepo(projectName, 'JS-MongoDB-TypeORM-NoAuth-Template'); - break; - // MySQL - case options.language_type === 'JavaScript' && options.database_type === 'MySQL' && options.orm_type === 'Prisma' && options.auth === false: - cloneRepo(projectName, 'JS-MySQL-Prisma-NoAuth-Template'); - case options.language_type === 'JavaScript' && options.database_type === 'MySQL' && options.orm_type === 'Sequelize' && options.auth === false: - cloneRepo(projectName, 'JS-MySQL-Sequelize-NoAuth-Template'); - case options.language_type === 'JavaScript' && options.database_type === 'MySQL' && options.orm_type === 'TypeORM' && options.auth === false: - cloneRepo(projectName, 'JS-MySQL-TypeORM-NoAuth-Template'); - // PostgreSQL - case options.language_type === 'JavaScript' && options.database_type === 'PostgreSQL' && options.orm_type === 'Prisma' && options.auth === false: - cloneRepo(projectName, 'JS-PostgreSQL-Prisma-NoAuth-Template'); - case options.language_type === 'JavaScript' && options.database_type === 'PostgreSQL' && options.orm_type === 'Sequelize' && options.auth === false: - cloneRepo(projectName, 'JS-PostgreSQL-Sequelize-NoAuth-Template'); - case options.language_type === 'JavaScript' && options.database_type === 'PostgreSQL' && options.orm_type === 'TypeORM' && options.auth === false: - cloneRepo(projectName, 'JS-PostgreSQL-TypeORM-NoAuth-Template'); - break; - default: - throw new Error ('unsupported option') - } -} + // MongoDB + case options.language_type === "JavaScript" && + options.database_type === "MongoDB" && + options.orm_type === "Mongoose" && + options.auth === false: + cloneRepo(projectName, "JS-MongoDB-Mongoose-NoAuth-Template"); + break; + case options.language_type === "JavaScript" && + options.database_type === "MongoDB" && + options.orm_type === "Prisma" && + options.auth === false: + cloneRepo(projectName, "JS-MongoDB-Prisma-NoAuth-Template"); + break; + case options.language_type === "JavaScript" && + options.database_type === "MongoDB" && + options.orm_type === "TypeORM" && + options.auth === false: + cloneRepo(projectName, "JS-MongoDB-TypeORM-NoAuth-Template"); + break; + // MySQL + case options.language_type === "JavaScript" && + options.database_type === "MySQL" && + options.orm_type === "Prisma" && + options.auth === false: + cloneRepo(projectName, "JS-MySQL-Prisma-NoAuth-Template"); + case options.language_type === "JavaScript" && + options.database_type === "MySQL" && + options.orm_type === "Sequelize" && + options.auth === false: + cloneRepo(projectName, "JS-MySQL-Sequelize-NoAuth-Template"); + case options.language_type === "JavaScript" && + options.database_type === "MySQL" && + options.orm_type === "TypeORM" && + options.auth === false: + cloneRepo(projectName, "JS-MySQL-TypeORM-NoAuth-Template"); + // PostgreSQL + case options.language_type === "JavaScript" && + options.database_type === "PostgreSQL" && + options.orm_type === "Prisma" && + options.auth === false: + cloneRepo(projectName, "JS-PostgreSQL-Prisma-NoAuth-Template"); + case options.language_type === "JavaScript" && + options.database_type === "PostgreSQL" && + options.orm_type === "Sequelize" && + options.auth === false: + cloneRepo(projectName, "JS-PostgreSQL-Sequelize-NoAuth-Template"); + case options.language_type === "JavaScript" && + options.database_type === "PostgreSQL" && + options.orm_type === "TypeORM" && + options.auth === false: + cloneRepo(projectName, "JS-PostgreSQL-TypeORM-NoAuth-Template"); + break; + + // TypeScript + + // MongoDB + case options.language_type === "TypeScript" && + options.database_type === "MongoDB" && + options.orm_type === "Mongoose" && + options.auth === false: + cloneRepo(projectName, "TS-MongoDB-Mongoose-NoAuth-Template"); + break; + case options.language_type === "TypeScript" && + options.database_type === "MongoDB" && + options.orm_type === "Prisma" && + options.auth === false: + cloneRepo(projectName, "TS-MongoDB-Prisma-NoAuth-Template"); + break; + case options.language_type === "TypeScript" && + options.database_type === "MongoDB" && + options.orm_type === "TypeORM" && + options.auth === false: + cloneRepo(projectName, "TS-MongoDB-TypeORM-NoAuth-Template"); + break; + // MySQL + case options.language_type === "TypeScript" && + options.database_type === "MySQL" && + options.orm_type === "Prisma" && + options.auth === false: + cloneRepo(projectName, "TS-MySQL-Prisma-NoAuth-Template"); + case options.language_type === "TypeScript" && + options.database_type === "MySQL" && + options.orm_type === "Sequelize" && + options.auth === false: + cloneRepo(projectName, "TS-MySQL-Sequelize-NoAuth-Template"); + case options.language_type === "TypeScript" && + options.database_type === "MySQL" && + options.orm_type === "TypeORM" && + options.auth === false: + cloneRepo(projectName, "TS-MySQL-TypeORM-NoAuth-Template"); + break; + // PostgreSQL + case options.language_type === "TypeScript" && + options.database_type === "PostgreSQL" && + options.orm_type === "Prisma" && + options.auth === false: + cloneRepo(projectName, "TS-PostgreSQL-Prisma-NoAuth-Template"); + case options.language_type === "TypeScript" && + options.database_type === "PostgreSQL" && + options.orm_type === "Sequelize" && + options.auth === false: + cloneRepo(projectName, "TS-PostgreSQL-Sequelize-NoAuth-Template"); + case options.language_type === "TypeScript" && + options.database_type === "PostgreSQL" && + options.orm_type === "TypeORM" && + options.auth === false: + cloneRepo(projectName, "TS-PostgreSQL-TypeORM-NoAuth-Template"); + break; + + default: + throw new Error("unsupported option"); + } +}; From fcda4c7112425186556b5c0b9a7075a09ed778e2 Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:35:28 +0300 Subject: [PATCH 02/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-MongoDB-Mongoose-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/package.json b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/package.json index 7f847fa9..352ff46e 100644 --- a/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MongoDB-Mongoose-NoAuth-Template/package.json @@ -26,7 +26,7 @@ "uuidv4": "^6.2.13" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1" } } From c6429be7ee4e05e16645ba3a49a6a000873019ff Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:36:02 +0300 Subject: [PATCH 03/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-MongoDB-Prisma-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/package.json b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/package.json index 17fc188d..005e2330 100644 --- a/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MongoDB-Prisma-NoAuth-Template/package.json @@ -26,7 +26,7 @@ "uuidv4": "^6.2.13" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1", "prisma": "^5.9.1" } From a1a4ee35fdabc9c6df8d6be1f68ffcee54514db4 Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:36:39 +0300 Subject: [PATCH 04/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-MongoDB-TypeORM-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/package.json b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/package.json index c909104b..ddaa29e9 100644 --- a/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MongoDB-TypeORM-NoAuth-Template/package.json @@ -28,7 +28,7 @@ "typeorm": "0.3.20" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1" } } From c21ea9c3bf842cd40b40686ffa50897c3d79f530 Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:37:05 +0300 Subject: [PATCH 05/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-MySQL-Prisma-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/package.json b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/package.json index 17fc188d..005e2330 100644 --- a/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MySQL-Prisma-NoAuth-Template/package.json @@ -26,7 +26,7 @@ "uuidv4": "^6.2.13" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1", "prisma": "^5.9.1" } From 0a55d80af6302d161582f33d11917bc79dc5b9da Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:37:38 +0300 Subject: [PATCH 06/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-MySQL-Sequelize-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json index 376d63a4..8b4dd3a1 100644 --- a/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MySQL-Sequelize-NoAuth-Template/package.json @@ -27,7 +27,7 @@ "sequelize": "^6.36.0" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1" } } From bc520794e134a4c4d112a101d4d9795bfcf7e106 Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:38:12 +0300 Subject: [PATCH 07/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-MySQL-TypeORM-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json index d9d6b0cd..3e1c209e 100644 --- a/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-MySQL-TypeORM-NoAuth-Template/package.json @@ -29,7 +29,7 @@ "typeorm": "0.3.20" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1" } } From 0d4c06bb6ccd3f55c795de996f1a26cf9cf6a44f Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:38:40 +0300 Subject: [PATCH 08/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-PostgreSQL-Prisma-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/package.json b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/package.json index 17fc188d..005e2330 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-PostgreSQL-Prisma-NoAuth-Template/package.json @@ -26,7 +26,7 @@ "uuidv4": "^6.2.13" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1", "prisma": "^5.9.1" } From 9b2cc3c8052bbac91342f11d23d3133ae1a9152d Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:39:48 +0300 Subject: [PATCH 09/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-PostgreSQL-Sequelize-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/package.json b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/package.json index 3f2ae4fc..92ebbb72 100644 --- a/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-PostgreSQL-Sequelize-NoAuth-Template/package.json @@ -28,7 +28,7 @@ "sequelize": "^6.36.0" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1" } } From 1c67085bfcc4c4a2cbaca0af93e3688c2141cd7a Mon Sep 17 00:00:00 2001 From: isasharafdin Date: Fri, 23 Feb 2024 16:40:12 +0300 Subject: [PATCH 10/10] Updated v0.5.0 to v0.6.0 package.json --- .../JS-PostgreSQL-TypeORM-NoAuth-Template/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json index 65c3c387..d62de962 100644 --- a/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json +++ b/packages/yonode-templates/JS-PostgreSQL-TypeORM-NoAuth-Template/package.json @@ -28,7 +28,7 @@ "typeorm": "0.3.20" }, "devDependencies": { - "yonode": "^0.5.0", + "yonode": "^0.6.0", "nodemon": "^3.0.1" } }