UNPKG

459 BJavaScriptView Raw
1/* eslint-disable object-shorthand */
2
3/**
4 * Takes the template and returns a string contents of the package.json.
5 */
6module.exports = template => {
7 const packageJson = template.packageJson;
8
9 // Add additional dependencies if specified
10 if (template.install) {
11 Object.entries(template.install).forEach(([depName, depVersion]) => {
12 packageJson.dependencies[depName] = depVersion;
13 });
14 }
15
16 return JSON.stringify(packageJson, null, 2);
17};