scripts/prebuild.js
function createIndex() {
  var directory = 'src/views'
  var directories = fs.readdirSync(directory)

  try {
    var lines = ['// This is a generated file, do not edit, or disable "prebuild" command in package.json if you want to take control']
    for (var i = 0; i < directories.length; i++) {
      var path = directory + '/' + directories[i];
      if (fs.existsSync(path) && fs.lstatSync(path).isDirectory()) {
        var file = directories[i] + '.js'
        if (fs.existsSync(directory + '/' + directories[i] + '/' + file)) {
          lines.push('export { default as ' + directories[i] + ' } from \'./' + directories[i] + '/' + directories[i] + '\'')
        }
      }
    }

    fs.writeFileSync(directory + '/index.js', lines.join('\n') + '\n');
  } catch (err) {
    console.log(err)
  }
}
function createIndex() {
  var directory = 'src/views'
  var directories = fs.readdirSync(directory)

  try {
    var lines = ['// This is a generated file, do not edit, or disable "prebuild" command in package.json if you want to take control']
    for (var i = 0; i < directories.length; i++) {
      var path = directory + '/' + directories[i];
      if (fs.existsSync(path) && fs.lstatSync(path).isDirectory()) {
        var file = directories[i] + '.js'
        if (fs.existsSync(directory + '/' + directories[i] + '/' + file)) {
          lines.push('export { default as ' + directories[i] + ' } from \'./' + directories[i] + '/' + directories[i] + '\'')
        }
      }
    }

    fs.writeFileSync(directory + '/index.js', lines.join('\n') + '\n');
  } catch (err) {
    console.log(err)
  }
}
function createIndex ( ) { var directory = 'src/views' var directories = fs . readdirSync ( directory ) try { var lines = [ '// This is a generated file, do not edit, or disable "prebuild" command in package.json if you want to take control' ] for ( var i = 0 ; i < directories . length ; i ++ ) { var path = directory + '/' + directories [ i ] ; if ( fs . existsSync ( path ) && fs . lstatSync ( path ) . isDirectory ( ) ) { var file = directories [ i ] + '.js' if ( fs . existsSync ( directory + '/' + directories [ i ] + '/' + file ) ) { lines . push ( 'export { default as ' + directories [ i ] + ' } from \'./' + directories [ i ] + '/' + directories [ i ] + '\'' ) } } } fs . writeFileSync ( directory + '/index.js' , lines . join ( '\n' ) + '\n' ) ; } catch ( err ) { console . log ( err ) } }
Creates index file for views
Creates index file for views