├── .npmignore ├── .github ├── PULL_REQUEST_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── feature-request---.md │ └── bug-report---.md └── workflows │ └── publish.yml ├── template ├── nuxt.js ├── angular.js ├── fastify.js ├── vue.js ├── nest.js ├── react.js ├── next.js └── express.js ├── LICENSE ├── package.json ├── bin ├── log.js └── cli.js ├── .gitignore └── README.md /.npmignore: -------------------------------------------------------------------------------- 1 | .github 2 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | **Checklist**: 2 | 3 | 4 | 5 | - [ ] Did you create an issue ? 6 | - [ ] Have you tested it ? 7 | - [ ] Did you have a update within the last 6 months ? 8 | -------------------------------------------------------------------------------- /template/nuxt.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/AhaOfficial/nuxt-template", 6 | title: "nuxt-template", 7 | author: "AhaOfficial", 8 | description: "🗃 Nuxt Template (Typescript + Composition API)", 9 | }, 10 | ]; 11 | -------------------------------------------------------------------------------- /template/angular.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/angular/universal-starter", 6 | title: "universal-starter", 7 | author: "vikerman", 8 | description: "Angular Universal starter kit by @AngularClass", 9 | }, 10 | ]; 11 | -------------------------------------------------------------------------------- /template/fastify.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/matschik/fastify-typescript-starter", 6 | title: "fastify-typescript-starter", 7 | author: "matschik", 8 | description: "Fastify & TypeScript starter repository", 9 | }, 10 | ]; 11 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request---.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "New Template(새로운 템플릿) \U0001F4A1" 3 | about: "Propose a new project." 4 | title: "" 5 | labels: "Feature" 6 | assignees: "" 7 | --- 8 | 9 | 20 | 21 | ```sh 22 | { 23 | url: '', 24 | name: '', 25 | author: '', 26 | description: '' 27 | } 28 | ``` 29 | 30 | > link : []() 31 | -------------------------------------------------------------------------------- /template/vue.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/Armour/vue-typescript-admin-template", 6 | title: "vue-typescript-admin-template", 7 | author: "Armour", 8 | description: "🖖 A vue-cli 3.0 + typescript minimal admin template", 9 | }, 10 | { 11 | url: "https://github.com/BootstrapDash/StarAdmin-Free-Vue-Admin-Template", 12 | title: "StarAdmin-Free-Vue-Admin-Template", 13 | author: "BootstrapDash", 14 | description: 15 | "Star Admin Vue Admin is a free admin template based on Bootstrap 4 and Vue.js.", 16 | }, 17 | ]; 18 | -------------------------------------------------------------------------------- /template/nest.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/mung9/nestjs-boilerplate", 6 | title: "nestjs-boilerplate", 7 | author: "mung9", 8 | description: 9 | "nodejs 기반 서버 프레임워크 nestjs 개발을 위한 보일러플레이트", 10 | }, 11 | { 12 | url: "https://github.com/changhoi/nestjs-todo-api-demo", 13 | title: "nestjs-todo-api-demo", 14 | author: "changhoi", 15 | description: "NestJS를 사용해서 국민 데모앱 TODO API를 만드는 데모", 16 | }, 17 | { 18 | url: "https://github.com/JaeWangL/nest-boilerplate", 19 | name: "nest-boilerplate", 20 | author: "JaeWangL", 21 | description: "A boilerplate project for Nest.JS", 22 | }, 23 | { 24 | url: "https://github.com/msanvarov/nest-rest-typeorm-boilerplate.git", 25 | name: "nest-rest-typeorm-boilerplate", 26 | author: "msanvarov", 27 | description: 28 | "🍱 backend with nest (typescript), typeorm, and authentication", 29 | }, 30 | ]; 31 | -------------------------------------------------------------------------------- /.github/workflows/publish.yml: -------------------------------------------------------------------------------- 1 | name: npm publish 2 | 3 | on: 4 | pull_request: 5 | branches: 6 | - master 7 | paths: 8 | - package.json 9 | 10 | jobs: 11 | build: 12 | runs-on: ubuntu-latest 13 | steps: 14 | - name: ⬇️ Checkout source code 15 | uses: actions/checkout@v2 16 | 17 | - name: ⎔ Setup nodejs 18 | uses: actions/setup-node@v1 19 | with: 20 | node-version: 12 21 | registry-url: https://registry.npmjs.org/ 22 | 23 | - name: 🏗 Publish npm 24 | run: npm publish --access public 25 | env: 26 | NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} 27 | 28 | - name: 📤 Send Notification to Slack 29 | uses: 8398a7/action-slack@v2.6.0 30 | with: 31 | status: ${{ job.status }} 32 | author_name: Github Actions 33 | env: 34 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 35 | SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} 36 | -------------------------------------------------------------------------------- /template/react.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/rokoroku/react-redux-typescript-boilerplate", 6 | title: "react-redux-typescript-boilerplate", 7 | author: "rokoroku", 8 | description: 9 | "A bare minimum frontend boilerplate with React 16, Typescript 3 and Webpack 4", 10 | }, 11 | { 12 | url: "https://github.com/sweetmilkys/type-react-saga-styled-18", 13 | name: "type-react-saga-styled-18.", 14 | author: "sweetmilkys", 15 | description: 16 | "React + Redux + Saga + StyledComponent + i18next elementary project template", 17 | }, 18 | { 19 | url: "https://github.com/dl0312/react-typescript-boilerplate", 20 | name: "react-typescript-boilerplate", 21 | author: "dl0312", 22 | description: "👶 타입스크립트와 함께 리액트 앱을 만들기 위한 최고의 방법!", 23 | }, 24 | { 25 | url: "https://github.com/SoYoung210/cra-template-soso", 26 | name: "cra-template-soso", 27 | author: "SoYoung210", 28 | description: "🥟 cra template", 29 | }, 30 | ]; 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 아구몬 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report---.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: "Bug Report(버그 보고서) \U0001F41B" 3 | about: "Create a report to help us improve" 4 | title: "" 5 | labels: "Bug" 6 | assignees: "" 7 | --- 8 | 9 | ### Describe the Bug(버그 설명) 10 | 11 | 12 | 13 | ### Version to Reproduce(현재 사용한 버전) 14 | 15 | 16 | 17 | ### Steps to Reproduce(재현 순서) 18 | 19 | 27 | 28 | ### Expected Behavior(예상 동작) 29 | 30 | 31 | 32 | ### Actual Behavior(실제 동작) 33 | 34 | 39 | 40 | ### Additional Context(추가 사항) 41 | 42 | 43 | 44 | ### Capture screen(캡쳐 화면) 45 | 46 | 47 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tsghc", 3 | "version": "1.3.0", 4 | "description": "TypeScript GitHub Clone CLI Tool", 5 | "author": "AGUMON ", 6 | "license": "MIT", 7 | "main": "bin/cli.js", 8 | "keywords": [ 9 | "typescript", 10 | "boilerplate", 11 | "starter", 12 | "cli", 13 | "github", 14 | "clone", 15 | "angular", 16 | "react", 17 | "next", 18 | "vue", 19 | "nuxt", 20 | "express", 21 | "nest", 22 | "fastify" 23 | ], 24 | "bin": { 25 | "tsghc": "bin/cli.js" 26 | }, 27 | "scripts": { 28 | "dev": "node bin/cli.js" 29 | }, 30 | "dependencies": { 31 | "chalk": "^4.1.0", 32 | "figlet": "^1.5.0", 33 | "git-clone": "^0.1.0", 34 | "inquirer": "^7.3.3", 35 | "signale": "^1.4.0" 36 | }, 37 | "devDependencies": {}, 38 | "publishConfig": { 39 | "access": "public" 40 | }, 41 | "engines": { 42 | "node": ">= 10.13.0", 43 | "npm": ">= 6.11.0" 44 | }, 45 | "repository": { 46 | "type": "git", 47 | "url": "git+https://github.com/ljlm0402/tsghc.git" 48 | }, 49 | "bugs": { 50 | "url": "https://github.com/ljlm0402/tsghc/issues" 51 | }, 52 | "homepage": "https://github.com/ljlm0402/tsghc#readme" 53 | } -------------------------------------------------------------------------------- /template/next.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/qvil/next-boilerplate", 6 | title: "next-boilerplate", 7 | author: "qvil", 8 | description: "Modern, lightweight, production-ready Next.js boilerplate", 9 | }, 10 | { 11 | url: "https://github.com/sweetmilkys/type-next-apollo-express-redux-styled-18", 12 | name: "type-next-apollo-express-redux-styled-18", 13 | author: "sweetmilkys", 14 | description: 15 | "React + Next + Express + Apollo + ReduxToolkit + StyledComponent + i18next elementary project template for client and server", 16 | }, 17 | { 18 | url: "https://github.com/maeng2418/next-typescript-boilerplate", 19 | name: "next-typescript-boilerplate", 20 | author: "maeng2418", 21 | description: "타입스크립트 기반의 Next.js와 Express로 보일러 플레이트 제작", 22 | }, 23 | { 24 | url: "https://github.com/jefferson1104/boilerplate-nextjs.git", 25 | name: "boilerplate-nextjs", 26 | author: "jefferson1104", 27 | description: 28 | "With this boilerplate start your project well configured with Eslint, prettier, Husky, babel, next-config and even the use of PLOP for you to automatically create your component structure, with style, storiebook and test files.", 29 | }, 30 | { 31 | url: "https://github.com/JagTheFriend/Nextjs-Firebase-Auth-Template", 32 | name: "next-firebase-auth", 33 | author: "JagTheFriend", 34 | description: "This template uses firebase (google more specifically) for authentication with along TypeScript" 35 | } 36 | ]; 37 | -------------------------------------------------------------------------------- /bin/log.js: -------------------------------------------------------------------------------- 1 | /***************************************************************** 2 | * The generated project is a tsghc. 3 | * The person who developed it is AGUMON . 4 | * The date of development is September 29, 2020. 5 | *****************************************************************/ 6 | "use strict"; 7 | 8 | const figlet = require("figlet"); 9 | const chalk = require("chalk"); 10 | const { Signale } = require("signale"); 11 | 12 | exports.cli = () => { 13 | console.log( 14 | chalk.blue.bgWhite( 15 | figlet.textSync("TypeScript GitHub Clone", { 16 | horizontalLayout: "fitted", 17 | font: "Standard", 18 | }) 19 | ) 20 | ); 21 | }; 22 | 23 | exports.info = (data) => { 24 | const option = { 25 | types: { 26 | url: { 27 | badge: "❤️", 28 | color: "red", 29 | label: "URL", 30 | }, 31 | title: { 32 | badge: "💛", 33 | color: "yellow", 34 | label: "TITLE", 35 | }, 36 | author: { 37 | badge: "💚", 38 | color: "green", 39 | label: "AUTHOR", 40 | }, 41 | desc: { 42 | badge: "💙", 43 | color: "blue", 44 | label: "DESC", 45 | }, 46 | }, 47 | }; 48 | 49 | const template = new Signale(option); 50 | data.url && template.url(data.url); 51 | data.title && template.title(data.title); 52 | data.author && template.author(data.author); 53 | data.description && template.desc(data.description); 54 | }; 55 | 56 | exports.interactive = () => { 57 | const interactive = new Signale({ interactive: true }); 58 | interactive.wait("[%d / 3] - Get GitHub Repositories Info.", 1); 59 | 60 | setTimeout(() => { 61 | interactive.start("[%d / 3] - Start GitHub Repositories Clone", 2); 62 | setTimeout(() => { 63 | interactive.complete("[%d / 3] - Complete GitHub Repositories Clone", 3); 64 | }, 1000); 65 | }, 1000); 66 | }; 67 | -------------------------------------------------------------------------------- /template/express.js: -------------------------------------------------------------------------------- 1 | "use strict"; 2 | 3 | module.exports = [ 4 | { 5 | url: "https://github.com/d4rkstar/ts-express-boilerplate", 6 | title: "ts-express-boilerplate", 7 | author: "d4rkstar", 8 | description: "Typescript Express Boilerplate", 9 | }, 10 | { 11 | url: "https://github.com/a7urag/node-express-mysql-typescript-api-boilerplate", 12 | title: "node-express-mysql-typescript-api-boilerplate", 13 | author: "a7urag", 14 | description: "Boilerplate for node express mysql typescript api project", 15 | }, 16 | { 17 | url: "https://github.com/rjmacarthy/express-typescript-starter", 18 | title: "express-typescript-starter", 19 | author: "rjmacarthy", 20 | description: 21 | "An Express.js project implemented using Typescript with strongly typed objects", 22 | }, 23 | { 24 | url: "https://github.com/sidhantpanda/docker-express-typescript-boilerplate", 25 | title: "docker-express-typescript-boilerplate", 26 | author: "sidhantpanda", 27 | description: 28 | "A dockerized TypeScript-Express App boilerplate with MongoDB and Github Actions", 29 | }, 30 | { 31 | url: "https://github.com/satishbabariya/nodejs-boilerplate", 32 | title: "nodejs-boilerplate", 33 | author: "satishbabariya", 34 | description: 35 | "Clean Architecture for node.js projects (Typescript + Express + TypeORM + Typedi)", 36 | }, 37 | { 38 | url: "https://github.com/changhoi/ts-backend-template", 39 | title: "ts-backend-template", 40 | author: "changhoi", 41 | description: "타입스크립트 백앤드 보일러플레이트", 42 | }, 43 | { 44 | url: "https://github.com/Q00/api_server_boilerplate", 45 | title: "api_server_boilerplate", 46 | author: "Q00", 47 | description: 48 | "typescript express board boilerplate using routing controller", 49 | }, 50 | { 51 | url: "https://github.com/kkrishnakv/express-ts-starter", 52 | name: "express-ts-starter", 53 | author: "kkrishnakv", 54 | description: 55 | "Express JS Starter pack using Typescript and configuration based JSON for different environment.", 56 | }, 57 | ]; 58 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | lerna-debug.log* 8 | 9 | # Diagnostic reports (https://nodejs.org/api/report.html) 10 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 11 | 12 | # Runtime data 13 | pids 14 | *.pid 15 | *.seed 16 | *.pid.lock 17 | 18 | # Directory for instrumented libs generated by jscoverage/JSCover 19 | lib-cov 20 | 21 | # Coverage directory used by tools like istanbul 22 | coverage 23 | *.lcov 24 | 25 | # nyc test coverage 26 | .nyc_output 27 | 28 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 29 | .grunt 30 | 31 | # Bower dependency directory (https://bower.io/) 32 | bower_components 33 | 34 | # node-waf configuration 35 | .lock-wscript 36 | 37 | # Compiled binary addons (https://nodejs.org/api/addons.html) 38 | build/Release 39 | 40 | # Dependency directories 41 | node_modules/ 42 | jspm_packages/ 43 | 44 | # TypeScript v1 declaration files 45 | typings/ 46 | 47 | # TypeScript cache 48 | *.tsbuildinfo 49 | 50 | # Optional npm cache directory 51 | .npm 52 | 53 | # Optional eslint cache 54 | .eslintcache 55 | 56 | # Microbundle cache 57 | .rpt2_cache/ 58 | .rts2_cache_cjs/ 59 | .rts2_cache_es/ 60 | .rts2_cache_umd/ 61 | 62 | # Optional REPL history 63 | .node_repl_history 64 | 65 | # Output of 'npm pack' 66 | *.tgz 67 | 68 | # Yarn Integrity file 69 | .yarn-integrity 70 | 71 | # dotenv environment variables file 72 | # .env 73 | # .env.test 74 | 75 | # parcel-bundler cache (https://parceljs.org/) 76 | .cache 77 | 78 | # Next.js build output 79 | .next 80 | 81 | # Nuxt.js build / generate output 82 | .nuxt 83 | dist 84 | 85 | # Gatsby files 86 | .cache/ 87 | # Comment in the public line in if your project uses Gatsby and *not* Next.js 88 | # https://nextjs.org/blog/next-9-1#public-directory-support 89 | # public 90 | 91 | # vuepress build output 92 | .vuepress/dist 93 | 94 | # Serverless directories 95 | .serverless/ 96 | 97 | # FuseBox cache 98 | .fusebox/ 99 | 100 | # DynamoDB Local files 101 | .dynamodb/ 102 | 103 | # TernJS port file 104 | .tern-port 105 | 106 | # Package-lock json file 107 | package-lock.json 108 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | logo 2 | 3 | NPM Version 4 | Package License 5 | Release Version 6 | NPM Downloads 7 | 8 |
9 | 10 | ## 🔎 What is it ? 11 | 12 | **tsghc** is a CLI module that quickly clones GitHub Repositories composed of TypeScript. 13 | 14 | ## 🚀 Quick Start 15 | 16 | ### Install with the npm global package 17 | 18 | ```sh 19 | $ npm install -g tsghc 20 | ``` 21 | 22 | ### CLI tsghc 23 | 24 | ```sh 25 | $ tsghc 26 | ``` 27 | 28 | cli 29 | 30 | ## 🕹 It supports various frameworks. 31 | 32 | ![](https://img.shields.io/badge/-Angular-DD0031?style=for-the-badge&logo=angular&logoColor=fff) 33 | ![](https://img.shields.io/badge/-React-61DAFB?style=for-the-badge&logo=react&logoColor=fff) 34 | ![](https://img.shields.io/badge/-Next-000000?style=for-the-badge&logo=next.js&logoColor=fff) 35 | ![](https://img.shields.io/badge/-Vue-4FC08D?style=for-the-badge&logo=vue.js&logoColor=fff) 36 | ![](https://img.shields.io/badge/-Nuxt-00C58E?style=for-the-badge&logo=nuxt.js&logoColor=fff) 37 | ![](https://img.shields.io/badge/-Svelte-FF3E00?style=for-the-badge&logo=svelte&logoColor=fff) 38 | ![](https://img.shields.io/badge/-Express_&&_Koa-F8F8F5?style=for-the-badge) 39 | ![](https://img.shields.io/badge/-Nest-E0234E?style=for-the-badge&logo=nestjs&logoColor=fff) 40 | ![](https://img.shields.io/badge/-Fastify-000000?style=for-the-badge&logo=fastify&logoColor=fff) 41 | 42 | ## 🙏 Please pull request from your repository. 43 | 44 | Add it to the template folder file according to your repo's framework. [here](https://github.com/ljlm0402/tsghc/issues/new) 45 | 46 | ```md 47 | { 48 | url: '', 49 | name: '', 50 | author: '', 51 | description: '' 52 | } 53 | 54 | link : '' 55 | ``` 56 | 57 | ## 📬 Recommended Commit Message 58 | 59 | | Template | Commit Message | 60 | | :------------ | :--------------- | 61 | | Angular | ❤️ Angular | 62 | | React & Next | 💙 React & Next | 63 | | Vue & Nuxt | 💚 Vue & Nuxt | 64 | | Svelte | 🧡 Svelte | 65 | | Express & Koa | 🤍 Express & Koa | 66 | | Nest | 💜 Nest | 67 | | Fastify | 🖤 Fastify | 68 | 69 | ## 💳 License 70 | 71 | [MIT](LICENSE) 72 | -------------------------------------------------------------------------------- /bin/cli.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | /***************************************************************** 4 | * The generated project is a tsghc. 5 | * The person who developed it is AGUMON . 6 | * The date of development is September 29, 2020. 7 | *****************************************************************/ 8 | "use strict"; 9 | 10 | const inquirer = require("inquirer"); 11 | const path = require("path"); 12 | const { readdir } = require("fs").promises; 13 | const clone = require("git-clone"); 14 | const log = require("./log.js"); 15 | 16 | const createProject = async () => { 17 | try { 18 | log.cli(); 19 | let decide, info; 20 | const { project } = await inputProjectName(); 21 | 22 | do { 23 | const { framework } = await selectedFramework(); 24 | const { template } = await selectedTemplate(framework); 25 | info = await getTemplateInfo(framework, template); 26 | decide = await decideTemplate(template); 27 | } while (!decide); 28 | 29 | await cloneProject(project, info); 30 | } catch (error) { 31 | console.error(error); 32 | } 33 | }; 34 | 35 | const inputProjectName = () => { 36 | return new Promise((resolve, reject) => { 37 | inquirer 38 | .prompt([ 39 | { 40 | type: "input", 41 | name: "project", 42 | message: "Please enter the desired project name.", 43 | default: "Selected Template Name", 44 | }, 45 | ]) 46 | .then((result) => { 47 | resolve({ 48 | project: result.project.replace(/\s+/g, "-").toLowerCase(), 49 | }); 50 | }) 51 | .catch((error) => { 52 | reject(error); 53 | }); 54 | }); 55 | }; 56 | 57 | const selectedFramework = () => { 58 | return new Promise(async (resolve, reject) => { 59 | let framework = await readdir(path.join(__dirname, "../template"), { 60 | withFileTypes: true, 61 | }); 62 | framework = framework 63 | .filter((p) => !p.isDirectory()) 64 | .map((p) => 65 | p.name 66 | .replace(".js", "") 67 | .replace(/\b[a-z]/, (letter) => letter.toUpperCase()) 68 | ); 69 | 70 | inquirer 71 | .prompt([ 72 | { 73 | type: "list", 74 | name: "framework", 75 | message: "Please select the desired project Freamework.", 76 | choices: framework, 77 | }, 78 | ]) 79 | .then((result) => { 80 | resolve(result); 81 | }) 82 | .catch((error) => { 83 | reject(error); 84 | }); 85 | }); 86 | }; 87 | 88 | const selectedTemplate = (framework) => { 89 | return new Promise((resolve, reject) => { 90 | const template = require(`../template/${framework.toLowerCase()}`).map( 91 | (template) => template.title 92 | ); 93 | 94 | inquirer 95 | .prompt([ 96 | { 97 | type: "list", 98 | name: "template", 99 | message: `The Freamework you choose is ${framework}. Select the template you want.`, 100 | choices: template, 101 | }, 102 | ]) 103 | .then((result) => { 104 | resolve(result); 105 | }) 106 | .catch((error) => { 107 | reject(error); 108 | }); 109 | }); 110 | }; 111 | 112 | const getTemplateInfo = (framework, template) => { 113 | const data = require(`../template/${framework.toLowerCase()}`).find( 114 | (t) => t.title === template 115 | ); 116 | log.info(data); 117 | return data; 118 | }; 119 | 120 | const decideTemplate = (template) => { 121 | return new Promise((resolve, reject) => { 122 | inquirer 123 | .prompt([ 124 | { 125 | type: "confirm", 126 | name: "decide", 127 | message: `Would you like to decide with the ${template} template ?`, 128 | }, 129 | ]) 130 | .then((result) => { 131 | resolve(result.decide); 132 | }) 133 | .catch((error) => { 134 | reject(error); 135 | }); 136 | }); 137 | }; 138 | 139 | const cloneProject = (project, template) => { 140 | return new Promise((resolve, reject) => { 141 | try { 142 | const projectName = 143 | project === "selected-template-name" ? template.title : project; 144 | clone(template.url, `./${projectName}`); 145 | log.interactive(); 146 | resolve(); 147 | } catch (error) { 148 | reject(error); 149 | } 150 | }); 151 | }; 152 | 153 | createProject(); 154 | --------------------------------------------------------------------------------