From bbfed3fbaa6da66e0fe7024a1d02baf07fd2ef2c Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Thu, 6 Feb 2020 18:16:14 +0100 Subject: [PATCH] remove vue template due to cli already being available --- snippets/vue/index.js | 89 ------------------- snippets/vue/template/.browserslistrc | 2 - snippets/vue/template/babel.config.js | 1 - snippets/vue/template/public/index.html | 17 ---- snippets/vue/template/src/App.vue | 20 ----- snippets/vue/template/src/components/comp.vue | 14 --- snippets/vue/template/src/main.js | 10 --- 7 files changed, 153 deletions(-) delete mode 100644 snippets/vue/index.js delete mode 100644 snippets/vue/template/.browserslistrc delete mode 100644 snippets/vue/template/babel.config.js delete mode 100644 snippets/vue/template/public/index.html delete mode 100644 snippets/vue/template/src/App.vue delete mode 100644 snippets/vue/template/src/components/comp.vue delete mode 100644 snippets/vue/template/src/main.js diff --git a/snippets/vue/index.js b/snippets/vue/index.js deleted file mode 100644 index cbabba0..0000000 --- a/snippets/vue/index.js +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (C) Sapphirecode - All Rights Reserved - * This file is part of snippeteer which is released under BSD-3-Clause. - * See file 'LICENSE' for full license details. - * Created by Timo Hocker , January 2020 - */ - -/* eslint-disable no-sync */ -/* eslint-disable no-console */ - -const fs = require ('fs-extra'); -const path = require ('path'); -const child_process = require ('child_process'); - -/** - * copies the full template to a new folder named after arg[0] - * - * @param {string} folder folder to run in - * @param {Array} args function arguments - */ -async function run (folder, args) { - const snip_folder = path.join (folder, ...args); - const template = path.join (__dirname, 'template'); - - for (const f of fs.readdirSync (template)) - fs.copy ( - path.join (template, f), - path.join (snip_folder, f), - { filter: (src, dest) => !fs.existsSync (dest) } - ); - - const devdeps = [ - 'babel-eslint', - 'vue-template-compiler', - '@vue/cli-plugin-babel', - '@vue/cli-plugin-eslint', - '@vue/cli-service' - ]; - const deps = [ - 'core-js', - 'vue' - ]; - - child_process.execSync ( - `npm i --save ${deps.join (' ')} && npm i --save-dev ${devdeps.join (' ')} - `, - { cwd: snip_folder, stdio: 'inherit' } - ); - - const package_json = JSON.parse ( - await fs.readFile (path.join (snip_folder, 'package.json'), 'utf-8') - ); - - package_json.scripts.serve = 'vue-cli-service serve'; - package_json.scripts.build = 'vue-cli-service build'; - - await fs.writeFile ( - path.join (snip_folder, 'package.json'), - JSON.stringify (package_json, null, 2) - ); -} - -/** - * checks if the arguments meet the requirements - * - * @param {string} folder folder to run in - * @returns {boolean} true if arguments match requirements - */ -function assert (folder) { - const tests = [ - { - f: () => (typeof folder === 'string'), - reason: 'cwd is not a folder (internal error)' - }, - { - f: () => (fs.existsSync (folder)), - reason: 'cwd does not exist (internal error)' - } - ]; - for (const test of tests) - if (!test.f ()) { - console.log (test.reason); - return false; - } - - return true; -} - -module.exports = { run, assert }; diff --git a/snippets/vue/template/.browserslistrc b/snippets/vue/template/.browserslistrc deleted file mode 100644 index d6471a3..0000000 --- a/snippets/vue/template/.browserslistrc +++ /dev/null @@ -1,2 +0,0 @@ -> 1% -last 2 versions diff --git a/snippets/vue/template/babel.config.js b/snippets/vue/template/babel.config.js deleted file mode 100644 index 81195ed..0000000 --- a/snippets/vue/template/babel.config.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = { presets: [ '@vue/cli-plugin-babel/preset' ] }; diff --git a/snippets/vue/template/public/index.html b/snippets/vue/template/public/index.html deleted file mode 100644 index 3863951..0000000 --- a/snippets/vue/template/public/index.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - html - - - -
- - - diff --git a/snippets/vue/template/src/App.vue b/snippets/vue/template/src/App.vue deleted file mode 100644 index f7aed77..0000000 --- a/snippets/vue/template/src/App.vue +++ /dev/null @@ -1,20 +0,0 @@ - - - - - diff --git a/snippets/vue/template/src/components/comp.vue b/snippets/vue/template/src/components/comp.vue deleted file mode 100644 index ccb0d3f..0000000 --- a/snippets/vue/template/src/components/comp.vue +++ /dev/null @@ -1,14 +0,0 @@ - - - - - diff --git a/snippets/vue/template/src/main.js b/snippets/vue/template/src/main.js deleted file mode 100644 index 043636a..0000000 --- a/snippets/vue/template/src/main.js +++ /dev/null @@ -1,10 +0,0 @@ -// @ts-nocheck -/* eslint-disable */ - -import Vue from 'vue'; -import App from './App.vue'; - -Vue.config.productionTip = false; - -new Vue ({ render: (h) => h (App) }) - .$mount ('#app');