Skip to content

Commit

Permalink
Merge pull request #1035 from jryanconklin/feature/js-export-data-mod…
Browse files Browse the repository at this point in the history
…ule-export

Add module export to exportData
  • Loading branch information
sghoweri committed Aug 16, 2019
2 parents 5aa0d00 + 8c3a7d3 commit d97b45a
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/core/src/lib/exportData.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ module.exports = function(patternlab) {
);
});

//write all output to patternlab-data
// add module.export to the Nodejs-specific file generated.
const exportedOutput =
output +
'module.exports = { config, ishControls, navItems, patternPaths, viewAllPaths, plugins, defaultShowPatternInfo, defaultPattern };';

//write all output to patternlab-data
_.each(patternlab.uikits, uikit => {
fs.outputFileSync(
path.resolve(
Expand All @@ -95,6 +99,13 @@ module.exports = function(patternlab) {
),
output
);
fs.outputFileSync(
path.resolve(
path.join(process.cwd(), uikit.outputDir, paths.public.data),
'patternlab-data.cjs.js'
),
exportedOutput
);
});

return output;
Expand Down

0 comments on commit d97b45a

Please sign in to comment.