forked from adobe/react-spectrum
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
working branch for supporting windows contributors (adobe#6313)
* remove --extensions as they are unnecessary add is-mingw use isMinGW to use proper slashes on windows git bash * remove logs from preview builder * is-mingw is a dev dep * patching storybook-builder-parcel to solve windows forward slash issues --------- Co-authored-by: David Coleman <[email protected]> Co-authored-by: Daniel Lu <[email protected]>
- Loading branch information
1 parent
25a2a30
commit acddd45
Showing
7 changed files
with
82 additions
and
6 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
.yarn/patches/storybook-builder-parcel-https-7ea26540e8.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
diff --git a/gen-preview-modern.js b/gen-preview-modern.js | ||
index a1fe3d1ce6b748e533200f5af69a0481e5809c6c..aeed09de7dbaddd4606ac3579a86cb2ba389eb2f 100644 | ||
--- a/gen-preview-modern.js | ||
+++ b/gen-preview-modern.js | ||
@@ -7,9 +7,16 @@ const { | ||
} = require("@storybook/core-common"); | ||
const { logger } = require("@storybook/node-logger"); | ||
const { promise: glob } = require("glob-promise"); | ||
+const isMingw = require('is-mingw'); | ||
|
||
-const absoluteToSpecifier = (generatedEntries, abs) => | ||
- "./" + path.relative(generatedEntries, abs); | ||
+const absoluteToSpecifier = (generatedEntries, abs) => { | ||
+ let relativePath = path.relative(generatedEntries, abs); | ||
+ if (isMingw()) { | ||
+ relativePath = relativePath.replace(/\\/g, '/'); | ||
+ } | ||
+ | ||
+ return "./" + relativePath; | ||
+} | ||
|
||
module.exports.generatePreviewModern = async function generatePreviewModern( | ||
options, | ||
@@ -66,7 +73,7 @@ module.exports.generatePreviewModern = async function generatePreviewModern( | ||
*/ | ||
const code = ` | ||
import { composeConfigs, PreviewWeb, ClientApi } from '@storybook/preview-api'; | ||
- | ||
+ | ||
// generateAddonSetupCode | ||
import { createBrowserChannel } from '@storybook/channels'; | ||
import { addons } from '@storybook/preview-api'; | ||
@@ -94,7 +101,7 @@ module.exports.generatePreviewModern = async function generatePreviewModern( | ||
window.__STORYBOOK_CLIENT_API__ = new ClientApi({ storyStore: preview.storyStore }); | ||
|
||
preview.initialize({ importFn, getProjectAnnotations }); | ||
- | ||
+ | ||
`; | ||
// ${generateHMRHandler(frameworkName)}; | ||
return code; | ||
@@ -152,7 +159,11 @@ function toImportPath(relativePath) { | ||
async function toImportFn(stories, generatedEntries) { | ||
const objectEntries = stories.map((file) => { | ||
const ext = path.extname(file); | ||
- const relativePath = /*normalizePath*/ path.relative(process.cwd(), file); | ||
+ let relativePath = /*normalizePath*/ path.relative(process.cwd(), file); | ||
+ if (isMingw()) { | ||
+ relativePath = relativePath.replace(/\\/g, '/'); | ||
+ } | ||
+ | ||
if (![".js", ".jsx", ".ts", ".tsx", ".mdx"].includes(ext)) { | ||
logger.warn( | ||
`Cannot process ${ext} file with storyStoreV7: ${relativePath}` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters