Skip to content

Commit b710150

Browse files
committed
Switch back to JS for sourcemap scripts.
1 parent 006e5ca commit b710150

9 files changed

+34
-61
lines changed

packages/remix/.eslintrc.js

-8
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ module.exports = {
66
parserOptions: {
77
jsx: true,
88
},
9-
overrides: [
10-
{
11-
files: ['scripts/**/*.ts'],
12-
parserOptions: {
13-
project: ['tsconfig.json'],
14-
},
15-
},
16-
],
179
extends: ['../../.eslintrc.js'],
1810
rules: {
1911
'@sentry-internal/sdk/no-async-await': 'off',

packages/remix/package.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"author": "Sentry",
88
"license": "MIT",
99
"bin": {
10-
"upload-sourcemaps": "build/cjs/scripts/upload-sourcemaps.js"
10+
"upload-sourcemaps": "scripts/upload-sourcemaps.js"
1111
},
1212
"engines": {
1313
"node": ">=14"
@@ -32,8 +32,7 @@
3232
},
3333
"devDependencies": {
3434
"@remix-run/node": "^1.4.3",
35-
"@remix-run/react": "^1.4.3",
36-
"rollup-plugin-hashbang": "^3.0.0"
35+
"@remix-run/react": "^1.4.3"
3736
},
3837
"peerDependencies": {
3938
"@remix-run/node": "^1.4.3",

packages/remix/rollup.npm.config.js

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,7 @@
1-
import hashbang from 'rollup-plugin-hashbang';
2-
31
import { makeBaseNPMConfig, makeNPMConfigVariants } from '../../rollup/index.js';
42

53
export default makeNPMConfigVariants(
64
makeBaseNPMConfig({
7-
entrypoints: ['src/index.server.ts', 'src/index.client.tsx', 'scripts/upload-sourcemaps.ts'],
8-
packageSpecificConfig: {
9-
// Rollup fails when there's a hashbang in the file
10-
// Ref: https://github.com/rollup/rollup/issues/235
11-
// This plugin also gives execution permissions to the output files.
12-
plugins: [hashbang()],
13-
},
5+
entrypoints: ['src/index.server.ts', 'src/index.client.tsx'],
146
}),
157
);
+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
const SentryCli = require('@sentry/cli');
2+
const sentry = new SentryCli();
3+
4+
async function createRelease(argv, DEFAULT_URL_PREFIX, DEFAULT_BUILD_PATH) {
5+
const RELEASE = argv.release || (await sentry.releases.proposeVersion());
6+
const URL_PREFIX = argv.urlPrefix || DEFAULT_URL_PREFIX;
7+
const BUILD_PATH = argv.buildPath || DEFAULT_BUILD_PATH;
8+
9+
await sentry.releases.new(RELEASE);
10+
11+
await sentry.releases.uploadSourceMaps(RELEASE, {
12+
urlPrefix: URL_PREFIX,
13+
include: [BUILD_PATH],
14+
});
15+
16+
await sentry.releases.finalize(RELEASE);
17+
}
18+
19+
module.exports = {
20+
createRelease,
21+
};

packages/remix/scripts/createRelease.ts

-29
This file was deleted.

packages/remix/scripts/upload-sourcemaps.ts renamed to packages/remix/scripts/upload-sourcemaps.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env node
2-
import yargs from 'yargs';
2+
const yargs = require('yargs');
33

4-
import { createRelease } from './createRelease';
4+
const { createRelease } = require('./createRelease');
55

66
const DEFAULT_URL_PREFIX = '~/build/';
77
const DEFAULT_BUILD_PATH = 'public/build';
@@ -36,4 +36,4 @@ const argv = yargs(process.argv.slice(2))
3636
)
3737
.wrap(120).argv;
3838

39-
void createRelease(argv, DEFAULT_URL_PREFIX, DEFAULT_BUILD_PATH);
39+
createRelease(argv, DEFAULT_URL_PREFIX, DEFAULT_BUILD_PATH);

packages/remix/test/scripts/upload-sourcemaps.test.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ jest.mock('@sentry/cli', () => {
1717
});
1818
});
1919

20-
import { createRelease } from '../../scripts/createRelease';
20+
// eslint-disable-next-line @typescript-eslint/no-var-requires
21+
const { createRelease } = require('../../scripts/createRelease');
2122

2223
beforeEach(() => {
2324
newMock.mockClear();
@@ -70,3 +71,7 @@ describe('createRelease', () => {
7071
expect(finalizeMock).toHaveBeenCalledWith('0.1.2.3.4');
7172
});
7273
});
74+
75+
// To avoid `--isolatedModules` flag as we're not importing
76+
// anything for these tests.
77+
export {};

packages/remix/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"extends": "../../tsconfig.json",
33

4-
"include": ["src/**/*", "scripts/**/*"],
4+
"include": ["src/**/*"],
55

66
"compilerOptions": {
77
"jsx": "react"

yarn.lock

-7
Original file line numberDiff line numberDiff line change
@@ -22634,13 +22634,6 @@ ripemd160@^2.0.0, ripemd160@^2.0.1:
2263422634
hash-base "^3.0.0"
2263522635
inherits "^2.0.1"
2263622636

22637-
rollup-plugin-hashbang@^3.0.0:
22638-
version "3.0.0"
22639-
resolved "https://registry.yarnpkg.com/rollup-plugin-hashbang/-/rollup-plugin-hashbang-3.0.0.tgz#6173df959592ba73d2e8ce01816a37c511a5e005"
22640-
integrity sha512-nNC2NeNcvkklPhPCUF8Yb+2a19xI0dSBBJJ2x814+Al2BqIEWOyaGIgEjPVSjjgxhoabkJC5vbO4AeI3cxx3wg==
22641-
dependencies:
22642-
magic-string "^0.25.7"
22643-
2264422637
rollup-plugin-license@^2.6.1:
2264522638
version "2.6.1"
2264622639
resolved "https://registry.yarnpkg.com/rollup-plugin-license/-/rollup-plugin-license-2.6.1.tgz#20f15cc37950f362f8eefdc6e3a2e659d0cad9eb"

0 commit comments

Comments
 (0)