Skip to content

Commit

Permalink
fix(@ngtools/webpack): change of CSS no longer breaks rebuild (angula…
Browse files Browse the repository at this point in the history
  • Loading branch information
Brocco authored and MRHarrison committed Feb 9, 2017
1 parent 60a9977 commit a856f51
Show file tree
Hide file tree
Showing 3 changed files with 166 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/@ngtools/webpack/src/compiler_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ export class WebpackCompilerHost implements ts.CompilerHost {
}

invalidate(fileName: string): void {
this._files[fileName] = null;
this._changedFiles[fileName] = true;
if (fileName in this._files) {
this._files[fileName] = null;
this._changedFiles[fileName] = true;
}
}

fileExists(fileName: string): boolean {
Expand Down
133 changes: 133 additions & 0 deletions packages/angular-cli/lib/config/schema.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
export interface CliConfig {
/**
* The global configuration of the project.
*/
project?: {
version?: string;
name?: string;
};
/**
* Properties of the different applications in this project.
*/
apps?: {
root?: string;
outDir?: string;
assets?: (string | string[]);
deployUrl?: string;
index?: string;
main?: string;
polyfills?: string;
test?: string;
tsconfig?: string;
prefix?: string;
mobile?: boolean;
/**
* Global styles to be included in the build.
*/
styles?: (string | {
input?: string;
[name: string]: any;
})[];
/**
* Options to pass to style preprocessors
*/
stylePreprocessorOptions?: {
/**
* Paths to include. Paths will be resolved to project root.
*/
includePaths?: string[];
};
/**
* Global scripts to be included in the build.
*/
scripts?: (string | {
input: string;
[name: string]: any;
})[];
/**
* Name and corresponding file for environment config.
*/
environments?: {
[name: string]: any;
};
}[];
/**
* Configuration reserved for installed third party addons.
*/
addons?: {
[name: string]: any;
}[];
/**
* Configuration reserved for installed third party packages.
*/
packages?: {
[name: string]: any;
}[];
e2e?: {
protractor?: {
config?: string;
};
};
/**
* Properties to be passed to TSLint.
*/
lint?: {
files: string;
project: string;
tslintConfig?: string;
}[];
test?: {
karma?: {
config?: string;
};
};
defaults?: {
styleExt?: string;
prefixInterfaces?: boolean;
poll?: number;
viewEncapsulation?: string;
changeDetection?: string;
inline?: {
style?: boolean;
template?: boolean;
};
spec?: {
class?: boolean;
component?: boolean;
directive?: boolean;
module?: boolean;
pipe?: boolean;
service?: boolean;
};
/**
* Properties to be passed to the serve command
*/
serve?: {
/**
* The port the application will be served on
*/
port?: number;
/**
* The host the application will be served on
*/
host?: string;
};
};
/**
* Allow people to disable console warnings.
*/
warnings?: {
/**
* Show a warning when the node version is incompatible.
*/
nodeDeprecation?: boolean;
/**
* Show a warning when the user installed angular-cli.
*/
packageDeprecation?: boolean;
/**
* Show a warning when the global version is newer than the local one.
*/
versionMismatch?: boolean;
};
}
29 changes: 29 additions & 0 deletions tests/e2e/tests/build/rebuild-css-change.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import {
killAllProcesses,
exec,
waitForAnyProcessOutputToMatch,
silentExecAndWaitForOutputToMatch
} from '../../utils/process';
import {appendToFile} from '../../utils/fs';

const webpackGoodRegEx = /webpack: bundle is now VALID|webpack: Compiled successfully./;
const webpackBadRegEx = /webpack: bundle is now INVALID|webpack: Compiling.../;

export default function() {
if (process.platform.startsWith('win')) {
return Promise.resolve();
}

return silentExecAndWaitForOutputToMatch('ng', ['serve'], webpackGoodRegEx)
// Should trigger a rebuild.
.then(() => exec('touch', 'src/main.ts'))
.then(() => waitForAnyProcessOutputToMatch(webpackBadRegEx, 1000))
.then(() => waitForAnyProcessOutputToMatch(webpackGoodRegEx, 5000))
.then(() => appendToFile('src/app/app.component.css', ':host { color: blue; }'))
.then(() => waitForAnyProcessOutputToMatch(webpackBadRegEx, 1000))
.then(() => waitForAnyProcessOutputToMatch(webpackGoodRegEx, 5000))
.then(() => killAllProcesses(), (err: any) => {
killAllProcesses();
throw err;
});
}

0 comments on commit a856f51

Please sign in to comment.