Skip to content

Commit

Permalink
old-web-redirector: rewrite urls to ocis (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
diocas authored Jun 23, 2022
1 parent 6deaaf2 commit bc982b7
Show file tree
Hide file tree
Showing 10 changed files with 7,224 additions and 0 deletions.
10 changes: 10 additions & 0 deletions old-web-redirector/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[bumpversion]
current_version = 0.0.0
commit = True
tag = True
tag_name = old-web-redirector/v{new_version}
message = old-web-redirector v{new_version}

[bumpversion:file:package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"
48 changes: 48 additions & 0 deletions old-web-redirector/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
module.exports = {
env: {
browser: true,
es6: true,
amd: true
},
extends: [
'standard',
'prettier/standard',
'plugin:prettier/recommended',
'plugin:jest/recommended'
],
parser: "@babel/eslint-parser",
parserOptions: {
requireConfigFile: false,
sourceType: 'module'
},
rules: {
/**
* TODO: fix project import issues and then enable it
* 'sort-imports': 'warn',
*/
'require-await': 'warn',
'no-new': 'off',
'jest/no-standalone-expect': 'off',
'node/no-callback-literal': 'off'
},
globals: {
require: false,
requirejs: false
},
plugins: ['jest'],
overrides: [
{
files: ['**/*.vue'],
extends: ['plugin:vue/recommended', 'prettier/vue']
},
{
files: ['**/*.ts'],
parser: '@typescript-eslint/parser',
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-extra-semi': 'off',
'@typescript-eslint/no-explicit-any': 'off'
}
}
]
}
6 changes: 6 additions & 0 deletions old-web-redirector/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 100,
"singleQuote": true,
"semi": false,
"trailingComma": "none"
}
14 changes: 14 additions & 0 deletions old-web-redirector/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
NAME := old-web-redirector

release: release/$(NAME).tar.gz

clean:
rm -rf dist release node_modules

dist:
yarn install
yarn build

release/$(NAME).tar.gz: dist
mkdir -p release
tar -C dist -czf release/$(NAME).tar.gz .
63 changes: 63 additions & 0 deletions old-web-redirector/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"name": "old-web-redirector",
"version": "0.0.0",
"description": "Handle the urls of the old UI and convert them into the new ones",
"license": "AGPL-3.0",
"author": "CERNBox",
"private": true,
"homepage": "https://github.com/cernbox/web-extensions",
"scripts": {
"lint": "eslint 'src**/*.{js,ts,vue}' --color",
"build": "rollup -c",
"watch": "rollup -c -w",
"serve": "SERVER=true yarn watch"
},
"browserslist": [
"last 2 version",
"> .2%",
"not dead",
"not IE 11",
"not IE_Mob 11"
],
"devDependencies": {
"@babel/core": "^7.12.10",
"@babel/eslint-parser": "^7.16.0",
"@erquhart/rollup-plugin-node-builtins": "^2.1.5",
"@rollup/plugin-commonjs": "^17.0.0",
"@rollup/plugin-json": "^4.1.0",
"@types/jest": "^26.0.23",
"@types/jest-axe": "^3.5.3",
"@typescript-eslint/eslint-plugin": "^5.2.0",
"babel-jest": "^27.0.6",
"eslint": "^7.30.0",
"eslint-config-prettier": "^6.10.0",
"eslint-config-standard": "^16.0.3",
"eslint-plugin-import": "^2.25.2",
"eslint-plugin-jest": "^24.1.3",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.0.0",
"eslint-plugin-promise": "^5.1.0",
"eslint-plugin-vue": "^7.13.0",
"eslint-plugin-vuejs-accessibility": "^0.7.1",
"jest": "^26.6.3",
"jest-axe": "^4.1.0",
"jest-fetch-mock": "^3.0.3",
"jest-mock-axios": "^4.4.0",
"jest-serializer-vue": "^2.0.2",
"rollup": "^2.52.7",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-gzip": "^2.5.0",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-node-globals": "^1.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-svg": "^2.0.0",
"rollup-plugin-terser": "^7.0.2",
"rollup-plugin-vue": "^5.1.4",
"ts-jest": "^27.0.7",
"typescript": "^4.4.4",
"vue-jest": "^3.0.7",
"vue-template-compiler": "^2.6.12"
},
"dependencies": {}
}
67 changes: 67 additions & 0 deletions old-web-redirector/rollup.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import vue from 'rollup-plugin-vue'
import { terser } from 'rollup-plugin-terser'
import gzip from 'rollup-plugin-gzip'
import resolve from 'rollup-plugin-node-resolve'
import commonjs from '@rollup/plugin-commonjs'
import babel from 'rollup-plugin-babel'
import json from '@rollup/plugin-json'
import builtins from '@erquhart/rollup-plugin-node-builtins'
import globals from 'rollup-plugin-node-globals'
import serve from 'rollup-plugin-serve'
import livereload from 'rollup-plugin-livereload'

const production = !process.env.ROLLUP_WATCH

// We can't really do much about circular dependencies in node_modules
function onwarn (warning) {
if (warning.code !== 'CIRCULAR_DEPENDENCY') {
console.error(`(!) ${warning.message}`)
}
}

const plugins = [
vue(),
resolve({
mainFields: ['browser', 'jsnext', 'module', 'main'],
include: 'node_modules/**',
preferBuiltins: true
}),
babel({
exclude: 'node_modules/**',
runtimeHelpers: true
}),
commonjs({
include: 'node_modules/**'
}),
json(),
globals(),
builtins(),
production && terser(),
gzip()
]

if (process.env.SERVER === 'true') {
plugins.push(
serve({
host: '0.0.0.0',
contentBase: ['dist'],
port: process.env.PORT || 9102
})
)
plugins.push(
livereload({
watch: 'dist'
})
)
}

export default {
input: 'src/index.js',
output: {
file: 'dist/main.js',
format: 'amd',
sourcemap: production
},
onwarn,
plugins
}
27 changes: 27 additions & 0 deletions old-web-redirector/src/Error.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<template>
<main>
<div class="oc-position-center">
<div class="oc-text-center">
<oc-icon size="xxlarge" name="error-warning" fill-type="line" />
<p class="oc-text-lead">This URL is no longer valid</p>
<p>Please contact the support if you think this is an error</p>
</div>
</div>
</main>
</template>
<script>
class UrlError extends Error {
constructor(url) {
super(`The url '${url}' is not registered`)
this.name = 'UrlError'
}
}
export default {
name: 'Redirector',
mounted() {
throw new UrlError(this.$route.fullPath)
}
}
</script>
Loading

0 comments on commit bc982b7

Please sign in to comment.