diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 9375defd37..162f31c8c0 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -31,6 +31,9 @@ jobs: cache: 'pnpm' - run: pnpm install --frozen-lockfile + - name: Set release version in env + run: echo "RELEASE=$(node -e 'console.log(require("./package.json").version)')" >> $GITHUB_ENV + - name: Build run: pnpm build @@ -38,7 +41,6 @@ jobs: run: | echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc pnpm publish -r --publish-branch ${{github.event.pull_request.base.ref}} --access public --tag rc - echo "RELEASE=$(node -e 'console.log(require("./package.json").version)')" >> $GITHUB_ENV - name: Create Release uses: ncipollo/release-action@v1 diff --git a/package.json b/package.json index 92ce288956..cc19ec8094 100644 --- a/package.json +++ b/package.json @@ -58,8 +58,8 @@ "supertest": "^6.3.3", "ts-jest": "^29.1.0", "tsc-watch": "^6.0.0", - "typescript": "*", - "turbo": "1.8.8" + "turbo": "1.8.8", + "typescript": "*" }, "pnpm": { "onlyBuiltDependencies": [ @@ -84,7 +84,8 @@ }, "patchedDependencies": { "element-ui@2.15.12": "patches/element-ui@2.15.12.patch", - "typedi@0.10.0": "patches/typedi@0.10.0.patch" + "typedi@0.10.0": "patches/typedi@0.10.0.patch", + "@sentry/cli@2.17.0": "patches/@sentry__cli@2.17.0.patch" } } } diff --git a/packages/editor-ui/package.json b/packages/editor-ui/package.json index 7b858c90b9..7b242c70c4 100644 --- a/packages/editor-ui/package.json +++ b/packages/editor-ui/package.json @@ -85,6 +85,7 @@ "devDependencies": { "@faker-js/faker": "^7.6.0", "@pinia/testing": "^0.0.14", + "@sentry/vite-plugin": "^0.4.0", "@testing-library/jest-dom": "^5.16.5", "@testing-library/user-event": "^14.4.3", "@testing-library/vue": "^5.8.3", @@ -99,9 +100,9 @@ "@types/lodash.set": "^4.3.6", "@types/luxon": "^3.2.0", "@types/uuid": "^8.3.2", - "@vitest/coverage-c8": "^0.28.5", "@vitejs/plugin-legacy": "^3.0.1", "@vitejs/plugin-vue2": "^2.2.0", + "@vitest/coverage-c8": "^0.28.5", "c8": "^7.12.0", "jshint": "^2.9.7", "miragejs": "^0.1.47", diff --git a/packages/editor-ui/vite.config.ts b/packages/editor-ui/vite.config.ts index 2649ec3547..431192d787 100644 --- a/packages/editor-ui/vite.config.ts +++ b/packages/editor-ui/vite.config.ts @@ -4,6 +4,7 @@ import monacoEditorPlugin from 'vite-plugin-monaco-editor'; import path, { resolve } from 'path'; import { defineConfig, mergeConfig } from 'vite'; import { defineConfig as defineVitestConfig } from 'vitest/config'; +import { sentryVitePlugin } from '@sentry/vite-plugin'; import packageJSON from './package.json'; @@ -80,6 +81,35 @@ if (NODE_ENV === 'test') { }); } +const plugins = [ + vue(), + legacy({ + targets: ['defaults', 'not IE 11'], + }), + monacoEditorPlugin({ + publicPath: 'assets/monaco-editor', + customDistPath: (root: string, buildOutDir: string, base: string) => + `${root}/${buildOutDir}/assets/monaco-editor`, + }), +]; + +const { SENTRY_AUTH_TOKEN: authToken, RELEASE: release } = process.env; +if (release && authToken) { + plugins.push( + sentryVitePlugin({ + org: 'n8nio', + project: 'instance-frontend', + // Specify the directory containing build artifacts + include: './dist', + // Auth tokens can be obtained from https://sentry.io/settings/account/api/auth-tokens/ + // and needs the `project:releases` and `org:read` scopes + authToken, + telemetry: false, + release, + }), + ); +} + export default mergeConfig( defineConfig({ define: { @@ -88,17 +118,7 @@ export default mergeConfig( ...(NODE_ENV === 'development' ? { process: { env: {} } } : {}), BASE_PATH: `'${publicPath}'`, }, - plugins: [ - vue(), - legacy({ - targets: ['defaults', 'not IE 11'], - }), - monacoEditorPlugin({ - publicPath: 'assets/monaco-editor', - customDistPath: (root: string, buildOutDir: string, base: string) => - `${root}/${buildOutDir}/assets/monaco-editor`, - }), - ], + plugins, resolve: { alias }, base: publicPath, envPrefix: 'VUE_APP', @@ -111,8 +131,10 @@ export default mergeConfig( }, build: { assetsInlineLimit: 0, - sourcemap: false, + minify: !!release, + sourcemap: !!release, rollupOptions: { + treeshake: !!release, output: { manualChunks: { vendor: vendorChunks, diff --git a/patches/@sentry__cli@2.17.0.patch b/patches/@sentry__cli@2.17.0.patch new file mode 100644 index 0000000000..f4325eaab4 --- /dev/null +++ b/patches/@sentry__cli@2.17.0.patch @@ -0,0 +1,12 @@ +diff --git a/js/helper.js b/js/helper.js +index a4a7a61f0e226d7cb45f8d5db34c35cc9e62cf96..38fd3ec2214970b1c5dd22fdff902ff3b5eeddde 100644 +--- a/js/helper.js ++++ b/js/helper.js +@@ -15,6 +15,7 @@ function getBinaryPath() { + const parts = []; + parts.push(__dirname); + parts.push('..'); ++ parts.push('bin'); + parts.push(`sentry-cli${process.platform === 'win32' ? '.exe' : ''}`); + return path.resolve(...parts); + } \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 08f13569a4..c8f46c209d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,6 +21,9 @@ overrides: qqjs>globby: ^11.1.0 patchedDependencies: + '@sentry/cli@2.17.0': + hash: nchnoezkq6p37qaiku3vrpwraq + path: patches/@sentry__cli@2.17.0.patch element-ui@2.15.12: hash: prckukfdop5sl2her6de25cod4 path: patches/element-ui@2.15.12.patch @@ -985,6 +988,9 @@ importers: '@pinia/testing': specifier: ^0.0.14 version: 0.0.14(pinia@2.0.23)(vue@2.7.14) + '@sentry/vite-plugin': + specifier: ^0.4.0 + version: 0.4.0 '@testing-library/jest-dom': specifier: ^5.16.5 version: 5.16.5 @@ -4573,6 +4579,46 @@ packages: selderee: 0.6.0 dev: false + /@sentry-internal/tracing@7.47.0: + resolution: {integrity: sha512-udpHnCzF8DQsWf0gQwd0XFGp6Y8MOiwnl8vGt2ohqZGS3m1+IxoRLXsSkD8qmvN6KKDnwbaAvYnK0z0L+AW95g==} + engines: {node: '>=8'} + dependencies: + '@sentry/core': 7.47.0 + '@sentry/types': 7.47.0 + '@sentry/utils': 7.47.0 + tslib: 2.5.0 + dev: true + + /@sentry/bundler-plugin-core@0.4.0: + resolution: {integrity: sha512-Xi+dqaSOoxbdmxegX7f66FVOxm2dVJLmrMXUpoNyuV6ASoccRWzouGaFekP059SUTTD05ytk1mHqwgVuBCA0Dw==} + engines: {node: '>= 10'} + dependencies: + '@sentry/cli': 2.17.0(patch_hash=nchnoezkq6p37qaiku3vrpwraq) + '@sentry/node': 7.28.1 + '@sentry/tracing': 7.47.0 + magic-string: 0.27.0 + unplugin: 1.0.1 + transitivePeerDependencies: + - encoding + - supports-color + dev: true + + /@sentry/cli@2.17.0(patch_hash=nchnoezkq6p37qaiku3vrpwraq): + resolution: {integrity: sha512-CHIMEg8+YNCpEBDgUctu+DvG3S8+g8Zn9jTE5MMGINNmGkQTMG179LuDE04B/inaCYixLVNpFPTe6Iow3tXjnQ==} + engines: {node: '>= 10'} + hasBin: true + dependencies: + https-proxy-agent: 5.0.1 + node-fetch: 2.6.8 + progress: 2.0.3 + proxy-from-env: 1.1.0 + which: 2.0.2 + transitivePeerDependencies: + - encoding + - supports-color + dev: true + patched: true + /@sentry/core@7.28.1: resolution: {integrity: sha512-7wvnuvn/mrAfcugWoCG/3pqDIrUgH5t+HisMJMGw0h9Tc33KqrmqMDCQVvjlrr2pWrw/vuUCFdm8CbUHJ832oQ==} engines: {node: '>=8'} @@ -4580,7 +4626,15 @@ packages: '@sentry/types': 7.28.1 '@sentry/utils': 7.28.1 tslib: 2.5.0 - dev: false + + /@sentry/core@7.47.0: + resolution: {integrity: sha512-EFhZhKdMu7wKmWYZwbgTi8FNZ7Fq+HdlXiZWNz51Bqe3pHmfAkdHtAEs0Buo0v623MKA0CA4EjXIazGUM34XTg==} + engines: {node: '>=8'} + dependencies: + '@sentry/types': 7.47.0 + '@sentry/utils': 7.47.0 + tslib: 2.5.0 + dev: true /@sentry/integrations@7.28.1: resolution: {integrity: sha512-opeXVR1L9mZmZcpAs9kX+4JPY7pXhVupy17Sbz+43zd5CshYTveIcttGNPp+EPT3j7mMU+1TMAYZspKqJXtEBQ==} @@ -4605,12 +4659,22 @@ packages: tslib: 2.5.0 transitivePeerDependencies: - supports-color - dev: false + + /@sentry/tracing@7.47.0: + resolution: {integrity: sha512-hJCpKdekwaFNbCVXxfCz5IxfSEJIKnkPmRSVHITOm5VhKwq2e5kmy4Rn6bzSETwJFSDE8LGbR/3eSfGTqw37XA==} + engines: {node: '>=8'} + dependencies: + '@sentry-internal/tracing': 7.47.0 + dev: true /@sentry/types@7.28.1: resolution: {integrity: sha512-DvSplMVrVEmOzR2M161V5+B8Up3vR71xMqJOpWTzE9TqtFJRGPtqT/5OBsNJJw1+/j2ssMcnKwbEo9Q2EGeS6g==} engines: {node: '>=8'} - dev: false + + /@sentry/types@7.47.0: + resolution: {integrity: sha512-GxXocplN0j1+uczovHrfkykl9wvkamDtWxlPUQgyGlbLGZn+UH1Y79D4D58COaFWGEZdSNKr62gZAjfEYu9nQA==} + engines: {node: '>=8'} + dev: true /@sentry/utils@7.28.1: resolution: {integrity: sha512-75/jzLUO9HH09iC9TslNimGbxOP3jgn89P+q7uR+rp2fJfRExHVeKJZQdK0Ij4/SmE7TJ3Uh2r154N0INZEx1g==} @@ -4618,7 +4682,24 @@ packages: dependencies: '@sentry/types': 7.28.1 tslib: 2.5.0 - dev: false + + /@sentry/utils@7.47.0: + resolution: {integrity: sha512-A89SaOLp6XeZfByeYo2C8Ecye/YAtk/gENuyOUhQEdMulI6mZdjqtHAp7pTMVgkBc/YNARVuoa+kR/IdRrTPkQ==} + engines: {node: '>=8'} + dependencies: + '@sentry/types': 7.47.0 + tslib: 2.5.0 + dev: true + + /@sentry/vite-plugin@0.4.0: + resolution: {integrity: sha512-dBxM00MCLzO/idzAqj33ZfbIBKZxP+FzpxtS2WaV0yzad9yLBAFZ/VGDIGHQJC0Qo3fsFi/CZpmN39wJkJoWFA==} + engines: {node: '>= 10'} + dependencies: + '@sentry/bundler-plugin-core': 0.4.0 + transitivePeerDependencies: + - encoding + - supports-color + dev: true /@servie/events@1.0.0: resolution: {integrity: sha512-sBSO19KzdrJCM3gdx6eIxV8M9Gxfgg6iDQmH5TIAGaUu+X9VDdsINXJOnoiZ1Kx3TrHdH4bt5UVglkjsEGBcvw==} @@ -9718,7 +9799,6 @@ packages: /cookie@0.4.2: resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==} engines: {node: '>= 0.6'} - dev: false /cookie@0.5.0: resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==} @@ -15345,7 +15425,6 @@ packages: /lru_map@0.3.3: resolution: {integrity: sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ==} - dev: false /luxon@3.3.0: resolution: {integrity: sha512-An0UCfG/rSiqtAIiBPO0Y9/zAnHUZxAMiCpTd5h2smgsj7GGmcenvrvww2cqNA8/4A5ZrD1gJpHN2mIHZQF+Mg==} @@ -20840,6 +20919,15 @@ packages: webpack-virtual-modules: 0.4.6 dev: true + /unplugin@1.0.1: + resolution: {integrity: sha512-aqrHaVBWW1JVKBHmGo33T5TxeL0qWzfvjWokObHA9bYmN7eNDkwOxmLjhioHl9878qDFMAaT51XNroRyuz7WxA==} + dependencies: + acorn: 8.8.1 + chokidar: 3.5.2 + webpack-sources: 3.2.3 + webpack-virtual-modules: 0.5.0 + dev: true + /unset-value@1.0.0: resolution: {integrity: sha512-PcA2tsuGSF9cnySLHTLSh2qrQiJ70mn+r+Glzxv2TWZblxsxCC52BDlZoPCsz7STd9pN7EZetkWZBAvk4cgZdQ==} engines: {node: '>=0.10.0'} @@ -21714,6 +21802,10 @@ packages: resolution: {integrity: sha512-5tyDlKLqPfMqjT3Q9TAqf2YqjwmnUleZwzJi1A5qXnlBCdj2AtOJ6wAWdglTIDOPgOiOrXeBeFcsQ8+aGQ6QbA==} dev: true + /webpack-virtual-modules@0.5.0: + resolution: {integrity: sha512-kyDivFZ7ZM0BVOUteVbDFhlRt7Ah/CSPwJdi8hBpkK7QLumUqdLtVfm/PX/hkcnrvr0i77fO5+TjZ94Pe+C9iw==} + dev: true + /webpack@5.75.0(esbuild@0.16.17): resolution: {integrity: sha512-piaIaoVJlqMsPtX/+3KTTO6jfvrSYgauFVdt8cr9LTHKmcq/AMd4mhzsiP7ZF/PGRNPGA8336jldh9l2Kt2ogQ==} engines: {node: '>=10.13.0'}