diff --git a/.dockerignore b/.dockerignore index 45ff21c4f..6d52ca7c8 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,5 +2,16 @@ *.pyc .env venv -node_modules -npm-debug.log \ No newline at end of file +node_modules/ +**/node_modules/ +npm-debug.log +.next/ +**/.next/ +.turbo/ +**/.turbo/ +build/ +**/build/ +out/ +**/out/ +dist/ +**/dist/ \ No newline at end of file diff --git a/setup.sh b/setup.sh index e028cc407..e1fa026b7 100755 --- a/setup.sh +++ b/setup.sh @@ -10,4 +10,4 @@ cp ./space/.env.example ./space/.env cp ./apiserver/.env.example ./apiserver/.env # Generate the SECRET_KEY that will be used by django -echo -e "SECRET_KEY=\"$(tr -dc 'a-z0-9' < /dev/urandom | head -c50)\"" >> ./apiserver/.env \ No newline at end of file +echo "SECRET_KEY=\"$(tr -dc 'a-z0-9' < /dev/urandom | head -c50)\"" >> ./apiserver/.env \ No newline at end of file diff --git a/space/next.config.js b/space/next.config.js index 767c2430d..16450199c 100644 --- a/space/next.config.js +++ b/space/next.config.js @@ -1,8 +1,9 @@ /** @type {import('next').NextConfig} */ -const path = require("path"); -const withImages = require("next-images"); +require("dotenv").config({ path: ".env" }); +const { withSentryConfig } = require("@sentry/nextjs"); const nextConfig = { + basePath: process.env.NEXT_PUBLIC_DEPLOY_WITH_NGINX === "1" ? "/spaces" : "", reactStrictMode: false, swcMinify: true, images: { @@ -11,12 +12,8 @@ const nextConfig = { output: "standalone", }; -if (parseInt(process.env.NEXT_PUBLIC_DEPLOY_WITH_NGINX || "0")) { - const nextConfigWithNginx = withImages({ - basePath: "/spaces", - ...nextConfig, - }); - module.exports = nextConfigWithNginx; +if (parseInt(process.env.NEXT_PUBLIC_ENABLE_SENTRY || "0")) { + module.exports = withSentryConfig(nextConfig, { silent: true }, { hideSourceMaps: true }); } else { module.exports = nextConfig; } diff --git a/space/package.json b/space/package.json index f9942e554..7c3c77a92 100644 --- a/space/package.json +++ b/space/package.json @@ -21,15 +21,16 @@ "@plane/lite-text-editor": "*", "@plane/rich-text-editor": "*", "@plane/ui": "*", + "@sentry/nextjs": "^7.85.0", "axios": "^1.3.4", "clsx": "^2.0.0", + "dotenv": "^16.3.1", "js-cookie": "^3.0.1", "lowlight": "^2.9.0", "lucide-react": "^0.293.0", "mobx": "^6.10.0", "mobx-react-lite": "^4.0.3", "next": "^14.0.3", - "next-images": "^1.8.5", "next-themes": "^0.2.1", "nprogress": "^0.2.0", "react": "^18.2.0", diff --git a/space/sentry.client.config.js b/space/sentry.client.config.js new file mode 100644 index 000000000..ca473045b --- /dev/null +++ b/space/sentry.client.config.js @@ -0,0 +1,18 @@ +// This file configures the initialization of Sentry on the browser. +// The config you add here will be used whenever a page is visited. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +import * as Sentry from "@sentry/nextjs"; + +const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN; + +Sentry.init({ + dsn: SENTRY_DSN, + environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "development", + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1.0, + // ... + // Note: if you want to override the automatic release value, do not set a + // `release` value here - use the environment variable `SENTRY_RELEASE`, so + // that it will also get attached to your source maps +}); diff --git a/space/sentry.edge.config.js b/space/sentry.edge.config.js new file mode 100644 index 000000000..8374ed410 --- /dev/null +++ b/space/sentry.edge.config.js @@ -0,0 +1,18 @@ +// This file configures the initialization of Sentry on the server. +// The config you add here will be used whenever middleware or an Edge route handles a request. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +import * as Sentry from "@sentry/nextjs"; + +const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN; + +Sentry.init({ + dsn: SENTRY_DSN, + environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "development", + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1.0, + // ... + // Note: if you want to override the automatic release value, do not set a + // `release` value here - use the environment variable `SENTRY_RELEASE`, so + // that it will also get attached to your source maps +}); diff --git a/space/sentry.properties b/space/sentry.properties new file mode 100644 index 000000000..1741152a3 --- /dev/null +++ b/space/sentry.properties @@ -0,0 +1,3 @@ +defaults.url=https://sentry.io/ +defaults.org=plane +defaults.project=plane-space diff --git a/space/sentry.server.config.js b/space/sentry.server.config.js new file mode 100644 index 000000000..d2acb07e1 --- /dev/null +++ b/space/sentry.server.config.js @@ -0,0 +1,18 @@ +// This file configures the initialization of Sentry on the server. +// The config you add here will be used whenever the server handles a request. +// https://docs.sentry.io/platforms/javascript/guides/nextjs/ + +import * as Sentry from "@sentry/nextjs"; + +const SENTRY_DSN = process.env.NEXT_PUBLIC_SENTRY_DSN; + +Sentry.init({ + dsn: SENTRY_DSN, + environment: process.env.NEXT_PUBLIC_SENTRY_ENVIRONMENT || "development", + // Adjust this value in production, or use tracesSampler for greater control + tracesSampleRate: 1.0, + // ... + // Note: if you want to override the automatic release value, do not set a + // `release` value here - use the environment variable `SENTRY_RELEASE`, so + // that it will also get attached to your source maps +}); diff --git a/web/package.json b/web/package.json index 6848a22bd..aeb751c4a 100644 --- a/web/package.json +++ b/web/package.json @@ -27,7 +27,7 @@ "@plane/rich-text-editor": "*", "@plane/ui": "*", "@popperjs/core": "^2.11.8", - "@sentry/nextjs": "^7.36.0", + "@sentry/nextjs": "^7.85.0", "axios": "^1.1.3", "clsx": "^2.0.0", "cmdk": "^0.2.0", @@ -63,9 +63,9 @@ "@types/node": "18.0.6", "@types/nprogress": "^0.2.0", "@types/react": "^18.2.42", + "@types/react-color": "^3.0.6", "@types/react-datepicker": "^4.8.0", "@types/react-dom": "^18.2.17", - "@types/react-color": "^3.0.6", "@types/uuid": "^8.3.4", "@typescript-eslint/eslint-plugin": "^5.48.2", "@typescript-eslint/parser": "^5.48.2", diff --git a/yarn.lock b/yarn.lock index 50cfe7930..803857bfc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2249,7 +2249,7 @@ "@sentry/utils" "7.85.0" localforage "^1.8.1" -"@sentry/nextjs@^7.36.0": +"@sentry/nextjs@^7.85.0": version "7.85.0" resolved "https://registry.yarnpkg.com/@sentry/nextjs/-/nextjs-7.85.0.tgz#ac9d736b4fcf797864e6a8102285701096782e51" integrity sha512-EmSEEW2JUG/agq3o0W+4TWElyRWE01t80cBMPc7DMo24UdC+WLSgONE45iClkN1dou9xgroJRwTk9rPe+6l+4A== @@ -2797,7 +2797,7 @@ dependencies: "@types/react" "*" -"@types/react@*", "@types/react@18.2.42", "@types/react@^18.2.39", "@types/react@^18.2.42": +"@types/react@*", "@types/react@^18.2.39", "@types/react@^18.2.42": version "18.2.42" resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.42.tgz#6f6b11a904f6d96dda3c2920328a97011a00aba7" integrity sha512-c1zEr96MjakLYus/wPnuWDo1/zErfdU9rNsIGmE+NV71nx88FG9Ttgo5dqorXTu/LImX2f63WBP986gJkMPNbA== @@ -4002,7 +4002,7 @@ dotenv@16.0.3: resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.0.3.tgz#115aec42bac5053db3c456db30cc243a5a836a07" integrity sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ== -dotenv@^16.0.3: +dotenv@^16.0.3, dotenv@^16.3.1: version "16.3.1" resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.3.1.tgz#369034de7d7e5b120972693352a3bf112172cc3e" integrity sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ== @@ -4910,14 +4910,6 @@ file-entry-cache@^6.0.1: dependencies: flat-cache "^3.0.4" -file-loader@^6.2.0: - version "6.2.0" - resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d" - integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw== - dependencies: - loader-utils "^2.0.0" - schema-utils "^3.0.0" - file-selector@^0.6.0: version "0.6.0" resolved "https://registry.yarnpkg.com/file-selector/-/file-selector-0.6.0.tgz#fa0a8d9007b829504db4d07dd4de0310b65287dc" @@ -6413,7 +6405,7 @@ mime-db@1.52.0: resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12, mime-types@^2.1.27: +mime-types@^2.1.12: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -6517,14 +6509,6 @@ natural-compare@^1.4.0: resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7" integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw== -next-images@^1.8.5: - version "1.8.5" - resolved "https://registry.yarnpkg.com/next-images/-/next-images-1.8.5.tgz#2eb5535bb1d6c58a5c4e03bc3be6c72c8a053a45" - integrity sha512-YLBERp92v+Nu2EVxI9+wa32KRuxyxTC8ItbiHUWVPlatUoTl0yRqsNtP39c2vYv27VRvY4LlYcUGjNRBSMUIZA== - dependencies: - file-loader "^6.2.0" - url-loader "^4.1.0" - next-pwa@^5.6.0: version "5.6.0" resolved "https://registry.yarnpkg.com/next-pwa/-/next-pwa-5.6.0.tgz#f7b1960c4fdd7be4253eb9b41b612ac773392bf4" @@ -7762,7 +7746,7 @@ schema-utils@^2.6.5: ajv "^6.12.4" ajv-keywords "^3.5.2" -schema-utils@^3.0.0, schema-utils@^3.1.1: +schema-utils@^3.1.1: version "3.3.0" resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-3.3.0.tgz#f50a88877c3c01652a15b622ae9e9795df7a60fe" integrity sha512-pN/yOAvcC+5rQ5nERGuwrjLlYvLTbCibnZ1I7B1LaiAz9BRBlE9GMgE/eqV30P7aJQUf7Ddimy/RsbYO/GrVGg== @@ -8737,15 +8721,6 @@ uri-js@^4.2.2: dependencies: punycode "^2.1.0" -url-loader@^4.1.0: - version "4.1.1" - resolved "https://registry.yarnpkg.com/url-loader/-/url-loader-4.1.1.tgz#28505e905cae158cf07c92ca622d7f237e70a4e2" - integrity sha512-3BTV812+AVHHOJQO8O5MkWgZ5aosP7GnROJwvzLS9hWDj00lZ6Z0wNak423Lp9PBZN05N+Jk/N5Si8jRAlGyWA== - dependencies: - loader-utils "^2.0.0" - mime-types "^2.1.27" - schema-utils "^3.0.0" - use-callback-ref@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/use-callback-ref/-/use-callback-ref-1.3.0.tgz#772199899b9c9a50526fedc4993fc7fa1f7e32d5"