@pure-ds/storybook 0.3.9 → 0.3.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +28 -0
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -83,6 +83,34 @@ if (process.cwd() !== packageRoot) {
|
|
|
83
83
|
};
|
|
84
84
|
|
|
85
85
|
copyAndTransform(srcStoriesDir, cacheDir);
|
|
86
|
+
|
|
87
|
+
// Also copy dist folder to cache so relative imports work
|
|
88
|
+
const cacheDistDir = join(process.cwd(), 'node_modules', '.cache', 'pds-storybook', 'dist');
|
|
89
|
+
const srcDistDir = join(packageRoot, 'dist');
|
|
90
|
+
|
|
91
|
+
if (fs.existsSync(srcDistDir)) {
|
|
92
|
+
if (fs.existsSync(cacheDistDir)) {
|
|
93
|
+
fs.rmSync(cacheDistDir, { recursive: true, force: true });
|
|
94
|
+
}
|
|
95
|
+
fs.mkdirSync(cacheDistDir, { recursive: true });
|
|
96
|
+
|
|
97
|
+
// Simple recursive copy for dist
|
|
98
|
+
const copyDir = (src, dest) => {
|
|
99
|
+
const entries = fs.readdirSync(src, { withFileTypes: true });
|
|
100
|
+
for (const entry of entries) {
|
|
101
|
+
const srcPath = join(src, entry.name);
|
|
102
|
+
const destPath = join(dest, entry.name);
|
|
103
|
+
if (entry.isDirectory()) {
|
|
104
|
+
fs.mkdirSync(destPath, { recursive: true });
|
|
105
|
+
copyDir(srcPath, destPath);
|
|
106
|
+
} else {
|
|
107
|
+
fs.copyFileSync(srcPath, destPath);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
copyDir(srcDistDir, cacheDistDir);
|
|
112
|
+
}
|
|
113
|
+
|
|
86
114
|
process.env.PDS_STORIES_PATH = cacheDir.replace(/\\/g, '/');
|
|
87
115
|
|
|
88
116
|
} catch (err) {
|