Skip to content

Commit

Permalink
feat: update to node 22 SEA (#125)
Browse files Browse the repository at this point in the history
* feat: update to node 22 SEA

* chore: add sea scripts

* fix: incorrect temp name for dump_syms when path contained .

* chore: add additional deps

* chore: update packages

* chore: fix package lock

* chore: fix windows script

* chore: test action with node 22
  • Loading branch information
bobbyg603 authored Jul 3, 2024
1 parent ed4a660 commit 5013741
Show file tree
Hide file tree
Showing 11 changed files with 2,930 additions and 2,551 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ jobs:
version: "1.0"
directory: "spec/support"
files: "**/*.sym"
node-version: '21'
node-version: '22'
14 changes: 7 additions & 7 deletions .github/workflows/pkg.yaml → .github/workflows/sea.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Package Builds
name: Single Executable Application

on:
push:
Expand All @@ -14,14 +14,14 @@ jobs:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
run_script: pkg:linux
run_script: sea:linux
artifact_name: symbol-upload-linux
- os: macos-latest
run_script: pkg:macos
run_script: sea:macos
artifact_name: symbol-upload-macos
- os: windows-latest
run_script: pkg:windows
artifact_name: symbol-upload-win
run_script: sea:windows
artifact_name: symbol-upload-win.exe

steps:
- name: ☑️ Checkout
Expand All @@ -30,7 +30,7 @@ jobs:
- name: ⚙️ Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '22'

- name: 🏗️ Install Dependencies
run: npm ci
Expand All @@ -42,4 +42,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: pkg/* # Uploads the artifact with a platform-specific name and path
path: dist/${{ matrix.artifact_name }} # Uploads the artifact with a platform-specific name and path
20 changes: 14 additions & 6 deletions bin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import commandLineUsage from 'command-line-usage';
import { glob } from 'glob';
import { existsSync } from 'node:fs';
import { mkdir, readFile, stat } from 'node:fs/promises';
import { basename, join } from 'node:path';
import { basename, extname, join } from 'node:path';
import { importNodeDumpSyms } from '../src/preload';
import { safeRemoveTmp, tmpDir } from '../src/tmp';
import { uploadSymbolFiles } from '../src/upload';
import { CommandLineDefinition, argDefinitions, usageDefinitions } from './command-line-definitions';
Expand Down Expand Up @@ -109,8 +110,7 @@ import { CommandLineDefinition, argDefinitions, usageDefinitions } from './comma

if (dumpSyms) {
try {
// @ts-ignore: Cannot find module
const nodeDumpSyms = (await import('node-dump-syms')).dumpSyms;
const nodeDumpSyms = (await importNodeDumpSyms()).dumpSyms;
symbolFilePaths = symbolFilePaths.map(file => {
console.log(`Dumping syms for ${file}...`);
const symFile = join(tmpDir, `${getSymFileBaseName(file)}.sym`);
Expand Down Expand Up @@ -158,7 +158,7 @@ async function getCommandLineOptions(argDefinitions: Array<CommandLineDefinition
const options = commandLineArgs(argDefinitions);
let { database, application, version } = options;
let packageJson;

if (!database || !application || !version) {
const packageJsonPath = './package.json';
packageJson = await fileExists(packageJsonPath) ? JSON.parse((await readFile(packageJsonPath)).toString()) : null;
Expand All @@ -183,13 +183,13 @@ async function getCommandLineOptions(argDefinitions: Array<CommandLineDefinition
version
}
}

// The rust-minidump-stackwalker symbol lookup implementation removes some extensions from the sym file name for symbol lookups.
// This is a bit of a mystery and is subject to change when we learn more about how it works.
// For now, remove any non .so extension in the sym file's base name to satisfy the minidump-stackwalker symbol lookup.
function getSymFileBaseName(file: string): string {
const linuxSoExtensionPattern = /\.so\.?.*$/gm;
const fileNoExt = file.split('.')[0];
return linuxSoExtensionPattern.test(file) ? basename(file) : basename(fileNoExt);
return linuxSoExtensionPattern.test(file) ? basename(file) : removeExtensionRecursive(file);
}

function logHelpAndExit() {
Expand All @@ -212,6 +212,14 @@ function normalizeDirectory(directory: string): string {
return directory.replace(/\\/g, '/');
}

// The extname function will return .dSYM for bugsplat.app.dSYM
// When processing, we want to our file name for bugsplat.app.dSYM to be bugsplat.sym
// This function will remove extensions recursively until there are none left
function removeExtensionRecursive(file: string): string {
const ext = extname(file);
return ext ? removeExtensionRecursive(basename(file, ext)) : file;
}

function validAuthenticationArguments({
user,
password,
Expand Down
Loading

0 comments on commit 5013741

Please sign in to comment.