New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

merge-jsons-webpack-plugin

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

merge-jsons-webpack-plugin - npm Package Compare versions

Comparing version 1.0.11 to 1.0.12

10

index.js

@@ -29,6 +29,7 @@ "use strict";

}
let globOptions = this.options.globOptions || {};
groupBy.forEach((globs) => {
let pattern = globs.pattern;
let outputPath = globs.fileName;
this._glob(pattern).then((files) => {
this._glob(pattern, globOptions).then((files) => {
this.processFiles(compilation, files, outputPath).then((result) => { done(); });

@@ -53,3 +54,3 @@ });

this.fileDependencies = this.fileDependencies.concat(files);
var fileContents = files.map(this.readFile);
const fileContents = files.map(this.readFile);
let mergedContents = {};

@@ -133,5 +134,6 @@ return es6_promise_1.Promise.all(fileContents)

};
this._glob = (pattern) => {
this._glob = (pattern, options) => {
return new es6_promise_1.Promise((resolve, reject) => {
new Glob(pattern, { mark: true }, function (err, matches) {
const defaultOptions = { mark: true };
new Glob(pattern, Object.assign({}, options, defaultOptions), function (err, matches) {
if (err) {

@@ -138,0 +140,0 @@ reject(err);

{
"name": "merge-jsons-webpack-plugin",
"description": "This plugin is used to merge json files into single json file,using glob or file names",
"version": "1.0.11",
"version": "1.0.12",
"author": {

@@ -43,3 +43,3 @@ "email": "sudharsan_tk@yahoo.co.in",

"scripts": {
"build":"tsc",
"build": "tsc",
"post-install": "typings install",

@@ -49,2 +49,1 @@ "deploy": "npm publish"

}

89

README.md

@@ -21,11 +21,13 @@ # Merge json files

```javascript
var MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin")
new MergeJsonWebpackPlugin({
"files": ['./jsons/file1.json',
'./jsons/file3.json',
'./jsons/file2.json'],
"output":{
"fileName":"./dist/result.json"
}
})
var MergeJsonWebpackPlugin = require("merge-jsons-webpack-plugin");
new MergeJsonWebpackPlugin({
"files": [
"./jsons/file1.json",
"./jsons/file3.json",
"./jsons/file2.json"
],
"output": {
"fileName": "./dist/result.json"
}
});
```

@@ -38,13 +40,15 @@

If you want to merge group of files use like this.
```javascript
new MergeJsonWebpackPlugin({
"files": [
"./jsons/file1.json",
"./jsons/file3.json",
"./jsons/file2.json"
],
"output": {
"fileName": "./dist/result.json"
}
});
```
new MergeJsonWebpackPlugin
({
"files": ['./jsons/file1.json','./jsons/file3.json','./jsons/file2.json'],
"output":{
"fileName":"./dist/result.json"
}
})
```

@@ -60,18 +64,24 @@

2. **By Patterns**
This plugin uses glob for searching file patterns,please refer glob for usage for sample pattern. You can specify a pattern to pull all the files that satify the particular pattern and output a single json file.
This plugin uses glob for searching file patterns,please refer glob for usage for sample pattern. You can specify a pattern to pull all the files that satify the particular pattern and output a single json file.
```javascript
new MergeJsonWebpackPlugin({
"encoding": "ascii",
"output": {
"groupBy": [
{
"pattern": "{./jsons/module*/en.json,./jsons/file1.json}",
"fileName": "./dist/en.json"
},
{
"pattern": "{./jsons/module*/es.json,./jsons/file2.json}",
"fileName":"./dist/es.json"
}
]
},
"globOptions": {
"nosort": true
}
});
```
new MergeJsonWebpackPlugin({
"encoding":"ascii",
"output":{
"groupBy":[
{ "pattern":"{./jsons/module*/en.json,./jsons/file1.json}",
"fileName":"./dist/en.json"
},
{ "pattern":"{./jsons/module*/es.json,./jsons/file2.json}",
"fileName":"./dist/es.json" }
]
}
})
```

@@ -85,3 +95,4 @@

| groupBy[].fileName | output file name for the corresponding pattern.Relative path from output.path entry | |
| encoding | Optional,encoding to be used default is utf-8 | |
| encoding | Optional, encoding to be used default is utf-8 | |
| globOptions | Optional, [glob options](https://github.com/isaacs/node-glob#options) to change pattern matching behavior | |

@@ -92,6 +103,6 @@ ## Change Logs

|--------------------|-----------------------------------|
| 1.0.8 | Error handling improved. Now **fileName** is relative path to output path specified |
| 1.0.10 | File watching feature added, result will be automatically refreshed if json files are modified |
| 1.0.11 | Publish issues with previous version |
| 1.0.8 | Error handling improved. Now **fileName** is relative path to output path specified |
| 1.0.10 | File watching feature added, result will be automatically refreshed if json files are modified |
| 1.0.11 | Publish issues with previous version |
| 1.0.12 | Added glob options handling |

@@ -112,4 +123,4 @@ ## Sample

##References
## References
- https://www.npmjs.com/package/glob
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