forked from davidcyp/appc-npm
/
appc-npm
executable file
·63 lines (49 loc) · 1.36 KB
/
appc-npm
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/usr/bin/env node
var path = require('path'),
fs = require('fs');
var _ = require('underscore');
var updateNotifier = require('update-notifier');
var main = require('../');
var pkg = require('../package.json');
updateNotifier({pkg: pkg}).notify();
var argv = process.argv.slice(2);
var type = argv.shift();
var src = argv.shift() || process.cwd();
if (!type || ['-h', '--help'].indexOf(type) !== -1) {
console.log('Usage: appc-npm <type> [src]');
console.log();
console.log('Types: ' + fs.readdirSync(path.join(__dirname, '..', 'lib', 'types')).join(', ').replace(/\.js/g, ''));
console.log();
process.exit(0);
}
main({
type: type,
src: src
}, function (err, pkg) {
if (err) {
console.log(err);
console.log();
return process.exit(1);
}
console.log('+ ' + pkg.name + '@' + pkg.version);
console.log();
var missing = _.omit({
'repository': {
'type': 'git',
'url': 'git+https://github.com/USER/REPO.git'
},
'bugs': {
'url': 'https://github.com/USER/REPO/issues'
},
'homepage': 'https://github.com/USER/REPO#readme',
'author': 'NAME <EMAIL>',
'license': 'LICENSE',
'description': 'DESCRIPTION'
}, _.keys(pkg));
if (_.size(missing) > 0) {
console.log('You might want to add these fields before you publish:');
console.log();
console.log(JSON.stringify(missing, null, 2).replace(/^(\{\n|\})/mg, ''));
}
process.exit(0);
});