diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b6a38191c..c9b6a0141 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,3 +55,6 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} NEXT_VERSION: ${{ steps.next_version.outputs.version }} SENTRY_RELEASE: ${{ steps.next_version.outputs.version }} + SENTRY_ORG: chromatic-lt + SENTRY_PROJECT: cli + SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} diff --git a/package.json b/package.json index 78a51d81c..2a4c0c78d 100644 --- a/package.json +++ b/package.json @@ -69,10 +69,13 @@ "isChromatic.d.ts" ], "scripts": { - "build": "clean-package && tsup && ./scripts/moveSourceMaps.mjs && clean-package restore", + "build": "clean-package && tsup && clean-package restore", "build-storybook": "storybook build --stats-json", "build-test-storybook": "cross-env SMOKE_TEST=true storybook build -o test-storybook --stats-json", "build-subdir": "cd subdir ; yarn build ; cd ..", + "sentry": "yarn sentry:sourcemaps:cli && yarn sentry:sourcemaps:action", + "sentry:sourcemaps:cli": "sentry-cli sourcemaps inject dist && sentry-cli sourcemaps upload dist", + "sentry:sourcemaps:action": "sentry-cli sourcemaps inject action && sentry-cli sourcemaps upload action", "chromatic": "./dist/bin.js", "chromatic-prebuilt": "./dist/bin.js --storybook-build-dir=\"storybook-static\"", "chromatic-staging": "CHROMATIC_INDEX_URL=https://www.staging-chromatic.com ./dist/bin.js", @@ -80,7 +83,7 @@ "lint": "yarn lint:js bin-src node-src test-stories ./isChromatic.js ./isChromatic.mjs", "lint:js": "cross-env NODE_ENV=production eslint --cache --cache-location=.cache/eslint --report-unused-disable-directives", "lint:package": "sort-package-json", - "release": "./scripts/versionAndBuild.mjs && auto shipit", + "release": "./scripts/versionAndBuild.mjs && yarn sentry && yarn sourcemaps:clean && auto shipit", "prepack": "clean-package", "postpack": "clean-package restore", "publish-action": "./scripts/publish-action.mjs", @@ -90,7 +93,8 @@ "test": "vitest run --coverage && vitest run -c vitest.no-threads.config.ts", "typescript:check": "tsc --project ./tsconfig.json --noEmit", "prepare": "yarn run build", - "dev": "tsup --watch" + "dev": "tsup --watch", + "clean:sourcemaps": "rm -f dist/*.map && rm -f action/*.map" }, "resolutions": { "any-observable": "^0.5.1" @@ -103,6 +107,7 @@ "@auto-it/slack": "^11.1.6", "@discoveryjs/json-ext": "^0.5.7", "@eslint-community/eslint-plugin-eslint-comments": "^4.3.0", + "@sentry/cli": "^2.37.0", "@sentry/node": "^8.30.0", "@storybook/addon-essentials": "^8.1.5", "@storybook/addon-webpack5-compiler-swc": "^1.0.3", @@ -185,6 +190,7 @@ "react-dom": "^17.0.2", "read-pkg-up": "^7.0.1", "semver": "^7.3.5", + "sentry-cli": "^0.0.0", "slash": "^3.0.0", "snyk-nodejs-lockfile-parser": "^1.52.1", "sort-package-json": "1.50.0", diff --git a/scripts/moveSourceMaps.mjs b/scripts/moveSourceMaps.mjs deleted file mode 100755 index 411616c01..000000000 --- a/scripts/moveSourceMaps.mjs +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env node - -import fs from 'node:fs'; - -async function main() { - fs.mkdirSync('sourcemaps', { recursive: true }); - for (const file of fs.readdirSync('sourcemaps')) { - fs.unlinkSync(`sourcemaps/${file}`); - } - - for (const file of fs.readdirSync('dist')) { - if (file.endsWith('.map')) { - fs.copyFileSync(`dist/${file}`, `sourcemaps/${file}`); - fs.unlinkSync(`dist/${file}`); - } - } - - for (const file of fs.readdirSync('action')) { - if (file.endsWith('.map')) { - fs.copyFileSync(`action/${file}`, `sourcemaps/${file}`); - fs.unlinkSync(`action/${file}`); - } - } -} - -main(); diff --git a/yarn.lock b/yarn.lock index ecc4242f8..fcfa568ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3655,6 +3655,92 @@ __metadata: languageName: node linkType: hard +"@sentry/cli-darwin@npm:2.37.0": + version: 2.37.0 + resolution: "@sentry/cli-darwin@npm:2.37.0" + conditions: os=darwin + languageName: node + linkType: hard + +"@sentry/cli-linux-arm64@npm:2.37.0": + version: 2.37.0 + resolution: "@sentry/cli-linux-arm64@npm:2.37.0" + conditions: (os=linux | os=freebsd) & cpu=arm64 + languageName: node + linkType: hard + +"@sentry/cli-linux-arm@npm:2.37.0": + version: 2.37.0 + resolution: "@sentry/cli-linux-arm@npm:2.37.0" + conditions: (os=linux | os=freebsd) & cpu=arm + languageName: node + linkType: hard + +"@sentry/cli-linux-i686@npm:2.37.0": + version: 2.37.0 + resolution: "@sentry/cli-linux-i686@npm:2.37.0" + conditions: (os=linux | os=freebsd) & (cpu=x86 | cpu=ia32) + languageName: node + linkType: hard + +"@sentry/cli-linux-x64@npm:2.37.0": + version: 2.37.0 + resolution: "@sentry/cli-linux-x64@npm:2.37.0" + conditions: (os=linux | os=freebsd) & cpu=x64 + languageName: node + linkType: hard + +"@sentry/cli-win32-i686@npm:2.37.0": + version: 2.37.0 + resolution: "@sentry/cli-win32-i686@npm:2.37.0" + conditions: os=win32 & (cpu=x86 | cpu=ia32) + languageName: node + linkType: hard + +"@sentry/cli-win32-x64@npm:2.37.0": + version: 2.37.0 + resolution: "@sentry/cli-win32-x64@npm:2.37.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@sentry/cli@npm:^2.37.0": + version: 2.37.0 + resolution: "@sentry/cli@npm:2.37.0" + dependencies: + "@sentry/cli-darwin": "npm:2.37.0" + "@sentry/cli-linux-arm": "npm:2.37.0" + "@sentry/cli-linux-arm64": "npm:2.37.0" + "@sentry/cli-linux-i686": "npm:2.37.0" + "@sentry/cli-linux-x64": "npm:2.37.0" + "@sentry/cli-win32-i686": "npm:2.37.0" + "@sentry/cli-win32-x64": "npm:2.37.0" + https-proxy-agent: "npm:^5.0.0" + node-fetch: "npm:^2.6.7" + progress: "npm:^2.0.3" + proxy-from-env: "npm:^1.1.0" + which: "npm:^2.0.2" + dependenciesMeta: + "@sentry/cli-darwin": + optional: true + "@sentry/cli-linux-arm": + optional: true + "@sentry/cli-linux-arm64": + optional: true + "@sentry/cli-linux-i686": + optional: true + "@sentry/cli-linux-x64": + optional: true + "@sentry/cli-win32-i686": + optional: true + "@sentry/cli-win32-x64": + optional: true + bin: + sentry-cli: bin/sentry-cli + checksum: 10c0/a6e5e3510b7b6a5b3414a2b2bee3bd9c3066b05f70ff20ff65df1d7fb384458182d12a8a0f0319af02e8dbaf6f5e5d23da394eb6bdb8b9face3909699d0f9495 + languageName: node + linkType: hard + "@sentry/core@npm:8.30.0": version: 8.30.0 resolution: "@sentry/core@npm:8.30.0" @@ -7457,6 +7543,7 @@ __metadata: "@auto-it/slack": "npm:^11.1.6" "@discoveryjs/json-ext": "npm:^0.5.7" "@eslint-community/eslint-plugin-eslint-comments": "npm:^4.3.0" + "@sentry/cli": "npm:^2.37.0" "@sentry/node": "npm:^8.30.0" "@storybook/addon-essentials": "npm:^8.1.5" "@storybook/addon-webpack5-compiler-swc": "npm:^1.0.3" @@ -7539,6 +7626,7 @@ __metadata: react-dom: "npm:^17.0.2" read-pkg-up: "npm:^7.0.1" semver: "npm:^7.3.5" + sentry-cli: "npm:^0.0.0" slash: "npm:^3.0.0" snyk-nodejs-lockfile-parser: "npm:^1.52.1" sort-package-json: "npm:1.50.0" @@ -15780,6 +15868,13 @@ __metadata: languageName: node linkType: hard +"progress@npm:^2.0.3": + version: 2.0.3 + resolution: "progress@npm:2.0.3" + checksum: 10c0/1697e07cb1068055dbe9fe858d242368ff5d2073639e652b75a7eb1f2a1a8d4afd404d719de23c7b48481a6aa0040686310e2dac2f53d776daa2176d3f96369c + languageName: node + linkType: hard + "promise-deferred@npm:^2.0.3": version: 2.0.4 resolution: "promise-deferred@npm:2.0.4" @@ -15849,6 +15944,13 @@ __metadata: languageName: node linkType: hard +"proxy-from-env@npm:^1.1.0": + version: 1.1.0 + resolution: "proxy-from-env@npm:1.1.0" + checksum: 10c0/fe7dd8b1bdbbbea18d1459107729c3e4a2243ca870d26d34c2c1bcd3e4425b7bcc5112362df2d93cc7fb9746f6142b5e272fd1cc5c86ddf8580175186f6ad42b + languageName: node + linkType: hard + "pump@npm:^2.0.0": version: 2.0.1 resolution: "pump@npm:2.0.1" @@ -17237,6 +17339,13 @@ __metadata: languageName: node linkType: hard +"sentry-cli@npm:^0.0.0": + version: 0.0.0 + resolution: "sentry-cli@npm:0.0.0" + checksum: 10c0/e660a09982d6c38940e1e9fac9c86a2213000938d042406b6964081349ed88f53036b1d3bd3651cdc814c42f68ec27953c3790b1e0103de4ce5b12e5780ea012 + languageName: node + linkType: hard + "serialize-javascript@npm:^6.0.1": version: 6.0.2 resolution: "serialize-javascript@npm:6.0.2" @@ -20026,7 +20135,7 @@ __metadata: languageName: node linkType: hard -"which@npm:^2.0.1": +"which@npm:^2.0.1, which@npm:^2.0.2": version: 2.0.2 resolution: "which@npm:2.0.2" dependencies: