Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async getFrameworkVersion(): Promise {
const ionicVersionFilePath = path.resolve(await this.getDistDir(), 'lib', 'ionic', 'version.json'); // TODO
const bowerJsonPath = path.resolve(this.directory, 'bower.json');
try {
try {
const ionicVersionJson = await readJson(ionicVersionFilePath);
return ionicVersionJson['version'];
} catch (e) {
const bwr = await this.loadBowerJson();
const deps = lodash.assign({}, bwr.dependencies, bwr.devDependencies);
const ionicEntry = deps['ionic'];
if (!ionicEntry) {
return;
}
const m = ionicEntry.match(/.+#(.+)/);
if (m && m[1]) {
return m[1];
}
export async function readPackageJsonFile(p: string): Promise {
const packageJson = await readJson(p);
if (!isPackageJson(packageJson)) {
throw ERROR_INVALID_PACKAGE_JSON;
}
return packageJson;
}
export async function readUpdateConfig(dir: string): Promise {
return readJson(path.resolve(dir, UPDATE_CONFIG_FILE));
}
async function readBowerJsonFile(p: string): Promise {
const bowerJson = await readJson(p);
if (!isBowerJson(bowerJson)) {
throw ERROR_INVALID_BOWER_JSON;
}
return bowerJson;
}