All files index.js

0% Statements 0/23
0% Branches 0/8
0% Functions 0/1
0% Lines 0/23
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42                                                                                   
#! /usr/bin/env node
 
// bundle-components input/to/bundle/index.js -o path/to/dist/
//         optional [-s path/to/src/] (default src/)
//         optional [-a angular/dust]
//         optional [--cssScope "#catalog"]
 
const bundler = '[components:bundler]';
process.stdout.write(`${bundler} preparing a bundle\n`);
 
const {join} = require('path');
const webpack = require('webpack');
const argv = require('minimist')(process.argv.slice(2));
const createConfig = require('../webpack.bundler.config');
 
const input = join(process.cwd(), argv._[0]);
const dist = join(process.cwd(), argv.o);
const src = argv.s || 'src/';
const adapter = argv.a;
const cssScope = argv.cssScope;
 
process.stdout.write(`${bundler}    input: ${argv._[0]}\n`);
process.stdout.write(`${bundler}    output: ${argv.o}\n`);
process.stdout.write(`${bundler}    src: ${src}\n`);
process.stdout.write(adapter ? `${bundler} adapter: ${adapter}\n` : '');
process.stdout.write(cssScope ? `${bundler} cssScope: ${cssScope}\n` : '');
process.stdout.write(`${bundler} webpack is running...\n`);
 
const config = createConfig(src, input, dist, cssScope);
 
webpack(config, function(err, stats) {
  if (err) {
    process.stderr.write(err.stack);
    return;
  }
 
  process.stdout.write(`${bundler} ${stats.toString({
    chunks: false, // Makes the build much quieter
    colors: true
  })}`);
});