Sha256: f861b3c60cdf670d634f76e22abc3bb162f51bf7294de83aafadf586e87f9163

Contents?: true

Size: 967 Bytes

Versions: 4

Compression:

Stored size: 967 Bytes

Contents

var fs = require('fs');
var recursive = require('recursive-readdir');

var parse = require('csv-parse');
var csvAr;

var parser = parse({delimiter: ','}, function(err, data){
    csvAr = data;
});

fs.createReadStream(__dirname+'/topics.csv').pipe(parser);

recursive('manifests', function (err, files) {
  for (var i = files.length - 1; i >= 0; i--) {
    var fi = files[i];
    var data = fs.readFileSync(fi, 'utf8');
    var manifest = JSON.parse(data);
    var name = manifest.name;
    var sel = csvAr.filter(function(d) {
         return d[0] == name;
    })[0];

    if(!sel){
      console.log(fi);
    }
    var sel1 = sel;
    
    sel1 = sel.slice(1);
    for (var j = 0; j < sel1.length ; j++) {
       if(sel1[j] === ''){
         sel1 = sel1.slice(0,j);
         break;
       }
    }
    
    manifest.topics = sel1;
    var data1 = JSON.stringify(manifest, null, 2) + '\n';
    
    var fi2 = 'update_'+ fi;
    fs.writeFileSync(fi2, data1);
  }
});

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
inqlude-0.12.0 topics/Manifest_updater/app.js
inqlude-0.11.0 topics/Manifest_updater/app.js
inqlude-0.10.0 topics/Manifest_updater/app.js
inqlude-0.9.0 topics/Manifest_updater/app.js