From 0fc5708ae3f49809a694c974fa4ad82add553264 Mon Sep 17 00:00:00 2001 From: GHOST Date: Tue, 24 May 2022 10:21:27 +0100 Subject: [PATCH] feat: support routify 2 --- package.json | 1 + pnpm-lock.yaml | 40 ++++++++++++++++++++++++++++++++++++++++ src/versions/two.js | 19 +++++++++++++++++-- 3 files changed, 58 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 071b1ef..635b2fe 100644 --- a/package.json +++ b/package.json @@ -36,6 +36,7 @@ "log-symbols": "^5.1.0", "minimist": "^1.2.6", "prompts": "^2.4.2", + "simple-git": "^3.7.1", "update-notifier": "^5.1.0" }, "devDependencies": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c77b69c..16fed90 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,6 +7,7 @@ specifiers: log-symbols: ^5.1.0 minimist: ^1.2.6 prompts: ^2.4.2 + simple-git: ^3.7.1 update-notifier: ^5.1.0 dependencies: @@ -14,6 +15,7 @@ dependencies: log-symbols: 5.1.0 minimist: 1.2.6 prompts: 2.4.2 + simple-git: 3.7.1 update-notifier: 5.1.0 devDependencies: @@ -22,6 +24,18 @@ devDependencies: packages: + /@kwsites/file-exists/1.1.1: + resolution: {integrity: sha512-m9/5YGR18lIwxSFDwfE3oA7bWuq9kdau6ugN4H2rJeyhFQZcG9AgSHkQtSD15a8WvTgfz9aikZMrKPHvbpqFiw==} + dependencies: + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + + /@kwsites/promise-deferred/1.1.1: + resolution: {integrity: sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==} + dev: false + /@sindresorhus/is/0.14.0: resolution: {integrity: sha512-9NET910DNaIPngYnLLPeg+Ogzqsi9uM4mSboU5y6p8S5DzMTVEsJZrawi+BoDNUVBa2DhJqQYUFvMDfgU062LQ==} engines: {node: '>=6'} @@ -193,6 +207,18 @@ packages: engines: {node: '>=8'} dev: false + /debug/4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: false + /decompress-response/3.3.0: resolution: {integrity: sha1-gKTdMjdIOEv6JICDYirt7Jgq3/M=} engines: {node: '>=4'} @@ -425,6 +451,10 @@ packages: resolution: {integrity: sha512-Jsjnk4bw3YJqYzbdyBiNsPWHPfO++UGG749Cxs6peCu5Xg4nrena6OVxOYxrQTqww0Jmwt+Ref8rggumkTLz9Q==} dev: false + /ms/2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: false + /normalize-url/4.5.1: resolution: {integrity: sha512-9UZCFRHQdNrfTpGg8+1INIg93B6zE0aXMVFkw1WFwvO4SlZywU6aLg5Of0Ap/PgcbSw4LNxvMWXMeugwMCX0AA==} engines: {node: '>=8'} @@ -532,6 +562,16 @@ packages: resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} dev: false + /simple-git/3.7.1: + resolution: {integrity: sha512-+Osjtsumbtew2y9to0pOYjNzSIr4NkKGBg7Po5SUtjQhaJf2QBmiTX/9E9cv9rmc7oUiSGFIB9e7ys5ibnT9+A==} + dependencies: + '@kwsites/file-exists': 1.1.1 + '@kwsites/promise-deferred': 1.1.1 + debug: 4.3.4 + transitivePeerDependencies: + - supports-color + dev: false + /sisteransi/1.0.5: resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==} dev: false diff --git a/src/versions/two.js b/src/versions/two.js index e272856..6abf5be 100644 --- a/src/versions/two.js +++ b/src/versions/two.js @@ -1,3 +1,18 @@ -export const run = () => { - console.log('Not done yet!'); +import logSymbols from 'log-symbols'; +import simpleGit from 'simple-git'; +import { rmSync } from 'fs'; +import { join } from 'path'; +import k from 'kleur'; + +export const run = async ({ projectDir, args }) => { + const git = simpleGit(projectDir); + + console.log(k.blue(`\n${logSymbols.info} Cloning template...`)); + + await git.clone('https://github.com/roxiness/routify-starter', projectDir); + + rmSync(join(projectDir, '.git'), { + recursive: true, + force: true, + }); };