Skip to content

Commit

Permalink
Upgrade vue to version 3
Browse files Browse the repository at this point in the history
Signed-off-by: Pierrick <[email protected]>
  • Loading branch information
PierrickP committed Jun 2, 2023
1 parent eed12d0 commit 12f9898
Show file tree
Hide file tree
Showing 18 changed files with 961 additions and 4,273 deletions.
14 changes: 14 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
root: true,
extends: [
'plugin:vue/vue3-essential',
'eslint:recommended',
'@vue/eslint-config-prettier/skip-formatting'
],
parserOptions: {
ecmaVersion: 'latest'
}
}
26 changes: 0 additions & 26 deletions .eslintrc.js

This file was deleted.

6 changes: 4 additions & 2 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
{
"tabWidth": 2,
"$schema": "https://json.schemastore.org/prettierrc",
"semi": false,
"singleQuote": true
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none"
}
3 changes: 3 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
publish = "dist/website"
functions = "dist/functions"

[dev]
functions = "functions"

[[plugins]]
package = "netlify-plugin-inline-functions-env"
[plugins.inputs]
Expand Down
23 changes: 11 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,14 @@
"build:functions": "netlify functions:build -s functions"
},
"devDependencies": {
"babel-eslint": "^7.2.3",
"eslint": "^4.15.0",
"eslint-config-prettier": "^3.1.0",
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-import": "^2.7.0",
"eslint-plugin-node": "^5.2.0",
"eslint-plugin-promise": "^3.4.0",
"eslint-plugin-vue": "^4.0.0",
"eslint": "^8.41.0",
"eslint-config-prettier": "^8.8.0",
"eslint-friendly-formatter": "^4.0.1",
"eslint-loader": "^4.0.2",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-vue": "^9.14.1",
"netlify-cli": "^10.14.0"
},
"workspaces": [
Expand All @@ -27,8 +26,8 @@
"check-systems",
"functions"
],
"engines" : {
"npm" : ">=8.0.0",
"node" : ">=18.0.0"
"engines": {
"npm": ">=8.0.0",
"node": ">=18.0.0"
}
}
5 changes: 0 additions & 5 deletions website/babel.config.js

This file was deleted.

1 change: 1 addition & 0 deletions website/public/index.html → website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
>
</noscript>
<div id="app"></div>
<script type="module" src="./src/main.js"></script>
<!-- built files will be auto injected -->
</body>
</html>
55 changes: 16 additions & 39 deletions website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,51 +5,28 @@
"description": "Website for GBFS validator",
"author": "Pierrick <[email protected]>",
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"test": "echo \"Error: no test specified\" && exit 0"
"dev": "vite",
"build": "vite build",
"preview": "vite preview",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs --fix --ignore-path .gitignore",
"format": "prettier --write src/"
},
"dependencies": {
"bootstrap": "^5.0.1",
"bootstrap-vue": "^2.21.2",
"bootstrap-vue": "^2.23.1",
"sass": "^1.34.1",
"sass-loader": "^12.0.0",
"vue": "^2.7.14",
"vue": "^3.3.2",
"@vue/compat": "^3.3.2",
"vue-gtag": "1.16.1"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^5.0.6",
"@vue/cli-plugin-eslint": "^5.0.6",
"@vue/cli-service": "^5.0.6",
"babel-eslint": "^10.0.1",
"core-js": "^3.30.1",
"eslint": "^7.32.0",
"eslint-plugin-vue": "^5.0.0",
"vue-template-compiler": "^2.5.21"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"postcss": {
"plugins": {
"autoprefixer": {}
}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not ie <= 8"
]
"@rushstack/eslint-patch": "^1.2.0",
"@vitejs/plugin-vue": "^4.2.3",
"@vue/eslint-config-prettier": "^7.1.0",
"eslint": "^8.39.0",
"eslint-plugin-vue": "^9.11.0",
"prettier": "^2.8.8",
"vite": "^4.3.5"
}
}
42 changes: 21 additions & 21 deletions website/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
<script setup>
import Validator from './components/Validator.vue'
import Footer from './components/Footer.vue'
</script>

