Skip to content
This repository was archived by the owner on Sep 17, 2024. It is now read-only.

Commit 7076bb1

Browse files
authored
ref: prep repo for move to @sentry-javascript (#227)
* esm is unused * tsconfig port * ref: output to build * ref: build ts * ref: fix linter errors * cleanup output * fix lint error when deleting property * copy binary to correct outdir * use yarn * swap npm run for yarn * install and use yarn in CI workflows * install prod deps only * drop node 14 * build with node 20 * downgrade ts to match sentry repo * install dev dep for test * test python latest * test python latest * install devdeps when building * remove node 14 from expected precompile binaries * output to lib because node-gyp doesnt allow configurable outdir * fix jsdoc comments * fix binary dir * revert optional chaining * bundle test should import from lib * remove another nullish coalescing * fix * build w/o typescript * drop modules after install * install prod deps to run * rename demo app build file * fix dep install
1 parent 229b585 commit 7076bb1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+6337
-8943
lines changed

.eslintrc

Lines changed: 0 additions & 14 deletions
This file was deleted.

.eslintrc.js

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
module.exports = {
2+
root: true,
3+
env: {
4+
es6: true,
5+
},
6+
parserOptions: {
7+
ecmaVersion: 2018,
8+
},
9+
rules: {
10+
'@sentry-internal/sdk/no-optional-chaining': 'off',
11+
'@sentry-internal/sdk/no-nullish-coalescing': 'off',
12+
'@sentry-internal/sdk/no-unsupported-es6-methods': 'off',
13+
'@sentry-internal/sdk/no-class-field-initializers': 'off',
14+
},
15+
extends: ['@sentry-internal/sdk/src/base'],
16+
ignorePatterns: [
17+
'coverage/**',
18+
'build/**',
19+
'lib/**',
20+
'dist/**',
21+
'cjs/**',
22+
'esm/**',
23+
'examples/**',
24+
'test/manual/**',
25+
'benchmarks/**',
26+
'playground/**',
27+
'demo_app/**',
28+
'test-binaries.entry.js',
29+
'jest.config.ts'
30+
],
31+
overrides: [
32+
{
33+
files: ['*.ts', '*.tsx', '*.d.ts'],
34+
parserOptions: {
35+
project: ['tsconfig.json'],
36+
},
37+
},
38+
{
39+
files: ['test/**/*.ts', 'test/**/*.tsx'],
40+
parserOptions: {
41+
project: ['tsconfig.test.json'],
42+
},
43+
},
44+
{
45+
files: ['jest/**/*.ts', 'scripts/**/*.ts'],
46+
parserOptions: {
47+
project: ['tsconfig.dev.json'],
48+
},
49+
},
50+
{
51+
files: ['*.tsx'],
52+
rules: {
53+
// Turn off jsdoc on tsx files until jsdoc is fixed for tsx files
54+
// See: https://github.com/getsentry/sentry-javascript/issues/3871
55+
'jsdoc/require-jsdoc': 'off',
56+
},
57+
},
58+
{
59+
files: ['scenarios/**', 'dev-packages/rollup-utils/**'],
60+
parserOptions: {
61+
sourceType: 'module',
62+
},
63+
rules: {
64+
'no-console': 'off',
65+
},
66+
},
67+
],
68+
};

.github/workflows/build.yml

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ jobs:
2525
# distributions and container images.
2626

2727
# linux x64 glibc
28-
- os: ubuntu-20.04
29-
node: 14
3028
- os: ubuntu-20.04
3129
node: 16
3230
- os: ubuntu-20.04
@@ -35,9 +33,6 @@ jobs:
3533
node: 20
3634

3735
# linux x64 musl
38-
- os: ubuntu-20.04
39-
container: node:14-alpine3.16
40-
node: 14
4136
- os: ubuntu-20.04
4237
container: node:16-alpine3.16
4338
node: 16
@@ -49,9 +44,6 @@ jobs:
4944
node: 20
5045

5146
# linux arm64 glibc
52-
- os: ubuntu-20.04
53-
arch: arm64
54-
node: 14
5547
- os: ubuntu-20.04
5648
arch: arm64
5749
node: 16
@@ -63,10 +55,6 @@ jobs:
6355
node: 20
6456

6557
# linux arm64 musl
66-
- os: ubuntu-20.04
67-
container: node:14-alpine3.16
68-
arch: arm64
69-
node: 14
7058
- os: ubuntu-20.04
7159
container: node:16-alpine3.16
7260
arch: arm64
@@ -81,9 +69,6 @@ jobs:
8169
node: 20
8270

8371
# macos x64
84-
- os: macos-11
85-
node: 14
86-
arch: x64
8772
- os: macos-11
8873
node: 16
8974
arch: x64
@@ -147,32 +132,23 @@ jobs:
147132
node-version: ${{ matrix.node }}
148133

149134
- uses: actions/setup-python@v4
150-
name: Setup python macos 14
151-
if: contains(matrix.os, 'macos-11') && matrix.node == '14'
152-
with:
153-
python-version: "3.10"
154-
155-
- uses: actions/setup-python@v4
156-
name: Setup python latest
157-
if: contains(matrix.os, 'macos-11') && matrix.node != '14'
158-
with:
159-
python-version: "3.11"
135+
name: Setup python
160136

161137
- name: Install dependencies
162-
run: npm install --ignore-scripts
138+
run: yarn install --ignore-scripts --frozen-lockfile
163139

164140
# configure build test copy x64
165141
- name: Configure gyp
166142
if: matrix.arch != 'arm64'
167-
run: npm run build:configure
143+
run: yarn build:configure
168144

169145
- name: Build bindings
170146
if: matrix.arch != 'arm64'
171-
run: npm run build:bindings
147+
run: yarn build:bindings
172148

173149
- name: Test
174150
if: matrix.arch != 'arm64'
175-
run: npm run test --silent
151+
run: yarn test --silent
176152

177153
# configure build test copy arm64
178154
- name: setup (arm64, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})
@@ -184,7 +160,7 @@ jobs:
184160
# linux arm64
185161
- name: "Configure gyp (arm64, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})"
186162
if: matrix.arch == 'arm64' && matrix.target_platform != 'darwin'
187-
run: npm run build:configure:arm64
163+
run: yarn build:configure:arm64
188164

