Skip to content

Commit d97b45a

Browse files
authored
Merge pull request #1035 from jryanconklin/feature/js-export-data-module-export
Add module export to exportData
2 parents 5aa0d00 + 8c3a7d3 commit d97b45a

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

packages/core/src/lib/exportData.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,12 @@ module.exports = function(patternlab) {
8585
);
8686
});
8787

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

93+
//write all output to patternlab-data
9094
_.each(patternlab.uikits, uikit => {
9195
fs.outputFileSync(
9296
path.resolve(
@@ -95,6 +99,13 @@ module.exports = function(patternlab) {
9599
),
96100
output
97101
);
102+
fs.outputFileSync(
103+
path.resolve(
104+
path.join(process.cwd(), uikit.outputDir, paths.public.data),
105+
'patternlab-data.cjs.js'
106+
),
107+
exportedOutput
108+
);
98109
});
99110

100111
return output;

0 commit comments

Comments
 (0)