1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 | 'use strict';
|
16 |
|
17 | const fs = require('fs');
|
18 | const yargs = require('yargs');
|
19 | const VersionChecker = require('./versionchecker');
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 | let program = yargs
|
27 | .usage('$0 [options]')
|
28 | .options({
|
29 | 'packageJSON' : {alias: 'p', required: true, describe: 'Path of the package.json file to check', type: 'string',default:'package.json' },
|
30 | 'changelog' : {alias: 'c', required: true, describe:'Path of the chanhgelog file to check', type: 'string'},
|
31 | 'api' : {alias: 'a', required: true, describe:'API Signature file',type:'string'}
|
32 | })
|
33 | .argv;
|
34 |
|
35 | const changelog = fs.readFileSync(program.changelog, 'utf8');
|
36 | const publicApi = fs.readFileSync(program.api, 'utf8');
|
37 | const packageJson = fs.readFileSync(program.packageJSON, 'utf8');
|
38 |
|
39 | try {
|
40 | VersionChecker.check(changelog, publicApi, packageJson);
|
41 | }
|
42 | catch(err) {
|
43 | console.log(err);
|
44 | process.exit(1);
|
45 | }
|