Skip to content

Commit 0689cac

Browse files
hanslfilipesilva
authored andcommitted
fix(@angular-devkit/schematics-cli): allow private and reset logging queue
General QoL.
1 parent 86aff35 commit 0689cac

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

packages/angular_devkit/schematics_cli/bin/schematics.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ function usage(exitCode = 0): never {
3636
Options:
3737
--debug Debug mode. This is true by default if the collection is a relative
3838
path (in that case, turn off with --debug=false).
39+
--allowPrivate Allow private schematics to be run from the command line. Default to
40+
false.
3941
--dry-run Do not output anything, but instead just show what actions would be
4042
performed. Default to true if debug is also true.
4143
--force Force overwriting files that would otherwise be an error.
@@ -87,7 +89,15 @@ function parseSchematicName(str: string | null): { collection: string, schematic
8789

8890

8991
/** Parse the command line. */
90-
const booleanArgs = [ 'debug', 'dry-run', 'force', 'help', 'list-schematics', 'verbose' ];
92+
const booleanArgs = [
93+
'allowPrivate',
94+
'debug',
95+
'dry-run',
96+
'force',
97+
'help',
98+
'list-schematics',
99+
'verbose',
100+
];
91101
const argv = minimist(process.argv.slice(2), {
92102
boolean: booleanArgs,
93103
default: {
@@ -124,6 +134,7 @@ if (argv['list-schematics']) {
124134
const debug: boolean = argv.debug === null ? isLocalCollection : argv.debug;
125135
const dryRun: boolean = argv['dry-run'] === null ? debug : argv['dry-run'];
126136
const force = argv['force'];
137+
const allowPrivate = argv['allowPrivate'];
127138

128139
/** Create a Virtual FS Host scoped to where the process is being run. **/
129140
const fsHost = new virtualFs.ScopedHost(new NodeJsSyncHost(), normalize(process.cwd()));
@@ -137,7 +148,7 @@ let nothingDone = true;
137148

138149
// Logging queue that receives all the messages to show the users. This only get shown when no
139150
// errors happened.
140-
const loggingQueue: string[] = [];
151+
let loggingQueue: string[] = [];
141152
let error = false;
142153

143154
/**
@@ -190,6 +201,7 @@ workflow.lifeCycle.subscribe(event => {
190201
loggingQueue.forEach(log => logger.info(log));
191202
}
192203

204+
loggingQueue = [];
193205
error = false;
194206
}
195207
});
@@ -235,6 +247,7 @@ workflow.execute({
235247
collection: collectionName,
236248
schematic: schematicName,
237249
options: args,
250+
allowPrivate: allowPrivate,
238251
debug: debug,
239252
logger: logger,
240253
})

0 commit comments

Comments
 (0)