Skip to content

fix(@ngtools/webpack): change of CSS no longer breaks rebuild #4334

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 2, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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;
});
}