Skip to content

Commit

Permalink
Remove async mostly from install.js
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie committed Jul 25, 2024
1 parent 8a61335 commit f008e99
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions src/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
});
});
}
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit f008e99

Please sign in to comment.