How to use the just-task.logger.verbose function in just-task

To help you get started, we’ve selected a few just-task examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github OfficeDev / office-ui-fabric-react / scripts / tasks / build-codepen-examples.js View on Github external
function transformFile(file, callback) {
  if (readFileStart(file, 150).includes('@codepen')) {
    let fileSource = fs.readFileSync(file).toString();
    const exampleName = path.basename(file, '.tsx');

    // extract the name of the component (relies on component/examples/examplefile.tsx structure)
    const transformResult = transformer(fileSource);
    const dirPath = path.dirname(path.dirname(file)).replace(/((\b)src(\b))(?!.*\1)/, '$2lib/codepen$3');

    if (!fs.existsSync(dirPath)) {
      fs.mkdirpSync(dirPath);
    }

    const outPath = path.join(dirPath, exampleName + '.Codepen.txt');
    logger.verbose('Writing codepen: ' + outPath);
    fs.writeFileSync(outPath, transformResult);
  }

  callback();
}