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

@konfik-plugin/package-json

Package Overview
Dependencies
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@konfik-plugin/package-json - npm Package Compare versions

Comparing version 0.0.12 to 0.0.13

.konfik.ts

22

dist/index.js

@@ -5,3 +5,14 @@ import { KonfikFactory } from '@konfik/core';

brand: PackageJsonKonfikBrand,
toString: (config) => JSON.stringify(config),
toString: (config) => {
if (config.dependencies) {
config.dependencies = sortObjectAlphabetically(config.dependencies);
}
if (config.devDependencies) {
config.devDependencies = sortObjectAlphabetically(config.devDependencies);
}
if (config.peerDependencies) {
config.peerDependencies = sortObjectAlphabetically(config.peerDependencies);
}
return JSON.stringify(config);
},
// NOTE we can't simply use `json` here since prettier seems to format `package.json` files with the `json-stringify` parser by default

@@ -11,2 +22,11 @@ // We should come up with a better solution to this

});
const sortObjectAlphabetically = (obj) => {
const sorted = {};
Object.keys(obj)
.sort()
.forEach((key) => {
sorted[key] = obj[key];
});
return sorted;
};
//# sourceMappingURL=index.js.map

4

package.json
{
"name": "@konfik-plugin/package-json",
"version": "0.0.12",
"version": "0.0.13",
"exports": {

@@ -9,3 +9,3 @@ ".": "./src/index.ts"

"dependencies": {
"@konfik/core": "0.0.12",
"@konfik/core": "0.0.13",
"type-fest": "^2.10.0"

@@ -12,0 +12,0 @@ },

@@ -9,3 +9,17 @@ import { KonfikFactory } from '@konfik/core'

brand: PackageJsonKonfikBrand,
toString: (config) => JSON.stringify(config),
toString: (config) => {
if (config.dependencies) {
config.dependencies = sortObjectAlphabetically(config.dependencies)
}
if (config.devDependencies) {
config.devDependencies = sortObjectAlphabetically(config.devDependencies)
}
if (config.peerDependencies) {
config.peerDependencies = sortObjectAlphabetically(config.peerDependencies)
}
return JSON.stringify(config)
},
// NOTE we can't simply use `json` here since prettier seems to format `package.json` files with the `json-stringify` parser by default

@@ -15,1 +29,11 @@ // We should come up with a better solution to this

})
const sortObjectAlphabetically = <T extends Record<string, any>>(obj: T) => {
const sorted = {} as T
Object.keys(obj)
.sort()
.forEach((key: keyof T) => {
sorted[key] = obj[key]
})
return sorted
}

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