Skip to content

Commit

Permalink
feat(nx): target es2015 by default for all applications
Browse files Browse the repository at this point in the history
  • Loading branch information
FrozenPandaz authored and vsavkin committed May 27, 2019
1 parent 9eb6bc4 commit df23cba
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 9 deletions.
21 changes: 17 additions & 4 deletions e2e/schematics/ng-new.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,28 @@ describe('Nrwl Workspace', () => {
`
);
runCLI(`build --prod --project=my-dir-${myapp} --output-hashing none`);
expect(exists(`./tmp/proj/dist/apps/my-dir/${myapp}/main.js`)).toEqual(
expect(
exists(`./tmp/proj/dist/apps/my-dir/${myapp}/main-es2015.js`)
).toEqual(true);
expect(exists(`./tmp/proj/dist/apps/my-dir/${myapp}/main-es5.js`)).toEqual(
true
);

// This is a loose requirement because there are a lot of
// influences external from this project that affect this.
const bundleSize = getSize(`./tmp/proj/dist/apps/my-dir/${myapp}/main.js`);
console.log(`The current bundle size is ${bundleSize} KB`);
expect(bundleSize).toBeLessThanOrEqual(200000);
const es2015BundleSize = getSize(
`./tmp/proj/dist/apps/my-dir/${myapp}/main-es2015.js`
);
console.log(
`The current es2015 bundle size is ${es2015BundleSize / 1000} KB`
);
expect(es2015BundleSize).toBeLessThanOrEqual(150000);

const es5BundleSize = getSize(
`./tmp/proj/dist/apps/my-dir/${myapp}/main-es5.js`
);
console.log(`The current es5 bundle size is ${es5BundleSize / 1000} KB`);
expect(es5BundleSize).toBeLessThanOrEqual(175000);

// running tests for the app
expectTestsPass(
Expand Down
3 changes: 2 additions & 1 deletion e2e/schematics/ngrx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ describe('ngrx', () => {
`generate @nrwl/angular:ngrx flights --module=libs/${mylib}/src/lib/${mylib}.module.ts --facade`
);

expect(runCLI(`build ${myapp}`)).toContain('chunk {main} main.js,');
expect(runCLI(`build ${myapp}`)).toContain('chunk {main} main-es2015.js,');
expect(runCLI(`build ${myapp}`)).toContain('chunk {main} main-es5.js,');
expectTestsPass(await runCLIAsync(`test ${myapp} --no-watch`));
expectTestsPass(await runCLIAsync(`test ${mylib} --no-watch`));
}, 1000000);
Expand Down
2 changes: 1 addition & 1 deletion e2e/schematics/node.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function getData(): Promise<any> {
}

describe('Node Applications', () => {
xit('should be able to generate an express application', async done => {
it('should be able to generate an express application', async done => {
ensureProject();
const nodeapp = uniq('nodeapp');
runCLI(`generate @nrwl/express:app ${nodeapp}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"target": "es2015",
"types": []
},
"include": ["**/*.ts", "**/*.tsx"]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "<%= offsetFromRoot %>tsconfig.json",
"compilerOptions": {
"target": "es2015",
"types": []
},
"include": ["**/*.ts"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"target": "es2015",
"module": "esnext",
"typeRoots": ["node_modules/@types"],
"lib": ["es2017", "dom"],
Expand Down

0 comments on commit df23cba

Please sign in to comment.