Skip to content

Commit

Permalink
Merge pull request #729 from christophercr/feature/build-enhancements
Browse files Browse the repository at this point in the history
chore(stark-all): remove greenkeeper-lockfile and obsolete RxJS artifacts. Ban imports from '@angular/material' and 'lodash' root entry points
  • Loading branch information
christophercr committed Sep 28, 2018
2 parents 688111d + 82bf7ab commit 16b6869
Show file tree
Hide file tree
Showing 23 changed files with 169 additions and 202 deletions.
5 changes: 0 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ before_install:
- echo $AUTHOR_NAME
- export TZ=Europe/Brussels
- npm i -g npm@5.8.0
- npm i -g greenkeeper-lockfile@2.4.0
# This ensures that we are authenticated without requiring to have an actual .npmrc file within the project
- 'echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc'

Expand Down Expand Up @@ -44,9 +43,6 @@ cache:
directories:
- $HOME/.npm

before_script:
- greenkeeper-lockfile-update

# Not needed since we use Puppeteer in karma.conf.ci.js
# It downloads Chrome itself and works with or without Travis
#addons:
Expand All @@ -63,4 +59,3 @@ script:

after_success:
- npm run test:ci:coveralls:combined
- greenkeeper-lockfile-upload
68 changes: 37 additions & 31 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/rollup.config.common-data.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const globals = {
"@angular/material/button-toggle": "ngMaterial.buttonToggle",
"@angular/material/checkbox": "ngMaterial.checkbox",
"@angular/material/core": "ngMaterial.core",
"@angular/material/datepicker": "ngMaterial.datepicker",
"@angular/material/dialog": "ngMaterial.dialog",
"@angular/material/expansion": "ngMaterial.expansion",
"@angular/material/icon": "ngMaterial.icon",
Expand Down
18 changes: 0 additions & 18 deletions packages/stark-build/config/build-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,6 @@ function getEnvironmentFile(environment) {
}
}

/**
* Read the tsconfig to determine if we should prefer ES2015 modules.
* Load rxjs path aliases.
* https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#build-and-treeshaking
* @param shouldSupportES2015 - Set to true when the output of typescript is >= ES6
*/
function rxjsAlias(shouldSupportES2015) {
try {
const rxjsPathMappingImport = shouldSupportES2015 ? "rxjs/_esm2015/path-mapping" : "rxjs/_esm5/path-mapping";
const rxPaths = require(rxjsPathMappingImport);
return rxPaths();
} catch (e) {
console.warn(e);
return {};
}
}

/**
* Read the assets array in the angular.json file of each NationalBankBelgium package installed in node_modules and concatenate
* them into one single array that will be provided to the CopyWebpackPlugin.
Expand Down Expand Up @@ -232,6 +215,5 @@ exports.DEFAULT_METADATA = DEFAULT_METADATA;
exports.supportES2015 = supportES2015;
exports.readTsConfig = readTsConfig;
exports.getEnvironmentFile = getEnvironmentFile;
exports.rxjsAlias = rxjsAlias;
exports.getNbbAssetsConfig = getNbbAssetsConfig;
exports.getApplicationAssetsConfig = getApplicationAssetsConfig;
2 changes: 1 addition & 1 deletion packages/stark-build/config/tslint.json
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
}
],
"no-magic-numbers": false,
"import-blacklist": true,
"import-blacklist": [true, "@angular/material", "lodash"],
"ordered-imports": false,
"max-classes-per-file": false, // [true, 1],
"prefer-for-of": true,
Expand Down
23 changes: 1 addition & 22 deletions packages/stark-build/config/webpack.common.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,28 +126,7 @@ module.exports = options => {
/**
* An array of directory names to be resolved to the current directory
*/
modules: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot), helpers.root("node_modules")],

/**
* Add support for pipeable operators.
*
* For existing codebase a refactor is required.
* All rxjs operator imports (e.g. `import 'rxjs/add/operator/map'` or `import { map } from `rxjs/operator/map'`
* must change to `import { map } from 'rxjs/operators'` (note that all operators are now under that import.
* Additionally some operators have changed to to JS keyword constraints (do => tap, catch => catchError)
*
* Remember to use the `pipe()` method to chain operators, this functionally makes pipeable operators similar to
* the old operators usage paradigm.
*
* For more details see:
* https://github.com/ReactiveX/rxjs/blob/master/doc/pipeable-operators.md#build-and-treeshaking
*
* If you are not planning on refactoring your codebase (or not planning on using imports from `rxjs/operators`
* comment out this line.
*
* BE AWARE that not using pipeable operators will probably result in significant payload added to your bundle.
*/
alias: buildUtils.rxjsAlias(supportES2015)
modules: [helpers.root(buildUtils.ANGULAR_APP_CONFIG.sourceRoot), helpers.root("node_modules")]
},

optimization: {
Expand Down
Loading

0 comments on commit 16b6869

Please sign in to comment.