1
0
Fork 0
mirror of https://github.com/anyproto/anytype-ts.git synced 2025-06-08 05:57:02 +09:00
anytype-ts/save-node-deps.js
Andrew Simachev cf2c9d2174 fix
2021-06-15 18:22:09 +03:00

32 lines
No EOL
721 B
JavaScript

'use strict';
const fs = require('fs');
let stdin = process.openStdin();
let data = "";
stdin.on('data', function(chunk) {
data +=chunk;
});
stdin.on('end', function() {
let lines = data.split('\n').sort();
let baseDepsFile = fs.readFileSync('package.deps.json');
let baseDepsJSON = JSON.parse(baseDepsFile);
let packageFile = fs.readFileSync('package.json');
let packageJSON = JSON.parse(packageFile);
lines = [ ...new Set(lines) ];
lines = lines.filter(function (el) {
return el != "";
}).map((it) => {
return {
from: it,
to: it,
};
});
packageJSON.build.files = baseDepsJSON.concat(lines);
let jsonS = JSON.stringify(packageJSON, null, '\t');
fs.writeFileSync('package.json', jsonS);
});