"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.XplatNativeScriptHelpers = void 0;
const xplat_1 = require("@nstudio/xplat");
const xplat_utils_1 = require("@nstudio/xplat-utils");
const versions_1 = require("./versions");
var XplatNativeScriptHelpers;
(function (XplatNativeScriptHelpers) {
    function updateRootDeps(options) {
        return (tree, context) => {
            return xplat_1.XplatHelpers.updatePackageForXplat(options, {
                dependencies: {
                    '@nativescript/core': versions_1.nsCoreVersion,
                    'nativescript-theme-core': versions_1.nsThemeCoreVersion,
                },
                devDependencies: {
                    sass: versions_1.sassVersion,
                    '@nativescript/types': versions_1.nsCoreVersion,
                },
            })(tree, context);
        };
    }
    XplatNativeScriptHelpers.updateRootDeps = updateRootDeps;
    function addReferences() {
        return (tree) => {
            const filename = 'references.d.ts';
            if (!tree.exists(filename)) {
                // add references.d.ts
                tree.create(filename, `/// <reference path="./node_modules/@nativescript/types-ios/index.d.ts" />
/// <reference path="./node_modules/@nativescript/types-android/lib/android-29.d.ts" />
`);
            }
            return tree;
        };
    }
    XplatNativeScriptHelpers.addReferences = addReferences;
    function updatePrettierIgnore() {
        return xplat_1.XplatHelpers.updatePrettierIgnore(`\n
# xplat added rules
**/*.d.ts
**/apps/**/platforms/**/*
**/App_Resources/**/*
**/apps/nativescript*/hooks/**/*
**/apps/nativescript*/tools/**/*
**/apps/nativescript*/src/assets/*.min.css
**/apps/*nativescript/hooks/**/*
**/apps/*nativescript/tools/**/*
**/apps/*nativescript/src/assets/*.css
**/libs/xplat/nativescript/scss/src/lib/fonticons/*.css
**/libs/xplat/nativescript*/plugins/**/*`, '**/libs/xplat/nativescript/scss/src/lib/fonticons/*.css');
    }
    XplatNativeScriptHelpers.updatePrettierIgnore = updatePrettierIgnore;
    function updateGitIgnore() {
        return (tree) => {
            const gitIgnorePath = '.gitignore';
            let gitIgnore = tree.get(gitIgnorePath).content.toString();
            if (gitIgnore) {
                if (gitIgnore.indexOf('# nativescript') === -1) {
                    gitIgnore += `
# nativescript
hooks
      `;
                }
            }
            return xplat_utils_1.updateFile(tree, gitIgnorePath, gitIgnore);
        };
    }
    XplatNativeScriptHelpers.updateGitIgnore = updateGitIgnore;
})(XplatNativeScriptHelpers = exports.XplatNativeScriptHelpers || (exports.XplatNativeScriptHelpers = {}));
