<commit_before>﻿var mv = require('mv');
var replace = require('replace-in-file');
var find = require('find-in-files');

function copyAndReplace(name) {
    var fromName = `./src/app/${name}/${name}.component.alt.css`;
    var tempName = `./src/app/${name}/${name}.component.temp.css`;
    var toName = `./src/app/${name}/${name}.component.css`;
    mv(toName, tempName, { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
    mv(fromName, toName, { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
    mv(tempName, fromName, { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
}

function copyAndReplaceAll(names) {
    for (name of names) {
        copyAndReplace(name);
    }
}

let names = ["action", "actions", "application-properties", "attachment", "attachment-property", "button", "buttons",
    "cicero", "collection", "collections", "dialog", "dynamic-error", "dynamic-list", "dynamic-object", "edit-parameter",
    "edit-property", "error", "footer", "home", "list", "menu", "menus", "multi-line-dialog", "object", "parameters",
    "properties", "recent"]

copyAndReplaceAll(names);

mv("./src/styles.css", "./src/styles.temp.css", { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
mv("./src/styles.alt.css", "./src/styles.css", { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
mv("./src/styles.temp.css", "./src/styles.alt.css", { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });

// to update package name 
var optionsToAlt = {
    files: ["./package.json"],
    from: [/nakedobjects.spa/g],
    to: "nakedobjects.alt.spa"
};

var optionsFromAlt = {
    files: ["./package.json"],
    from: [/nakedobjects.alt.spa/g],
    to: "nakedobjects.spa"
};

find.findSync("name", ".", "package.json").then(s => {

    try {
        var nameLine = s["package.json"].line[0];
        var nameSplit = nameLine.split('"');
        var name = nameSplit[3];

        var newName = name.indexOf("alt") >= 0 ? "nakedobjects.spa" : "nakedobjects.alt.spa";

        var regex = new RegExp(name, "g");

        var options = {
            files: ["package.json"],
            from: regex,
            to: newName
        };
<commit_msg>move packaging<commit_after>﻿var mv = require('mv');
var replace = require('replace-in-file');
var find = require('find-in-files');

function copyAndReplace(name) {
    var fromName = `./src/app/${name}/${name}.component.alt.css`;
    var tempName = `./src/app/${name}/${name}.component.temp.css`;
    var toName = `./src/app/${name}/${name}.component.css`;
    mv(toName, tempName, { clobber: false, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
    mv(fromName, toName, { clobber: false, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
    mv(tempName, fromName, { clobber: false, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
}

function copyAndReplaceAll(names) {
    for (name of names) {
        copyAndReplace(name);
    }
}

let names = ["action", "actions", "application-properties", "attachment", "attachment-property", "button", "buttons",
    "cicero", "collection", "collections", "dialog", "dynamic-error", "dynamic-list", "dynamic-object", "edit-parameter",
    "edit-property", "error", "footer", "home", "list", "menu", "menus", "multi-line-dialog", "object", "parameters",
    "properties", "recent"]

copyAndReplaceAll(names);

mv("./src/styles.css", "./src/styles.temp.css", { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
mv("./src/styles.alt.css", "./src/styles.css", { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });
mv("./src/styles.temp.css", "./src/styles.alt.css", { clobber: true, mkdirp: false }, function (err) { if (err) console.error('Error occurred:', err); });

// to update package name 
var optionsToAlt = {
    files: ["./package.json"],
    from: [/nakedobjects.spa/g],
    to: "nakedobjects.alt.spa"
};

find.findSync("name", ".", "package.json").then(s => {

    try {
        var nameLine = s["package.json"].line[0];
        var nameSplit = nameLine.split('"');
        var name = nameSplit[3];

        var newName = name.indexOf("alt") >= 0 ? "nakedobjects.spa" : "nakedobjects.alt.spa";

        var regex = new RegExp(name, "g");

        var options = {
            files: ["package.json"],
            from: regex,
            to: newName
        };

{'fraction_non_alphanumeric': 0.20919009651699538, 'fraction_numerical': 0.001258917331095258, 'mean_word_length': 3.6281553398058253, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '2248731', 'n_tokens_mistral': 1604, 'n_tokens_neox': 1591, 'n_words': 365}