-
Notifications
You must be signed in to change notification settings - Fork 196
/
publish_validate.js
executable file
·35 lines (33 loc) · 1.25 KB
/
publish_validate.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
34
35
#!/usr/bin/env node
// LICENSE_CODE ZON
'use strict'; /*jslint node:true*/
if (!module.parent)
global.zon_config_fallback = {};
require('../util/config.js');
const lpm_config = require('./util/lpm_config_static');
const etask = require('../util/etask.js');
const request = require('request');
const exec = require('../util/exec.js');
const cli = require('../util/cli.js');
const cli_opt = [
['', 'version=VERSION', 'Version being released'],
];
cli.getopt(cli_opt, 'Usage: publish_validate.js\n\n[[OPTIONS]]\n');
const main = ()=>etask(function*(){
cli.process_args();
if (!cli.opt.version)
return console.log('You need to pass --version');
const url = 'https://raw.githubusercontent.com/'+lpm_config.github_repo
+'/master/package.json';
const github_res = yield etask.nfn_apply(request, [{url, json: true}]);
if (github_res.body.version!=cli.opt.version)
return console.log('Wrong version on github.com');
const npm_check = ['npm', 'view', '@luminati-io/luminati-proxy',
'version'];
const npm_res = yield exec.sys(npm_check, {out: 'stdout'});
if (npm_res.trim()!=cli.opt.version)
return console.log('Wrong version on npmjs.com');
console.log('Success');
});
if (!module.parent)
main();