/* eslint no-console: off */
const ngrok = require('ngrok')
const browserSync = require('browser-sync')

const config = {
  port: 3219,
  server: './pkg/latest',
  files: './pkg/latest',
  directory: true,
  open: false,
}

browserSync(config, (error, bs) => {
  if (error) {
    throw new Error(error)
  }

  ngrok.connect(bs.options.get('port'), (error, url) => {
    if (error) {
      throw new Error(error)
    }

    console.log('Open in browser: ', url)
  })
})

@@ -96,16 +96,41 @@
 r-sync')
+%0Aconst fs = require('fs')
 %0A%0Aconst 
@@ -242,16 +242,255 @@
 lse,%0A%7D%0A%0A
+/**%0A * Save url generated by ngrok to file%0A * @param url%0A */%0Afunction saveUrl(url) %7B%0A  fs.writeFile('serve-url.log', url, error =%3E %7B%0A    if (error) %7B%0A      return console.log(error)%0A    %7D%0A%0A    console.log('serve-url.log updated!')%0A  %7D)%0A%7D%0A%0A
 browserS
@@ -668,32 +668,32 @@
 r(error)%0A    %7D%0A%0A
-
     console.log(
@@ -717,16 +717,34 @@
  ', url)
+%0A%0A    saveUrl(url)
 %0A  %7D)%0A%7D)

Save generated by ngrok url to serve-url.log