const path = require('path');
const vfs = require('vinyl-fs');
const through = require('through2');
const sassdoc = require('../src/sassdoc');

function inspect() {
  let count = 0;

  return through.obj((chunk, enc, cb) => {
    count++;
    cb(null, chunk);
  }, (cb) => {
    console.log(count);
    cb();
  });
}

function documentize() {
  return sassdoc('./test/data', { verbose: true })
    .then(() => {
      console.log('yeah!');
    });
}

function stream() {
  return vfs.src('./test/data/**/*.scss')
    .pipe(sassdoc({ verbose: true }))
    .pipe(inspect())
    .on('data', () => {});
}

(async function () {
  try {
    await documentize();
    stream();
  }
  catch (err) {
    console.error(err);
  }
}());

const path = require('path');
const chalk = require('chalk');
const vfs = require('vinyl-fs');
const through = require('through2');
const sassdoc = require('../src/sassdoc');

function devLog(...args) {
  args.unshift(chalk.styles.inverse.open)
  args.push(chalk.styles.inverse.close);
  console.log(...args);
  return this;
}

function inspect() {
  let count = 0;

  return through.obj((chunk, enc, cb) => {
    count++;
    cb(null, chunk);
  }, (cb) => {
    devLog(`develop:stream:count:${count}`);
    cb();
  });
}

function documentize() {
  return sassdoc('./test/data', { verbose: true })
    .then(() => {
      devLog('develop:documentize:end');
    });
}

function stream() {
  let parse = sassdoc({ verbose: true });

  vfs.src('./test/data/**/*.scss')
    .pipe(parse)
    .on('end', () => {
      devLog('develop:stream:end');
    })
    .pipe(inspect())
    .on('data', () => {});

  return parse.promise.then(() => {
    devLog('develop:stream:promise:end');
  });
}

(async function () {
  try {
    await documentize();
    await stream();
  }
  catch (err) {
    console.error(err);
  }
}());

Update `develop` helpers