diff --git a/.eslintignore b/.eslintignore index 181955808..69d9ce171 100644 --- a/.eslintignore +++ b/.eslintignore @@ -2,3 +2,4 @@ node_modules build .nuxt cypress/ +styleguide/ diff --git a/.travis.yml b/.travis.yml index 54a9b37c8..da827f262 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,30 @@ language: node_js node_js: - "10" - +services: + - docker cache: + yarn: true directories: - - "node_modules" + - node_modules install: - - yarn install + - docker build --build-arg BUILD_COMMIT=$TRAVIS_COMMIT -t humanconnection/nitro-web . script: - - yarn run test + - docker run humanconnection/nitro-web yarn run lint + +after_success: + # - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh + # - chmod +x send.sh + # - ./send.sh success $WEBHOOK_URL + - if [ $TRAVIS_BRANCH == "master" ] && [ $TRAVIS_EVENT_TYPE == "push" ]; then + docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"; + docker tag humanconnection/nitro-web humanconnection/nitro-web:latest; + docker push humanconnection/nitro-web:latest; + fi + +after_failure: + - wget https://raw.githubusercontent.com/DiscordHooks/travis-ci-discord-webhook/master/send.sh + - chmod +x send.sh + - ./send.sh failure $WEBHOOK_URL diff --git a/Dockerfile b/Dockerfile index d0d0e28dd..7ababd203 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,29 @@ FROM node:10-alpine -LABEL Description="This image builds and runs the Human-Connection Web Application Frontend" Vendor="Human-Connection gGmbH" Version="0.0.1" Maintainer="Human-Connection gGmbH (developer@human-connection.org)" +LABEL Description="Web Frontend of the Social Network Human-Connection.org" Vendor="Human-Connection gGmbH" Version="0.0.1" Maintainer="Human-Connection gGmbH (developer@human-connection.org)" -# expose the app port +# Expose the app port EXPOSE 3000 -ARG WORKDIR=/HC-WebApp +ARG WORKDIR=/nitro-web RUN mkdir -p $WORKDIR WORKDIR $WORKDIR # See: https://github.com/nodejs/docker-node/pull/367#issuecomment-430807898 RUN apk --no-cache add git -COPY styleguide/ ./styleguide -RUN cd styleguide && yarn install --production=false --frozen-lockfile --non-interactive --ignore-engines - +# Install Web Application COPY package.json . COPY yarn.lock . +COPY styleguide/ ./styleguide RUN yarn install --production=false --frozen-lockfile --non-interactive --ignore-engines +# Install and build Styleguide +COPY styleguide/ ./styleguide +RUN cd styleguide && yarn install --production=false --frozen-lockfile --non-interactive --ignore-engines \ + && cd .. \ + && yarn run styleguide:build \ + && rm -Rf styleguide/node_modules + COPY . . RUN ["yarn", "run", "build"] CMD ["yarn", "run", "start"] diff --git a/README.md b/README.md index 41ec07c5b..e57de2edd 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ # NOTE: currently we need the --ignore-engines parameter as one package is an idiot and dont like new node versions # install all dependencies $ cd styleguide && yarn install --ignore-engines && cd .. +$ yarn run styleguide:build $ yarn install --ignore-engines ``` diff --git a/components/Author.vue b/components/Author.vue index 48236f8c9..f307bc19b 100644 --- a/components/Author.vue +++ b/components/Author.vue @@ -136,7 +136,7 @@ export default { }, author() { return this.hasAuthor - ? this.post.author.User + ? this.post.author : { name: 'Anonymus' } diff --git a/components/Badges.spec.js b/components/Badges.spec.js index 711cb89da..5273fca21 100644 --- a/components/Badges.spec.js +++ b/components/Badges.spec.js @@ -5,8 +5,7 @@ describe('Badges.vue', () => { let wrapper beforeEach(() => { - wrapper = shallowMount(Badges, { - }) + wrapper = shallowMount(Badges, {}) }) it('renders', () => { diff --git a/graphql/UserProfileQuery.js b/graphql/UserProfileQuery.js index de1992885..1848c82b9 100644 --- a/graphql/UserProfileQuery.js +++ b/graphql/UserProfileQuery.js @@ -66,11 +66,9 @@ export default gql(` icon } author { - User { - id - avatar - name - } + id + avatar + name } } } diff --git a/nuxt.config.js b/nuxt.config.js index 33a1cc314..a9a607ca8 100644 --- a/nuxt.config.js +++ b/nuxt.config.js @@ -1,9 +1,13 @@ const pkg = require('./package') const envWhitelist = ['NODE_ENV', 'BACKEND_URL', 'MAINTENANCE'] +const dev = process.env.NODE_ENV !== 'production' module.exports = { mode: 'universal', + dev: dev, + debug: dev ? 'nuxt:*,app' : null, + transition: { name: 'slide-up', mode: 'out-in' diff --git a/package.json b/package.json index 04cd3b977..7a3d4011d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "build": "nuxt build", "start": "cross-env node server/index.js", "generate": "nuxt generate", - "lint": "eslint --ext .js,.vue --ignore-path .gitignore .", + "lint": "eslint --ext .js,.vue .", "styleguide": "cd ./styleguide && yarn dev", "styleguide:build": "cd ./styleguide && yarn build:lib && cd ../ && yarn upgrade vue-cion-design-system --ignore-engines", "test": "jest", @@ -49,6 +49,7 @@ "vue-izitoast": "^1.1.0" }, "devDependencies": { + "@vue/eslint-config-prettier": "^4.0.1", "@vue/test-utils": "^1.0.0-beta.25", "babel-eslint": "^10.0.1", "babel-jest": "^23.6.0", diff --git a/pages/index.vue b/pages/index.vue index 846dc9f98..ed5a2f7d3 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -86,20 +86,18 @@ export default { slug image author { - User { + id + avatar + slug + name + contributionsCount + shoutedCount + commentsCount + followedByCount + badges { id - avatar - slug - name - contributionsCount - shoutedCount - commentsCount - followedByCount - badges { - id - key - icon - } + key + icon } } commentsCount diff --git a/pages/post/_slug/index.vue b/pages/post/_slug/index.vue index adda11db9..e737e9df5 100644 --- a/pages/post/_slug/index.vue +++ b/pages/post/_slug/index.vue @@ -127,20 +127,18 @@ export default { slug image author { - User { + id + slug + name + avatar + shoutedCount + contributionsCount + commentsCount + followedByCount + badges { id - slug - name - avatar - shoutedCount - contributionsCount - commentsCount - followedByCount - badges { - id - key - icon - } + key + icon } } tags { @@ -153,20 +151,18 @@ export default { createdAt deleted author { - User { + id + slug + name + avatar + shoutedCount + contributionsCount + commentsCount + followedByCount + badges { id - slug - name - avatar - shoutedCount - contributionsCount - commentsCount - followedByCount - badges { - id - key - icon - } + key + icon } } } diff --git a/pages/post/_slug/more-info.vue b/pages/post/_slug/more-info.vue index d7553f917..1c6d8b128 100644 --- a/pages/post/_slug/more-info.vue +++ b/pages/post/_slug/more-info.vue @@ -91,19 +91,17 @@ export default { icon } author { - User { + id + name + slug + avatar + contributionsCount + followedByCount + commentsCount + badges { id - name - slug - avatar - contributionsCount - followedByCount - commentsCount - badges { - id - key - icon - } + key + icon } } } diff --git a/styleguide/.prettierrc b/styleguide/.prettierrc index b2095be81..7dc4f8263 100644 --- a/styleguide/.prettierrc +++ b/styleguide/.prettierrc @@ -1,4 +1,6 @@ { "semi": false, - "singleQuote": true + "singleQuote": true, + "tabWidth": 2, + "bracketSpacing": true } diff --git a/styleguide/package.json b/styleguide/package.json index 6879fabaf..45e62edf7 100644 --- a/styleguide/package.json +++ b/styleguide/package.json @@ -56,7 +56,7 @@ "vue-router": "^3.0.1", "vue-svg-loader": "^0.8.0", "vue-template-compiler": "^2.5.17", - "vuep": "git://github.com/visualjerk/vuep.git#iframe-preview", + "vuep": "git://github.com/visualjerk/vuep.git#fix-iframe-firefox", "webpack-bundle-analyzer": "^2.13.1", "webpack-merge-and-include-globally": "^2.0.11" }, diff --git a/styleguide/yarn.lock b/styleguide/yarn.lock index dcde904cd..6d396a01c 100644 --- a/styleguide/yarn.lock +++ b/styleguide/yarn.lock @@ -9460,9 +9460,9 @@ vue@^2.4.2, vue@^2.5.17: version "2.5.17" resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.17.tgz#0f8789ad718be68ca1872629832ed533589c6ada" -"vuep@git://github.com/visualjerk/vuep.git#iframe-preview": - version "0.8.0" - resolved "git://github.com/visualjerk/vuep.git#98a05b94f54dc30432a8d0ac2da0c0cadd74dae7" +"vuep@git://github.com/visualjerk/vuep.git#fix-iframe-firefox": + version "0.8.1" + resolved "git://github.com/visualjerk/vuep.git#df765f9bce3d96f79ffc35e75ec2885539bf9baa" dependencies: simple-assign "^0.1.0" diff --git a/yarn.lock b/yarn.lock index 23cca1240..3041af532 100644 --- a/yarn.lock +++ b/yarn.lock @@ -916,6 +916,15 @@ source-map "^0.5.6" vue-template-es2015-compiler "^1.6.0" +"@vue/eslint-config-prettier@^4.0.1": + version "4.0.1" + resolved "https://registry.yarnpkg.com/@vue/eslint-config-prettier/-/eslint-config-prettier-4.0.1.tgz#a036d0d2193c5c836542b35a3a7c35c4e1c68c97" + integrity sha512-rJEDXPb61Hfgg8GllO3XXFP98bcIxdNNHSrNcxP/vBSukOolgOwQyZJ5f5z/c7ViPyh5/IDlC4qBnhx/0n+I4g== + dependencies: + eslint-config-prettier "^3.3.0" + eslint-plugin-prettier "^3.0.0" + prettier "^1.15.2" + "@vue/test-utils@^1.0.0-beta.25": version "1.0.0-beta.25" resolved "https://registry.yarnpkg.com/@vue/test-utils/-/test-utils-1.0.0-beta.25.tgz#4703076de3076bac42cdd242cd53e6fb8752ed8c" @@ -3665,6 +3674,13 @@ eslint-config-prettier@^3.1.0: dependencies: get-stdin "^6.0.0" +eslint-config-prettier@^3.3.0: + version "3.3.0" + resolved "https://registry.yarnpkg.com/eslint-config-prettier/-/eslint-config-prettier-3.3.0.tgz#41afc8d3b852e757f06274ed6c44ca16f939a57d" + integrity sha512-Bc3bh5bAcKNvs3HOpSi6EfGA2IIp7EzWcg2tS4vP7stnXu/J1opihHDM7jI9JCIckyIDTgZLSWn7J3HY0j2JfA== + dependencies: + get-stdin "^6.0.0" + eslint-loader@^2.0.0: version "2.1.1" resolved "https://registry.yarnpkg.com/eslint-loader/-/eslint-loader-2.1.1.tgz#2a9251523652430bfdd643efdb0afc1a2a89546a" @@ -3675,7 +3691,7 @@ eslint-loader@^2.0.0: object-hash "^1.1.4" rimraf "^2.6.1" -eslint-plugin-prettier@3.0.0: +eslint-plugin-prettier@3.0.0, eslint-plugin-prettier@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/eslint-plugin-prettier/-/eslint-plugin-prettier-3.0.0.tgz#f6b823e065f8c36529918cdb766d7a0e975ec30c" dependencies: @@ -7645,6 +7661,11 @@ prettier@1.14.3: version "1.14.3" resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.14.3.tgz#90238dd4c0684b7edce5f83b0fb7328e48bd0895" +prettier@^1.15.2: + version "1.15.2" + resolved "https://registry.yarnpkg.com/prettier/-/prettier-1.15.2.tgz#d31abe22afa4351efa14c7f8b94b58bb7452205e" + integrity sha512-YgPLFFA0CdKL4Eg2IHtUSjzj/BWgszDHiNQAe0VAIBse34148whfdzLagRL+QiKS+YfK5ftB6X4v/MBw8yCoug== + pretty-error@^2.0.2: version "2.1.1" resolved "https://registry.yarnpkg.com/pretty-error/-/pretty-error-2.1.1.tgz#5f4f87c8f91e5ae3f3ba87ab4cf5e03b1a17f1a3" @@ -9541,6 +9562,7 @@ vue-template-es2015-compiler@^1.6.0: vue@^2.5.17: version "2.5.17" resolved "https://registry.yarnpkg.com/vue/-/vue-2.5.17.tgz#0f8789ad718be68ca1872629832ed533589c6ada" + integrity sha512-mFbcWoDIJi0w0Za4emyLiW72Jae0yjANHbCVquMKijcavBGypqlF7zHRgMa5k4sesdv7hv2rB4JPdZfR+TPfhQ== vuex@^3.0.1: version "3.0.1"