@orangemug/oops 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -21,6 +21,7 @@ You can attach this command to a bug tracker ticket somewhere in your company/or
21
21
  > @ctrl/tinycolor:4.1.2
22
22
  > ```
23
23
 
24
+ The examples are from <https://orca.security/resources/blog/npm-malware-campaign-tinycolor/>
24
25
 
25
26
  ## Licence
26
27
  MIT
@@ -3,6 +3,7 @@ import chalk from 'chalk';
3
3
  import { exec as exec$1 } from 'child_process';
4
4
  import { promisify } from 'util';
5
5
  import semver from 'semver';
6
+ import validSemver from 'semver/ranges/valid.js';
6
7
  import minimist from 'minimist';
7
8
 
8
9
  const exec = promisify(exec$1);
@@ -38,7 +39,7 @@ async function yarnDoesPackageExist(pkgName) {
38
39
  return out;
39
40
  }
40
41
  async function doesPackageExistInCache(pkgName, version) {
41
- if (!semver.valid(version)) {
42
+ if (!validSemver(version)) {
42
43
  throw new Error(`Invalid version range "${version}"`);
43
44
  }
44
45
  const effectedVersions = {};
@@ -93,7 +94,7 @@ const HELP_TEXT = `
93
94
  Example: ./oops @ctrl/tinycolor:4.1.1 @ctrl/tinycolor:4.1.2
94
95
  `.trim();
95
96
  const argv = minimist(process.argv.slice(2));
96
- if (argv._.length < 1 && argv.help || argv.h) {
97
+ if (argv._.length < 1 || argv.help || argv.h) {
97
98
  console.log(HELP_TEXT);
98
99
  process.exit(0);
99
100
  }
@@ -3,6 +3,7 @@
3
3
  var child_process = require('child_process');
4
4
  var util = require('util');
5
5
  var semver = require('semver');
6
+ var validSemver = require('semver/ranges/valid.js');
6
7
 
7
8
  const exec = util.promisify(child_process.exec);
8
9
  async function pnpmDoesPackageExist(pkgName) {
@@ -37,7 +38,7 @@ async function yarnDoesPackageExist(pkgName) {
37
38
  return out;
38
39
  }
39
40
  async function doesPackageExistInCache(pkgName, version) {
40
- if (!semver.valid(version)) {
41
+ if (!validSemver(version)) {
41
42
  throw new Error(`Invalid version range "${version}"`);
42
43
  }
43
44
  const effectedVersions = {};
@@ -1,6 +1,7 @@
1
1
  import { exec as exec$1 } from 'child_process';
2
2
  import { promisify } from 'util';
3
3
  import semver from 'semver';
4
+ import validSemver from 'semver/ranges/valid.js';
4
5
 
5
6
  const exec = promisify(exec$1);
6
7
  async function pnpmDoesPackageExist(pkgName) {
@@ -35,7 +36,7 @@ async function yarnDoesPackageExist(pkgName) {
35
36
  return out;
36
37
  }
37
38
  async function doesPackageExistInCache(pkgName, version) {
38
- if (!semver.valid(version)) {
39
+ if (!validSemver(version)) {
39
40
  throw new Error(`Invalid version range "${version}"`);
40
41
  }
41
42
  const effectedVersions = {};
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@orangemug/oops",
3
3
  "description": "Have I got a compromised pacakge in my cache?",
4
+ "version": "0.1.4",
4
5
  "repository": {
5
6
  "type": "git",
6
7
  "url": "https://github.com/orangemug/oops"
@@ -14,7 +15,7 @@
14
15
  "build": "rollup -c rollup.config.ts && chmod +x dist/npm/bin/index.js"
15
16
  },
16
17
  "bin": {
17
- "@orangemug/oops": "./dist/npm/bin/index.ts"
18
+ "@orangemug/oops": "./dist/npm/bin/index.js"
18
19
  },
19
20
  "exports": {
20
21
  ".": {
@@ -52,6 +53,5 @@
52
53
  "chalk": "^5.6.2",
53
54
  "minimist": "^1.2.8",
54
55
  "semver": "^7.7.4"
55
- },
56
- "version": "0.1.2"
56
+ }
57
57
  }