Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@anolilab/package-json-utils

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@anolilab/package-json-utils - npm Package Compare versions

Comparing version 1.0.1 to 1.1.0

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## @anolilab/package-json-utils [1.1.0](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/package-json-utils@1.0.1...@anolilab/package-json-utils@1.1.0) (2023-06-10)
### Features
* extended the showMissingPackages with some options to better control the log message ([14d3661](https://github.com/anolilab/javascript-style-guide/commit/14d3661e587246c96f352baf7a5ce1190444ebb8))
## @anolilab/package-json-utils [1.0.1](https://github.com/anolilab/javascript-style-guide/compare/@anolilab/package-json-utils@1.0.0...@anolilab/package-json-utils@1.0.1) (2023-06-10)

@@ -2,0 +9,0 @@

7

dist/index.d.ts

@@ -18,3 +18,8 @@ import readPkgUp from 'read-pkg-up';

declare const isPackageAvailable: (moduleName: string) => boolean;
declare const showMissingPackages: (packageName: string, packages: string[]) => void;
declare const showMissingPackages: (packageName: string, packages: string[], options?: {
exit?: boolean;
consoleType?: "error" | "info" | "log" | "warn";
preMessage?: string;
postMessage?: string;
}) => void;
declare const unique: (array: unknown[]) => unknown[];

@@ -21,0 +26,0 @@ declare const pkg: readPkgUp.NormalizedReadResult | undefined;

53

dist/index.js

@@ -5,20 +5,19 @@ 'use strict';

var fs = require('fs');
var a = require('module');
var c = require('module');
var path = require('path');
var h = require('read-pkg-up');
var x = require('read-pkg-up');
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
var a__default = /*#__PURE__*/_interopDefault(a);
var h__default = /*#__PURE__*/_interopDefault(h);
var c__default = /*#__PURE__*/_interopDefault(c);
var x__default = /*#__PURE__*/_interopDefault(x);
var i=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var {packageJson:r,path:c}=h__default.default.sync({cwd:fs.realpathSync(process.cwd())})??{packageJson:void 0,path:void 0},p=e=>e.split("@").includes("@")?e:`${e}@latest`,l=e=>e.some(n=>!!(r!==void 0&&dotPathValue.getByPath(r,n))),s=e=>n=>l(n.map(t=>`${e}.${t}`)),x=e=>!!(process.env[e]&&process.env[e]!=="undefined"),E=(e,n)=>{if(x(e))try{return JSON.parse(process.env[e]??"")}catch{return process.env[e]}return n},v=c?path.dirname(c):"",y=(...e)=>path.join(v,...e),P=(...e)=>fs.existsSync(y(...e)),J=s("scripts"),k=s("peerDependencies"),w=s("dependencies"),b=s("devDependencies"),D=e=>[w,b,k].some(n=>n(e)),M=D(["typescript"])&&P("tsconfig.json"),$=l(["type"])&&r?.type==="module",O=e=>{let n=(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('out.js', document.baseURI).href));if(process.versions.pnp){if(a__default.default.findPnpApi(n).resolveRequest(e,n))return !0}else if($)try{return a__default.default.createRequire(n).resolve(e),!0}catch{return !1}try{return i.resolve(e),!0}catch{return !1}},T=(e,n)=>{let t=n.length===1?"":"s";console.warn(`
Oops! Something went wrong! :(
var a=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(n,t)=>(typeof require<"u"?require:n)[t]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw new Error('Dynamic require of "'+e+'" is not supported')});var {packageJson:r,path:l}=x__default.default.sync({cwd:fs.realpathSync(process.cwd())})??{packageJson:void 0,path:void 0},p=e=>e.split("@").includes("@")?e:`${e}@latest`,g=e=>e.some(n=>!!(r!==void 0&&dotPathValue.getByPath(r,n))),s=e=>n=>g(n.map(t=>`${e}.${t}`)),v=e=>!!(process.env[e]&&process.env[e]!=="undefined"),B=(e,n)=>{if(v(e))try{return JSON.parse(process.env[e]??"")}catch{return process.env[e]}return n},y=l?path.dirname(l):"",P=(...e)=>path.join(y,...e),k=(...e)=>fs.existsSync(P(...e)),E=s("scripts"),$=s("peerDependencies"),b=s("dependencies"),w=s("devDependencies"),D=e=>[b,w,$].some(n=>n(e)),J=D(["typescript"])&&k("tsconfig.json"),M=g(["type"])&&r?.type==="module",I=e=>{let n=(typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('out.js', document.baseURI).href));if(process.versions.pnp){if(c__default.default.findPnpApi(n).resolveRequest(e,n))return !0}else if(M)try{return c__default.default.createRequire(n).resolve(e),!0}catch{return !1}try{return a.resolve(e),!0}catch{return !1}},N=(e,n,t={})=>{let i=n.length===1?"":"s";console[t.consoleType??"warn"](`
${t.preMessage??""}
${e} could not find the following package${i}
${e} could not find the following package${t}
${n.join(`
`)}
To install the missing package${t}, please run the following command:
To install the missing package${i}, please run the following command:

@@ -34,23 +33,25 @@ npm install ${n.map(o=>p(o)).join(" ")} --save-dev

pnpm add ${n.map(o=>p(o)).join(" ")} -D
`),process.exit(1);},I=e=>[...new Set(e)],N=r;
${t.postMessage??""}
exports.appDirectory = v;
exports.environmentIsSet = x;
exports.fromRoot = y;
`),process.exit(1);},O=e=>[...new Set(e)],U=r;
exports.appDirectory = y;
exports.environmentIsSet = v;
exports.fromRoot = P;
exports.hasAnyDep = D;
exports.hasDep = w;
exports.hasDevelopmentDep = b;
exports.hasFile = P;
exports.hasPackageProperties = l;
exports.hasDep = b;
exports.hasDevelopmentDep = w;
exports.hasFile = k;
exports.hasPackageProperties = g;
exports.hasPackageSubProperties = s;
exports.hasPeerDep = k;
exports.hasScripts = J;
exports.hasTypescript = M;
exports.isPackageAvailable = O;
exports.packageIsTypeModule = $;
exports.parseEnvironment = E;
exports.pkg = N;
exports.showMissingPackages = T;
exports.unique = I;
exports.hasPeerDep = $;
exports.hasScripts = E;
exports.hasTypescript = J;
exports.isPackageAvailable = I;
exports.packageIsTypeModule = M;
exports.parseEnvironment = B;
exports.pkg = U;
exports.showMissingPackages = N;
exports.unique = O;
//# sourceMappingURL=out.js.map
//# sourceMappingURL=index.js.map
{
"name": "@anolilab/package-json-utils",
"version": "1.0.1",
"version": "1.1.0",
"description": "Shared utilities for parsing information from a package.json.",

@@ -57,4 +57,4 @@ "keywords": [

"dependencies": {
"read-pkg-up": "^7.0.1",
"dot-path-value": "^0.0.10"
"dot-path-value": "^0.0.10",
"read-pkg-up": "^7.0.1"
},

@@ -66,4 +66,4 @@ "devDependencies": {

"tsup": "^6.7.0",
"vitest": "^0.32.0",
"typescript": "^5.1.3"
"typescript": "^5.1.3",
"vitest": "^0.32.0"
},

@@ -70,0 +70,0 @@ "engines": {

@@ -20,11 +20,11 @@ # Javascript Style Guide Utils

```sh
$ npm install @anolilab/package-json-utils
npm install @anolilab/package-json-utils
```
```sh
$ yarn add @anolilab/package-json-utils
yarn add @anolilab/package-json-utils
```
```sh
$ pnpm add @anolilab/package-json-utils
pnpm add @anolilab/package-json-utils
```

@@ -31,0 +31,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc