diff --git a/client/.babelrc b/client/.babelrc index 46e6f10b..3d4e3855 100644 --- a/client/.babelrc +++ b/client/.babelrc @@ -1,14 +1,15 @@ { "presets": [ "@babel/preset-typescript", - ["@babel/preset-env", { - "useBuiltIns": false, - "targets": { - "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] + [ + "@babel/preset-env", + { + "useBuiltIns": false, + "targets": { + "browsers": ["> 1%", "last 2 versions", "not ie <= 8"] + } } - }] + ] ], - "plugins": [ - "@babel/plugin-transform-runtime" - ] + "plugins": ["@babel/plugin-transform-runtime"] } diff --git a/client/.eslintrc.js b/client/.eslintrc.js index 285fb91b..5f0f3142 100644 --- a/client/.eslintrc.js +++ b/client/.eslintrc.js @@ -10,7 +10,7 @@ module.exports = { browser: true, }, globals: { - process: "readonly" + process: 'readonly', }, extends: [ // https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention @@ -21,69 +21,77 @@ module.exports = { 'plugin:@typescript-eslint/eslint-recommended', ], // required to lint *.vue files - plugins: [ - 'vue', - '@typescript-eslint' + plugins: ['vue', '@typescript-eslint'], + overrides: [ + { + files: ['*.ts', '*.tsx'], + rules: { + 'no-unused-vars': 'off', + }, + }, ], - overrides: [{ - files: ['*.ts','*.tsx'], - rules: { - 'no-unused-vars': 'off' - } - }], // add your custom rules here rules: { // allow async-await 'generator-star-spacing': 'off', // allow debugger during development 'no-debugger': process.env.NODE_ENV === 'production' ? 'error' : 'off', - 'indent': 'off', - 'semi': ['error', 'always'], + indent: 'off', + semi: ['error', 'always'], 'space-before-function-paren': 'off', 'comma-dangle': 'off', // vue rules 'vue/require-prop-types': 'off', //todo: should we do this? 'vue/require-default-prop': 'off', //todo: should we do this? - 'vue/attributes-order': ['error', { - 'order': [ - 'OTHER_ATTR', - 'DEFINITION', - 'LIST_RENDERING', - 'CONDITIONALS', - 'RENDER_MODIFIERS', - 'GLOBAL', - 'UNIQUE', - 'TWO_WAY_BINDING', - 'OTHER_DIRECTIVES', - 'EVENTS', - 'CONTENT' - ] - }], - "vue/multi-word-component-names": ["off", { - "ignores": [] - }], - 'vue/order-in-components': ['error', { - 'order': [ - 'el', - 'name', - 'parent', - 'functional', - ['delimiters', 'comments'], - ['props', 'propsData'], - 'mixins', - ['components', 'directives', 'filters'], - 'data', - 'extends', - 'inheritAttrs', - 'model', - 'computed', - 'watch', - 'LIFECYCLE_HOOKS', - 'methods', - ['template', 'render'], - 'renderError' - ] - }] - } + 'vue/attributes-order': [ + 'error', + { + order: [ + 'OTHER_ATTR', + 'DEFINITION', + 'LIST_RENDERING', + 'CONDITIONALS', + 'RENDER_MODIFIERS', + 'GLOBAL', + 'UNIQUE', + 'TWO_WAY_BINDING', + 'OTHER_DIRECTIVES', + 'EVENTS', + 'CONTENT', + ], + }, + ], + 'vue/multi-word-component-names': [ + 'off', + { + ignores: [], + }, + ], + 'vue/order-in-components': [ + 'error', + { + order: [ + 'el', + 'name', + 'parent', + 'functional', + ['delimiters', 'comments'], + ['props', 'propsData'], + 'mixins', + ['components', 'directives', 'filters'], + 'data', + 'extends', + 'inheritAttrs', + 'model', + 'computed', + 'watch', + 'LIFECYCLE_HOOKS', + 'methods', + ['template', 'render'], + 'renderError', + ], + }, + ], + }, }; diff --git a/client/.postcssrc.js b/client/.postcssrc.js index eee3e92d..39ebf318 100644 --- a/client/.postcssrc.js +++ b/client/.postcssrc.js @@ -1,10 +1,10 @@ // https://github.com/michael-ciniawsky/postcss-load-config module.exports = { - "plugins": { - "postcss-import": {}, - "postcss-url": {}, + plugins: { + 'postcss-import': {}, + 'postcss-url': {}, // to edit target browsers: use "browserslist" field in package.json - "autoprefixer": {} - } -} + autoprefixer: {}, + }, +}; diff --git a/client/build/build.js b/client/build/build.js index 0d5f51ef..78ba7f23 100644 --- a/client/build/build.js +++ b/client/build/build.js @@ -1,41 +1,45 @@ -'use strict' -require('./check-versions')() +'use strict'; +require('./check-versions')(); -process.env.NODE_ENV = 'production' +process.env.NODE_ENV = 'production'; -const ora = require('ora') -const rm = require('rimraf') -const path = require('path') -const chalk = require('chalk') -const webpack = require('webpack') -const config = require('../config') -const webpackConfig = require('./webpack.prod.conf') +const ora = require('ora'); +const rm = require('rimraf'); +const path = require('path'); +const chalk = require('chalk'); +const webpack = require('webpack'); +const config = require('../config'); +const webpackConfig = require('./webpack.prod.conf'); -const spinner = ora('building for production...') -spinner.start() +const spinner = ora('building for production...'); +spinner.start(); -rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { - if (err) throw err +rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), (err) => { + if (err) throw err; webpack(webpackConfig, (err, stats) => { - spinner.succeed() - if (err) throw err - process.stdout.write(stats.toString({ - colors: true, - modules: false, - children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. - chunks: false, - chunkModules: false - }) + '\n\n') + spinner.succeed(); + if (err) throw err; + process.stdout.write( + stats.toString({ + colors: true, + modules: false, + children: false, // If you are using ts-loader, setting this to true will make TypeScript errors show up during build. + chunks: false, + chunkModules: false, + }) + '\n\n' + ); if (stats.hasErrors()) { - console.log(chalk.red(' Build failed with errors.\n')) - process.exit(1) + console.log(chalk.red(' Build failed with errors.\n')); + process.exit(1); } - console.log(chalk.cyan(' Build complete.\n')) - console.log(chalk.yellow( - ' Tip: built files are meant to be served over an HTTP server.\n' + - ' Opening index.html over file:// won\'t work.\n' - )) - }) -}) + console.log(chalk.cyan(' Build complete.\n')); + console.log( + chalk.yellow( + ' Tip: built files are meant to be served over an HTTP server.\n' + + " Opening index.html over file:// won't work.\n" + ) + ); + }); +}); diff --git a/client/build/check-versions.js b/client/build/check-versions.js index 3ef972a0..3999006d 100644 --- a/client/build/check-versions.js +++ b/client/build/check-versions.js @@ -1,54 +1,53 @@ -'use strict' -const chalk = require('chalk') -const semver = require('semver') -const packageConfig = require('../package.json') -const shell = require('shelljs') +'use strict'; +const chalk = require('chalk'); +const semver = require('semver'); +const packageConfig = require('../package.json'); +const shell = require('shelljs'); -function exec (cmd) { - return require('child_process').execSync(cmd).toString().trim() +function exec(cmd) { + return require('child_process').execSync(cmd).toString().trim(); } const versionRequirements = [ { name: 'node', currentVersion: semver.clean(process.version), - versionRequirement: packageConfig.engines.node - } -] + versionRequirement: packageConfig.engines.node, + }, +]; if (shell.which('npm')) { versionRequirements.push({ name: 'npm', currentVersion: exec('npm --version'), - versionRequirement: packageConfig.engines.npm - }) + versionRequirement: packageConfig.engines.npm, + }); } module.exports = function () { - const warnings = [] + const warnings = []; for (let i = 0; i < versionRequirements.length; i++) { - const mod = versionRequirements[i] + const mod = versionRequirements[i]; if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { - warnings.push(mod.name + ': ' + - chalk.red(mod.currentVersion) + ' should be ' + - chalk.green(mod.versionRequirement) - ) + warnings.push( + mod.name + ': ' + chalk.red(mod.currentVersion) + ' should be ' + chalk.green(mod.versionRequirement) + ); } } if (warnings.length) { - console.log('') - console.log(chalk.yellow('To use this template, you must update following to modules:')) - console.log() + console.log(''); + console.log(chalk.yellow('To use this template, you must update following to modules:')); + console.log(); for (let i = 0; i < warnings.length; i++) { - const warning = warnings[i] - console.log(' ' + warning) + const warning = warnings[i]; + console.log(' ' + warning); } - console.log() - process.exit(1) + console.log(); + process.exit(1); } -} +}; diff --git a/client/build/utils.js b/client/build/utils.js index 20c511b6..80059123 100644 --- a/client/build/utils.js +++ b/client/build/utils.js @@ -1,20 +1,17 @@ -'use strict' -const path = require('path') -const config = require('../config') -const packageConfig = require('../package.json') +'use strict'; +const path = require('path'); +const config = require('../config'); +const packageConfig = require('../package.json'); const isDev = process.env.NODE_ENV !== 'production'; const assetsPath = (_path) => { - const assetsSubDirectory = isDev - ? config.dev.assetsSubDirectory - : config.build.assetsSubDirectory - - return path.posix.join(assetsSubDirectory, _path) -} + const assetsSubDirectory = isDev ? config.dev.assetsSubDirectory : config.build.assetsSubDirectory; + return path.posix.join(assetsSubDirectory, _path); +}; module.exports = { isDev, - assetsPath -} + assetsPath, +}; diff --git a/client/build/webpack.base.conf.js b/client/build/webpack.base.conf.js index 3190e8b7..6ef67bcb 100644 --- a/client/build/webpack.base.conf.js +++ b/client/build/webpack.base.conf.js @@ -3,10 +3,10 @@ const path = require('path'); const config = require('../config'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); -const {VueLoaderPlugin} = require('vue-loader'); +const { VueLoaderPlugin } = require('vue-loader'); const ESLintPlugin = require('eslint-webpack-plugin'); -const {isDev, assetsPath} = require('./utils'); +const { isDev, assetsPath } = require('./utils'); function resolve(dir) { return path.join(__dirname, '..', dir); @@ -15,7 +15,7 @@ function resolve(dir) { const eslintOptions = { formatter: require('eslint-formatter-friendly'), emitWarning: !config.dev.showEslintErrorsInOverlay, - extensions: ['js', 'ts', 'vue'] + extensions: ['js', 'ts', 'vue'], }; //todo: mini-css-extract-plugin? upgrade to webpack 4, then use this @@ -29,9 +29,7 @@ module.exports = { output: { path: config.build.assetsRoot, filename: '[name].js', - publicPath: isDev - ? config.dev.assetsPublicPath - : config.build.assetsPublicPath, + publicPath: isDev ? config.dev.assetsPublicPath : config.build.assetsPublicPath, }, optimization: { splitChunks: { @@ -131,10 +129,7 @@ module.exports = { // styleRule(true), // sass rule ], }, - plugins: [ - new VueLoaderPlugin(), - new ESLintPlugin(eslintOptions), - ], + plugins: [new VueLoaderPlugin(), new ESLintPlugin(eslintOptions)], // node: { // // prevent webpack from injecting useless setImmediate polyfill because Vue diff --git a/client/build/webpack.dev.conf.js b/client/build/webpack.dev.conf.js index eeb59ea6..657069ce 100755 --- a/client/build/webpack.dev.conf.js +++ b/client/build/webpack.dev.conf.js @@ -8,7 +8,7 @@ const CopyPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const portfinder = require('portfinder'); -const {merge} = require('webpack-merge'); +const { merge } = require('webpack-merge'); const HOST = process.env.HOST; const PORT = process.env.PORT && Number(process.env.PORT); @@ -21,15 +21,12 @@ const devWebpackConfig = merge(baseWebpackConfig, { devServer: { client: { logging: 'warn', - overlay: config.dev.errorOverlay ? {errors: true, warnings: false} : false, + overlay: config.dev.errorOverlay ? { errors: true, warnings: false } : false, progress: true, - }, historyApiFallback: { - rewrites: [ - {from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html')}, - ], + rewrites: [{ from: /.*/, to: path.posix.join(config.dev.assetsPublicPath, 'index.html') }], }, hot: true, compress: true, @@ -66,8 +63,8 @@ const devWebpackConfig = merge(baseWebpackConfig, { ], }), new BundleAnalyzerPlugin({ - analyzerMode: 'disabled' // do nothing by default, but be able to generate stats with --profile - }) + analyzerMode: 'disabled', // do nothing by default, but be able to generate stats with --profile + }), ], }); diff --git a/client/build/webpack.prod.conf.js b/client/build/webpack.prod.conf.js index 7a3096b9..c516f4a7 100644 --- a/client/build/webpack.prod.conf.js +++ b/client/build/webpack.prod.conf.js @@ -3,11 +3,11 @@ const path = require('path'); const utils = require('./utils'); const webpack = require('webpack'); const config = require('../config'); -const {merge} = require('webpack-merge'); +const { merge } = require('webpack-merge'); const baseWebpackConfig = require('./webpack.base.conf'); const CopyWebpackPlugin = require('copy-webpack-plugin'); const HtmlWebpackPlugin = require('html-webpack-plugin'); -const CssMinimizerPlugin = require("css-minimizer-webpack-plugin"); +const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const env = require('../config/prod.env'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); @@ -21,9 +21,7 @@ const webpackConfig = merge(baseWebpackConfig, { chunkFilename: utils.assetsPath('js/[id].[chunkhash].js'), }, optimization: { - minimizer: [ - new CssMinimizerPlugin() - ] + minimizer: [new CssMinimizerPlugin()], }, plugins: [ // http://vuejs.github.io/vue-loader/en/workflow/production.html @@ -44,7 +42,8 @@ const webpackConfig = merge(baseWebpackConfig, { filename: config.build.index, template: 'index.html', ...require('../config/prod.env'), - minify: { // defaults from https://github.com/jantimon/html-webpack-plugin#minification + minify: { + // defaults from https://github.com/jantimon/html-webpack-plugin#minification collapseWhitespace: true, keepClosingSlash: true, removeComments: true, @@ -112,14 +111,10 @@ if (config.build.productionGzip) { new CompressionWebpackPlugin({ asset: '[path].gz[query]', algorithm: 'gzip', - test: new RegExp( - '\\.(' + - config.build.productionGzipExtensions.join('|') + - ')$', - ), + test: new RegExp('\\.(' + config.build.productionGzipExtensions.join('|') + ')$'), threshold: 10240, minRatio: 0.8, - }), + }) ); } diff --git a/client/config/dev.env.js b/client/config/dev.env.js index e9cf97d7..92ff8787 100644 --- a/client/config/dev.env.js +++ b/client/config/dev.env.js @@ -1,8 +1,8 @@ -'use strict' -const {merge} = require('webpack-merge') -const prodEnv = require('./prod.env') +'use strict'; +const { merge } = require('webpack-merge'); +const prodEnv = require('./prod.env'); module.exports = merge(prodEnv, { NODE_ENV: '"development"', - VUE_APP_ENABLE_SPELLCHECK: 'true' + VUE_APP_ENABLE_SPELLCHECK: 'true', }); diff --git a/client/config/index.js b/client/config/index.js index 313916d2..07465239 100644 --- a/client/config/index.js +++ b/client/config/index.js @@ -1,12 +1,11 @@ -'use strict' +'use strict'; // Template version: 1.3.1 // see http://vuejs-templates.github.io/webpack for documentation. -const path = require('path') +const path = require('path'); module.exports = { dev: { - // Paths assetsSubDirectory: 'static', assetsPublicPath: '/', @@ -41,7 +40,7 @@ module.exports = { // https://vue-loader.vuejs.org/en/options.html#cachebusting cacheBusting: true, - cssSourceMap: true + cssSourceMap: true, }, build: { @@ -71,6 +70,6 @@ module.exports = { // View the bundle analyzer report after build finishes: // `npm run build --report` // Set to `true` or `false` to always turn it on or off - bundleAnalyzerReport: process.env.npm_config_report - } -} + bundleAnalyzerReport: process.env.npm_config_report, + }, +}; diff --git a/client/config/prod-dha.env.js b/client/config/prod-dha.env.js index dca5df77..5efa78c3 100644 --- a/client/config/prod-dha.env.js +++ b/client/config/prod-dha.env.js @@ -1,9 +1,9 @@ -'use strict' +'use strict'; module.exports = { /* - * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes - * around strings - */ + * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes + * around strings + */ VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, /* @@ -12,6 +12,6 @@ module.exports = { // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv VUE_APP_FAVICON_32: 'https://skillbox-my-detailhandel-dha-prod.s3.eu-central-1.amazonaws.com/myDHA-favicon.png', VUE_APP_FAVICON_16: 'https://skillbox-my-detailhandel-dha-prod.s3.eu-central-1.amazonaws.com/myDHA-favicon.png', - VUE_APP_TITLE: 'myDHA' + VUE_APP_TITLE: 'myDHA', // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ -} +}; diff --git a/client/config/prod-dhf.env.js b/client/config/prod-dhf.env.js index cdcb0d9c..fa5b1fca 100644 --- a/client/config/prod-dhf.env.js +++ b/client/config/prod-dhf.env.js @@ -1,9 +1,9 @@ -'use strict' +'use strict'; module.exports = { /* - * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes - * around strings - */ + * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes + * around strings + */ VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, /* @@ -12,6 +12,6 @@ module.exports = { // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv VUE_APP_FAVICON_32: 'https://skillbox-my-detailhandel-dhf-prod.s3.eu-central-1.amazonaws.com/myDHF-favicon.png', VUE_APP_FAVICON_16: 'https://skillbox-my-detailhandel-dhf-prod.s3.eu-central-1.amazonaws.com/myDHF-favicon.png', - VUE_APP_TITLE: 'myDHF' + VUE_APP_TITLE: 'myDHF', // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ -} +}; diff --git a/client/config/prod-my-kv.env.js b/client/config/prod-my-kv.env.js index 7b7d560a..797a8bca 100644 --- a/client/config/prod-my-kv.env.js +++ b/client/config/prod-my-kv.env.js @@ -1,9 +1,9 @@ -'use strict' +'use strict'; module.exports = { /* - * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes - * around strings - */ + * ENV variables used in JS code need to be stringyfied, as they will be replaced in the code, and JS needs quotes + * around strings + */ VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, /* @@ -12,6 +12,6 @@ module.exports = { // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv VUE_APP_FAVICON_32: 'https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-favicon.png', VUE_APP_FAVICON_16: 'https://skillbox-my-kv-prod.s3-eu-west-1.amazonaws.com/mykv-favicon.png', - VUE_APP_TITLE: 'myKV' + VUE_APP_TITLE: 'myKV', // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ -} +}; diff --git a/client/config/prod.env.js b/client/config/prod.env.js index 7ff19464..4f4fafe0 100644 --- a/client/config/prod.env.js +++ b/client/config/prod.env.js @@ -1,5 +1,5 @@ -'use strict' -const { merge } = require('webpack-merge') +'use strict'; +const { merge } = require('webpack-merge'); const values = { NODE_ENV: '"production"', @@ -9,10 +9,10 @@ const values = { LOGOUT_REDIRECT_URL: JSON.stringify(process.env.LOGOUT_REDIRECT_URL), VUE_APP_FLAVOR: JSON.stringify(process.env.APP_FLAVOR), /* - * ENV variables used in JS code need to be stringyfied, as they will be replaced (in place) in the code, - * and JS needs quotes around strings - * see https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code - */ + * ENV variables used in JS code need to be stringyfied, as they will be replaced (in place) in the code, + * and JS needs quotes around strings + * see https://cli.vuejs.org/guide/mode-and-env.html#using-env-variables-in-client-side-code + */ VUE_APP_ENABLE_SPELLCHECK: !!process.env.TASKBASE_BASEURL, /* @@ -21,9 +21,9 @@ const values = { // vvvv HTML PROPERTIES FROM HERE, NOT STRINGIFIED vvvv VUE_APP_FAVICON_32: '/static/favicon-32x32.png', VUE_APP_FAVICON_16: '/static/favicon-16x16.png', - VUE_APP_TITLE: 'mySkillbox' + VUE_APP_TITLE: 'mySkillbox', // ^^^^ HTML PROPERTIES TO HERE, NOT STRINGIFIED ^^^^ -} +}; switch (process.env.APP_FLAVOR) { case 'my-kv': @@ -39,4 +39,3 @@ switch (process.env.APP_FLAVOR) { // we are on the skillbox APP_FLAVOR module.exports = values; } - diff --git a/client/cypress.e2e.ts b/client/cypress.e2e.ts index 8bb23982..9e9a0919 100644 --- a/client/cypress.e2e.ts +++ b/client/cypress.e2e.ts @@ -1,27 +1,24 @@ -import {defineConfig} from 'cypress'; -import {readFileSync} from "fs"; -import {resolve} from "path"; -export default defineConfig( { +import { defineConfig } from 'cypress'; +import { readFileSync } from 'fs'; +import { resolve } from 'path'; +export default defineConfig({ e2e: { - "baseUrl": "http://localhost:8000", + baseUrl: 'http://localhost:8000', specPattern: 'cypress/e2e/e2e/**/*.{spec,cy}.{js,ts}', supportFile: 'cypress/support/e2e.ts', setupNodeEvents(on, config) { on('task', { getSchema() { - return readFileSync( - resolve(__dirname, '../server/schema.graphql'), - 'utf8' - ); - } + return readFileSync(resolve(__dirname, '../server/schema.graphql'), 'utf8'); + }, }); }, }, - "videoUploadOnPasses": false, - "reporter": "junit", - "reporterOptions": { - "mochaFile": "cypress/test-reports/e2e/cypress-results-[hash].xml", - "toConsole": true + videoUploadOnPasses: false, + reporter: 'junit', + reporterOptions: { + mochaFile: 'cypress/test-reports/e2e/cypress-results-[hash].xml', + toConsole: true, }, - "projectId": "msk-ee", + projectId: 'msk-ee', }); diff --git a/client/cypress.frontend.ts b/client/cypress.frontend.ts index 29927148..48d4366e 100644 --- a/client/cypress.frontend.ts +++ b/client/cypress.frontend.ts @@ -1,34 +1,29 @@ -import {defineConfig} from 'cypress'; -import {readFileSync} from "fs"; -import {resolve} from "path"; +import { defineConfig } from 'cypress'; +import { readFileSync } from 'fs'; +import { resolve } from 'path'; export default defineConfig({ chromeWebSecurity: false, e2e: { - baseUrl: "http://localhost:8080", + baseUrl: 'http://localhost:8080', specPattern: 'cypress/e2e/frontend/**/*.{cy,spec}.{js,ts}', supportFile: 'cypress/support/e2e.ts', setupNodeEvents(on, config) { on('task', { getSchema() { - return readFileSync( - resolve(__dirname, '../server/schema.graphql'), - 'utf8' - ); - } + return readFileSync(resolve(__dirname, '../server/schema.graphql'), 'utf8'); + }, }); }, }, videoUploadOnPasses: false, - reporter: "junit", + reporter: 'junit', reporterOptions: { - mochaFile: "cypress/test-reports/frontend/cypress-results-[hash].xml", - toConsole: true + mochaFile: 'cypress/test-reports/frontend/cypress-results-[hash].xml', + toConsole: true, }, - "projectId": "msk-fe", + projectId: 'msk-fe', retries: { - runMode: 3 - } + runMode: 3, + }, }); - - diff --git a/client/index.html b/client/index.html index b29052f2..c0866fd4 100644 --- a/client/index.html +++ b/client/index.html @@ -1,43 +1,41 @@ - - - - <%= htmlWebpackPlugin.options.VUE_APP_TITLE %> + + + + <%= htmlWebpackPlugin.options.VUE_APP_TITLE %> - - - + + + - - - - - - - + + + + + + + - - - - -
-
-
-
- - + + + +
+
+
+ + diff --git a/client/jest.config.js b/client/jest.config.js index fd7e0cd0..460b060a 100644 --- a/client/jest.config.js +++ b/client/jest.config.js @@ -1,11 +1,5 @@ module.exports = { - moduleFileExtensions: [ - 'js', - 'jsx', - 'ts', - 'json', - 'vue', - ], + moduleFileExtensions: ['js', 'jsx', 'ts', 'json', 'vue'], transform: { '\\.(gql|graphql)$': 'jest-transform-graphql', '^.+\\.js$': 'babel-jest', @@ -13,27 +7,15 @@ module.exports = { '^.+\\.vue$': '@vue/vue2-jest', '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 'jest-transform-stub', }, - modulePaths: [ - '/src', - '/node_modules', - ], - transformIgnorePatterns: [ - '/node_modules/', - ], + modulePaths: ['/src', '/node_modules'], + transformIgnorePatterns: ['/node_modules/'], moduleNameMapper: { '^@/(.*)$': '/src/$1', '^gql/(.*)$': '/src/graphql/gql/$1', }, - snapshotSerializers: [ - '/node_modules/jest-serializer-vue', - ], + snapshotSerializers: ['/node_modules/jest-serializer-vue'], testEnvironment: 'jsdom', - testMatch: [ - '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)', - ], + testMatch: ['**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)'], testURL: 'http://localhost/', - watchPlugins: [ - 'jest-watch-typeahead/filename', - 'jest-watch-typeahead/testname', - ], + watchPlugins: ['jest-watch-typeahead/filename', 'jest-watch-typeahead/testname'], }; diff --git a/client/mock.js b/client/mock.js index 0769f90b..ad319f11 100644 --- a/client/mock.js +++ b/client/mock.js @@ -1,29 +1,26 @@ -const {readFileSync} = require('fs'); -const {resolve} = require('path'); -const { addMocksToSchema} = require('@graphql-tools/mock'); +const { readFileSync } = require('fs'); +const { resolve } = require('path'); +const { addMocksToSchema } = require('@graphql-tools/mock'); const { makeExecutableSchema } = require('@graphql-tools/schema'); const { graphql } = require('graphql'); -const schemaString = readFileSync( - resolve(__dirname,'../server/schema.graphql'), - 'utf8' -); +const schemaString = readFileSync(resolve(__dirname, '../server/schema.graphql'), 'utf8'); // Make a GraphQL schema with no resolvers -const schema = makeExecutableSchema({ typeDefs: schemaString }) +const schema = makeExecutableSchema({ typeDefs: schemaString }); // Create a new schema with mocks -const schemaWithMocks = addMocksToSchema({ schema }) +const schemaWithMocks = addMocksToSchema({ schema }); const query = /* GraphQL */ ` query MeQuery { me { - firstName + firstName } } -` +`; graphql({ schema: schemaWithMocks, source: query, -}).then(result => console.log('Got result', result)) +}).then((result) => console.log('Got result', result)); diff --git a/client/src/@types/graphql.d.ts b/client/src/@types/graphql.d.ts index 60950b87..90cca9ba 100644 --- a/client/src/@types/graphql.d.ts +++ b/client/src/@types/graphql.d.ts @@ -1,12 +1,12 @@ declare module '*.graphql' { - import {DocumentNode} from "graphql"; + import { DocumentNode } from 'graphql'; const Schema: DocumentNode; export = Schema; } declare module '*.gql' { - import {DocumentNode} from "graphql"; + import { DocumentNode } from 'graphql'; const content: DocumentNode; export default content; } diff --git a/client/src/@types/index.ts b/client/src/@types/index.ts index ea59eef3..74bf4dea 100644 --- a/client/src/@types/index.ts +++ b/client/src/@types/index.ts @@ -11,7 +11,7 @@ export interface ContentBlock { } export interface ActionOptions { - up?: boolean, - down?: boolean, - extended?: boolean + up?: boolean; + down?: boolean; + extended?: boolean; } diff --git a/client/src/App.vue b/client/src/App.vue index 0905d8c3..253967df 100644 --- a/client/src/App.vue +++ b/client/src/App.vue @@ -1,109 +1,107 @@ diff --git a/client/src/components/AddContentButton.vue b/client/src/components/AddContentButton.vue index f9ed72fc..529c2578 100644 --- a/client/src/components/AddContentButton.vue +++ b/client/src/components/AddContentButton.vue @@ -1,104 +1,98 @@ diff --git a/client/src/components/AddContentElement.vue b/client/src/components/AddContentElement.vue index 692b617c..5afa10e8 100644 --- a/client/src/components/AddContentElement.vue +++ b/client/src/components/AddContentElement.vue @@ -1,41 +1,38 @@ diff --git a/client/src/components/AddWidget.vue b/client/src/components/AddWidget.vue index f223ae46..2856a11e 100644 --- a/client/src/components/AddWidget.vue +++ b/client/src/components/AddWidget.vue @@ -11,68 +11,71 @@ diff --git a/client/src/components/AssignmentWithSubmissions.vue b/client/src/components/AssignmentWithSubmissions.vue index fe49cc74..db5e1d93 100644 --- a/client/src/components/AssignmentWithSubmissions.vue +++ b/client/src/components/AssignmentWithSubmissions.vue @@ -1,53 +1,31 @@ diff --git a/client/src/components/BackLink.vue b/client/src/components/BackLink.vue index b2d8a89e..0fb0651f 100644 --- a/client/src/components/BackLink.vue +++ b/client/src/components/BackLink.vue @@ -1,72 +1,68 @@ diff --git a/client/src/components/Chapter.vue b/client/src/components/Chapter.vue index 220f3ebc..6e9a3fb6 100644 --- a/client/src/components/Chapter.vue +++ b/client/src/components/Chapter.vue @@ -1,26 +1,12 @@