-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
33 lines (24 loc) · 981 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* global process require */
const https = require('https');
const fs = require('fs');
const tag = process.argv[2];
if (typeof tag == 'undefined') {
throw "No tag specified as argument!";
}
console.log('TAG: ', tag);
const file = fs.createWriteStream("packages.json");
const packagesURL = 'https://raw.githubusercontent.com/purescript/package-sets/' + tag + '/packages.json';
const request = https.get(packagesURL, function(response) {
response.pipe(file);
file.on('finish', () => {
const allPackages = require('./packages.json');
const spagoDhall = (
'{ sources = [ "src/**/*.purs", "test/**/*.purs" ], \
name = "install-everything", \
dependencies = ' + JSON.stringify(Object.keys(allPackages)) +
', packages = ./packages.dhall }'
);
fs.writeFileSync('spago.dhall', spagoDhall);
fs.writeFileSync('packages.dhall', 'https://github.com/purescript/package-sets/releases/download/' + tag + '/packages.dhall');
});
});