189165
- name: Setup musl cross compiler
190166
if: contains(matrix.container, 'alpine')
@@ -198,24 +174,24 @@ jobs:
198174
run: |
199175
CC=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-gcc \
200176
CXX=$(pwd)/aarch64-linux-musl-cross/bin/aarch64-linux-musl-g++ \
201-
BUILD_ARCH=arm64 npm run build:bindings
177+
BUILD_ARCH=arm64 yarn build:bindings
202178
203179
- name: "Build bindings (arm64, ${{ contains(matrix.container, 'alpine') && 'musl' || 'glibc' }})"
204180
if: matrix.arch == 'arm64' && !contains(matrix.container, 'alpine') && matrix.target_platform != 'darwin'
205181
run: |
206182
CC=aarch64-linux-gnu-gcc \
207183
CXX=aarch64-linux-gnu-g++ \
208-
BUILD_ARCH=arm64 npm run build:bindings:arm64
184+
BUILD_ARCH=arm64 yarn build:bindings:arm64
209185
210186
# linux arm64 target darwin
211187
- name: "Configure gyp (arm64, darwin)"
212188
if: matrix.arch == 'arm64' && matrix.target_platform == 'darwin'
213-
run: npm run build:configure:arm64
189+
run: yarn build:configure:arm64
214190

215191
- name: "Build bindings (arm64, darwin)"
216192
if: matrix.arch == 'arm64' && matrix.target_platform == 'darwin'
217193
run: |
218-
BUILD_PLATFORM=darwin BUILD_ARCH=arm64 npm run build:bindings:arm64
194+
BUILD_PLATFORM=darwin BUILD_ARCH=arm64 yarn build:bindings:arm64
219195
220196
# continue with common steps
221197
- name: Log binary
@@ -235,15 +211,14 @@ jobs:
235211
- uses: actions/checkout@v3
236212
- uses: actions/setup-node@v3
237213
with:
238-
node-version: 18
239-
- run: npm ci
240-
- run: npm run build:lib
214+
node-version: 20
215+
- run: yarn install --frozen-lockfile
216+
- run: yarn build:lib
241217
- uses: actions/download-artifact@v3
242218
with:
243219
name: binaries-${{ github.sha }}
244220
path: lib/
245-
- run: ls -l lib/
246-
- run: npm run test:bundle
221+
- run: yarn test:bundle
247222

248223
build-and-pack:
249224
runs-on: ubuntu-latest
@@ -254,17 +229,16 @@ jobs:
254229

255230
- uses: actions/setup-node@v3
256231
with:
257-
node-version: 18
232+
node-version: 20
258233

259-
- run: npm ci
260-
- run: npm run build:lib
234+
- run: yarn install --frozen-lockfile
235+
- run: yarn build:lib
261236

262237
- uses: actions/download-artifact@v3
263238
with:
264239
name: binaries-${{ github.sha }}
265240
path: lib/
266-
- run: ls -l lib/
267-
- run: npm pack
241+
- run: yarn pack
268242

269243
- name: Archive artifacts
270244
uses: actions/upload-artifact@v3
@@ -302,27 +276,27 @@ jobs:
302276

303277
# The general workflow for testing a bundler workflow
304278
# is to build our library, download the generated binaries and
305-
# use npm link to link the what will be our final published library
279+
# use yarn link to link the what will be our final published library
306280
# into the demo_app folder. From there, we run the different bundler
307281
# build commands and attempt to run the demo app.
308282
bundler: ["esbuild"]
309283
steps:
310284
- uses: actions/checkout@v3
311285
- uses: actions/setup-node@v3
312286
with:
313-
node-version: 18
287+
node-version: 20
314288

