-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(@ngtools/webpack): change of CSS no longer breaks rebuild (#4334)
- Loading branch information
Showing
3 changed files
with
166 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
}); | ||
} |