<template>
<div>
<b-container>
<b-row class="mt-5 mb-4">
<b-col>
<b-row class="mb-2">
<b-col class="flex-grow-0">
<img src="/gbfs_validator.jpg" alt="">
<img src="/gbfs_validator.jpg" alt="" />
</b-col>
<b-col>
<h1>gbfs-validator.netlify.com</h1>
Expand All @@ -14,40 +19,35 @@
</b-row>
<b-row>
<b-col>
<p>Validate any <a href="https://github.com/NABSA/gbfs/">GBFS</a> feed online. Based on official <a href="https://github.com/MobilityData/gbfs-json-schema">GBFS json schemas</a>. <br>
More details on <a href="https://github.com/MobilityData/gbfs-validator">https://github.com/MobilityData/gbfs-validator</a>.</p>
<p>
Validate any
<a href="https://github.com/NABSA/gbfs/">GBFS</a> feed online.
Based on official
<a href="https://github.com/MobilityData/gbfs-json-schema"
>GBFS json schemas</a
>. <br />
More details on
<a href="https://github.com/MobilityData/gbfs-validator"
>https://github.com/MobilityData/gbfs-validator</a
>.
</p>
</b-col>
</b-row>
</b-col>
</b-row>
<b-row>
<b-col>
<Validator/>
<Validator />
</b-col>
</b-row>
<b-row>
<b-col>

</b-col>
<b-col> </b-col>
</b-row>
</b-container>
<Footer/>
<Footer />
</div>
</template>

<script>
import Validator from './components/Validator'
import Footer from './components/Footer'
export default {
name: 'App',
components: {
Validator,
Footer
}
}
</script>

<style>
html {
position: relative;
Expand Down
66 changes: 39 additions & 27 deletions website/src/components/DownloadSchema.vue
Original file line number Diff line number Diff line change
@@ -1,35 +1,47 @@
<script setup>
import { defineProps } from 'vue'
import { BIconDownload } from 'bootstrap-vue'
const props = defineProps(['file'])
function jsonAsBlob(data, fileName) {
const a = document.createElement('a')
document.body.appendChild(a)
a.style = 'display: none'
const blob = new Blob([JSON.stringify(data, null, 2)], {
type: 'application/json'
})
const url = window.URL.createObjectURL(blob)
a.href = url
a.download = fileName
a.click()
window.URL.revokeObjectURL(url)
}
</script>

<template>
<div>
<a v-if="file.schema" href="#" @click.prevent="jsonAsBlob(file.schema, `${file.file}-schema.json`)" v-b-tooltip.hover title="Download the validation schema">
<a
v-if="file.schema"
href="#"
@click.prevent="jsonAsBlob(file.schema, `${file.file}-schema.json`)"
v-b-tooltip.hover
title="Download the validation schema"
>
<b-icon-download />
</a>
<a v-else-if="file.languages && file.languages[0] && file.languages[0].schema" @click.prevent="jsonAsBlob(file.languages[0].schema, `${file.file}-schema.json`)" href="#" v-b-tooltip.hover title="Download the validation schema">
<a
v-else-if="
file.languages && file.languages[0] && file.languages[0].schema
"
@click.prevent="
jsonAsBlob(file.languages[0].schema, `${file.file}-schema.json`)
"
href="#"
v-b-tooltip.hover
title="Download the validation schema"
>
<b-icon-download />
</a>
</div>
</template>

<script>
import { BIconDownload } from 'bootstrap-vue'
export default {
name: 'DownloadSchema',
components: { BIconDownload },
props: ['file'],
methods: {
jsonAsBlob(data, fileName) {
const a = document.createElement('a')
document.body.appendChild(a)
a.style = 'display: none'
const blob = new Blob([JSON.stringify(data, null, 2)], {
type: 'application/json'
})
const url = window.URL.createObjectURL(blob)
a.href = url
a.download = fileName
a.click()
window.URL.revokeObjectURL(url)
}
}
}
</script>
4 changes: 3 additions & 1 deletion website/src/components/Footer.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<template>
<footer class="footer text-center text-muted mt-5">
Made with &hearts; by <a href="http://fluctuo.com">fluctuo</a>, website powered by <a href="http://https://www.netlify.com/">netlify </a>
Made with &hearts; by <a href="http://fluctuo.com">fluctuo</a>, website
powered by
<a href="http://https://www.netlify.com/">netlify </a>
</footer>
</template>

Expand Down
Loading

0 comments on commit 12f9898

Please sign in to comment.