Skip to content
This repository was archived by the owner on May 1, 2020. It is now read-only.

Commit fab1d48

Browse files
awebdeveloperdanbucholtz
authored andcommitted
refactor(config): use polyfill environment variable in copy config to make it easier to override
* Config for supporting polyfill * package.json config name change * copy spec change * Docs updated * feat(config) : Config for supporting polyfill * change log added * 1.3.8 * Revert "change log added" This reverts commit 20bcf13. * Revert "1.3.8" This reverts commit 34a2f52.
1 parent 54bf3f6 commit fab1d48

File tree

5 files changed

+9
-3
lines changed

5 files changed

+9
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ npm run build --rollup ./config/rollup.config.js
141141
| experimental babili | `ionic_use_experimental_babili` | `--useExperimentalBabili` | `null` | Set to `true` to use babili to minify es2015 code |
142142
| convert bundle to ES5 | `ionic_build_to_es5` | `--buildToEs5` | `true` | Convert bundle to ES5 for for production deployments |
143143
| default watch timeout | `ionic_start_watch_timeout` | `--startWatchTimeout` | `3000` | Milliseconds controlling the default watch timeout |
144+
| choose the polyfill | `ionic_polyfill_name` | `--polyfillName` | `polyfills` | Change with polyfills.modern or polyfills.ng (all options)[https://github.com/driftyco/ionic/tree/master/scripts/polyfill] |
144145
| enable linting | `enable_lint` | `--enableLint` | `true` | Set to `false` for skipping the linting after the build |
145146

146147

config/copy.config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@ module.exports = {
1515
dest: '{{WWW}}/assets/fonts'
1616
},
1717
copyPolyfills: {
18-
src: ['{{ROOT}}/node_modules/ionic-angular/polyfills/polyfills.js'],
18+
src: [`{{ROOT}}/node_modules/ionic-angular/polyfills/${process.env.POLLYFILL_NAME}.js`],
1919
dest: '{{BUILD}}'
2020
},
2121
copySwToolbox: {
2222
src: ['{{ROOT}}/node_modules/sw-toolbox/sw-toolbox.js'],
2323
dest: '{{BUILD}}'
2424
}
25-
}
25+
}

src/copy.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ describe('copy task', () => {
2222
dest: '{{WWW}}/assets/fonts'
2323
},
2424
copyPolyfills: {
25-
src: ['{{ROOT}}/node_modules/ionic-angular/polyfills/polyfills.js'],
25+
src: [`{{ROOT}}/node_modules/ionic-angular/polyfills/${process.env.POLLYFILL_NAME}.js`],
2626
dest: '{{BUILD}}'
2727
},
2828
someOtherOption: {

src/util/config.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,10 @@ export function generateContext(context?: BuildContext): BuildContext {
260260
setProcessEnvVar(Constants.ENV_NG_MODULE_FILE_NAME_SUFFIX, ngModuleFileNameSuffix);
261261
Logger.debug(`ngModuleFileNameSuffix set to ${ngModuleFileNameSuffix}`);
262262

263+
const polyfillName = getConfigValue(context, '--polyfillName', null, Constants.ENV_POLYFILL_NAME, Constants.ENV_POLYFILL_NAME.toLowerCase(), 'polyfills');
264+
setProcessEnvVar(Constants.ENV_POLYFILL_NAME, polyfillName);
265+
Logger.debug(`polyfillName set to ${polyfillName}`);
266+
263267
/* Provider Path Stuff */
264268
setProcessEnvVar(Constants.ENV_ACTION_SHEET_CONTROLLER_CLASSNAME, 'ActionSheetController');
265269
setProcessEnvVar(Constants.ENV_ACTION_SHEET_CONTROLLER_PATH, join(context.ionicAngularDir, 'components', 'action-sheet', 'action-sheet-controller.js'));

src/util/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const ENV_ENABLE_LINT = 'IONIC_ENABLE_LINT';
7272
export const ENV_DISABLE_LOGGING = 'IONIC_DISABLE_LOGGING';
7373
export const ENV_START_WATCH_TIMEOUT = 'IONIC_START_WATCH_TIMEOUT';
7474
export const ENV_NG_MODULE_FILE_NAME_SUFFIX = 'IONIC_NG_MODULE_FILENAME_SUFFIX';
75+
export const ENV_POLYFILL_NAME = 'IONIC_POLYFILL_NAME';
7576

7677
export const ENV_PRINT_ORIGINAL_DEPENDENCY_TREE = 'IONIC_PRINT_ORIGINAL_DEPENDENCY_TREE';
7778
export const ENV_PRINT_MODIFIED_DEPENDENCY_TREE = 'IONIC_PRINT_MODIFIED_DEPENDENCY_TREE';

0 commit comments

Comments
 (0)