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" } } 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" } 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" } } 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" } 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" } } 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" } } 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" } 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" } } 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" } } 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"); + } +};