haul icon indicating copy to clipboard operation
haul copied to clipboard

Node API

Open zamotany opened this issue 6 years ago • 3 comments

To use the Node API, you need to create a compiler:

// Spawn a worker with the specified options.
const compiler = Haul.create({
  platform: 'android',
  context: process.cwd(),
  production: false,
  minify: false,
  bundle: false,
  port: 3021,
  config: require('./haul.config.js'),
});

// Trigger a build
compiler.build()
  .map(result => match (result.type) {
    'success': `Bundle built in ${result.duration}`,
    'error': `Failed to build bundle`,
    else: null,
  })
  .filter(Boolean)
  .subscribe(console.log);

// Symbolicate
compiler.symbolicate(frames)
  .subscribe(result => console.log(result.stack));

// Kill the server and cleanup
compiler.destroy();

This issue assumes that #287 is done.

zamotany avatar Jan 10 '18 11:01 zamotany

What were you thinking the watch api would look like?

kcjonson avatar Jan 24 '18 00:01 kcjonson

@zamotany Now that #287 (#339) is done. Is something like this possible? There doesn't seem to be the necessary exports in order to achieve the above

aaronschubert0 avatar Jun 20 '18 11:06 aaronschubert0

@aaronschubert0 It's possible to start implementing this API because we've rebuilt the internals as part #287. This is just a proposal, yet accepted and we want to have this feature.

jukben avatar Jul 09 '18 20:07 jukben