function buildSettingsTemplatesArchive() {
  // create a file to stream archive data to.
  const output = fs.createWriteStream(
    `${__dirname}/settings-templates/settings-templates.zip`
  )

  const archive = archiver('zip')

  archive.pipe(output)

  // listen for all archive data to be written
  // 'close' event is fired only when a file descriptor is involved
  output.on('close', () => {
    console.log(`${archive.pointer()} total bytes`)
    console.log(
      'archiver has been finalized and the output file descriptor has closed.'
    )
  })

  // good practice to catch warnings (ie stat failures and other non-blocking errors)
  archive.on('warning', (err) => {
    if (err.code === 'ENOENT') {
      console.log(err)
    } else {
      // throw error
      throw err
    }
  })

  // good practice to catch this error explicitly
  archive.on('error', (err) => {
    throw err
  })

  // append a file
  archive.file('settings-templates/_color-palette.scss', {
    name: 'settings-templates/_color-palette.scss',
  })

  archive.file('settings-templates/_harmonium-settings.scss', {
    name: 'settings-templates/_harmonium-settings.scss',
  })

  archive.file('settings-templates/_harmonium-component-settings.scss', {
    name: 'settings-templates/_harmonium-component-settings.scss',
  })

  archive.file('settings-templates/harmonium-tokens.js', {
    name: 'settings-templates/harmonium-tokens.js',
  })

  archive.finalize()
}
/**
 * Generates our settings-templates zip file
 * @returns {void}
 */
Generates our settings-templates zip file
@returns {void}
Generates our settings - templates zip file @returns { void }
function buildSettingsTemplatesArchive() {
  const output = fs.createWriteStream(
    `${__dirname}/settings-templates/settings-templates.zip`
  )
  const archive = archiver('zip')
  archive.pipe(output)
  output.on('close', () => {
    console.log(`${archive.pointer()} total bytes`)
    console.log(
      'archiver has been finalized and the output file descriptor has closed.'
    )
  })
  archive.on('warning', (err) => {
    if (err.code === 'ENOENT') {
      console.log(err)
    } else {
      throw err
    }
  })
  archive.on('error', (err) => {
    throw err
  })
  archive.file('settings-templates/_color-palette.scss', {
    name: 'settings-templates/_color-palette.scss',
  })
  archive.file('settings-templates/_harmonium-settings.scss', {
    name: 'settings-templates/_harmonium-settings.scss',
  })
  archive.file('settings-templates/_harmonium-component-settings.scss', {
    name: 'settings-templates/_harmonium-component-settings.scss',
  })
  archive.file('settings-templates/harmonium-tokens.js', {
    name: 'settings-templates/harmonium-tokens.js',
  })
  archive.finalize()
}
function buildSettingsTemplatesArchive ( ) { const output = fs . createWriteStream ( ` ${ __dirname } ` ) const archive = archiver ( 'zip' ) archive . pipe ( output ) output . on ( 'close' , ( ) => { console . log ( ` ${ archive . pointer ( ) } ` ) console . log ( 'archiver has been finalized and the output file descriptor has closed.' ) } ) archive . on ( 'warning' , ( err ) => { if ( err . code === 'ENOENT' ) { console . log ( err ) } else { throw err } } ) archive . on ( 'error' , ( err ) => { throw err } ) archive . file ( 'settings-templates/_color-palette.scss' , { name : 'settings-templates/_color-palette.scss' , } ) archive . file ( 'settings-templates/_harmonium-settings.scss' , { name : 'settings-templates/_harmonium-settings.scss' , } ) archive . file ( 'settings-templates/_harmonium-component-settings.scss' , { name : 'settings-templates/_harmonium-component-settings.scss' , } ) archive . file ( 'settings-templates/harmonium-tokens.js' , { name : 'settings-templates/harmonium-tokens.js' , } ) archive . finalize ( ) }
Generates our settings-templates zip file
 @returns {void}
Generates our settings - templates zip file @returns { void }
// create a file to stream archive data to. // listen for all archive data to be written // 'close' event is fired only when a file descriptor is involved // good practice to catch warnings (ie stat failures and other non-blocking errors) // throw error // good practice to catch this error explicitly // append a file