diff --git a/scripts/make-npm-override.js b/scripts/make-npm-override.js index 7e978b7a..8ed474d6 100644 --- a/scripts/make-npm-override.js +++ b/scripts/make-npm-override.js @@ -7,7 +7,6 @@ const util = require('node:util') const { ReturnTypeEnums, default: didYouMean } = require('didyoumean2') const { open } = require('out-url') const semver = require('semver') -const { onExit } = require('signal-exit') const { glob: tinyGlob } = require('tinyglobby') const constants = require('@socketregistry/scripts/constants') @@ -21,6 +20,7 @@ const { TEMPLATE_ES_SHIM_CONSTRUCTOR, TEMPLATE_ES_SHIM_PROTOTYPE_METHOD, TEMPLATE_ES_SHIM_STATIC_METHOD, + abortSignal, npmPackagesPath, parseArgsConfig, rootPath, @@ -65,14 +65,6 @@ const { const { indentString } = require('@socketsecurity/registry/lib/strings') const { pluralize } = require('@socketsecurity/registry/lib/words') -const abortController = new AbortController() -const { signal: abortSignal } = abortController - -// Detect ^C, i.e. Ctrl + C. -onExit(() => { - abortController.abort() -}) - const { positionals: cliPositionals, values: cliArgs } = util.parseArgs(parseArgsConfig) diff --git a/scripts/release-npm-packages.js b/scripts/release-npm-packages.js index eb2b0c0b..f66f5d67 100644 --- a/scripts/release-npm-packages.js +++ b/scripts/release-npm-packages.js @@ -3,7 +3,6 @@ const path = require('node:path') const semver = require('semver') -const { onExit } = require('signal-exit') const ssri = require('ssri') const constants = require('@socketregistry/scripts/constants') @@ -12,6 +11,7 @@ const { OVERRIDES, PACKAGE_JSON, PACKAGE_SCOPE, + abortSignal, npmPackagesPath, registryPkgPath, relNpmPackagesPath, @@ -27,14 +27,6 @@ const { } = require('@socketsecurity/registry/lib/packages') const { pEach } = require('@socketsecurity/registry/lib/promises') -const abortController = new AbortController() -const { signal: abortSignal } = abortController - -// Detect ^C, i.e. Ctrl + C. -onExit(() => { - abortController.abort() -}) - function packageData(data) { const { printName = data.name, tag = LATEST } = data return Object.assign(data, { printName, tag }) diff --git a/scripts/update-package-json.js b/scripts/update-package-json.js index 4026fd2b..da04e27a 100644 --- a/scripts/update-package-json.js +++ b/scripts/update-package-json.js @@ -1,20 +1,10 @@ 'use strict' -const { onExit } = require('signal-exit') - const constants = require('@socketregistry/scripts/constants') -const { rootPackageJsonPath, rootPath } = constants +const { abortSignal, rootPackageJsonPath, rootPath } = constants const { runScript } = require('@socketsecurity/registry/lib/npm') const { readPackageJson } = require('@socketsecurity/registry/lib/packages') -const abortController = new AbortController() -const { signal: abortSignal } = abortController - -// Detect ^C, i.e. Ctrl + C. -onExit(() => { - abortController.abort() -}) - void (async () => { const rootEditablePkgJson = await readPackageJson(rootPackageJsonPath, { editable: true diff --git a/test/npm.test.ts b/test/npm.test.ts index 57aba372..eb994857 100644 --- a/test/npm.test.ts +++ b/test/npm.test.ts @@ -4,7 +4,6 @@ import { describe, it } from 'node:test' import util from 'node:util' import semver from 'semver' -import { onExit } from 'signal-exit' import constants from '@socketregistry/scripts/constants' const { @@ -14,6 +13,7 @@ const { PACKAGE_JSON, README_GLOB_RECURSIVE, WIN32, + abortSignal, parseArgsConfig, skipTestsByEcosystem, testNpmNodeWorkspacesPath, @@ -29,14 +29,6 @@ import { runScript } from '@socketsecurity/registry/lib/npm' import { resolveOriginalPackageName } from '@socketsecurity/registry/lib/packages' import { isNonEmptyString } from '@socketsecurity/registry/lib/strings' -const abortController = new AbortController() -const { signal: abortSignal } = abortController - -// Detect ^C, i.e. Ctrl + C. -onExit(() => { - abortController.abort() -}) - // Pass args as tap --test-arg: // npm run test:unit ./test/npm.test.ts -- --test-arg="--force" const { values: cliArgs } = util.parseArgs(parseArgsConfig)