Skip to content

Commit 627e722

Browse files
filipesilvaBrocco
authored andcommitted
refactor(@angular/cli): use this.project instead of cliProject
1 parent f6e5961 commit 627e722

File tree

6 files changed

+9
-14
lines changed

6 files changed

+9
-14
lines changed

packages/@angular/cli/commands/build.ts

+2-4
Original file line numberDiff line numberDiff line change
@@ -148,15 +148,13 @@ const BuildCommand = Command.extend({
148148
]),
149149

150150
run: function (commandOptions: BuildTaskOptions) {
151-
const project = this.project;
152-
153151
// Check angular version.
154-
Version.assertAngularVersionIs2_3_1OrHigher(project.root);
152+
Version.assertAngularVersionIs2_3_1OrHigher(this.project.root);
155153

156154
const BuildTask = require('../tasks/build').default;
157155

158156
const buildTask = new BuildTask({
159-
cliProject: project,
157+
project: this.project,
160158
ui: this.ui,
161159
});
162160

packages/@angular/cli/commands/eject.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ const EjectCommand = Command.extend({
3232
availableOptions: baseEjectCommandOptions,
3333

3434
run: function (commandOptions: EjectTaskOptions) {
35-
const project = this.project;
3635
const EjectTask = require('../tasks/eject').default;
3736
const ejectTask = new EjectTask({
38-
cliProject: project,
37+
project: this.project,
3938
ui: this.ui,
4039
});
4140

packages/@angular/cli/commands/init.ts

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ const InitCommand: any = Command.extend({
2929
const InitTask = require('../tasks/init').default;
3030

3131
const initTask = new InitTask({
32-
cliProject: this.project,
3332
project: this.project,
3433
tasks: this.tasks,
3534
ui: this.ui,

packages/@angular/cli/tasks/build.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,19 @@ const SilentError = require('silent-error');
1515

1616
export default Task.extend({
1717
run: function (runTaskOptions: BuildTaskOptions) {
18-
const project = this.cliProject;
1918
const config = CliConfig.fromProject().config;
2019

2120
const app = getAppFromConfig(runTaskOptions.app);
2221

2322
const outputPath = runTaskOptions.outputPath || app.outDir;
24-
if (project.root === outputPath) {
23+
if (this.project.root === outputPath) {
2524
throw new SilentError('Output path MUST not be project root directory!');
2625
}
2726
if (config.project && config.project.ejected) {
2827
throw new SilentError('An ejected project cannot use the build command anymore.');
2928
}
3029
if (runTaskOptions.deleteOutputPath) {
31-
rimraf.sync(path.resolve(project.root, outputPath));
30+
rimraf.sync(path.resolve(this.project.root, outputPath));
3231
}
3332

3433
const webpackConfig = new NgCliWebpackConfig(runTaskOptions, app).buildConfig();
@@ -51,7 +50,7 @@ export default Task.extend({
5150
const jsonStats = stats.toJson('verbose');
5251

5352
fs.writeFileSync(
54-
path.resolve(project.root, outputPath, 'stats.json'),
53+
path.resolve(this.project.root, outputPath, 'stats.json'),
5554
JSON.stringify(jsonStats, null, 2)
5655
);
5756
}

packages/@angular/cli/tasks/eject.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ class JsonWebpackSerializer {
386386

387387
export default Task.extend({
388388
run: function (runTaskOptions: EjectTaskOptions) {
389-
const project = this.cliProject;
389+
const project = this.project;
390390
const cliConfig = CliConfig.fromProject();
391391
const config = cliConfig.config;
392392
const appConfig = getAppFromConfig(runTaskOptions.app);

packages/@angular/cli/utilities/find-up.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import * as path from 'path';
2-
import { existsSync } from 'fs';
2+
import { existsSync, realpathSync } from 'fs';
33

44
export function findUp(names: string | string[], from: string, stopOnNodeModules = false) {
55
if (!Array.isArray(names)) {
@@ -12,7 +12,7 @@ export function findUp(names: string | string[], from: string, stopOnNodeModules
1212
for (const name of names) {
1313
const p = path.join(currentDir, name);
1414
if (existsSync(p)) {
15-
return p;
15+
return realpathSync(p);
1616
}
1717
}
1818

0 commit comments

Comments
 (0)