<commit_before>'use strict';

function branchDocumentationTasks(packageInfo, target) {
    target = target || packageInfo.version;
    const path = `doc/generated/versions/${target}`;
    return {
        jsdoc: {
            src: ['lib/'],
            options: {
                configure: 'doc/jsdoc.json',
                recurse: true,
                encoding: 'utf8',
                destination: path,
                package: 'package.json',
                template : 'node_modules/ink-docstrap/template',
                readme: 'README.md'
            }
        },
        pages: {
            options: {
                base: 'doc/generated',
                only: ['doc/generated', '!doc/generated/versions', path]
            },
            src: ['**']
        },
        copy: {
            cwd: `${path}/${packageInfo.name}/${packageInfo.version}`,
            expand: true,
            src: "**",
            dest: path,
        },
        clean: ['doc/placeholder.jsdoc', `${path}/${packageInfo.name}/`],
    };
}

module.exports = function(grunt) {
    const packageInfo = grunt.file.readJSON('package.json');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-jsdoc');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-touch');
    grunt.loadNpmTasks('grunt-gh-pages');
    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.initConfig({
        pkg: packageInfo,
        clean: {
          'doc-all': ['doc/generated'],
          'doc-current-version': branchDocumentationTasks(packageInfo).clean,
          'doc-master':  branchDocumentationTasks(packageInfo, 'master').clean,<commit_msg>Stop clobbing other versions' documentation in pages<commit_after>'use strict';

function branchDocumentationTasks(packageInfo, target) {
    target = target || packageInfo.version;
    const path = `doc/generated/versions/${target}`;
    return {
        jsdoc: {
            src: ['lib/'],
            options: {
                configure: 'doc/jsdoc.json',
                recurse: true,
                encoding: 'utf8',
                destination: path,
                package: 'package.json',
                template : 'node_modules/ink-docstrap/template',
                readme: 'README.md'
            }
        },
        pages: {
            options: {
                base: 'doc/generated',
                add: true
            },
            src: ['**']
        },
        copy: {
            cwd: `${path}/${packageInfo.name}/${packageInfo.version}`,
            expand: true,
            src: "**",
            dest: path,
        },
        clean: ['doc/placeholder.jsdoc', `${path}/${packageInfo.name}/`],
    };
}

module.exports = function(grunt) {
    const packageInfo = grunt.file.readJSON('package.json');
    grunt.loadNpmTasks('grunt-mocha-test');
    grunt.loadNpmTasks('grunt-jsdoc');
    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-touch');
    grunt.loadNpmTasks('grunt-gh-pages');
    grunt.loadNpmTasks('grunt-contrib-copy');

    grunt.initConfig({
        pkg: packageInfo,
        clean: {
          'doc-all': ['doc/generated'],
          'doc-current-version': branchDocumentationTasks(packageInfo).clean,
          'doc-master':  branchDocumentationTasks(packageInfo, 'master').clean,
{'fraction_non_alphanumeric': 0.14987937273823884, 'fraction_numerical': 0.0006031363088057901, 'mean_word_length': 1.9250440917107583, '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': '1007840', 'n_tokens_mistral': 976, 'n_tokens_neox': 961, 'n_words': 147}