Changing install signatures from yeoman-generator@3.0.0 (#29351)

* Changing install signatures from yeoman-generator@3.0.0

* Fixing tests

* Upping version

* Updating docs

* Fixing linting
This commit is contained in:
Erik Elkins
2018-10-02 13:02:15 -05:00
committed by Wesley Wigham
parent c50244c6b2
commit 1f989a0c29
2 changed files with 29 additions and 35 deletions

View File

@@ -1,4 +1,4 @@
// Type definitions for yeoman-generator 2.0
// Type definitions for yeoman-generator 3.0
// Project: https://github.com/yeoman/generator
// Definitions by: Kentaro Okuno <https://github.com/armorik83>
// Jay Anslow <https://github.com/janslow>
@@ -128,9 +128,8 @@ declare class Generator extends EventEmitter {
* @param component Components to install
* @param options Options to pass to `dargs` as arguments
* @param spawnOptions Options to pass `child_process.spawn`.
* @return Resolved if install successful, rejected otherwise
*/
bowerInstall(component?: string|string[], options?: object, spawnOptions?: object): Promise<void>;
bowerInstall(component?: string|string[], options?: object, spawnOptions?: object): void;
/**
* Runs `npm` and `bower`, in sequence, in the generated directory and prints a
* message to let the user know.
@@ -147,9 +146,8 @@ declare class Generator extends EventEmitter {
* npm: false
* }).then(() => console.log('Everything is ready!'));
*
* @return Resolved if install successful, rejected otherwise
*/
installDependencies(options?: Generator.InstallOptions): Promise<void>;
installDependencies(options?: Generator.InstallOptions): void;
/**
* Receives a list of `packages` and an `options` object to install through npm.
*
@@ -158,24 +156,21 @@ declare class Generator extends EventEmitter {
* @param pkgs Packages to install
* @param options Options to pass to `dargs` as arguments
* @param spawnOptions Options to pass `child_process.spawn`.
* @return Resolved if install successful, rejected otherwise
*/
npmInstall(pkgs?: string|string[], options?: object, spawnOptions?: object): Promise<void>;
npmInstall(pkgs?: string|string[], options?: object, spawnOptions?: object): void;
/**
* Combine package manager cmd line arguments and run the `install` command.
*
* During the `install` step, every command will be scheduled to run once, on the
* run loop. This means you can use `Promise.then` to log information, but don't
* return it or mix it with `this.async` as it'll dead lock the process.
* run loop.
*
* @param installer Which package manager to use
* @param paths Packages to install. Use an empty string for `npm install`
* @param options Options to pass to `dargs` as arguments
* @param spawnOptions Options to pass `child_process.spawn`. ref
* https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options
* @return Resolved if install successful, rejected otherwise
*/
runInstall(installer: string, paths?: string|string[], options?: object, spawnOptions?: object): Promise<void>;
scheduleInstallTask(installer: string, paths?: string|string[], options?: object, spawnOptions?: object): void;
/**
* Receives a list of `packages` and an `options` object to install through npm.
*
@@ -184,9 +179,8 @@ declare class Generator extends EventEmitter {
* @param pkgs Packages to install
* @param options Options to pass to `dargs` as arguments
* @param spawnOptions Options to pass `child_process.spawn`.
* @return Resolved if install successful, rejected otherwise
*/
yarnInstall(pkgs?: string|string[], options?: object, spawnOptions?: object): Promise<void>;
yarnInstall(pkgs?: string|string[], options?: object, spawnOptions?: object): void;
// actions/user mixin
readonly user: {

View File

@@ -43,35 +43,35 @@ generator.argument('arg4', {
const argsHelp = generator.argumentsHelp();
async function install() {
await generator.installDependencies();
await generator.installDependencies({
generator.installDependencies();
generator.installDependencies({
bower: true,
npm: true,
});
await generator.bowerInstall();
await generator.bowerInstall('pkg');
await generator.bowerInstall(['pkg1', 'pkg2']);
await generator.bowerInstall('pkg', {});
await generator.bowerInstall('pkg', { 'custom-option': 3 }, {});
generator.bowerInstall();
generator.bowerInstall('pkg');
generator.bowerInstall(['pkg1', 'pkg2']);
generator.bowerInstall('pkg', {});
generator.bowerInstall('pkg', { 'custom-option': 3 }, {});
await generator.npmInstall();
await generator.npmInstall('pkg');
await generator.npmInstall(['pkg1', 'pkg2']);
await generator.npmInstall('pkg', {});
await generator.npmInstall('pkg', { 'custom-option': 3 }, {});
generator.npmInstall();
generator.npmInstall('pkg');
generator.npmInstall(['pkg1', 'pkg2']);
generator.npmInstall('pkg', {});
generator.npmInstall('pkg', { 'custom-option': 3 }, {});
await generator.yarnInstall();
await generator.yarnInstall('pkg');
await generator.yarnInstall(['pkg1', 'pkg2']);
await generator.yarnInstall('pkg', {});
await generator.yarnInstall('pkg', { 'custom-option': 3 }, {});
generator.yarnInstall();
generator.yarnInstall('pkg');
generator.yarnInstall(['pkg1', 'pkg2']);
generator.yarnInstall('pkg', {});
generator.yarnInstall('pkg', { 'custom-option': 3 }, {});
await generator.runInstall('installer');
await generator.runInstall('installer', 'pkg');
await generator.runInstall('installer', ['pkg1', 'pkg2']);
await generator.runInstall('installer', 'pkg', {});
await generator.runInstall('installer', 'pkg', { 'custom-option': 3 }, {});
generator.scheduleInstallTask('installer');
generator.scheduleInstallTask('installer', 'pkg');
generator.scheduleInstallTask('installer', ['pkg1', 'pkg2']);
generator.scheduleInstallTask('installer', 'pkg', {});
generator.scheduleInstallTask('installer', 'pkg', { 'custom-option': 3 }, {});
}
const composed1: Base = generator.composeWith('bootstrap', { sass: true });