Merge branch 'feature/add-polyfill-for-intersection-observer' into 'master'

Fix build on Safari and improve js build

Closes #246

See merge request framasoft/mobilizon!283
This commit is contained in:
Thomas Citharel 2019-10-17 14:49:31 +02:00
commit ddd9d44da1
13 changed files with 1326 additions and 847 deletions

2
.gitignore vendored
View File

@ -17,7 +17,7 @@ erl_crash.dump
.env.production .env.production
.env.test .env.test
.env /.env
.env.2 .env.2
setup_db.psql setup_db.psql

View File

@ -1,5 +0,0 @@
{
"presets": [
"@vue/app"
]
}

1
js/.env Normal file
View File

@ -0,0 +1 @@
VUE_APP_INJECT_COMMENT = <meta name="server-injected-data" />

1
js/.gitignore vendored
View File

@ -27,4 +27,3 @@ yarn-error.log*
*.sln *.sln
*.sw* *.sw*
.env

7
js/babel.config.js Normal file
View File

@ -0,0 +1,7 @@
module.exports = {
presets: [
[
"@vue/app", {useBuiltIns: "entry"}
]
]
};

View File

@ -4,7 +4,7 @@
"license": "AGPL-3.0", "license": "AGPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "vue-cli-service build", "build": "vue-cli-service build --modern",
"test:unit": "vue-cli-service test:unit", "test:unit": "vue-cli-service test:unit",
"test:e2e": "vue-cli-service test:e2e", "test:e2e": "vue-cli-service test:e2e",
"lint": "vue-cli-service lint", "lint": "vue-cli-service lint",
@ -24,6 +24,7 @@
"buefy": "^0.8.2", "buefy": "^0.8.2",
"graphql": "^14.5.8", "graphql": "^14.5.8",
"graphql-tag": "^2.10.1", "graphql-tag": "^2.10.1",
"intersection-observer": "^0.7.0",
"leaflet": "^1.4.0", "leaflet": "^1.4.0",
"lodash": "^4.17.11", "lodash": "^4.17.11",
"ngeohash": "^0.6.3", "ngeohash": "^0.6.3",
@ -45,12 +46,13 @@
"@types/leaflet": "^1.5.2", "@types/leaflet": "^1.5.2",
"@types/lodash": "^4.14.141", "@types/lodash": "^4.14.141",
"@types/mocha": "^5.2.6", "@types/mocha": "^5.2.6",
"@vue/cli-plugin-babel": "^3.6.0", "@vue/cli-plugin-babel": "^4.0.3",
"@vue/cli-plugin-e2e-cypress": "^4.0.0-rc.7", "@vue/cli-plugin-e2e-cypress": "^4.0.3",
"@vue/cli-plugin-pwa": "^3.6.0", "@vue/cli-plugin-pwa": "^4.0.3",
"@vue/cli-plugin-typescript": "^3.6.0", "@vue/cli-plugin-router": "^4.0.3",
"@vue/cli-plugin-unit-mocha": "^3.6.0", "@vue/cli-plugin-typescript": "^4.0.3",
"@vue/cli-service": "^3.6.0", "@vue/cli-plugin-unit-mocha": "^4.0.3",
"@vue/cli-service": "^4.0.3",
"@vue/eslint-config-typescript": "^4.0.0", "@vue/eslint-config-typescript": "^4.0.0",
"@vue/test-utils": "^1.0.0-beta.29", "@vue/test-utils": "^1.0.0-beta.29",
"apollo-link-error": "^1.1.12", "apollo-link-error": "^1.1.12",
@ -63,7 +65,7 @@
"tslint": "^5.20.0", "tslint": "^5.20.0",
"tslint-config-airbnb": "^5.11.2", "tslint-config-airbnb": "^5.11.2",
"typescript": "^3.6.3", "typescript": "^3.6.3",
"vue-cli-plugin-styleguidist": "^3.24.2", "vue-cli-plugin-styleguidist": "^3.25.0",
"vue-cli-plugin-webpack-bundle-analyzer": "^1.3.0", "vue-cli-plugin-webpack-bundle-analyzer": "^1.3.0",
"vue-i18n-extract": "^1.0.2", "vue-i18n-extract": "^1.0.2",
"vue-svg-inline-loader": "^1.3.0", "vue-svg-inline-loader": "^1.3.0",
@ -72,7 +74,7 @@
}, },
"browserslist": [ "browserslist": [
">0.25%", ">0.25%",
"not ie 11", "ie 11",
"not op_mini all" "not op_mini all"
], ],
"engines": { "engines": {

View File

@ -6,7 +6,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0"> <meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico"> <link rel="icon" href="<%= BASE_URL %>favicon.ico">
<!--server-generated-meta--> <%= VUE_APP_INJECT_COMMENT %>
</head> </head>
<body> <body>

View File

@ -99,9 +99,10 @@ $mdi-font-path: "~@mdi/font/fonts";
body { body {
// background: #f7f8fa; // background: #f7f8fa;
background: #ebebeb; background: #ebebeb;
font-family: BlinkMacSystemFont,'Segoe UI',Roboto,Oxygen,Ubuntu,Cantarell,'Fira Sans','Droid Sans','Helvetica Neue',Helvetica,Arial,sans-serif;
main { main {
margin: 1rem auto; margin: 1rem auto 0;
} }
} }

View File

@ -277,7 +277,7 @@ import {
EventVisibility, EventVisibility,
IEvent, ParticipantRole, IEvent, ParticipantRole,
} from '@/types/event.model'; } from '@/types/event.model';
import { CURRENT_ACTOR_CLIENT, IDENTITIES, LOGGED_USER_DRAFTS, LOGGED_USER_PARTICIPATIONS } from '@/graphql/actor'; import { CURRENT_ACTOR_CLIENT, LOGGED_USER_DRAFTS, LOGGED_USER_PARTICIPATIONS } from '@/graphql/actor';
import { IPerson, Person } from '@/types/actor'; import { IPerson, Person } from '@/types/actor';
import PictureUpload from '@/components/PictureUpload.vue'; import PictureUpload from '@/components/PictureUpload.vue';
import EditorComponent from '@/components/Editor.vue'; import EditorComponent from '@/components/Editor.vue';
@ -289,6 +289,7 @@ import AddressAutoComplete from '@/components/Event/AddressAutoComplete.vue';
import { buildFileFromIPicture, buildFileVariable, readFileAsync } from '@/utils/image'; import { buildFileFromIPicture, buildFileVariable, readFileAsync } from '@/utils/image';
import IdentityPickerWrapper from '@/views/Account/IdentityPickerWrapper.vue'; import IdentityPickerWrapper from '@/views/Account/IdentityPickerWrapper.vue';
import { RouteName } from '@/router'; import { RouteName } from '@/router';
import 'intersection-observer';
@Component({ @Component({
components: { IdentityPickerWrapper, AddressAutoComplete, TagInput, DateTimePicker, PictureUpload, Editor: EditorComponent }, components: { IdentityPickerWrapper, AddressAutoComplete, TagInput, DateTimePicker, PictureUpload, Editor: EditorComponent },

View File

@ -1,6 +1,3 @@
import {ParticipantRole} from "@/types/event.model";
import {ParticipantRole} from "@/types/event.model";
import {ParticipantRole} from "@/types/event.model";
<template> <template>
<main class="container"> <main class="container">
<b-tabs type="is-boxed" v-if="event" v-model="activeTab"> <b-tabs type="is-boxed" v-if="event" v-model="activeTab">

View File

@ -1,6 +1,3 @@
const Dotenv = require('dotenv-webpack');
const path = require('path');
module.exports = { module.exports = {
pluginOptions: { pluginOptions: {
webpackBundleAnalyzer: { webpackBundleAnalyzer: {
@ -11,9 +8,6 @@ module.exports = {
runtimeCompiler: true, runtimeCompiler: true,
outputDir: '../priv/static', outputDir: '../priv/static',
configureWebpack: { configureWebpack: {
plugins: [
new Dotenv({ path: path.resolve(process.cwd(), '../.env') }),
],
module: { module: {
rules: [ // fixes https://github.com/graphql/graphql-js/issues/1272 rules: [ // fixes https://github.com/graphql/graphql-js/issues/1272
{ {
@ -28,19 +22,14 @@ module.exports = {
} }
}, },
chainWebpack: config => { chainWebpack: config => {
config // config
.plugin('html') // .plugin('html')
.tap(args => { // .tap(args => {
args[0].minify = { // args[0].minify = {
collapseWhitespace: true, // removeComments: false,
removeComments: false, // };
removeRedundantAttributes: true, // return args
removeScriptTypeAttributes: true, // });
removeStyleLinkTypeAttributes: true,
useShortDoctype: true
};
return args
});
config.module config.module
.rule("vue") .rule("vue")

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ defmodule MobilizonWeb.PageView do
when page in ["actor.html", "event.html", "comment.html"] do when page in ["actor.html", "event.html", "comment.html"] do
with {:ok, index_content} <- File.read(index_file_path()) do with {:ok, index_content} <- File.read(index_file_path()) do
tags = object |> Metadata.build_tags() |> MetadataUtils.stringify_tags() tags = object |> Metadata.build_tags() |> MetadataUtils.stringify_tags()
index_content = String.replace(index_content, "<!--server-generated-meta-->", tags) index_content = String.replace(index_content, "<meta name=server-injected-data>", tags)
{:safe, index_content} {:safe, index_content}
end end
end end
@ -82,7 +82,7 @@ defmodule MobilizonWeb.PageView do
def render("index.html", _assigns) do def render("index.html", _assigns) do
with {:ok, index_content} <- File.read(index_file_path()) do with {:ok, index_content} <- File.read(index_file_path()) do
tags = Instance.build_tags() |> MetadataUtils.stringify_tags() tags = Instance.build_tags() |> MetadataUtils.stringify_tags()
index_content = String.replace(index_content, "<!--server-generated-meta-->", tags) index_content = String.replace(index_content, "<meta name=server-injected-data>", tags)
{:safe, index_content} {:safe, index_content}
end end
end end