From e3934adc9ac9d7b7c60c07d88633b357542768fd Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Tue, 12 Dec 2023 23:08:50 -0500 Subject: [PATCH 1/2] src: Stop pinging backend during package uninstalls So, we stopped *using* these pings on our implementation of the backend, since it doesn't really make sense to decrement the install count when someone uninstalls... And it may or may not have simpoly been telemetry when the O.G. Atom backend was expecting this to be an authed action. Since we don't need to auth or ping the backend for uninstalls... Just delete the code that does it! --- src/uninstall.js | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/src/uninstall.js b/src/uninstall.js index 9d78c368..e0371681 100644 --- a/src/uninstall.js +++ b/src/uninstall.js @@ -37,24 +37,6 @@ Delete the installed package(s) from the ~/.pulsar/packages directory.\ } } - async registerUninstall({packageName, packageVersion}) { - if (!packageVersion) { return; } - - try { - const token = await auth.getToken(); - const requestOptions = { - url: `${config.getAtomPackagesUrl()}/${packageName}/versions/${packageVersion}/events/uninstall`, - json: true, - headers: { - authorization: token - } - }; - return new Promise((resolve, _reject) => void request.post(requestOptions, (_error, _response, _body) => resolve())); - } catch (error) { - return error; // error as value here - } - } - async run(options) { options = this.parseOptions(options.commandArgs); const packageNames = this.packageNamesFromArgv(options.argv); @@ -66,7 +48,6 @@ Delete the installed package(s) from the ~/.pulsar/packages directory.\ const packagesDirectory = path.join(config.getAtomDirectory(), 'packages'); const devPackagesDirectory = path.join(config.getAtomDirectory(), 'dev', 'packages'); - const uninstallsToRegister = []; let uninstallError = null; for (let packageName of Array.from(packageNames)) { @@ -82,9 +63,6 @@ Delete the installed package(s) from the ~/.pulsar/packages directory.\ if (fs.existsSync(packageManifestPath)) { const packageVersion = this.getPackageVersion(packageDirectory); fs.removeSync(packageDirectory); - if (packageVersion) { - uninstallsToRegister.push({packageName, packageVersion}); - } } else if (!options.argv.hard) { throw new Error(`No package.json found at ${packageManifestPath}`); } @@ -107,7 +85,6 @@ Delete the installed package(s) from the ~/.pulsar/packages directory.\ } } - await async.eachSeries(uninstallsToRegister, (data, errorHandler) =>void this.registerUninstall(data).then(errorHandler)); return uninstallError; // both error and lack of error, as return value atm } } From afa059bf0de663b650d4919f74165a2b804ed5ce Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Tue, 12 Dec 2023 23:23:32 -0500 Subject: [PATCH 2/2] src: Delete unused requires from uninstall.js --- src/uninstall.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/uninstall.js b/src/uninstall.js index e0371681..a5eb7f1e 100644 --- a/src/uninstall.js +++ b/src/uninstall.js @@ -5,11 +5,9 @@ const async = require('async'); const CSON = require('season'); const yargs = require('yargs'); -const auth = require('./auth'); const Command = require('./command'); const config = require('./apm'); const fs = require('./fs'); -const request = require('./request'); module.exports = class Uninstall extends Command {