How to use the pkg.builder function in pkg

To help you get started, we’ve selected a few pkg 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 michaelsbradleyjr / node-clojurescript / scripts / postinstall_build.js View on Github external
var fs   = require('fs');
var shell = require('shelljs');

var pkg  = path.join(path.dirname(fs.realpathSync(__filename)), '../');

var cljs = require(pkg);

var options = { path: ( pkg + 'support/cljs/postinstall_build.cljs' ) };
var outputDir = pkg + 'support/out';
shell.exec('mkdir -p ' + pkg + 'support/out', { silent: true });
var cljscOptions = '{:optimizations :simple :target :nodejs :pretty-print true :output-dir "' + outputDir + '"}';
var javaOptions = null;

try {
  var callback = function (err) { if (err) { throw err; } };
  cljs.build(options, cljs.builder, callback, cljscOptions, javaOptions);
} catch (error) {
  process.stdout.write('\nError: ' + error.message + '\n');
  process.exit(1);
}