storybook-addon-source-link
Version:
Add a button to the Storybook toolbar that opens the file containing the Story in an IDE like VSCode.
1 lines • 1.17 kB
Source Map (JSON)
{"version":3,"sources":["../src/preset.ts"],"names":["env","base","_config","workingDir"],"mappings":"AAOO,IAAMA,EAA6B,CAACC,EAAMC,IAAY,CAE5D,GAAI,QAAQ,IAAI,WAAa,aAC5B,MAAO,CACN,GAAGD,EACH,8BAA+B,EAChC,EAID,IAAME,EAAa,QAAQ,IAAI,EAE/B,MAAO,CACN,GAAGF,EACH,8BAA+BE,CAChC,CACD","sourcesContent":["// You can use presets to augment the Storybook configuration\n// You rarely want to do this in addons,\n// so often you want to delete this file and remove the reference to it in package.json#exports and package.json#bunder.nodeEntries\n// Read more about presets at https://storybook.js.org/docs/addons/writing-presets\n\nimport type { PresetProperty } from \"@storybook/types\";\n\nexport const env: PresetProperty<\"env\"> = (base, _config) => {\n\t// If NODE_ENV is set to production, Storybook is being executed with a static build.\n\tif (process.env.NODE_ENV === \"production\") {\n\t\treturn {\n\t\t\t...base,\n\t\t\tSOURCE_LINK_PROJECT_ROOT_PATH: \"\",\n\t\t};\n\t}\n\n\t// Storybook uses process.cwd() as the root path for the project\n\tconst workingDir = process.cwd();\n\n\treturn {\n\t\t...base,\n\t\tSOURCE_LINK_PROJECT_ROOT_PATH: workingDir,\n\t};\n};\n"]}