Skip to content

Commit

Permalink
Merge pull request #1566 from stanimirovv/fix/add-exit-status
Browse files Browse the repository at this point in the history
fix: fail on nest add results in non 0 exit code
  • Loading branch information
kamilmysliwiec authored Mar 15, 2022
2 parents 9f0dea2 + c759f7d commit 5fcf1bb
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions actions/add.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@ import { Input } from '../commands';
import { getValueOrDefault } from '../lib/compiler/helpers/get-value-or-default';
import {
AbstractPackageManager,
PackageManagerFactory,
PackageManagerFactory
} from '../lib/package-managers';
import {
AbstractCollection,
CollectionFactory,
SchematicOption,
SchematicOption
} from '../lib/schematics';
import { MESSAGES } from '../lib/ui';
import { loadConfiguration } from '../lib/utils/load-configuration';
import {
askForProjectName,
moveDefaultProjectToStart,
shouldAskForProject,
shouldAskForProject
} from '../lib/utils/project-utils';
import { AbstractAction } from './abstract.action';

Expand Down Expand Up @@ -44,6 +44,7 @@ export class AddAction extends AbstractAction {
MESSAGES.LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE(libraryName),
),
);
throw new Error(MESSAGES.LIBRARY_INSTALLATION_FAILED_BAD_PACKAGE(libraryName));
}
}

Expand Down
3 changes: 2 additions & 1 deletion actions/build.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import { WebpackCompiler } from '../lib/compiler/webpack-compiler';
import { WorkspaceUtils } from '../lib/compiler/workspace-utils';
import {
ConfigurationLoader,
NestConfigurationLoader,
NestConfigurationLoader
} from '../lib/configuration';
import { defaultOutDir } from '../lib/configuration/defaults';
import { FileSystemReader } from '../lib/readers';
Expand Down Expand Up @@ -62,6 +62,7 @@ export class BuildAction extends AbstractAction {
} else {
console.error(`\n${chalk.red(err)}\n`);
}
process.exit(1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion commands/add.command.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class AddCommand extends AbstractCommand {
try {
await this.action.handle(inputs, options, flags);
} catch (err) {
process.exit(0);
process.exit(1);
}
});
}
Expand Down

0 comments on commit 5fcf1bb

Please sign in to comment.