Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Begin less reliance on async package: Await as we go #134

Merged
merged 6 commits into from
Aug 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 6 additions & 11 deletions src/ci.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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();
await this.installModules(opts);
} catch(err) {
return err;
}

}
};
11 changes: 4 additions & 7 deletions src/dedupe.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@

const path = require('path');

const async = require('async');
const _ = require('underscore-plus');
const yargs = require('yargs');

Expand Down Expand Up @@ -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;
}
}
}
15 changes: 6 additions & 9 deletions src/develop.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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}`);
});
Expand All @@ -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);
}

Expand All @@ -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
}
Expand Down
Loading