-
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.
feat(@schematics/angular): evergreen new applications
By default, we now generate new applications which support only evergreen browsers, as a result differential loading is now opt-in. A new flag `--legacy-browsers`, was added to generate applications which support non evergreen browsers such as Internet Explorer 11. **Note**: After an application is generated opting in and out of differential loading is still possible through the supported browsers configuration in the browserslist configuration file defaulted to `.browserslistrc`.
- Loading branch information
1 parent
e2eed2c
commit a723af4
Showing
44 changed files
with
295 additions
and
351 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
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
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
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
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
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
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,49 @@ | ||
import { oneLineTrim } from 'common-tags'; | ||
import { appendToFile, expectFileToMatch, replaceInFile, writeMultipleFiles } from '../../utils/fs'; | ||
import { ng } from '../../utils/process'; | ||
import { updateJsonFile } from '../../utils/project'; | ||
import { expectToFail } from '../../utils/utils'; | ||
|
||
export default async function () { | ||
// Enable Differential loading to run both size checks | ||
await replaceInFile( | ||
'.browserslistrc', | ||
'not IE 9-11', | ||
'IE 9-11', | ||
); | ||
|
||
await writeMultipleFiles({ | ||
'src/string-script.js': "console.log('string-script'); var number = 1+1;", | ||
'src/pre-rename-script.js': "console.log('pre-rename-script');", | ||
}); | ||
|
||
await updateJsonFile('angular.json', configJson => { | ||
const appArchitect = configJson.projects['test-project'].architect; | ||
appArchitect.build.options.scripts = [ | ||
{ input: 'src/string-script.js' }, | ||
{ input: 'src/pre-rename-script.js', bundleName: 'renamed-script' }, | ||
]; | ||
}); | ||
|
||
await ng('build', '--extract-css', '--vendor-chunk', '--optimization'); | ||
|
||
// index.html lists the right bundles | ||
await expectFileToMatch( | ||
'dist/test-project/index.html', | ||
oneLineTrim` | ||
<script src="runtime-es2015.js" type="module"></script> | ||
<script src="runtime-es5.js" nomodule defer></script> | ||
<script src="polyfills-es5.js" nomodule defer></script> | ||
<script src="polyfills-es2015.js" type="module"></script> | ||
<script src="scripts.js" defer></script> | ||
<script src="renamed-script.js" defer></script> | ||
<script src="vendor-es2015.js" type="module"></script> | ||
<script src="vendor-es5.js" nomodule defer></script> | ||
<script src="main-es2015.js" type="module"></script> | ||
<script src="main-es5.js" nomodule defer></script> | ||
`, | ||
); | ||
|
||
await expectFileToMatch('dist/test-project/vendor-es2015.js', /class \w{constructor\(/); | ||
await expectToFail(() => expectFileToMatch('dist/test-project/vendor-es5.js', /class \w{constructor\(/)); | ||
} |
Oops, something went wrong.