<commit_before>DryIce
======

DryIce is a CommonJS/RequireJS packaging tool for browser scripts, initially
targeting the Skywriter/Ace project.

It is basically just a copy function. It takes input from a set of input files,
which can be specified in various ways, optionally filters them and outputs them
to something else.

DryIce is licensed under your choice of Mozilla Public License, GNU General
Public License or GNU Lesser General Public License (MPL/GPL/LGPL tri-license).


Why?
----

RequireJS has a build tool which is nice and works well, but it requires Rhino
and therefore Java. With DryIce, your whole build process can be in JavaScript.

DryIce produces a single file output that can include binary files (by base64
encoding them)


How to install DryIce
---------------------

    sudo npm install dryice


How does it work?
-----------------

To copy a single file:

    copy({
      source: 'foo.txt',
      dest: 'bar.txt'
    });

To cat a bunch of files together:

    copy({
      source: [ 'file1.js', 'file2.js' ],
      dest: 'output.js'
    });

To cat together all the files in a directory:

    copy({
      source: { root:'src' },
      dest: 'built.js'
    });

As above, but only use the JavaScript files:

    copy({
      source: { root:'src', include:/.*\.js$/ },
      dest: 'built.js'
    });

As above, but exclude tests:

    copy({
      source: { root:'src', include:/.*\.js$/: exclude:/test/ },
      dest: 'built.js'
    });

If your set of files is very custom:

    copy({
      source: function() {
        var files = [ 'file1.js' ];
        if (baz) files.push('file2.js');
        return files;
      },
      dest: 'built.js'
    });

We can filter the files on the way:

    copy({
      source: /src/.*\.js$/,
      filter: copy.filter.uglify,
      dest: 'built.js'
    });

This includes running multiple custom filters:

    copy({
      source: 'src/index.html',
      filter: [
        function(data) {
          return data.replace(/Sun/, 'Oracle');
        },
        htmlCompressor
      ],
      dest: 'war/index.html'
    });

Results can be stored and then used/reused:

    var sources = copy.createDataObject();
    copy({
      source: { root: 'src1' },
      dest: sources
    });
    copy({
      source: { root: 'src2' },
      dest: sources
    });
    copy({
      source: sources,
      dest: 'sources-uncompressed.js'
    });
    copy({
      source: sources,
      filter: copy.filter.uglify,
      dest: 'sources.js'
    });

Data objects are just JS objects with a 'value' member, so you can do all sorts
of things with them:

    var test = copy.createDataObject();
    copy({
      source: 'README.txt',
      dest: test
    });
    console.log(test.value);
<commit_msg>Fix typos in code sample of the README on calling uglifyjs filter<commit_after>DryIce
======

DryIce is a CommonJS/RequireJS packaging tool for browser scripts, initially
targeting the Skywriter/Ace project.

It is basically just a copy function. It takes input from a set of input files,
which can be specified in various ways, optionally filters them and outputs them
to something else.

DryIce is licensed under your choice of Mozilla Public License, GNU General
Public License or GNU Lesser General Public License (MPL/GPL/LGPL tri-license).


Why?
----

RequireJS has a build tool which is nice and works well, but it requires Rhino
and therefore Java. With DryIce, your whole build process can be in JavaScript.

DryIce produces a single file output that can include binary files (by base64
encoding them)


How to install DryIce
---------------------

    sudo npm install dryice


How does it work?
-----------------

To copy a single file:

    copy({
      source: 'foo.txt',
      dest: 'bar.txt'
    });

To cat a bunch of files together:

    copy({
      source: [ 'file1.js', 'file2.js' ],
      dest: 'output.js'
    });

To cat together all the files in a directory:

    copy({
      source: { root:'src' },
      dest: 'built.js'
    });

As above, but only use the JavaScript files:

    copy({
      source: { root:'src', include:/.*\.js$/ },
      dest: 'built.js'
    });

As above, but exclude tests:

    copy({
      source: { root:'src', include:/.*\.js$/: exclude:/test/ },
      dest: 'built.js'
    });

If your set of files is very custom:

    copy({
      source: function() {
        var files = [ 'file1.js' ];
        if (baz) files.push('file2.js');
        return files;
      },
      dest: 'built.js'
    });

We can filter the files on the way:

    copy({
      source: /src/.*\.js$/,
      filter: copy.filter.uglifyjs,
      dest: 'built.js'
    });

This includes running multiple custom filters:

    copy({
      source: 'src/index.html',
      filter: [
        function(data) {
          return data.replace(/Sun/, 'Oracle');
        },
        htmlCompressor
      ],
      dest: 'war/index.html'
    });

Results can be stored and then used/reused:

    var sources = copy.createDataObject();
    copy({
      source: { root: 'src1' },
      dest: sources
    });
    copy({
      source: { root: 'src2' },
      dest: sources
    });
    copy({
      source: sources,
      dest: 'sources-uncompressed.js'
    });
    copy({
      source: sources,
      filter: copy.filter.uglifyjs,
      dest: 'sources.js'
    });

Data objects are just JS objects with a 'value' member, so you can do all sorts
of things with them:

    var test = copy.createDataObject();
    copy({
      source: 'README.txt',
      dest: test
    });
    console.log(test.value);

{'fraction_non_alphanumeric': 0.1303564998199496, 'fraction_numerical': 0.0028808066258552397, 'mean_word_length': 2.2676470588235293, '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': '6997787', 'n_tokens_mistral': 1721, 'n_tokens_neox': 1648, 'n_words': 619}