sourceset

Utility for generating sourcesets.

Usage no npm install needed!

<script type="module">
  import sourceset from 'https://cdn.skypack.dev/sourceset';
</script>

README

Sourceset

Sourceset is a small utility for generated sourcesets in Node. Some plugins, like those for Grunt, don't include expanders or sourceset generators. Instead of having to manually map out each and every file while creating your app, sourceset will expand the directories and generate the sourceset for you.

Installation

npm install sourceset

Usage

var sourceset = require('sourceset');
...
babel: {
    dist: {
        files: sourceset({
            files: ['../lib/your-file.js', 'somewhere/*.js'],
            src: 'some-dir',
            dest: 'somewhere/dest-dir'
        })
    }
}
...

// This will generate:
//{
//    '{CWD}/somewhere/dest-dir/lib/your-file.js' : '{CWD}/lib/your-file.js',
//    '{CWD}/somewhere/dest-dir/somewhere/one.js' : '{CWD}/some-dir/somewhere/one.js',
//    '{CWD}/somewhere/dest-dir/somewhere/two.js' : '{CWD}/some-dir/somewhere/two.js',
//}

The default value for src is just the current working directory while the default for dest is the current working directory appended by /tmp/.