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

Commit 700ca04

Browse files
committed
fix(config): only read ionic-angular package json for version info in apps, not in the Ionic repo itself
1 parent 0e90965 commit 700ca04

File tree

4 files changed

+14
-11
lines changed

4 files changed

+14
-11
lines changed

src/build/util.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getTsConfigAsync, TsConfig } from '../transpile';
44
import * as Constants from '../util/constants';
55
import { BuildError } from '../util/errors';
66
import { GlobResult, globAll } from '../util/glob-util';
7-
import { getStringPropertyValue, readFileAsync, readJsonAsync, semverStringToObject } from '../util/helpers';
7+
import { getBooleanPropertyValue, getStringPropertyValue, readFileAsync, readJsonAsync, semverStringToObject } from '../util/helpers';
88
import { BuildContext, } from '../util/interfaces';
99

1010
export function scanSrcTsFiles(context: BuildContext) {
@@ -77,13 +77,18 @@ export async function readVersionOfDependencies(context: BuildContext) {
7777
// read the package.json version from ionic, angular/core, and typescript
7878
const promises: Promise<any>[] = [];
7979
promises.push(readPackageVersion(context.angularCoreDir));
80-
promises.push(readPackageVersion(context.ionicAngularDir));
80+
if (!getBooleanPropertyValue(Constants.ENV_SKIP_IONIC_ANGULAR_VERSION)) {
81+
promises.push(readPackageVersion(context.ionicAngularDir));
82+
}
8183
promises.push(readPackageVersion(context.typescriptDir));
8284

8385
const versions = await Promise.all(promises);
8486
context.angularVersion = semverStringToObject(versions[0]);
85-
context.ionicAngularVersion = semverStringToObject(versions[1]);
86-
context.typescriptVersion = semverStringToObject(versions[2]);
87+
if (!getBooleanPropertyValue(Constants.ENV_SKIP_IONIC_ANGULAR_VERSION)) {
88+
context.ionicAngularVersion = semverStringToObject(versions[1]);
89+
}
90+
// index could be 1 or 2 depending on if you read ionic-angular, its always the last one bro
91+
context.typescriptVersion = semverStringToObject(versions[versions.length - 1]);
8792
}
8893

8994
export async function readPackageVersion(packageDir: string) {

src/util/config.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ describe('config', () => {
165165
expect(fakeConfig[Constants.ENV_TOAST_COMPONENT_FACTORY_PATH]).toEqual(join(context.ionicAngularDir, 'components', 'toast', 'toast-component.ngfactory.js'));
166166

167167
expect(fakeConfig[Constants.ENV_PARSE_DEEPLINKS]).toBeTruthy();
168-
expect(fakeConfig[Constants.ENV_BUILD_TO_ES5]).toEqual('true');
168+
expect(fakeConfig[Constants.ENV_SKIP_IONIC_ANGULAR_VERSION]).toEqual('false');
169169
expect(context.bundler).toEqual('webpack');
170170
});
171171

src/util/config.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,10 @@ export function generateContext(context?: BuildContext): BuildContext {
350350
setProcessEnvVar(Constants.ENV_PARSE_DEEPLINKS, parseDeepLinks);
351351
Logger.debug(`parseDeepLinks set to ${parseDeepLinks}`);
352352

353-
// default stand-alone builds to default to es5
354-
// if closure is being used, don't worry about this as it already automatically converts to ES5
353+
const skipReadIonicAngular = getConfigValue(context, '--skipIonicAngularVersion', null, Constants.ENV_SKIP_IONIC_ANGULAR_VERSION, Constants.ENV_SKIP_IONIC_ANGULAR_VERSION.toLowerCase(), 'false');
354+
setProcessEnvVar(Constants.ENV_SKIP_IONIC_ANGULAR_VERSION, skipReadIonicAngular);
355+
Logger.debug(`skipReadIonicAngular set to ${skipReadIonicAngular}`);
355356

356-
const buildToEs5 = getConfigValue(context, '--buildToEs5', null, Constants.ENV_BUILD_TO_ES5, Constants.ENV_BUILD_TO_ES5.toLowerCase(), 'true');
357-
setProcessEnvVar(Constants.ENV_BUILD_TO_ES5, buildToEs5);
358-
Logger.debug(`buildToEs5 set to ${buildToEs5}`);
359357

360358
if (!isValidBundler(context.bundler)) {
361359
context.bundler = bundlerStrategy(context);

src/util/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,6 @@ export const ENV_CACHE_LOADER = 'IONIC_CACHE_LOADER';
8383
export const ENV_AOT_WRITE_TO_DISK = 'IONIC_AOT_WRITE_TO_DISK';
8484
export const ENV_BAIL_ON_LINT_ERROR = 'IONIC_BAIL_ON_LINT_ERROR';
8585
export const ENV_TYPE_CHECK_ON_LINT = 'IONIC_TYPE_CHECK_ON_LINT';
86-
export const ENV_BUILD_TO_ES5 = 'IONIC_BUILD_TO_ES5';
8786
export const ENV_ENABLE_LINT = 'IONIC_ENABLE_LINT';
8887
export const ENV_DISABLE_LOGGING = 'IONIC_DISABLE_LOGGING';
8988
export const ENV_START_WATCH_TIMEOUT = 'IONIC_START_WATCH_TIMEOUT';
@@ -92,6 +91,7 @@ export const ENV_POLYFILL_FILE_NAME = 'IONIC_POLYFILL_FILE_NAME';
9291
export const ENV_PRINT_WEBPACK_DEPENDENCY_TREE = 'IONIC_PRINT_WEBPACK_DEPENDENCY_TREE';
9392
export const ENV_PARSE_DEEPLINKS = 'IONIC_PARSE_DEEPLINKS';
9493
export const ENV_PURGE_UNUSED_FONTS = 'IONIC_PURGE_UNUSED_FONTS';
94+
export const ENV_SKIP_IONIC_ANGULAR_VERSION = 'IONIC_SKIP_IONIC_ANGULAR_VERSION';
9595

9696

9797
/* Providers */

0 commit comments

Comments
 (0)