0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00
verdaccio/packages/plugins/ui-theme/tools/getPackageJson.js
Juan Picado e9e4552658 feat: ui theme on 5.x (#2033)
* refactor: relocate theme-ui as plugin

* refactor: relocate theme-ui as plugin

* refactor: relocate theme-ui as plugin

* chore: fix lint

* chore: add missing folder

* refactor: relocate theme-ui as plugin

* refactor: relocate theme-ui as plugin

* refactor: relocate theme-ui as plugin

* chore: update scripts

* refactor: relocate theme-ui as plugin

* refactor: relocate theme-ui as plugin

* refactor: relocate theme-ui as plugin

* refactor: relocate theme-ui as plugin
2021-04-09 17:54:29 +02:00

25 lines
675 B
JavaScript

import fs from 'fs';
import path from 'path';
/**
* A module to get package informations from package.json
* @module getPackageJson
* @param {...string} keys from package.json if no arguments passed it returns package.json content as object
* @returns {object} with given keys or content of package.json as object
*/
/**
* Returns package info
*/
const getPackageJson = function (...args) {
const packageJSON = JSON.parse(fs.readFileSync(path.join(__dirname, '../package.json')));
if (!args.length) {
return packageJSON;
}
return args.reduce((out, key) => {
out[key] = packageJSON[key];
return out;
}, {});
};
module.exports = getPackageJson;