Skip to content

Commit

Permalink
ref!: Follow up to Node v18 changes (#797)
Browse files Browse the repository at this point in the history
  • Loading branch information
BYK authored Feb 20, 2025
1 parent eca89d6 commit 9edc8a5
Show file tree
Hide file tree
Showing 20 changed files with 871 additions and 974 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Changelog


## Unreleased

- ref!: Bump main Node.js version to the earliest LTS v18 ([#793](https://github.com/getsentry/sentry-wizard/pull/793))
- ref!: Follow up to Node v18 changes ([#797](https://github.com/getsentry/sentry-wizard/pull/797))

## 3.42.1

Expand All @@ -13,7 +13,6 @@

- feat: Update `nextjs`, `remix`, `sveltekit` and `nuxt` wizards to install v9 ([#794](https://github.com/getsentry/sentry-wizard/pull/794))


## 3.41.0

- feat: Add `forceInstall` option to NPM-based wizards ([#791](https://github.com/getsentry/sentry-wizard/pull/791))
Expand Down
2 changes: 1 addition & 1 deletion bin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { red } from './lib/Helper/Logging';
import yargs from 'yargs';
import { hideBin } from 'yargs/helpers';

const NODE_VERSION_RANGE = '>=14.18.0';
const NODE_VERSION_RANGE = '>=18.20.0';

// Have to run this above the other imports because they are importing clack that
// has the problematic imports.
Expand Down
14 changes: 7 additions & 7 deletions e2e-tests/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ export class WizardTestEnv {
this.taskHandle = spawn(cmd, args, { cwd: opts?.cwd, stdio: 'pipe' });

if (opts?.debug) {
this.taskHandle.stdout.pipe(process.stdout);
this.taskHandle.stderr.pipe(process.stderr);
this.taskHandle.stdout?.pipe(process.stdout);
this.taskHandle.stderr?.pipe(process.stderr);
}
}

sendStdin(input: string) {
this.taskHandle.stdin.write(input);
this.taskHandle.stdin?.write(input);
}

/**
Expand Down Expand Up @@ -142,7 +142,7 @@ export class WizardTestEnv {
}
}, timeout);

this.taskHandle.stdout.on('data', (data) => {
this.taskHandle.stdout?.on('data', (data) => {
outputBuffer += data;
if (outputBuffer.includes(output)) {
clearTimeout(timeoutId);
Expand All @@ -154,9 +154,9 @@ export class WizardTestEnv {
}

kill() {
this.taskHandle.stdin.destroy();
this.taskHandle.stderr.destroy();
this.taskHandle.stdout.destroy();
this.taskHandle.stdin?.destroy();
this.taskHandle.stderr?.destroy();
this.taskHandle.stdout?.destroy();
this.taskHandle.kill('SIGINT');
this.taskHandle.unref();
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Helper/BottomBar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { nl } from './Logging';

export class BottomBar {
public static bar: typeof ui.BottomBar;
public static interval: NodeJS.Timer;
public static interval: NodeJS.Timeout;

// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
public static show(msg: string): void {
Expand Down
2 changes: 1 addition & 1 deletion lib/Helper/Env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const readEnv = require('read-env').default;
import readEnv from 'read-env';

// TODO: move to src/utils (+tests)
export function readEnvironment(): Record<string, unknown> {
Expand Down
10 changes: 2 additions & 8 deletions lib/Steps/Integrations/BaseIntegration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Answers } from 'inquirer';
import * as _ from 'lodash';

import type { Args } from '../../Constants';
import { BaseStep } from '../BaseStep';
Expand Down Expand Up @@ -34,13 +33,8 @@ export abstract class BaseIntegration extends BaseStep {
}

public async shouldEmit(_answers: Answers): Promise<boolean> {
return (
_.keys(
_.pickBy(
await this.shouldConfigure(_answers),
(active: boolean) => active,
),
).length > 0
return Object.values(await this.shouldConfigure(_answers)).some(
(active: boolean) => active,
);
}

Expand Down
20 changes: 7 additions & 13 deletions lib/Steps/Integrations/Cordova.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import { green } from '../../Helper/Logging';
import { SentryCli } from '../../Helper/SentryCli';
import { BaseIntegration } from './BaseIntegration';

const xcode = require('xcode');
import xcode from 'xcode';
import type { PBXShellScriptBuildPhase } from 'xcode';

export class Cordova extends BaseIntegration {
protected _sentryCli: SentryCli;
Expand Down Expand Up @@ -142,18 +143,11 @@ export class Cordova extends BaseIntegration {
}

const buildScripts = [];
for (const key in proj.hash.project.objects.PBXShellScriptBuildPhase ||
{}) {
if (
// eslint-disable-next-line no-prototype-builtins
proj.hash.project.objects.PBXShellScriptBuildPhase.hasOwnProperty(
key,
)
) {
const val = proj.hash.project.objects.PBXShellScriptBuildPhase[key];
if (val.isa) {
buildScripts.push(val);
}
for (const val of Object.values(
proj.hash.project.objects.PBXShellScriptBuildPhase || {},
)) {
if ((val as PBXShellScriptBuildPhase).isa) {
buildScripts.push(val);
}
}

Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,15 @@
"yargs": "^16.2.0"
},
"devDependencies": {
"@babel/types": "~7.21.4",
"@sentry-internal/eslint-config-sdk": "^7.48.0",
"@types/chai": "^4.3.17",
"@types/glob": "^7.2.0",
"@types/inquirer": "^0.0.43",
"@types/jest": "^29.5.0",
"@types/lodash": "^4.14.144",
"@types/node": "^10.11.0",
"@types/node": "^18.19.76",
"@types/opn": "5.1.0",
"@types/rimraf": "^3.0.2",
"@types/semver": "^7.3.7",
"@types/yargs": "^16.0.9",
Expand Down Expand Up @@ -107,7 +109,7 @@
"json"
],
"modulePathIgnorePatterns": [
"<rootDir>/dist/__mocks__"
"<rootDir>/dist/"
],
"testPathIgnorePatterns": [
"/dist/",
Expand Down
20 changes: 10 additions & 10 deletions src/apple/xcode-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@
/* eslint-disable @typescript-eslint/no-unsafe-call */
// @ts-ignore - clack is ESM and TS complains about that. It works though
import clack from '@clack/prompts';
import * as fs from 'fs';
import * as path from 'path';
import { SentryProjectData } from '../utils/types';
import * as fs from 'node:fs';
import * as path from 'node:path';
import type { SentryProjectData } from '../utils/types';
import * as templates from './templates';

import {
project as createXcodeProject,
PBXBuildFile,
PBXGroup,
PBXNativeTarget,
PBXObjects,
PBXSourcesBuildPhase,
Project,
XCConfigurationList,
type PBXBuildFile,
type PBXGroup,
type PBXNativeTarget,
type PBXObjects,
type PBXSourcesBuildPhase,
type Project,
type XCConfigurationList,
} from 'xcode';

interface ProjectFile {
Expand Down
3 changes: 1 addition & 2 deletions src/react-native/react-native-wizard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,7 @@ import { patchExpoAppConfig, printSentryExpoMigrationOutro } from './expo';
import { addSentryToExpoMetroConfig } from './expo-metro';
import { addExpoEnvLocal } from './expo-env-file';

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const xcode = require('xcode');
import xcode from 'xcode';

export const RN_SDK_PACKAGE = '@sentry/react-native';
export const RN_SDK_SUPPORTED_RANGE = '>=5.0.0';
Expand Down
3 changes: 1 addition & 2 deletions src/react-native/uninstall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ import {
import { ReactNativeWizardOptions } from './options';
import { unPatchMetroConfig } from './metro';

// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
const xcode = require('xcode');
import xcode from 'xcode';

export async function runReactNativeUninstall(
options: ReactNativeWizardOptions,
Expand Down
Loading

0 comments on commit 9edc8a5

Please sign in to comment.