<commit_before>﻿"use strict";

var gulp = require("gulp");
var path = require('path');

var compileTypescript = require('threax-gulp-tk/typescript.js');
var compileLess = require('threax-gulp-tk/less.js');
var copyFiles = require('threax-gulp-tk/copy.js');

var htmlRapierBuild = require(__dirname + '/node_modules/htmlrapier/build');
var htmlRapierWidgetsBuild = require(__dirname + '/node_modules/htmlrapier.widgets/build');
var htmlRapierBootstrapBuild = require(__dirname + '/node_modules/htmlrapier.bootstrap/build');

var webroot = __dirname + "/wwwroot";

gulp.task("default",function () {
    build();
});

gulp.task("debug",function () {
    build({
        minify:false
    });
});

function build(sharedSettings) {
    if (sharedSettings === undefined) {
        sharedSettings = {};
    }

    if (sharedSettings.minify === undefined) {
        sharedSettings.minify = true;
    }

    if (sharedSettings.concat === undefined) {
        sharedSettings.concat = true;
    }

    var libDir = webroot + "/lib";
    var viewBaseDir = webroot + "/edity";
    var editylibDir = viewBaseDir + "/lib";

    //Shared client side
    copyFiles({
        libs: ["./node_modules/jsns/jsns.js",
        ],
        baseName: './node_modules/jsns',
        dest: libDir
    });

    htmlRapierBuild(__dirname, libDir, sharedSettings);
    htmlRapierWidgetsBuild(__dirname, libDir, sharedSettings);
    htmlRapierBootstrapBuild(__dirname, libDir, sharedSettings);

    compileLess({
        files: [
        __dirname + '/Client/bootstrap/bootstrap-custom.less'
        ],
        dest: libDir + '/bootstrap/dist/css',
        importPaths: path.join(__dirname),
    });

    copyFiles({
        libs: ["./node_modules/bootstrap/dist/**/*",
               "!./node_modules/bootstrap/dist/css/**/*",
               "!./node_modules/bootstrap/dist/js/**/*"
        ],
        baseName: './node_modules',
        dest: libDir
    });

    compileLess({
        files: [
        __dirname + '/Client/edity/**/*.less'
        ],
        dest: libDir + '/edity',
        importPaths: path.join(__dirname),
    });

    //Compile widget typescript
    compileTypescript({
        libs: [
            __dirname + "/Client/Widgets/**/*.ts",
            "!**/*.intellisense.js"
        ],
        runners: false,
        dest: libDir + '/Widgets',
        sourceRoot: __dirname + "/Client/Widgets/",
        namespace: "edity.widgets",
        concat: false,
        minify: sharedSettings.minify
    });

    //Edity Editor Client Side
    copyFiles({
        libs: ["./node_modules/codemirror/lib/**/*",
               "./node_modules/codemirror/mode/xml/**/*",
               "./node_modules/codemirror/mode/javascript/**/*",
               "./node_modules/codemirror/mode/css/**/*",
               "./node_modules/codemirror/mode/htmlmixed/**/*",
               "./node_modules/codemirror/addon/merge/**/*" 
        ],
        baseName: './node_modules',
        dest: editylibDir
    });

    copyFiles({
        libs: ["./node_modules/ckeditor/ckeditor.js",
               "./node_modules/ckeditor/contents.css",
               "./node_modules/ckeditor/skins/moono/**/*",
               "./node_modules/ckeditor/lang/en.js",
               "./node_modules/ckeditor/plugins/*.png",
               "./node_modules/ckeditor/plugins/magicline/**/*",
               "./node_modules/ckeditor/plugins/colorbutton/**/*",
               "./node_modules/ckeditor/plugins/panelbutton/**/*",
               "./node_modules/ckeditor/plugins/floatpanel/**/*",
               "./node_modules/ckeditor/plugins/dialog/**/*",
               "./node_modules/ckeditor/plugins/specialchar/**/*",
               "./node_modules/ckeditor/plugins/clipboard/**/*",
               "./node_modules/ckeditor/plugins/link/**/*",
               "./node_modules/ckeditor/plugins/table/**/*",
               "./node_modules/ckeditor/plugins/pastefromword/**/*",
               "./node_modules/ckeditor/plugins/uploadwidget/**/*",
               "./node_modules/ckeditor/plugins/uploadimage/**/*",
               "./node_modules/ckeditor/plugins/notificationaggregator/**/*",
               "./node_modules/ckeditor/plugins/filetools/**/*",
               "./node_modules/ckeditor/plugins/widget/**/*",
               "./node_modules/ckeditor/plugins/lineutils/**/*",
               "./node_modules/ckeditor/plugins/notification/**/*",
               "./node_modules/ckeditor/plugins/image/**/*",
        ],
        baseName: './node_modules',
        dest: editylibDir
    });

    copyFiles({
        libs: ["./node_modules/ckeditor-youtube-plugin/youtube/**/*"],
        baseName: './node_modules/ckeditor-youtube-plugin',
        dest: editylibDir + "/ckeditor/plugins/"
    });

    copyFiles({
        libs: [
            "./Client/diff_match_patch/**/*",
            "./Client/ckeditor/**/*",
            "./Client/codemirror/**/*",<commit_msg>Removed copying ckeditors file upload.<commit_after>﻿"use strict";

var gulp = require("gulp");
var path = require('path');

var compileTypescript = require('threax-gulp-tk/typescript.js');
var compileLess = require('threax-gulp-tk/less.js');
var copyFiles = require('threax-gulp-tk/copy.js');

var htmlRapierBuild = require(__dirname + '/node_modules/htmlrapier/build');
var htmlRapierWidgetsBuild = require(__dirname + '/node_modules/htmlrapier.widgets/build');
var htmlRapierBootstrapBuild = require(__dirname + '/node_modules/htmlrapier.bootstrap/build');

var webroot = __dirname + "/wwwroot";

gulp.task("default",function () {
    build();
});

gulp.task("debug",function () {
    build({
        minify:false
    });
});

function build(sharedSettings) {
    if (sharedSettings === undefined) {
        sharedSettings = {};
    }

    if (sharedSettings.minify === undefined) {
        sharedSettings.minify = true;
    }

    if (sharedSettings.concat === undefined) {
        sharedSettings.concat = true;
    }

    var libDir = webroot + "/lib";
    var viewBaseDir = webroot + "/edity";
    var editylibDir = viewBaseDir + "/lib";

    //Shared client side
    copyFiles({
        libs: ["./node_modules/jsns/jsns.js",
        ],
        baseName: './node_modules/jsns',
        dest: libDir
    });

    htmlRapierBuild(__dirname, libDir, sharedSettings);
    htmlRapierWidgetsBuild(__dirname, libDir, sharedSettings);
    htmlRapierBootstrapBuild(__dirname, libDir, sharedSettings);

    compileLess({
        files: [
        __dirname + '/Client/bootstrap/bootstrap-custom.less'
        ],
        dest: libDir + '/bootstrap/dist/css',
        importPaths: path.join(__dirname),
    });

    copyFiles({
        libs: ["./node_modules/bootstrap/dist/**/*",
               "!./node_modules/bootstrap/dist/css/**/*",
               "!./node_modules/bootstrap/dist/js/**/*"
        ],
        baseName: './node_modules',
        dest: libDir
    });

    compileLess({
        files: [
        __dirname + '/Client/edity/**/*.less'
        ],
        dest: libDir + '/edity',
        importPaths: path.join(__dirname),
    });

    //Compile widget typescript
    compileTypescript({
        libs: [
            __dirname + "/Client/Widgets/**/*.ts",
            "!**/*.intellisense.js"
        ],
        runners: false,
        dest: libDir + '/Widgets',
        sourceRoot: __dirname + "/Client/Widgets/",
        namespace: "edity.widgets",
        concat: false,
        minify: sharedSettings.minify
    });

    //Edity Editor Client Side
    copyFiles({
        libs: ["./node_modules/codemirror/lib/**/*",
               "./node_modules/codemirror/mode/xml/**/*",
               "./node_modules/codemirror/mode/javascript/**/*",
               "./node_modules/codemirror/mode/css/**/*",
               "./node_modules/codemirror/mode/htmlmixed/**/*",
               "./node_modules/codemirror/addon/merge/**/*" 
        ],
        baseName: './node_modules',
        dest: editylibDir
    });

    copyFiles({
        libs: ["./node_modules/ckeditor/ckeditor.js",
               "./node_modules/ckeditor/contents.css",
               "./node_modules/ckeditor/skins/moono/**/*",
               "./node_modules/ckeditor/lang/en.js",
               "./node_modules/ckeditor/plugins/*.png",
               "./node_modules/ckeditor/plugins/magicline/**/*",
               "./node_modules/ckeditor/plugins/colorbutton/**/*",
               "./node_modules/ckeditor/plugins/panelbutton/**/*",
               "./node_modules/ckeditor/plugins/floatpanel/**/*",
               "./node_modules/ckeditor/plugins/dialog/**/*",
               "./node_modules/ckeditor/plugins/specialchar/**/*",
               "./node_modules/ckeditor/plugins/clipboard/**/*",
               "./node_modules/ckeditor/plugins/link/**/*",
               "./node_modules/ckeditor/plugins/table/**/*",
               "./node_modules/ckeditor/plugins/pastefromword/**/*",
               "./node_modules/ckeditor/plugins/uploadwidget/**/*",
               "./node_modules/ckeditor/plugins/notificationaggregator/**/*",
               "./node_modules/ckeditor/plugins/filetools/**/*",
               "./node_modules/ckeditor/plugins/widget/**/*",
               "./node_modules/ckeditor/plugins/lineutils/**/*",
               "./node_modules/ckeditor/plugins/notification/**/*",
               "./node_modules/ckeditor/plugins/image/**/*",
        ],
        baseName: './node_modules',
        dest: editylibDir
    });

    copyFiles({
        libs: ["./node_modules/ckeditor-youtube-plugin/youtube/**/*"],
        baseName: './node_modules/ckeditor-youtube-plugin',
        dest: editylibDir + "/ckeditor/plugins/"
    });

    copyFiles({
        libs: [
            "./Client/diff_match_patch/**/*",
            "./Client/ckeditor/**/*",
            "./Client/codemirror/**/*",
{'fraction_non_alphanumeric': 0.17345060339537738, 'fraction_numerical': 0.0, 'mean_word_length': 2.111358574610245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 2}, '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': '488094', 'n_tokens_mistral': 2905, 'n_tokens_neox': 2901, 'n_words': 386}