@npm-breach/check 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commands/help.js +16 -2
- package/lib/utils/versionChecker.js +1 -1
- package/package.json +1 -1
package/lib/commands/help.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
1
|
const { colorize } = require('../utils/colors');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
function getVersion() {
|
|
6
|
+
try {
|
|
7
|
+
const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|
|
8
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
9
|
+
return packageJson.version;
|
|
10
|
+
} catch (error) {
|
|
11
|
+
return '1.0.0'; // fallback version
|
|
12
|
+
}
|
|
13
|
+
}
|
|
2
14
|
|
|
3
15
|
function showHelp() {
|
|
4
|
-
|
|
16
|
+
const version = getVersion();
|
|
17
|
+
console.log(colorize(`NPM Package Checker v${version}`, 'blue'));
|
|
5
18
|
console.log(colorize("Check npm packages and semantic version ranges in dependency trees", 'gray'));
|
|
6
19
|
console.log();
|
|
7
20
|
console.log(colorize("Usage:", 'yellow'));
|
|
@@ -30,7 +43,8 @@ function showHelp() {
|
|
|
30
43
|
}
|
|
31
44
|
|
|
32
45
|
function showVersion() {
|
|
33
|
-
|
|
46
|
+
const version = getVersion();
|
|
47
|
+
console.log(version);
|
|
34
48
|
}
|
|
35
49
|
|
|
36
50
|
module.exports = { showHelp, showVersion };
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { colorize } = require('./colors');
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
function checkForUpdates() {
|
|
8
8
|
try {
|
|
9
9
|
// Get current version from package.json
|
|
10
10
|
const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
|