From 1027e05c98f8d3f9e03257ee25244a9f7fd8b8bc Mon Sep 17 00:00:00 2001 From: Wojciech Date: Mon, 28 Sep 2020 11:15:32 +0200 Subject: [PATCH] fix: wrong company url when assetsCDN is set --- app/package.json | 4 +- app/src/admin/options.ts | 8 +- app/src/utils/bundle.ts | 6 ++ app/yarn.lock | 82 +++++-------------- .../utils/options-parser/options-parser.ts | 10 +-- 5 files changed, 38 insertions(+), 72 deletions(-) diff --git a/app/package.json b/app/package.json index f77ea2b0b..f0e504615 100644 --- a/app/package.json +++ b/app/package.json @@ -30,11 +30,11 @@ "wait-on": "^5.2.0" }, "dependencies": { - "@admin-bro/express": "^3.0.0", + "@admin-bro/express": "^3.0.1", "@admin-bro/firebase-functions": "^3.0.1", "@admin-bro/passwords": "^1.0.3", "@admin-bro/sequelize": "1.1.1", - "admin-bro": "^3.3.0-beta.7", + "admin-bro": "^3.2.5", "argon2": "^0.27.0", "connect-session-sequelize": "^7.0.3", "dotenv": "^8.2.0", diff --git a/app/src/admin/options.ts b/app/src/admin/options.ts index 2f6b4fc65..7e463900b 100644 --- a/app/src/admin/options.ts +++ b/app/src/admin/options.ts @@ -1,14 +1,18 @@ -import { models } from './../databases/sequelize/models'; import { AdminBroOptions } from 'admin-bro' +import { models } from '../databases/sequelize/models' import * as UserAdmin from './resources/user' import * as BlogPostAdmin from './resources/blog-post' import * as BrandAdmin from './resources/brand' import * as ProductAdmin from './resources/product' -const rootPath = '/admin' +const rootPath = '/' +const loginPath = '/login' +const logoutPath = '/logout' export const options: AdminBroOptions = { rootPath, + loginPath, + logoutPath, resources: [ { resource: models.User, ...UserAdmin }, { resource: models.BlogPost, ...BlogPostAdmin }, diff --git a/app/src/utils/bundle.ts b/app/src/utils/bundle.ts index cc0e8621f..9068a6239 100644 --- a/app/src/utils/bundle.ts +++ b/app/src/utils/bundle.ts @@ -13,6 +13,12 @@ export const bundle = async () => { './node_modules/admin-bro/lib/frontend/assets/scripts/app-bundle.production.js', './public/app.bundle.js', ) + + await fs.promises.copyFile( + './node_modules/admin-bro/lib/frontend/assets/images/logo.svg', + './public/logo.svg', + ) + await fs.promises.copyFile( './node_modules/admin-bro/lib/frontend/assets/scripts/global-bundle.production.js', './public/global.bundle.js', diff --git a/app/yarn.lock b/app/yarn.lock index b494d6f0b..297ff15b1 100644 --- a/app/yarn.lock +++ b/app/yarn.lock @@ -2,23 +2,21 @@ # yarn lockfile v1 -"@admin-bro/design-system@^1.7.0-beta.8": - version "1.7.0-beta.8" - resolved "https://registry.yarnpkg.com/@admin-bro/design-system/-/design-system-1.7.0-beta.8.tgz#1834e02b5f3314c16be61518ff783f6c5c9c22d2" - integrity sha512-hByMBplQNfOjEbmo1lHX/wK8VGBwp4eXeM0tUUGnd73alSsAVOXkwZ2hhygeCbTj6NEpekny6ls51BQJmAXl0g== +"@admin-bro/design-system@^1.3.3": + version "1.6.0" + resolved "https://registry.yarnpkg.com/@admin-bro/design-system/-/design-system-1.6.0.tgz#4371a57c7faed4e6d49eafe50615217a73a933d5" + integrity sha512-mVo26KVeB80tXEsqyc5Bw9Ysyod7k4VRuAF30isu1wqkwgJLbaAih8tDcNiahB4Ga0AKHKAYBfA5TUa4ULKvMQ== dependencies: "@carbon/icons-react" "^10.14.0" jw-paginate "^1.0.4" - lodash "^4.17.20" polished "^3.6.5" - quill "^1.3.7" react-datepicker "^3.1.3" - styled-system "^5.1.5" + styled-system "^5.1.4" -"@admin-bro/express@^3.0.0": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@admin-bro/express/-/express-3.0.0.tgz#0ac581bbd4511d8854d07409b980e0fff3d9d8e0" - integrity sha512-Ya/a3F/JT//VanaIjlVBeU6gh1afwcjU/q9qhMcETKwy3M+QbVhfmLdOyD1mFqVxwifnkiGnC6gPkupb51C9Pg== +"@admin-bro/express@^3.0.1": + version "3.0.1" + resolved "https://registry.yarnpkg.com/@admin-bro/express/-/express-3.0.1.tgz#21e6693cce257da6f25e75be28b4e2b7ef387531" + integrity sha512-CNGZxdMBFhhr9WGDKmdEpuxYumryO9VNZN+HK93o+Xjqx7lDfFk7smUDFRxmfoHsmaI4QRpErmvswNwpGGzevA== "@admin-bro/firebase-functions@^3.0.1": version "3.0.1" @@ -1632,12 +1630,12 @@ accepts@~1.3.7: mime-types "~2.1.24" negotiator "0.6.2" -admin-bro@^3.3.0-beta.7: - version "3.3.0-beta.7" - resolved "https://registry.yarnpkg.com/admin-bro/-/admin-bro-3.3.0-beta.7.tgz#3bf877404a6492a5192b7bf36881c37e39d6ccae" - integrity sha512-env9eqtCOQilt/jROWDtosHujY28NUxCQpt9LFw0esG/DS/5HTr9vhjA7dVG6opCtsqzQgt7ihBm0UmR5SPdZA== +admin-bro@^3.2.5: + version "3.2.5" + resolved "https://registry.yarnpkg.com/admin-bro/-/admin-bro-3.2.5.tgz#ee9c41c4342099d48639e106800a6af07416fa0f" + integrity sha512-KMiWXj7UbYuMFZ+p8aPh3KQ8BuPXS5zL+IakY8vjJnBlNz4MEdlL4KMT5o8sOGCA4oa8ikRfZs+IAZN1h/NXgA== dependencies: - "@admin-bro/design-system" "^1.7.0-beta.8" + "@admin-bro/design-system" "^1.3.3" "@babel/core" "^7.10.2" "@babel/parser" "^7.10.2" "@babel/plugin-transform-runtime" "^7.10.1" @@ -1671,7 +1669,8 @@ admin-bro@^3.3.0-beta.7: rollup-plugin-replace "^2.2.0" rollup-plugin-terser "^6.1.0" slash "^3.0.0" - styled-components "^5.1.0" + styled-components "^5.1.1" + styled-system "^5.1.5" agent-base@6: version "6.0.1" @@ -2252,11 +2251,6 @@ clone@^1.0.2: resolved "https://registry.yarnpkg.com/clone/-/clone-1.0.4.tgz#da309cc263df15994c688ca902179ca3c7cd7c7e" integrity sha1-2jCcwmPfFZlMaIypAheco8fNfH4= -clone@^2.1.1: - version "2.1.2" - resolved "https://registry.yarnpkg.com/clone/-/clone-2.1.2.tgz#1b7f4b9f591f1e8f83670401600345a02887435f" - integrity sha1-G39Ln1kfHo+DZwQBYANFoCiHQ18= - code-point-at@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/code-point-at/-/code-point-at-1.1.0.tgz#0d070b4d043a5bea33a2f1a40e2edb3d9a4ccf77" @@ -2631,7 +2625,7 @@ decompress-response@^3.3.0: dependencies: mimic-response "^1.0.0" -deep-equal@^1.0.1, deep-equal@^1.1.1: +deep-equal@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-1.1.1.tgz#b5c98c942ceffaf7cb051e24e1434a25a2e6076a" integrity sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g== @@ -2962,11 +2956,6 @@ eventemitter2@^6.4.2: resolved "https://registry.yarnpkg.com/eventemitter2/-/eventemitter2-6.4.3.tgz#35c563619b13f3681e7eb05cbdaf50f56ba58820" integrity sha512-t0A2msp6BzOf+QAcI6z9XMktLj52OjGQg+8SJH6v5+3uxNpWYRR3wQmfA+6xtMU9kOC59qk9licus5dYcrYkMQ== -eventemitter3@^2.0.3: - version "2.0.3" - resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-2.0.3.tgz#b5e1079b59fb5e1ba2771c0a993be060a58c99ba" - integrity sha1-teEHm1n7XhuidxwKmTvgYKWMmbo= - events@1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/events/-/events-1.1.1.tgz#9ebdb7635ad099c70dcc4c2a1f5004288e8bd924" @@ -3086,11 +3075,6 @@ fast-deep-equal@^3.1.1: resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz#3a7d56b559d6cbc3eb512325244e619a65c6c525" integrity sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q== -fast-diff@1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/fast-diff/-/fast-diff-1.1.2.tgz#4b62c42b8e03de3f848460b639079920695d0154" - integrity sha512-KaJUt+M9t1qaIteSvjc6P3RbMdXsNhK61GRftR6SNxqmhthcd9MGIi4T+o0jD8LUSpSnSKXE20nLtJ3fOHxQig== - fast-json-stable-stringify@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz#874bf69c6f404c2b5d99c481341399fd55892633" @@ -4280,7 +4264,7 @@ lodash.once@^4.0.0, lodash.once@^4.1.1: resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac" integrity sha1-DdOXEhPHxW34gJd9UEyI+0cal6w= -lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.20: +lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19: version "4.17.20" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.20.tgz#b44a9b6297bcb698f1c51a3545a2b3b368d59c52" integrity sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA== @@ -4839,11 +4823,6 @@ packet-reader@1.0.0: resolved "https://registry.yarnpkg.com/packet-reader/-/packet-reader-1.0.0.tgz#9238e5480dedabacfe1fe3f2771063f164157d74" integrity sha512-HAKu/fG3HpHFO0AA8WE8q2g+gBJaZ9MG7fcKk+IJPLTGAD6Psw4443l+9DGRbOIh3/aXr7Phy0TjilYivJo5XQ== -parchment@^1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/parchment/-/parchment-1.1.4.tgz#aeded7ab938fe921d4c34bc339ce1168bc2ffde5" - integrity sha512-J5FBQt/pM2inLzg4hEWmzQx/8h8D0CiDxaG3vyp9rKrQRSDgBlhjdP5jQGgosEajXPSQouXGHOmVdgo7QmJuOg== - parent-module@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/parent-module/-/parent-module-1.0.1.tgz#691d2709e78c79fae3a156622452d00762caaaa2" @@ -5161,27 +5140,6 @@ querystring@0.2.0: resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620" integrity sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA= -quill-delta@^3.6.2: - version "3.6.3" - resolved "https://registry.yarnpkg.com/quill-delta/-/quill-delta-3.6.3.tgz#b19fd2b89412301c60e1ff213d8d860eac0f1032" - integrity sha512-wdIGBlcX13tCHOXGMVnnTVFtGRLoP0imqxM696fIPwIf5ODIYUHIvHbZcyvGlZFiFhK5XzDC2lpjbxRhnM05Tg== - dependencies: - deep-equal "^1.0.1" - extend "^3.0.2" - fast-diff "1.1.2" - -quill@^1.3.7: - version "1.3.7" - resolved "https://registry.yarnpkg.com/quill/-/quill-1.3.7.tgz#da5b2f3a2c470e932340cdbf3668c9f21f9286e8" - integrity sha512-hG/DVzh/TiknWtE6QmWAF/pxoZKYxfe3J/d/+ShUWkDvvkZQVTPeVmUJVu1uE6DDooC4fWTiCLh84ul89oNz5g== - dependencies: - clone "^2.1.1" - deep-equal "^1.0.1" - eventemitter3 "^2.0.3" - extend "^3.0.2" - parchment "^1.1.4" - quill-delta "^3.6.2" - raf@^3.4.0: version "3.4.1" resolved "https://registry.yarnpkg.com/raf/-/raf-3.4.1.tgz#0742e99a4a6552f445d73e3ee0328af0ff1ede39" @@ -6048,7 +6006,7 @@ stubs@^3.0.0: resolved "https://registry.yarnpkg.com/stubs/-/stubs-3.0.0.tgz#e8d2ba1fa9c90570303c030b6900f7d5f89abe5b" integrity sha1-6NK6H6nJBXAwPAMLaQD31fiavls= -styled-components@^5.1.0: +styled-components@^5.1.1: version "5.2.0" resolved "https://registry.yarnpkg.com/styled-components/-/styled-components-5.2.0.tgz#6dcb5aa8a629c84b8d5ab34b7167e3e0c6f7ed74" integrity sha512-9qE8Vgp8C5cpGAIdFaQVAl89Zgx1TDM4Yf4tlHbO9cPijtpSXTMLHy9lmP0lb+yImhgPFb1AmZ1qMUubmg3HLg== @@ -6064,7 +6022,7 @@ styled-components@^5.1.0: shallowequal "^1.1.0" supports-color "^5.5.0" -styled-system@^5.1.5: +styled-system@^5.1.4, styled-system@^5.1.5: version "5.1.5" resolved "https://registry.yarnpkg.com/styled-system/-/styled-system-5.1.5.tgz#e362d73e1dbb5641a2fd749a6eba1263dc85075e" integrity sha512-7VoD0o2R3RKzOzPK0jYrVnS8iJdfkKsQJNiLRDjikOpQVqQHns/DXWaPZOH4tIKkhAT7I6wIsy9FWTWh2X3q+A== diff --git a/src/backend/utils/options-parser/options-parser.ts b/src/backend/utils/options-parser/options-parser.ts index 746a4631f..157bb043c 100644 --- a/src/backend/utils/options-parser/options-parser.ts +++ b/src/backend/utils/options-parser/options-parser.ts @@ -1,9 +1,8 @@ import merge from 'lodash/merge' -import slash from 'slash' -import path from 'path' import AdminBro from '../../../admin-bro' import { CurrentAdmin } from '../../../current-admin.interface' import { BrandingOptions, Assets } from '../../../admin-bro-options.interface' +import ViewHelpers from '../view-helpers/view-helpers' const defaultBranding = { @@ -32,10 +31,9 @@ export const getBranding = async ( currentAdmin?: CurrentAdmin, ): Promise => { const { branding } = admin.options - const defaultLogo = slash(path.join( - admin.options.rootPath, - '/frontend/assets/logo.svg', - )) + + const h = new ViewHelpers(admin) + const defaultLogo = h.assetPath('logo.svg') const computed = typeof branding === 'function' ? await branding(currentAdmin)