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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Revert "Remove async mostly from install.js"
This reverts commit f008e99.
  • Loading branch information
confused-Techie committed Jul 25, 2024
commit e3635f23bf613ae231f73a7a36e260b31f9f4345
25 changes: 13 additions & 12 deletions src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
});
}
Expand Down Expand Up @@ -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.
Expand Down
Loading