diff --git a/package.json b/package.json index 45c110ed..99c8f1fa 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "preview": "astro preview", "server": "node server/server.mjs", "start": "astro dev", + "start:local": "cross-env PUBLIC_API_URL=http://localhost:8080 astro dev", "typecheck": "astro check && tsc --noEmit", "typecheck:watch": "tsc --noEmit --watch", "vercel-build": "astro build" @@ -46,7 +47,7 @@ "@nanostores/router": "^0.7.0", "@nanostores/solid": "^0.3.0", "@popperjs/core": "^2.11.6", - "@solid-devtools/debugger": "^0.15.0", + "@solid-devtools/debugger": "^0.15.1", "@solid-devtools/logger": "^0.5.0", "@solid-primitives/memo": "^1.1.2", "@solid-primitives/storage": "^1.3.3", @@ -65,6 +66,7 @@ "clsx": "^1.2.1", "cookie": "^0.5.0", "cookie-signature": "^1.2.0", + "cross-env": "^7.0.3", "eslint": "^8.27.0", "eslint-config-stylelint": "^17.0.0", "eslint-import-resolver-typescript": "^3.5.2", @@ -111,8 +113,8 @@ "prosemirror-view": "^1.29.1", "rollup": "^2.79.1", "rollup-plugin-visualizer": "^5.8.3", - "sass": "^1.56.1", - "solid-devtools": "^0.23.0", + "sass": "1.32.13", + "solid-devtools": "^0.22.0", "solid-js": "^1.6.2", "solid-js-form": "^0.1.5", "solid-jsx": "^0.9.1", diff --git a/src/graphql/client.ts b/src/graphql/client.ts deleted file mode 100644 index 3cf12b35..00000000 --- a/src/graphql/client.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { createClient } from '@urql/core' -import { isDev } from '../utils/config' - -const localClient = (options) => { - console.info('[graphql] using local client') - const url = 'http://localhost:8080' - return createClient({ ...options, url }) -} - -export const initClient = (options) => { - try { - if (isDev) { - console.info('[graphql] devmode detected') - return localClient(options) - } else return createClient(options) - } catch (error) { - console.error(error) - return localClient(options) - } -} diff --git a/src/graphql/privateGraphQLClient.ts b/src/graphql/privateGraphQLClient.ts index bbecdc00..0beff1ec 100644 --- a/src/graphql/privateGraphQLClient.ts +++ b/src/graphql/privateGraphQLClient.ts @@ -1,7 +1,6 @@ -import { ClientOptions, dedupExchange, fetchExchange, Exchange } from '@urql/core' +import { ClientOptions, dedupExchange, fetchExchange, Exchange, createClient } from '@urql/core' import { devtoolsExchange } from '@urql/devtools' import { isDev, apiBaseUrl } from '../utils/config' -import { initClient } from './client' // import { cache } from './cache' const TOKEN_LOCAL_STORAGE_KEY = 'token' @@ -39,4 +38,4 @@ const options: ClientOptions = { exchanges } -export const privateGraphQLClient = initClient(options) +export const privateGraphQLClient = createClient(options) diff --git a/src/graphql/publicGraphQLClient.ts b/src/graphql/publicGraphQLClient.ts index 657ea6d9..13c97c16 100644 --- a/src/graphql/publicGraphQLClient.ts +++ b/src/graphql/publicGraphQLClient.ts @@ -1,7 +1,6 @@ -import { ClientOptions, dedupExchange, fetchExchange, Exchange } from '@urql/core' +import { ClientOptions, dedupExchange, fetchExchange, Exchange, createClient } from '@urql/core' import { devtoolsExchange } from '@urql/devtools' import { isDev, apiBaseUrl } from '../utils/config' -import { initClient } from './client' import { cache } from './cache' const exchanges: Exchange[] = [dedupExchange, fetchExchange] //, cache] @@ -17,4 +16,4 @@ const options: ClientOptions = { exchanges } -export const publicGraphQLClient = initClient(options) +export const publicGraphQLClient = createClient(options) diff --git a/src/utils/config.ts b/src/utils/config.ts index 7631c9e5..428dcddb 100644 --- a/src/utils/config.ts +++ b/src/utils/config.ts @@ -1,4 +1,4 @@ export const isDev = import.meta.env.MODE === 'development' -// export const apiBaseUrl = 'https://v2.discours.io' -export const apiBaseUrl = 'https://testapi.discours.io' +const defaultApiUrl = 'https://testapi.discours.io' +export const apiBaseUrl = import.meta.env.PUBLIC_API_URL || defaultApiUrl diff --git a/yarn.lock b/yarn.lock index cb10ff83..6f255c74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1638,10 +1638,28 @@ dependencies: "@sinonjs/commons" "^1.7.0" -"@solid-devtools/debugger@^0.15.0": - version "0.15.0" - resolved "https://registry.yarnpkg.com/@solid-devtools/debugger/-/debugger-0.15.0.tgz#97186c82acb2b12970284dc5fb607de5ec6c98c0" - integrity sha512-23P4FhSwIeYT3ruVc/NBdHlb33UWxex4D/lgEfM17os3PWKf2gQvJ4HQBH+nx7s6uJXUiwrZEgPzXGxtNJL1rw== +"@solid-devtools/debugger@^0.14.0": + version "0.14.0" + resolved "https://registry.yarnpkg.com/@solid-devtools/debugger/-/debugger-0.14.0.tgz#256dadc338bccf3acdb3e150e8327265c6be658b" + integrity sha512-Sdvmf/h2XEmcLgnObSPTiE5vELJk8Jxr4iD/lrHc9npNLUDervrgHXBcBdNorirbm7rLqYzwUQd6AICBUk8/Jg== + dependencies: + "@solid-devtools/shared" "^0.10.0" + "@solid-primitives/bounds" "^0.0.104" + "@solid-primitives/cursor" "^0.0.101" + "@solid-primitives/event-bus" "^0.1.3" + "@solid-primitives/event-listener" "^2.2.3" + "@solid-primitives/keyboard" "^1.0.3" + "@solid-primitives/platform" "^0.0.102" + "@solid-primitives/scheduled" "^1.2.0" + "@solid-primitives/utils" "^3.1.0" + type-fest "^3.2.0" + optionalDependencies: + "@solid-devtools/transform" "^0.8.0" + +"@solid-devtools/debugger@^0.15.0", "@solid-devtools/debugger@^0.15.1": + version "0.15.1" + resolved "https://registry.yarnpkg.com/@solid-devtools/debugger/-/debugger-0.15.1.tgz#c98ccf401be9efb2965809de27525e6175ea6d6c" + integrity sha512-E5vXsdemei9T/k/0X0GyZFvKpHiz73am3o8PmWV6vYhipvwVgPRnBvvHI85IjmtqBKK8gqHVtqu2D2qNu0rN2w== dependencies: "@solid-devtools/shared" "^0.10.1" "@solid-devtools/transform" "^0.9.0" @@ -1664,7 +1682,7 @@ "@solid-devtools/shared" "^0.10.1" "@solid-primitives/utils" "^4.0.0" -"@solid-devtools/shared@^0.10.1": +"@solid-devtools/shared@^0.10.0", "@solid-devtools/shared@^0.10.1": version "0.10.1" resolved "https://registry.yarnpkg.com/@solid-devtools/shared/-/shared-0.10.1.tgz#1547665eba540203ddcb7a104a1e3c6a0ec42d31" integrity sha512-RCa6Ev5ZGdOWIo34bqcZixlaV9tEuVMTxELjuzCg561Lbja2JSp3SwKCpxu9CQrJ21CZpgvu/PxsJ28YEHJ0TA== @@ -1678,6 +1696,16 @@ "@solid-primitives/utils" "^4.0.0" type-fest "^3.2.0" +"@solid-devtools/transform@^0.8.0": + version "0.8.0" + resolved "https://registry.yarnpkg.com/@solid-devtools/transform/-/transform-0.8.0.tgz#6821a305569df6450a5e4aad97c410c61ea1b4c2" + integrity sha512-AHyURaA0yGeoWxnBbA2Fuf297X6y313kU2k++O8FQUQKZWcOl3bZTW6BzD8YIBTcX/wGbGM+GcGKyJYtnf4HVw== + dependencies: + "@babel/core" "^7.19.6" + "@babel/plugin-syntax-typescript" "^7.18.6" + "@babel/types" "^7.19.4" + "@solid-devtools/shared" "^0.10.0" + "@solid-devtools/transform@^0.9.0": version "0.9.0" resolved "https://registry.yarnpkg.com/@solid-devtools/transform/-/transform-0.9.0.tgz#d1bf14184786c487c3301b542d372fd82fc90ed6" @@ -1688,6 +1716,15 @@ "@babel/types" "^7.19.4" "@solid-devtools/shared" "^0.10.1" +"@solid-primitives/bounds@^0.0.104": + version "0.0.104" + resolved "https://registry.yarnpkg.com/@solid-primitives/bounds/-/bounds-0.0.104.tgz#fa83e4bdb0966e915abfea1820cabd2da8856298" + integrity sha512-p5KXzNWzocrlHtd5Zi0OnudlQiw1DCBKrGjMfbhqvZb7YxmLaF6pR1bG4PBcL7Ud5PH420UL5SieDG5CsrSH9A== + dependencies: + "@solid-primitives/event-listener" "^2.2.3" + "@solid-primitives/resize-observer" "^2.0.5" + "@solid-primitives/utils" "^3.1.0" + "@solid-primitives/bounds@^0.0.105": version "0.0.105" resolved "https://registry.yarnpkg.com/@solid-primitives/bounds/-/bounds-0.0.105.tgz#5f8330b2b5b86c724d05d3e895da29c1149c347a" @@ -1697,6 +1734,13 @@ "@solid-primitives/resize-observer" "^2.0.6" "@solid-primitives/utils" "^4.0.0" +"@solid-primitives/cursor@^0.0.101": + version "0.0.101" + resolved "https://registry.yarnpkg.com/@solid-primitives/cursor/-/cursor-0.0.101.tgz#06945f518cd0de747a87a49eeb7b074b7d6a127b" + integrity sha512-BGRxYf+j23khlih4Xbk5t5zEBC7c2kR0ASMwEEQpNnp9jQB21A8vSS9GVhRQj09HNcQ03Rvyvn6Sl9HzXM40Pg== + dependencies: + "@solid-primitives/utils" "^3.1.0" + "@solid-primitives/cursor@^0.0.103": version "0.0.103" resolved "https://registry.yarnpkg.com/@solid-primitives/cursor/-/cursor-0.0.103.tgz#d127b069b0e62e2c33f912f382bd47f1deea6725" @@ -1764,7 +1808,7 @@ resolved "https://registry.yarnpkg.com/@solid-primitives/platform/-/platform-0.0.102.tgz#cd4aa3e209f6b1671656396ef0d890802a17ef5f" integrity sha512-1eZA1/HYOhmlZ9LrrGot+LUi/ypO2NXqfB+9F1WY98dGNDMz9pG9k+X7kg2YDJTUHDGbzY7WrsBRyAE8LurE7Q== -"@solid-primitives/resize-observer@^2.0.6": +"@solid-primitives/resize-observer@^2.0.5", "@solid-primitives/resize-observer@^2.0.6": version "2.0.7" resolved "https://registry.yarnpkg.com/@solid-primitives/resize-observer/-/resize-observer-2.0.7.tgz#0f909ed58d5fd7ec59b2fee15ddafdd28fdce4c8" integrity sha512-/RtCTs61ACdsCKJodNTgnKA05CI09dkg7usAb5jg14L6mzwTNWWdZbXtbYsUlD+kh1/1j+BKxp6VtkbpgJE5yQ== @@ -1802,6 +1846,11 @@ dependencies: "@solid-primitives/rootless" "^1.2.0" +"@solid-primitives/utils@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@solid-primitives/utils/-/utils-3.1.0.tgz#52edf36dabe62eba94f8356c3b9b788234d088a8" + integrity sha512-/rerChcwgFtHEgVCCBY7BXGHh7a83HcIAzR8QhXJ789geIVbBs2YxHF4UUZlG7ec00NKSfvO3+sQquN/xKQLMw== + "@solid-primitives/utils@^4.0.0": version "4.0.0" resolved "https://registry.yarnpkg.com/@solid-primitives/utils/-/utils-4.0.0.tgz#3c592287519dc885290d134f8aff3f0f6f4b4720" @@ -3401,6 +3450,13 @@ crelt@^1.0.0: resolved "https://registry.yarnpkg.com/crelt/-/crelt-1.0.5.tgz#57c0d52af8c859e354bace1883eb2e1eb182bb94" integrity sha512-+BO9wPPi+DWTDcNYhr/W90myha8ptzftZT+LwcmUbbok0rcP/fequmFYCw8NMoH7pkAZQzU78b3kYrlua5a9eA== +cross-env@^7.0.3: + version "7.0.3" + resolved "https://registry.yarnpkg.com/cross-env/-/cross-env-7.0.3.tgz#865264b29677dc015ba8418918965dd232fc54cf" + integrity sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw== + dependencies: + cross-spawn "^7.0.1" + cross-fetch@^3.1.5: version "3.1.5" resolved "https://registry.yarnpkg.com/cross-fetch/-/cross-fetch-3.1.5.tgz#e1389f44d9e7ba767907f7af8454787952ab534f" @@ -3408,7 +3464,7 @@ cross-fetch@^3.1.5: dependencies: node-fetch "2.6.7" -cross-spawn@^7.0.2, cross-spawn@^7.0.3: +cross-spawn@^7.0.1, cross-spawn@^7.0.2, cross-spawn@^7.0.3: version "7.0.3" resolved "https://registry.yarnpkg.com/cross-spawn/-/cross-spawn-7.0.3.tgz#f73a85b9d5d41d045551c177e2882d4ac85728a6" integrity sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w== @@ -5270,11 +5326,6 @@ ignore@^5.1.1, ignore@^5.2.0: resolved "https://registry.yarnpkg.com/ignore/-/ignore-5.2.0.tgz#6d3bac8fa7fe0d45d9f9be7bac2fc279577e345a" integrity sha512-CmxgYGiEPCLhfLnpPp1MoRmifwEIOgjcHXxOBjv7mY96c+eWScsOP9c112ZyLdWHi0FxHjI+4uVhKYp/gcdRmQ== -immutable@^4.0.0: - version "4.1.0" - resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef" - integrity sha512-oNkuqVTA8jqG1Q6c+UglTOD1xhC1BtjKI7XkCXRkZHrN5m18/XsnUp8Q89GkQO/z+0WjonSvl0FLhDYftp46nQ== - immutable@~3.7.6: version "3.7.6" resolved "https://registry.yarnpkg.com/immutable/-/immutable-3.7.6.tgz#13b4d3cb12befa15482a26fe1b2ebae640071e4b" @@ -7792,9 +7843,9 @@ postcss-scss@^4.0.2: integrity sha512-F7xpB6TrXyqUh3GKdyB4Gkp3QL3DDW1+uI+gxx/oJnUt/qXI4trj5OGlp9rOKdoABGULuqtqeG+3HEVQk4DjmA== postcss-selector-parser@^6.0.10, postcss-selector-parser@^6.0.2, postcss-selector-parser@^6.0.4, postcss-selector-parser@^6.0.6: - version "6.0.10" - resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.10.tgz#79b61e2c0d1bfc2602d549e11d0876256f8df88d" - integrity sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w== + version "6.0.11" + resolved "https://registry.yarnpkg.com/postcss-selector-parser/-/postcss-selector-parser-6.0.11.tgz#2e41dc39b7ad74046e1615185185cd0b17d0c8dc" + integrity sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g== dependencies: cssesc "^3.0.0" util-deprecate "^1.0.2" @@ -7911,9 +7962,9 @@ property-expr@^2.0.4: integrity sha512-IJUkICM5dP5znhCckHSv30Q4b5/JA5enCtkRHYaOVOAocnH/1BQEYTC5NMfT3AVl/iXKdr3aqQbQn9DxyWknwA== property-information@^6.0.0: - version "6.1.1" - resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.1.1.tgz#5ca85510a3019726cb9afed4197b7b8ac5926a22" - integrity sha512-hrzC564QIl0r0vy4l6MvRLhafmUowhO/O3KgVSoXIbbA2Sz4j8HGpJc6T2cubRVwMwpdiG/vKGfhT4IixmKN9w== + version "6.2.0" + resolved "https://registry.yarnpkg.com/property-information/-/property-information-6.2.0.tgz#b74f522c31c097b5149e3c3cb8d7f3defd986a1d" + integrity sha512-kma4U7AFCTwpqq5twzC1YVIDXSqg6qQK6JN0smOw8fgRy1OkMi0CYSzFmsy6dnqSenamAtj0CyXMUJ1Mf6oROg== prosemirror-commands@^1.0.0, prosemirror-commands@^1.3.1: version "1.3.1" @@ -8525,14 +8576,12 @@ sass-formatter@^0.7.5: dependencies: suf-log "^2.5.3" -sass@^1.56.1: - version "1.56.1" - resolved "https://registry.yarnpkg.com/sass/-/sass-1.56.1.tgz#94d3910cd468fd075fa87f5bb17437a0b617d8a7" - integrity sha512-VpEyKpyBPCxE7qGDtOcdJ6fFbcpOM+Emu7uZLxVrkX8KVU/Dp5UF7WLvzqRuUhB6mqqQt1xffLoG+AndxTZrCQ== +sass@1.32.13: + version "1.32.13" + resolved "https://registry.yarnpkg.com/sass/-/sass-1.32.13.tgz#8d29c849e625a415bce71609c7cf95e15f74ed00" + integrity sha512-dEgI9nShraqP7cXQH+lEXVf73WOPCse0QlFzSD8k+1TcOxCMwVXfQlr0jtoluZysQOyJGnfr21dLvYKDJq8HkA== dependencies: chokidar ">=3.0.0 <4.0.0" - immutable "^4.0.0" - source-map-js ">=0.6.2 <2.0.0" scslre@^0.1.6: version "0.1.6" @@ -8720,15 +8769,15 @@ snake-case@^3.0.4: dot-case "^3.0.4" tslib "^2.0.3" -solid-devtools@^0.23.0: - version "0.23.0" - resolved "https://registry.yarnpkg.com/solid-devtools/-/solid-devtools-0.23.0.tgz#08b26d81310d446043d70dfc905bb3dd2a510307" - integrity sha512-gLjE7CRu5z5zxOvbwwV6jELCSXlheqRJv4whjmYMcPLDFeKJfCegYh5Sjz0BAwWwSADK8YjpklUvPBVlzriySA== +solid-devtools@^0.22.0: + version "0.22.0" + resolved "https://registry.yarnpkg.com/solid-devtools/-/solid-devtools-0.22.0.tgz#7a5bd6aed682e89d5fbad5fae20a7217e1df2f81" + integrity sha512-kgux8FITSORiPzTDkL/2/K8/ErYXN53S3288Le3g2cFc8riIAzBZ4BXEBpwl7cjJ1FgKE8Lpx0RUGRKJSBeyug== dependencies: - "@solid-devtools/debugger" "^0.15.0" - "@solid-devtools/shared" "^0.10.1" - "@solid-devtools/transform" "^0.9.0" - "@solid-primitives/utils" "^4.0.0" + "@solid-devtools/debugger" "^0.14.0" + "@solid-devtools/shared" "^0.10.0" + "@solid-devtools/transform" "^0.8.0" + "@solid-primitives/utils" "^3.1.0" type-fest "^3.2.0" solid-js-form@^0.1.5: @@ -8781,7 +8830,7 @@ sort-package-json@^2.1.0: is-plain-obj "^4.1.0" sort-object-keys "^1.1.3" -"source-map-js@>=0.6.2 <2.0.0", source-map-js@^1.0.2: +source-map-js@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/source-map-js/-/source-map-js-1.0.2.tgz#adbc361d9c62df380125e7f161f71c826f1e490c" integrity sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==