"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const dependencies_1 = require("@schematics/angular/utility/dependencies");
function addPackageDependecies(tree, deps) {
    // let pkgFileBuffer: Buffer | null = tree.read(packagePath);
    // if (!pkgFileBuffer){
    //   throw new SchematicsException(`No package.json file in current directory`);
    // }
    // let packageInfo = JSON.parse(pkgFileBuffer.toString());
    for (let dep of deps) {
        // if (packageInfo['dependencies'][dep]){
        //   console.log(`Dependency already here: ${dep}`)
        // }
        // else {
        //   console.log(`Added dep: ${dep}`)
        //   packageInfo['dependencies'][dep] = '@latest';
        // }
        dependencies_1.addPackageJsonDependency(tree, typeof dep === "string" ? {
            name: dep,
            overwrite: false,
            type: dependencies_1.NodeDependencyType.Default,
            version: 'latest'
        } : dep);
    }
    // tree.overwrite(packagePath, Buffer.from(JSON.stringify(packageInfo, null, 4)));
}
exports.addPackageDependecies = addPackageDependecies;
//# sourceMappingURL=dependencies.js.map