315-
- run: npm install --ignore-scripts
316-
- run: npm run build:lib
289+
- run: yarn install --frozen-lockfile
290+
- run: yarn build:lib
317291

318292
- uses: actions/download-artifact@v3
319293
with:
320294
name: binaries-${{ github.sha }}
321295
path: lib/
322296
- run: ls -l lib/
323297

324-
- run: npm link
325-
- run: npm run test:setup:bundle
326-
- run: npm run test:${{matrix.bundler}}:build
327-
- run: npm run test:${{matrix.bundler}}:run
328-
- run: rm -rf ./node_modules/ && npm install --omit=dev && node scripts/check-build.mjs
298+
- run: yarn link
299+
- run: yarn test:setup:bundle
300+
- run: yarn test:${{matrix.bundler}}:build
301+
- run: yarn test:${{matrix.bundler}}:run
302+
- run: rm -rf ./node_modules/ && yarn install && node scripts/check-build.mjs

.github/workflows/ci.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ jobs:
99
lint:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v2
13-
- uses: actions/setup-node@v2
14-
- run: npm ci
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
14+
- run: yarn install --frozen-lockfile
1515
- run: |
1616
git config clangFormat.binary node_modules/.bin/clang-format
1717
git config clangFormat.style file
18-
npm run lint
18+
yarn lint
1919
2020
build-test-matrix:
2121
strategy:
2222
fail-fast: false
2323
matrix:
2424
os: [macos-latest, windows-2019, ubuntu-latest]
25-
node-version: [14.x, 16.x, 18.x, 20.x]
25+
node-version: [16.x, 18.x, 20.x]
2626
runs-on: ${{ matrix.os }}
2727
steps:
2828
- uses: actions/checkout@v3
@@ -33,13 +33,13 @@ jobs:
3333
- uses: actions/setup-python@v4
3434
with:
3535
python-version: "3.10"
36-
- run: npm run clean
36+
- run: yarn clean
3737

3838
- name: Setup windows build tools
3939
uses: microsoft/[email protected]
4040
if: ${{ runner.os == 'Windows' }}
4141

42-
- run: npm install
43-
- run: npm run build:configure
44-
- run: npm run build
45-
- run: npm run test --silent
42+
- run: yarn install --frozen-lockfile
43+
- run: yarn build:configure
44+
- run: yarn build
45+
- run: yarn test --silent

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414
jobs:
1515
release:
1616
runs-on: ubuntu-latest
17-
name: 'Release a new version'
17+
name: "Release a new version"
1818
steps:
1919
- uses: actions/checkout@v3
2020
with:

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66

77
coverage/
88
lib/
9+
build/
910
build-test/
1011
demo_app/dist/
1112
demo_app/package-lock.json
1213

1314
node_modules/
1415
memory_db
15-
build/
1616
benchmarks/format/output/
1717
benchmarks/format/results/
1818

.yarn/install-state.gz

741 KB
Binary file not shown.

CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ Because the repository requires you to compile the c++ bindings via node-gyp, we
2020

2121
Since we are using [`TypeScript`](https://www.typescriptlang.org/) and native node addons, you need to transpile the code to JavaScript and compile the c++ bindings in order to be able to run the addon.
2222

23-
- `npm run build` will compile the c++ bindings and ts files.
24-
- `npm run build:lib` will compile only the ts files
25-
- `npm run build:bindings` will compile the c++ bindings
23+
- `yarn build` will compile the c++ bindings and ts files.
24+
- `yarn build:lib` will compile ts files
25+
- `yarn build:bindings` will compile c++ bindings
2626

2727
## Tests
2828

29-
Tests are colocated with source files and should have a .test.ts suffix. The entire test suite can be ran using the `npm run test` command.
29+
Tests are colocated with source files and should have a .test.ts suffix. The entire test suite can be ran using the `yarn test` command.
3030

3131
## Linting
3232

33-
Similar to building and testing, linting can be done via `npm run lint` command.
33+
Similar to building and testing, linting can be done via `yarn lint` command.
3434

3535
## Considerations Before Sending Your First PR
3636

@@ -42,7 +42,7 @@ When contributing to the codebase, please note:
4242

4343
## Benchmarks
4444

45-
The repository contains micro benchmarks. You can find all benchmarks at the benchmarks folder in project root directory. The benchmarks can either be ran directly through node via `node benchmarks/cpu/benchmark.profiler.js` or via `npm run benchmark` command. There are also individual npm run benchmark commands like `npm run benchmark:server` or `npm run benchmark:methods` which will only run individual benchmarks.
45+
The repository contains micro benchmarks. You can find all benchmarks at the benchmarks folder in project root directory. The benchmarks can either be ran directly through node via `node benchmarks/cpu/benchmark.profiler.js` or via `yarn benchmark` command. There are also individual yarn benchmark commands like `yarn benchmark:server` or `yarn benchmark:methods` which will only run individual benchmarks.
4646

4747
Remember that these are micro benchmarks and that results will vary across different OS and architectures.
4848

0 commit comments

Comments
 (0)