Skip to content

Commit e328e51

Browse files
hanslfilipesilva
authored andcommitted
refactor: simplify the schematic-run task a bit
1 parent 3726abf commit e328e51

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

packages/@angular/cli/tasks/schematic-run.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import { CliConfig } from '../models/config';
1515
import 'rxjs/add/operator/concatMap';
1616
import 'rxjs/add/operator/map';
1717
import { getCollection, getSchematic } from '../utilities/schematics';
18-
import { getAppFromConfig } from '../utilities/app-utils';
1918

2019

2120
const Task = require('../ember-cli/lib/models/task');
@@ -53,13 +52,6 @@ export default Task.extend({
5352
const collection = getCollection(collectionName);
5453
const schematic = getSchematic(collection, schematicName);
5554

56-
let modifiedFiles: string[] = [];
57-
58-
let appConfig;
59-
try {
60-
appConfig = getAppFromConfig(taskOptions.app);
61-
} catch (err) {}
62-
6355
const projectRoot = !!this.project ? this.project.root : workingDir;
6456

6557
const preppedOptions = prepOptions(schematic, taskOptions);
@@ -73,6 +65,7 @@ export default Task.extend({
7365

7466
let error = false;
7567
const loggingQueue: OutputLogging[] = [];
68+
const modifiedFiles: string[] = [];
7669

7770
dryRunSink.reporter.subscribe((event: DryRunEvent) => {
7871
const eventPath = event.path.startsWith('/') ? event.path.substr(1) : event.path;
@@ -88,15 +81,15 @@ export default Task.extend({
8881
keyword: 'update',
8982
message: `${eventPath} (${event.content.length} bytes)`
9083
});
91-
modifiedFiles = [...modifiedFiles, event.path];
84+
modifiedFiles.push(event.path);
9285
break;
9386
case 'create':
9487
loggingQueue.push({
9588
color: green,
9689
keyword: 'create',
9790
message: `${eventPath} (${event.content.length} bytes)`
9891
});
99-
modifiedFiles = [...modifiedFiles, event.path];
92+
modifiedFiles.push(event.path);
10093
break;
10194
case 'delete':
10295
loggingQueue.push({
@@ -112,6 +105,7 @@ export default Task.extend({
112105
keyword: 'rename',
113106
message: `${eventPath} => ${eventToPath}`
114107
});
108+
modifiedFiles.push(event.to);
115109
break;
116110
}
117111
});

0 commit comments

Comments
 (0)