"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.copyThemeFiles = exports.getDependencyPath = exports.buildFileTargetPath = void 0;
const tslib_1 = require("tslib");
const path_1 = tslib_1.__importDefault(require("path"));
const copyThemeFiles_1 = require("@vue-storefront/nuxt-theme/scripts/copyThemeFiles");
const getAllFilesFromDir_js_1 = tslib_1.__importDefault(require("@vue-storefront/nuxt-theme/scripts/getAllFilesFromDir.js"));
const fs_1 = tslib_1.__importDefault(require("fs"));
const buildFileTargetPath = (file, targetPath, chopPhrase) => targetPath + (file.replace(chopPhrase, ''));
exports.buildFileTargetPath = buildFileTargetPath;
const getDependencyPath = (themeName) => path_1.default.dirname(require.resolve(`@vue-storefront/${themeName}/package.json`));
exports.getDependencyPath = getDependencyPath;
const copyThemeFiles = (filesDir, targetPath, chopPhrase) => {
    if (fs_1.default.statSync(filesDir).isDirectory()) {
        return Promise.all(getAllFilesFromDir_js_1.default(filesDir).map(file => copyThemeFiles_1.copyFile(file, exports.buildFileTargetPath(file, targetPath, chopPhrase))));
    }
    return copyThemeFiles_1.copyFile(filesDir, exports.buildFileTargetPath(filesDir, targetPath, chopPhrase));
};
exports.copyThemeFiles = copyThemeFiles;
//# sourceMappingURL=helpers.js.map