@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.
@@ -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
- console.log(colorize('NPM Package Checker v1.0.0', 'blue'));
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
- console.log('1.0.0');
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
- async function checkForUpdates() {
7
+ function checkForUpdates() {
8
8
  try {
9
9
  // Get current version from package.json
10
10
  const packageJsonPath = path.join(__dirname, '..', '..', 'package.json');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@npm-breach/check",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Security-focused CLI tool to detect potentially vulnerable packages in your Node.js applications",
5
5
  "main": "lib/index.js",
6
6
  "bin": {