From 13b45e17093e26e40dc700070ebc45dd20b90419 Mon Sep 17 00:00:00 2001 From: Niels Simenon Date: Sun, 15 Dec 2019 23:01:48 +0100 Subject: [PATCH] Fixed Babel dependencies. --- assets/components/actors/actor.vue | 2 +- assets/components/home/home.vue | 2 +- assets/js/actors/actions.js | 73 +++++++- assets/js/releases/actions.js | 28 +--- package-lock.json | 258 ----------------------------- package.json | 1 - 6 files changed, 76 insertions(+), 288 deletions(-) diff --git a/assets/components/actors/actor.vue b/assets/components/actors/actor.vue index ff599b34..6e5c7e60 100644 --- a/assets/components/actors/actor.vue +++ b/assets/components/actors/actor.vue @@ -263,7 +263,7 @@ function scrollPhotos(event) { async function mounted() { [this.actor] = await Promise.all([ - this.$store.dispatch('fetchActors', { actorId: this.$route.params.actorSlug }), + this.$store.dispatch('fetchActors', { actorSlug: this.$route.params.actorSlug }), this.fetchReleases(), ]); diff --git a/assets/components/home/home.vue b/assets/components/home/home.vue index 6c08c2a6..8bb14d48 100644 --- a/assets/components/home/home.vue +++ b/assets/components/home/home.vue @@ -15,7 +15,7 @@ import FilterBar from '../header/filter-bar.vue'; import Releases from '../releases/releases.vue'; async function fetchReleases() { - this.releases = await this.$store.dispatch('fetchReleases'); + this.releases = await this.$store.dispatch('fetchReleases', { limit: 100 }); } async function mounted() { diff --git a/assets/js/actors/actions.js b/assets/js/actors/actions.js index ac949be8..6a821a3a 100644 --- a/assets/js/actors/actions.js +++ b/assets/js/actors/actions.js @@ -1,12 +1,75 @@ -import { get } from '../api'; +import { graphql, get } from '../api'; + +function curateActor(actor) { + const curatedActor = { + ...actor, + avatar: actor.avatar[0], + origin: { + country: actor.originCountry, + }, + }; + + return curatedActor; +} function initActorActions(store, _router) { - async function fetchActors({ _commit }, { actorId, limit = 100 }) { - if (actorId) { - return get(`/actors/${actorId}`, { limit }); + async function fetchActorBySlug(actorSlug) { + const { actor } = await graphql(` + query Actor($actorSlug:String!) { + actor: actorBySlug(slug:$actorSlug) { + id + name + slug + avatar: actorsMediasByTargetId(condition: { role:"avatar" }) { + thumbnail + } + originCountry: countryByBirthCountryAlpha2 { + alpha2 + name + alias + } + aliases: actorsByAliasFor { + id + name + slug + } + } + } + `, { + actorSlug, + }); + + return curateActor(actor); + } + + async function fetchActors({ _commit }, { actorSlug, limit = 100 }) { + if (actorSlug) { + return fetchActorBySlug(actorSlug); } - return get('/actors', { limit }); + const { actors } = await graphql(` + query Actors($limit:Int) { + actors(first:$limit) { + id + name + slug + avatar: actorsMediasByTargetId(condition: { role:"avatar" }) { + thumbnail + } + originCountry: countryByBirthCountryAlpha2 { + alpha2 + name + alias + } + } + } + `, { + limit, + }); + + console.log(actors); + + return actors.map(actor => curateActor(actor)); } async function fetchActorReleases({ _commit }, actorId) { diff --git a/assets/js/releases/actions.js b/assets/js/releases/actions.js index 8a6b5bb7..4ae82b80 100644 --- a/assets/js/releases/actions.js +++ b/assets/js/releases/actions.js @@ -21,7 +21,7 @@ function curateRelease(release) { } function initReleasesActions(_store, _router) { - async function fetchReleases({ _commit }) { + async function fetchReleases({ _commit }, { limit = 100 }) { /* const releases = await get('/releases', { filter: store.state.ui.filter, @@ -31,8 +31,8 @@ function initReleasesActions(_store, _router) { */ const { releases } = await graphql(` - query Releases { - releases(orderBy: DATE_DESC) { + query Releases($limit:Int) { + releases(first:$limit, orderBy: DATE_DESC) { id title description @@ -53,20 +53,14 @@ function initReleasesActions(_store, _router) { alias } avatar: actorsMediasByTargetId(condition: { role: "avatar" }) { - id thumbnail - path - mime } } } poster: releasesMediasByTargetId(condition: { role: "poster" }) { - mime - id index path thumbnail - role } tags: releasesTagsByTargetId { tag { @@ -90,7 +84,9 @@ function initReleasesActions(_store, _router) { } } } - `); + `, { + limit, + }); return releases.map(release => curateRelease(release)); } @@ -121,36 +117,24 @@ function initReleasesActions(_store, _router) { alias } avatar: actorsMediasByTargetId(condition: { role: "avatar" }) { - id thumbnail - path - mime } } } poster: releasesMediasByTargetId(condition: { role: "poster" }) { - mime - id index path thumbnail - role } photos: releasesMediasByTargetId(condition: { role: "photo" }) { - mime - id index path thumbnail - role } trailer: releasesMediasByTargetId(condition: { role: "trailer" }) { - mime - id index path thumbnail - role } tags: releasesTagsByTargetId { tag { diff --git a/package-lock.json b/package-lock.json index 24fcf144..e5d48699 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2316,106 +2316,6 @@ "@babel/runtime-corejs3": "^7.7.4" } }, - "babel-code-frame": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.26.0.tgz", - "integrity": "sha1-Y/1D99weO7fONZR9uP42mj9Yx0s=", - "dev": true, - "requires": { - "chalk": "^1.1.3", - "esutils": "^2.0.2", - "js-tokens": "^3.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true - }, - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } - } - }, - "babel-core": { - "version": "6.26.3", - "resolved": "https://registry.npmjs.org/babel-core/-/babel-core-6.26.3.tgz", - "integrity": "sha512-6jyFLuDmeidKmUEb3NM+/yawG0M2bDZ9Z1qbZP59cyHLz8kYGKYwpJP0UwUKKUiTRNvxfLesJnTedqczP7cTDA==", - "dev": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-generator": "^6.26.0", - "babel-helpers": "^6.24.1", - "babel-messages": "^6.23.0", - "babel-register": "^6.26.0", - "babel-runtime": "^6.26.0", - "babel-template": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "convert-source-map": "^1.5.1", - "debug": "^2.6.9", - "json5": "^0.5.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.4", - "path-is-absolute": "^1.0.1", - "private": "^0.1.8", - "slash": "^1.0.0", - "source-map": "^0.5.7" - }, - "dependencies": { - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, - "slash": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slash/-/slash-1.0.0.tgz", - "integrity": "sha1-xB8vbDn8FtHNF61LXYlhFK5HDVU=", - "dev": true - } - } - }, "babel-eslint": { "version": "10.0.3", "resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-10.0.3.tgz", @@ -2430,40 +2330,6 @@ "resolve": "^1.12.0" } }, - "babel-generator": { - "version": "6.26.1", - "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz", - "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==", - "dev": true, - "requires": { - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "detect-indent": "^4.0.0", - "jsesc": "^1.3.0", - "lodash": "^4.17.4", - "source-map": "^0.5.7", - "trim-right": "^1.0.1" - }, - "dependencies": { - "jsesc": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-1.3.0.tgz", - "integrity": "sha1-RsP+yMGJKxKwgz25vHYiF226s0s=", - "dev": true - } - } - }, - "babel-helpers": { - "version": "6.24.1", - "resolved": "https://registry.npmjs.org/babel-helpers/-/babel-helpers-6.24.1.tgz", - "integrity": "sha1-NHHenK7DiOXIUOWX5Yom3fN2ArI=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0", - "babel-template": "^6.24.1" - } - }, "babel-loader": { "version": "8.0.6", "resolved": "https://registry.npmjs.org/babel-loader/-/babel-loader-8.0.6.tgz", @@ -2476,15 +2342,6 @@ "pify": "^4.0.1" } }, - "babel-messages": { - "version": "6.23.0", - "resolved": "https://registry.npmjs.org/babel-messages/-/babel-messages-6.23.0.tgz", - "integrity": "sha1-8830cDhYA1sqKVHG7F7fbGLyYw4=", - "dev": true, - "requires": { - "babel-runtime": "^6.22.0" - } - }, "babel-plugin-dynamic-import-node": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/babel-plugin-dynamic-import-node/-/babel-plugin-dynamic-import-node-2.3.0.tgz", @@ -2536,32 +2393,6 @@ "babel-plugin-transform-react-remove-prop-types": "^0.4.18" } }, - "babel-register": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.26.0.tgz", - "integrity": "sha1-btAhFz4vy0htestFxgCahW9kcHE=", - "dev": true, - "requires": { - "babel-core": "^6.26.0", - "babel-runtime": "^6.26.0", - "core-js": "^2.5.0", - "home-or-tmp": "^2.0.0", - "lodash": "^4.17.4", - "mkdirp": "^0.5.1", - "source-map-support": "^0.4.15" - }, - "dependencies": { - "source-map-support": { - "version": "0.4.18", - "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.18.tgz", - "integrity": "sha512-try0/JqxPLF9nOjvSta7tVondkP5dwgyLDjVoyMDlmjugT2lRZ1OfsrYTkCd2hkDnJTKRbO/Rl3orm8vlsUzbA==", - "dev": true, - "requires": { - "source-map": "^0.5.6" - } - } - } - }, "babel-runtime": { "version": "6.26.0", "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", @@ -2578,70 +2409,6 @@ } } }, - "babel-template": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-template/-/babel-template-6.26.0.tgz", - "integrity": "sha1-3gPi0WOWsGn0bdn/+FIfsaDjXgI=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "babel-traverse": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "lodash": "^4.17.4" - } - }, - "babel-traverse": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-traverse/-/babel-traverse-6.26.0.tgz", - "integrity": "sha1-RqnL1+3MYsjlwGTi0tjQ9ANXZu4=", - "dev": true, - "requires": { - "babel-code-frame": "^6.26.0", - "babel-messages": "^6.23.0", - "babel-runtime": "^6.26.0", - "babel-types": "^6.26.0", - "babylon": "^6.18.0", - "debug": "^2.6.8", - "globals": "^9.18.0", - "invariant": "^2.2.2", - "lodash": "^4.17.4" - }, - "dependencies": { - "globals": { - "version": "9.18.0", - "resolved": "https://registry.npmjs.org/globals/-/globals-9.18.0.tgz", - "integrity": "sha512-S0nG3CLEQiY/ILxqtztTWH/3iRRdyBLw6KMDxnKMchrtbj2OFmehVh0WUCfW3DUrIgx/qFrJPICrq4Z4sTR9UQ==", - "dev": true - } - } - }, - "babel-types": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/babel-types/-/babel-types-6.26.0.tgz", - "integrity": "sha1-o7Bz+Uq0nrb6Vc1lInozQ4BjJJc=", - "dev": true, - "requires": { - "babel-runtime": "^6.26.0", - "esutils": "^2.0.2", - "lodash": "^4.17.4", - "to-fast-properties": "^1.0.3" - }, - "dependencies": { - "to-fast-properties": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-1.0.3.tgz", - "integrity": "sha1-uDVx+k2MJbguIxsG46MFXeTKGkc=", - "dev": true - } - } - }, - "babylon": { - "version": "6.18.0", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-6.18.0.tgz", - "integrity": "sha512-q/UEjfGJ2Cm3oKV71DJz9d25TPnq5rhBVL2Q4fA5wcC3jcrdn7+SssEybFIxwAvvP+YCsCYNKughoF33GxgycQ==", - "dev": true - }, "backo2": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", @@ -4060,15 +3827,6 @@ "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=" }, - "detect-indent": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-4.0.0.tgz", - "integrity": "sha1-920GQ1LN9Docts5hnE7jqUdd4gg=", - "dev": true, - "requires": { - "repeating": "^2.0.0" - } - }, "detect-libc": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", @@ -6347,16 +6105,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "home-or-tmp": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/home-or-tmp/-/home-or-tmp-2.0.0.tgz", - "integrity": "sha1-42w/LSyufXRqhX440Y1fMqeILbg=", - "dev": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.1" - } - }, "homedir-polyfill": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", @@ -11489,12 +11237,6 @@ "integrity": "sha1-WIeWa7WCpFA6QetST301ARgVphM=", "dev": true }, - "trim-right": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/trim-right/-/trim-right-1.0.1.tgz", - "integrity": "sha1-yy4SAwZ+DI3h9hQJS5/kVwTqYAM=", - "dev": true - }, "true-case-path": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/true-case-path/-/true-case-path-1.0.3.tgz", diff --git a/package.json b/package.json index 463db59f..0d94db8b 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "@babel/preset-env": "^7.7.6", "@babel/register": "^7.7.4", "autoprefixer": "^9.7.3", - "babel-core": "^6.26.3", "babel-eslint": "^10.0.3", "babel-loader": "^8.0.6", "babel-preset-airbnb": "^3.3.2",