Script to merge deep hierarchy of JSON files into a flat set of objects (files) containing deep objects inside.
More "independent" version of the gulp-locales-bundler.
Check the Real Life Example to get more context for this script.
Locally to use in runtime:
npm install locales-bundler
Or globally to use in CLI:
npm install -g locales-bundler
const localesBundler = require('locales-bundler');
// Gets all JSON files from 'locales' directories under the 'src' path,
// omits the 'locales' directory from the resulting objects (default is '').
const locales = localesBundler('src', 'locales/**/*.json', 'locales');
Can be used as part of the build process, writes merged JSON files to the destination dir.
locales-bundler -s src -p locales/**/*.json -o locales -d dist
Where -s
is source, -p
is pattern, -o
is omit and -d
is destination.