From e077219f5ca10b00e1d3869216379f74317de94b Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Wed, 24 Jul 2024 21:25:46 -0700 Subject: [PATCH 1/6] Remove `async` from `ci.js` --- src/ci.js | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/ci.js b/src/ci.js index 96305da1..9fcc1f66 100644 --- a/src/ci.js +++ b/src/ci.js @@ -2,7 +2,6 @@ const path = require('path'); const fs = require('./fs'); const yargs = require('yargs'); -const async = require('async'); const _ = require('underscore-plus'); const config = require('./apm'); @@ -70,17 +69,13 @@ but cannot be used to install new packages or dependencies.\ async run(options) { const opts = this.parseOptions(options.commandArgs); - const commands = []; - commands.push(async () => { - const npm = await config.loadNpm(); - this.npm = npm; - }); - commands.push(async () => await this.loadInstalledAtomMetadata()); - commands.push(async () => this.installModules(opts)); try { - await async.waterfall(commands); - } catch (error) { - return error; // errors as return values atm + this.npm = await config.loadNpm(); + await this.loadInstalledAtomMetadata(); + this.installModules(opts); + } catch(err) { + return err; } + } }; From a642f0b3d8eed0ab98defc18ffb6e1dae0ec8c75 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Wed, 24 Jul 2024 21:26:54 -0700 Subject: [PATCH 2/6] Remove `async` from `dedupe.js` --- src/dedupe.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/dedupe.js b/src/dedupe.js index dd83be5e..c3444b89 100644 --- a/src/dedupe.js +++ b/src/dedupe.js @@ -1,7 +1,6 @@ const path = require('path'); -const async = require('async'); const _ = require('underscore-plus'); const yargs = require('yargs'); @@ -76,13 +75,11 @@ This command is experimental.\ this.createAtomDirectories(); - const commands = []; - commands.push(async () => await this.loadInstalledAtomMetadata()); - commands.push(async () => await this.dedupeModules(options)); try { - await async.waterfall(commands); - } catch (error) { - return error; //errors as return values atm + await this.loadInstalledAtomMetadata(); + await this.dedupeModules(options); + } catch(err) { + return err; } } } From 8a613359c14a8d3fccf8e0e1efb584eb54f17eb3 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Wed, 24 Jul 2024 21:30:08 -0700 Subject: [PATCH 3/6] Remove `async` from `develop.js` --- src/develop.js | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/develop.js b/src/develop.js index 5d8b20aa..643db746 100644 --- a/src/develop.js +++ b/src/develop.js @@ -3,7 +3,6 @@ const fs = require('fs'); const path = require('path'); const _ = require('underscore-plus'); -const async = require('async'); const yargs = require('yargs'); const config = require('./apm'); @@ -64,7 +63,7 @@ cmd-shift-o to run the package out of the newly cloned repository.\ return void reject(`No repository URL found for package: ${packageName}`); } - + const message = request.getErrorMessage(body, error); return void reject(`Request for package information failed: ${message}`); }); @@ -90,7 +89,7 @@ cmd-shift-o to run the package out of the newly cloned repository.\ installDependencies(packageDirectory, options) { process.chdir(packageDirectory); const installOptions = _.clone(options); - + return new Install().run(installOptions); } @@ -117,12 +116,10 @@ cmd-shift-o to run the package out of the newly cloned repository.\ try { const repoUrl = await this.getRepositoryUrl(packageName); - const tasks = []; - tasks.push(async () => await this.cloneRepository(repoUrl, packageDirectory, options)); - tasks.push(async () => await this.installDependencies(packageDirectory, options)); - tasks.push(async () => await this.linkPackage(packageDirectory, options)); - - await async.waterfall(tasks); + + await this.cloneRepository(repoUrl, packageDirectory, options); + await this.installDependencies(packageDirectory, options); + await this.linkPackage(packageDirectory, options); } catch (error) { return error; //errors as return values atm } From f008e99c94ad8e6db2e34f46f2e0d995bb5a058d Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Wed, 24 Jul 2024 21:39:19 -0700 Subject: [PATCH 4/6] Remove `async` mostly from `install.js` --- src/install.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/install.js b/src/install.js index 46a624be..54675fe3 100644 --- a/src/install.js +++ b/src/install.js @@ -114,24 +114,25 @@ package names to install with optional versions using the return void resolve({name: undefined, installPath: undefined}); } - const commands = []; const children = fs.readdirSync(nodeModulesDirectory) .filter(dir => dir !== ".bin"); assert.equal(children.length, 1, "Expected there to only be one child in node_modules"); const child = children[0]; const source = path.join(nodeModulesDirectory, child); const destination = path.join(this.atomPackagesDirectory, child); - commands.push(async () => await fs.cp(source, destination)); - commands.push(async () => await this.buildModuleCache(pack.name)); - commands.push(async () => await this.warmCompileCache(pack.name)); - async.waterfall(commands).then(() => { + try { + await fs.cp(source, destination); + await this.buildModuleCache(pack.name); + await this.warmCompileCache(pack.name); + if (!options.argv.json) { this.logSuccess(); } - resolve({name: child, installPath: destination}); - }, error => { + resolve({ name: child, installPath: destination }); + + } catch(err) { this.logFailure(); - reject(error); - }); + reject(err); + } }); }); } @@ -388,11 +389,9 @@ Run ppm -v after installing Git to see what version has been detected.\ async installDependencies(options) { options.installGlobally = false; - const commands = []; - commands.push(async () => void await this.installModules(options)); - commands.push(async () => void await this.installPackageDependencies(options)); - await async.waterfall(commands); + await this.installModule(options); + await this.installPackageDependencies(options); } // Get all package dependency names and versions from the package.json file. From e3635f23bf613ae231f73a7a36e260b31f9f4345 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Wed, 24 Jul 2024 21:56:28 -0700 Subject: [PATCH 5/6] Revert "Remove `async` mostly from `install.js`" This reverts commit f008e99c94ad8e6db2e34f46f2e0d995bb5a058d. --- src/install.js | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/install.js b/src/install.js index 54675fe3..46a624be 100644 --- a/src/install.js +++ b/src/install.js @@ -114,25 +114,24 @@ package names to install with optional versions using the return void resolve({name: undefined, installPath: undefined}); } + const commands = []; const children = fs.readdirSync(nodeModulesDirectory) .filter(dir => dir !== ".bin"); assert.equal(children.length, 1, "Expected there to only be one child in node_modules"); const child = children[0]; const source = path.join(nodeModulesDirectory, child); const destination = path.join(this.atomPackagesDirectory, child); + commands.push(async () => await fs.cp(source, destination)); + commands.push(async () => await this.buildModuleCache(pack.name)); + commands.push(async () => await this.warmCompileCache(pack.name)); - try { - await fs.cp(source, destination); - await this.buildModuleCache(pack.name); - await this.warmCompileCache(pack.name); - + async.waterfall(commands).then(() => { if (!options.argv.json) { this.logSuccess(); } - resolve({ name: child, installPath: destination }); - - } catch(err) { + resolve({name: child, installPath: destination}); + }, error => { this.logFailure(); - reject(err); - } + reject(error); + }); }); }); } @@ -389,9 +388,11 @@ Run ppm -v after installing Git to see what version has been detected.\ async installDependencies(options) { options.installGlobally = false; + const commands = []; + commands.push(async () => void await this.installModules(options)); + commands.push(async () => void await this.installPackageDependencies(options)); - await this.installModule(options); - await this.installPackageDependencies(options); + await async.waterfall(commands); } // Get all package dependency names and versions from the package.json file. From 8b42d587691f0986c44deb830be5c934b66cc057 Mon Sep 17 00:00:00 2001 From: confused-Techie Date: Thu, 25 Jul 2024 00:39:52 -0700 Subject: [PATCH 6/6] Await all functions in `ci.js` --- src/ci.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ci.js b/src/ci.js index 9fcc1f66..95b6da5a 100644 --- a/src/ci.js +++ b/src/ci.js @@ -72,7 +72,7 @@ but cannot be used to install new packages or dependencies.\ try { this.npm = await config.loadNpm(); await this.loadInstalledAtomMetadata(); - this.installModules(opts); + await this.installModules(opts); } catch(err) { return err; }