diff --git a/.drone.yml b/.drone.yml index d2fc3577..9ce342ba 100644 --- a/.drone.yml +++ b/.drone.yml @@ -86,7 +86,7 @@ steps: YARN_CACHE_FOLDER: .cache/yarn/ CYPRESS_CACHE_FOLDER: .cache/cypress/ commands: - - yarn build --mode dev + - yarn build:dev depends_on: - dependencies @@ -95,7 +95,6 @@ steps: pull: true environment: YARN_CACHE_FOLDER: .cache/yarn/ - CYPRESS_CACHE_FOLDER: .cache/cypress/ commands: - yarn build --dest dist-prod depends_on: @@ -119,8 +118,8 @@ steps: CYPRESS_CACHE_FOLDER: .cache/cypress/ CYPRESS_DEFAULT_COMMAND_TIMEOUT: 60000 commands: - - sed -i 's/localhost/api/g' dist/index.html - - yarn serve:dist & npx wait-on http://localhost:8080 + - sed -i 's/localhost/api/g' dist-dev/index.html + - yarn serve:dist-dev & npx wait-on http://localhost:5000 - yarn test:frontend --browser chrome depends_on: - dependencies diff --git a/.gitignore b/.gitignore index aad7d285..b0700e38 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,6 @@ .DS_Store node_modules -/dist +/dist* *.zip # local env files @@ -20,6 +20,7 @@ yarn-error.log* *.njsproj *.sln *.sw* +!rollup.sw.js # Test files cypress/screenshots diff --git a/cypress.json b/cypress.json index b7319d94..404249f3 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,5 @@ { - "baseUrl": "http://localhost:8080", + "baseUrl": "http://localhost:5000", "env": { "API_URL": "http://localhost:3456/api/v1", "TEST_SECRET": "testingS3cr3et" diff --git a/cypress/integration/list/list.spec.js b/cypress/integration/list/list.spec.js index 57e98b15..a79236d1 100644 --- a/cypress/integration/list/list.spec.js +++ b/cypress/integration/list/list.spec.js @@ -253,11 +253,11 @@ describe('Lists', () => { describe('Gantt View', () => { it('Hides tasks with no dates', () => { - TaskFactory.create(1) + const tasks = TaskFactory.create(1) cy.visit('/lists/1/gantt') cy.get('.gantt-chart-container .gantt-chart .tasks') - .should('be.empty') + .should('not.contain', tasks[0].title) }) it('Shows tasks from the current and next month', () => { diff --git a/index.html b/index.html new file mode 100644 index 00000000..edf1d45f --- /dev/null +++ b/index.html @@ -0,0 +1,35 @@ + + + + Vikunja + + + + + + + + + + + + + + + + + +
+ + + + diff --git a/package.json b/package.json index f00a41ea..4440638d 100644 --- a/package.json +++ b/package.json @@ -3,9 +3,10 @@ "version": "0.10.0", "private": true, "scripts": { - "serve": "vue-cli-service serve", - "serve:dist": "node scripts/serve-dist.js", - "build": "vue-cli-service build", + "serve": "vite", + "serve:dist-dev": "node scripts/serve-dist.js", + "build": "vite build && rollup -c ./rollup.sw.js && workbox copyLibraries dist/", + "build:dev": "vite build -m development --outDir dist-dev/", "build:report": "vue-cli-service build --report", "lint": "vue-cli-service lint --ignore-pattern '*.test.*'", "cypress:open": "cypress open", @@ -23,7 +24,6 @@ "lodash": "4.17.21", "marked": "2.1.3", "register-service-worker": "1.7.2", - "sass": "1.36.0", "snake-case": "3.0.4", "verte": "0.0.12", "vue": "2.6.14", @@ -33,13 +33,18 @@ "vue-i18n": "8.25.0", "vue-shortkey": "3.1.7", "vue-smooth-dnd": "0.8.1", - "vuex": "3.6.2" + "vuex": "3.6.2", + "workbox-precaching": "^6.1.1" }, "devDependencies": { "@fortawesome/fontawesome-svg-core": "1.2.35", "@fortawesome/free-regular-svg-icons": "5.15.3", "@fortawesome/free-solid-svg-icons": "5.15.3", "@fortawesome/vue-fontawesome": "2.0.2", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-commonjs": "^19.0.1", + "@rollup/plugin-node-resolve": "^13.0.4", + "@rollup/plugin-replace": "^3.0.0", "@types/jest": "26.0.24", "@typescript-eslint/eslint-plugin": "4.28.4", "@typescript-eslint/parser": "4.28.4", @@ -54,18 +59,25 @@ "babel-eslint": "10.1.0", "cypress": "8.0.0", "cypress-file-upload": "5.0.8", + "esbuild": "0.8.51", "eslint": "7.31.0", "eslint-plugin-vue": "7.14.0", "faker": "5.5.3", "jest": "27.0.6", + "rollup-plugin-terser": "^7.0.2", + "sass": "1.36.0", "sass-loader": "10.2.0", "ts-jest": "27.0.4", "typescript": "4.3.5", + "vite": "2.0.2", + "vite-plugin-pwa": "0.5.6", + "vite-plugin-vue2": "1.2.1", "vue-flatpickr-component": "8.1.7", "vue-notification": "1.3.20", "vue-router": "3.5.2", "vue-template-compiler": "2.6.14", - "wait-on": "6.0.0" + "wait-on": "6.0.0", + "workbox-cli": "6.1.1" }, "eslintConfig": { "root": true, diff --git a/public/images/llama-nightscape.svg b/public/images/llama-nightscape.svg index 0321075e..1dd1a814 100644 --- a/public/images/llama-nightscape.svg +++ b/public/images/llama-nightscape.svg @@ -16,9 +16,6 @@ height="1066.6667" viewBox="0 0 1066.6667 1066.6667" sodipodi:docname="llama-nightscape.svg" - inkscape:export-filename="/home/konrad/www/vikunja/frontend/public/images/llama-nightscape.png" - inkscape:export-xdpi="172.8" - inkscape:export-ydpi="172.8" inkscape:version="0.92.4 (5da689c313, 2019-01-14)">image/svg+xml - - - Vikunja - - - - - - - - - - - - - - - - - - -
- - - - diff --git a/rollup.sw.js b/rollup.sw.js new file mode 100644 index 00000000..828d9872 --- /dev/null +++ b/rollup.sw.js @@ -0,0 +1,43 @@ +import { nodeResolve } from '@rollup/plugin-node-resolve' +import babel from '@rollup/plugin-babel' +import commonjs from '@rollup/plugin-commonjs' +import { terser } from 'rollup-plugin-terser' +import replace from '@rollup/plugin-replace' + +// Building the sw stuff ourselves to have more controle over it - see https://github.com/antfu/vite-plugin-pwa/issues/35#issuecomment-797942573 +export default { + input: './dist/sw.js', + output: { + dir: 'dist', + format: 'esm', + }, + plugins: [ + replace({ + 'process.env.NODE_ENV': JSON.stringify('production'), + 'preventAssignment': true, + }), + nodeResolve({ + browser: true, + }), + commonjs(), + babel({ + exclude: '**/node_modules/**', + extensions: ['js'], + babelHelpers: 'runtime', + presets: [ + [ + '@babel/preset-env', + { + corejs: 3, + useBuiltIns: 'entry', + targets: { + 'esmodules': true, + }, + modules: false, + }, + ], + ], + }), + terser(), + ], +} diff --git a/scripts/serve-dist.js b/scripts/serve-dist.js index 842f634f..e0303dd7 100644 --- a/scripts/serve-dist.js +++ b/scripts/serve-dist.js @@ -2,8 +2,8 @@ const path = require('path') const express = require('express') const app = express() -const p = path.join(__dirname, '..', 'dist') -const port = 8080 +const p = path.join(__dirname, '..', 'dist-dev') +const port = 5000 app.use(express.static(p)) // Handle urls set by the frontend diff --git a/src/App.vue b/src/App.vue index 774d8161..9dae1e76 100644 --- a/src/App.vue +++ b/src/App.vue @@ -30,11 +30,11 @@ import authTypes from './models/authTypes' import Notification from './components/misc/notification' import {KEYBOARD_SHORTCUTS_ACTIVE, ONLINE} from './store/mutation-types' import KeyboardShortcuts from './components/misc/keyboard-shortcuts' -import TopNavigation from '@/components/home/topNavigation' -import ContentAuth from '@/components/home/contentAuth' -import ContentLinkShare from '@/components/home/contentLinkShare' -import ContentNoAuth from '@/components/home/contentNoAuth' -import {setLanguage} from '@/i18n/setup' +import TopNavigation from './components/home/topNavigation' +import ContentAuth from './components/home/contentAuth' +import ContentLinkShare from './components/home/contentLinkShare' +import ContentNoAuth from './components/home/contentNoAuth' +import {setLanguage} from './i18n/setup' export default { name: 'app', diff --git a/src/ServiceWorker/sw.js b/src/ServiceWorker/sw.js index 98d8bc29..05656792 100644 --- a/src/ServiceWorker/sw.js +++ b/src/ServiceWorker/sw.js @@ -1,6 +1,12 @@ /* eslint-disable no-console */ /* eslint-disable no-undef */ +importScripts( '/workbox-v6.1.5/workbox-sw.js') +workbox.setConfig({modulePathPrefix: '/workbox-v6.1.5'}) + +import { precacheAndRoute } from 'workbox-precaching' +precacheAndRoute(self.__WB_MANIFEST) + // Cache assets workbox.routing.registerRoute( // This regexp matches all files in precache-manifest diff --git a/src/components/home/contentAuth.vue b/src/components/home/contentAuth.vue index 55ab90f8..e2cdc467 100644 --- a/src/components/home/contentAuth.vue +++ b/src/components/home/contentAuth.vue @@ -44,8 +44,8 @@