"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.readSourceFile = readSourceFile;
exports.getVersion = getVersion;
const schematics_1 = require("@angular-devkit/schematics");
function readSourceFile(tree, path) {
    const fileBuffer = tree.read(path);
    if (!fileBuffer) {
        throw new schematics_1.SchematicsException(`Could not find file for path: ${path}`);
    }
    const sourceText = fileBuffer.toString('utf8');
    if (!sourceText) {
        throw new schematics_1.SchematicsException(`Could not find file for path: ${path}`);
    }
    return JSON.parse(sourceText);
}
function getVersion(packageJSON) {
    return Number.parseInt(packageJSON.dependencies['@angular/core'].split('.')[0].replace(/\D/g, ''));
}
//# sourceMappingURL=helper.js.map