Initial commit

This commit is contained in:
2022-04-27 20:48:21 -04:00
commit edaa99a45f
28 changed files with 21629 additions and 0 deletions

23
frontend/.gitignore vendored Normal file
View File

@ -0,0 +1,23 @@
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

24
frontend/README.md Normal file
View File

@ -0,0 +1,24 @@
# frontend
## Project setup
```
npm install
```
### Compiles and hot-reloads for development
```
npm run serve
```
### Compiles and minifies for production
```
npm run build
```
### Lints and fixes files
```
npm run lint
```
### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).

5
frontend/babel.config.js Normal file
View File

@ -0,0 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
}

19
frontend/jsconfig.json Normal file
View File

@ -0,0 +1,19 @@
{
"compilerOptions": {
"target": "es5",
"module": "esnext",
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@/*": [
"src/*"
]
},
"lib": [
"esnext",
"dom",
"dom.iterable",
"scripthost"
]
}
}

20249
frontend/package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

50
frontend/package.json Normal file
View File

@ -0,0 +1,50 @@
{
"name": "frontend",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"axios": "^0.27.2",
"core-js": "^3.8.3",
"vue": "^2.6.14",
"vue-codemirror": "^4.0.6",
"vuetify": "^2.6.0"
},
"devDependencies": {
"@babel/core": "^7.12.16",
"@babel/eslint-parser": "^7.12.16",
"@vue/cli-plugin-babel": "~5.0.0",
"@vue/cli-plugin-eslint": "~5.0.0",
"@vue/cli-service": "~5.0.0",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^8.0.3",
"sass": "~1.32.0",
"sass-loader": "^10.0.0",
"vue-cli-plugin-vuetify": "~2.4.8",
"vue-template-compiler": "^2.6.14",
"vuetify-loader": "^1.7.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "@babel/eslint-parser"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}

BIN
frontend/public/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@mdi/font@latest/css/materialdesignicons.min.css">
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>

27
frontend/src/App.vue Normal file
View File

@ -0,0 +1,27 @@
<template>
<v-app>
<v-container class="text-center">
<h1>Minify API</h1>
</v-container>
<v-main>
<MinifierEditor/>
</v-main>
</v-app>
</template>
<script>
import MinifierEditor from './components/MinifierEditor';
export default {
name: 'App',
components: {
MinifierEditor,
},
data: () => ({
//
}),
};
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View File

@ -0,0 +1 @@
<svg id="Layer_1" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 87.5 100"><defs><style>.cls-1{fill:#1697f6;}.cls-2{fill:#7bc6ff;}.cls-3{fill:#1867c0;}.cls-4{fill:#aeddff;}</style></defs><title>Artboard 46</title><polyline class="cls-1" points="43.75 0 23.31 0 43.75 48.32"/><polygon class="cls-2" points="43.75 62.5 43.75 100 0 14.58 22.92 14.58 43.75 62.5"/><polyline class="cls-3" points="43.75 0 64.19 0 43.75 48.32"/><polygon class="cls-4" points="64.58 14.58 87.5 14.58 43.75 100 43.75 62.5 64.58 14.58"/></svg>

After

Width:  |  Height:  |  Size: 539 B

View File

@ -0,0 +1,78 @@
<template>
<v-container>
<v-row>
<v-col cols="12">
<v-select block
v-model="language"
:items="languages"
label="Language"
item-value="mime"
item-text="name"
dense
></v-select>
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<codemirror v-model="code" :options="cmOptions" />
</v-col>
</v-row>
<v-row>
<v-col cols="12">
<v-btn v-on:click="minify" block>
Minify
</v-btn>
</v-col>
</v-row>
<v-row class="text-center">
<v-col cols="12">
<v-container fluid>
<v-textarea
label="Minified"
v-model="minified"
></v-textarea>
</v-container>
</v-col>
</v-row>
</v-container>
</template>
<script>
import axios from "axios";
export default {
name: 'MinifierEditor',
data () {
return {
code: '',
minified: '',
language: 'text/javascript',
languages: [
{ mime: 'text/html', name: 'HTML' },
{ mime: 'text/css', name: 'CSS' },
{ mime: 'text/javascript', name: 'JavaScript' },
{ mime: 'application/json', name: 'JSON' },
{ mime: 'text/xml', name: 'XML' },
],
cmOptions: {
// codemirror options
tabSize: 4,
mode: this.language,
lineNumbers: true,
line: true,
}
}
},
methods: {
async minify() {
const {data} = await axios.post('http://localhost:3000/api', this.code, {
headers: {
'Content-Type': this.language
}
});
this.minified = data;
}
},
}
</script>

15
frontend/src/main.js Normal file
View File

@ -0,0 +1,15 @@
import Vue from 'vue'
import App from './App.vue'
import vuetify from './plugins/vuetify'
import VueCodemirror from 'vue-codemirror';
Vue.config.productionTip = false
import 'codemirror/lib/codemirror.css';
Vue.use(VueCodemirror);
new Vue({
vuetify,
render: h => h(App)
}).$mount('#app')

View File

@ -0,0 +1,7 @@
import Vue from 'vue';
import Vuetify from 'vuetify/lib/framework';
Vue.use(Vuetify);
export default new Vuetify({
});

12
frontend/vue.config.js Normal file
View File

@ -0,0 +1,12 @@
const { defineConfig } = require('@vue/cli-service')
module.exports = defineConfig({
pages: {
index: {
entry: 'src/main.js',
title: 'MinifyAPI'
}
},
transpileDependencies: [
'vuetify'
]
})