-
-
Notifications
You must be signed in to change notification settings - Fork 3
feat: Handle disabled install scripts #41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -16,7 +16,7 @@ | |
| "sentry" | ||
| ], | ||
| "scripts": { | ||
| "install": "node scripts/check-build.mjs", | ||
| "install": "node -p \"'@sentry/node-native-stacktrace@' + require('./package.json').version\"", | ||
| "lint": "yarn lint:eslint && yarn lint:clang", | ||
| "lint:eslint": "eslint . --format stylish", | ||
| "lint:clang": "node scripts/clang-format.mjs", | ||
|
|
@@ -25,22 +25,23 @@ | |
| "fix:clang": "node scripts/clang-format.mjs --fix", | ||
| "build": "yarn clean && yarn build:lib && yarn build:bindings:configure && yarn build:bindings", | ||
| "build:lib": "tsc", | ||
| "build:copy-binary": "node -e \"const { copyBinary } = require('./lib/copy-binary.js'); copyBinary();\"", | ||
| "build:bindings:configure": "node-gyp configure", | ||
| "build:bindings:configure:arm64": "node-gyp configure --arch=arm64 --target_arch=arm64", | ||
| "build:bindings": "node-gyp build && node scripts/copy-target.mjs", | ||
| "build:bindings:arm64": "node-gyp build --arch=arm64 && node scripts/copy-target.mjs", | ||
| "build:bindings": "yarn build:lib && node-gyp build && yarn build:copy-binary", | ||
| "build:bindings:arm64": "yarn build:lib && node-gyp build --arch=arm64 && yarn build:copy-binary", | ||
| "build:tarball": "npm pack", | ||
| "clean": "node-gyp clean && rm -rf lib && rm -rf build && rm -f *.tgz", | ||
| "test": "yarn test:install && yarn test:prepare && vitest run --poolOptions.forks.singleFork --silent=false --disable-console-intercept", | ||
| "test:prepare": "node ./test/prepare.mjs", | ||
| "test:install": "cross-env ALWAYS_THROW=true yarn install" | ||
| "test": "node ./test/prepare.mjs && vitest run --poolOptions.forks.singleFork --silent=false --disable-console-intercept" | ||
| }, | ||
| "gypfile": false, | ||
| "engines": { | ||
| "node": ">=18" | ||
| }, | ||
|
sentry[bot] marked this conversation as resolved.
|
||
| "dependencies": { | ||
| "detect-libc": "^2.0.4", | ||
| "node-abi": "^3.89.0" | ||
| "node-abi": "^3.92.0", | ||
| "node-gyp": "^11.5.0" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. m/h: The node engines are |
||
| }, | ||
| "devDependencies": { | ||
| "@sentry-internal/eslint-config-sdk": "^9.22.0", | ||
|
|
@@ -49,7 +50,6 @@ | |
| "clang-format": "^1.8.0", | ||
| "cross-env": "^7.0.3", | ||
| "eslint": "^7.0.0", | ||
| "node-gyp": "^11.2.0", | ||
| "typescript": "^5.8.3", | ||
| "vitest": "^3.1.4" | ||
| }, | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,11 @@ | ||||||
|
|
||||||
| import * as os from 'node:os'; | ||||||
| import { versions } from 'node:process'; | ||||||
| import * as libc from 'detect-libc'; | ||||||
| import { getAbi } from 'node-abi'; | ||||||
|
|
||||||
| export const stdlib = libc.familySync(); | ||||||
| export const platform = process.env['BUILD_PLATFORM'] || os.platform(); | ||||||
| export const arch = process.env['BUILD_ARCH'] || os.arch(); | ||||||
| export const abi = getAbi(versions.node, 'node'); | ||||||
| export const identifier = [platform, arch, stdlib, abi].filter(c => c !== undefined && c !== null).join('-'); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Unnecessary byte saving suggestion
Suggested change
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| /* eslint-disable no-console */ | ||
| import * as fs from 'node:fs'; | ||
| import * as path from 'node:path'; | ||
| import { identifier } from './constants'; | ||
|
|
||
| const source = path.join(__dirname, '..', 'build', 'Release', 'stack-trace.node'); | ||
| const target = path.join(__dirname, '..', 'lib', `stack-trace-${identifier}.node`); | ||
|
|
||
| /** | ||
| * Copies the compiled binary from the build directory to the lib directory with the correct name based on the current platform and Node version. | ||
| * | ||
| * @hidden We only use this for copying the binary after building, it is not intended to be used by end users. | ||
| */ | ||
| export function copyBinary(): void { | ||
| const build = path.resolve(__dirname, '..', 'lib'); | ||
| if (!fs.existsSync(build)) { | ||
| fs.mkdirSync(build, { recursive: true }); | ||
| } | ||
|
|
||
| if (!fs.existsSync(source)) { | ||
| throw new Error(`Source file does not exist: ${ source}`); | ||
| } else { | ||
|
timfish marked this conversation as resolved.
|
||
| if (fs.existsSync(target)) { | ||
| console.log('Target file already exists, overwriting it'); | ||
| fs.unlinkSync(target); | ||
| } | ||
| console.log('Copying', source, 'to', target); | ||
| fs.copyFileSync(source, target); | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
q/l: Is it on purpose only testing for node 18 and 26?