<commit_before>var wrench = require("wrench");
var fs     = require("fs");


module.exports = {
    /**
     * Symlinks the assets directory
     */
    symlink: function ()
    {
        if (fs.existsSync("web/assets"))
        {
            var stat = fs.lstatSync("web/assets");

            if (stat.isFile() || stat.isSymbolicLink())
            {
                fs.unlinkSync("web/assets");
            }
            else
            {
                wrench.rmdirSyncRecursive("web/assets");
            }
        }

        fs.symlinkSync("../public", "web/assets");
    },

    /**
     * Copies the assets directory
     */
    copy: function ()
    {
        wrench.copyDirSyncRecursive("public", "web/assets", {
            forceDelete: true
        });
    }
};
<commit_msg>First remove the already published assets dir<commit_after>var wrench = require("wrench");
var fs     = require("fs");

/**
 * Removes the existing directory
 */
function removeExisting ()
{
    if (fs.existsSync("web/assets"))
    {
        var stat = fs.lstatSync("web/assets");

        if (stat.isFile() || stat.isSymbolicLink())
        {
            fs.unlinkSync("web/assets");
        }
        else
        {
            wrench.rmdirSyncRecursive("web/assets");
        }
    }
}


module.exports = {
    /**
     * Symlinks the assets directory
     */
    symlink: function ()
    {
        removeExisting();

        fs.symlinkSync("../public", "web/assets");
    },


    /**
     * Copies the assets directory
     */
    copy: function ()
    {
        removeExisting();

        wrench.copyDirSyncRecursive("public", "web/assets", {
            forceDelete: true
        });
    }
};

{'fraction_non_alphanumeric': 0.14691943127962084, 'fraction_numerical': 0.0, 'mean_word_length': 1.6390625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5064633', 'n_tokens_mistral': 509, 'n_tokens_neox': 498, 'n_words': 86}