Skip to content

Commit

Permalink
Revert "Remove async mostly from install.js"
Browse files Browse the repository at this point in the history
This reverts commit f008e99.
  • Loading branch information
confused-Techie committed Jul 25, 2024
1 parent f008e99 commit e3635f2
Showing 1 changed file with 13 additions and 12 deletions.
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

0 comments on commit e3635f2

Please sign in to comment.