@storybook/cli
Version:
Storybook's CLI - easiest method of adding storybook to your projects
27 lines (22 loc) • 633 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getStorybookConfiguration = getStorybookConfiguration;
/*
* Lifted from chromatic-cli
*
* This is not exactly clever but it works most of the time
* we receive the full text of the npm script, and we look if we can find the cli flag
*/
function getStorybookConfiguration(storybookScript, shortName, longName) {
const parts = storybookScript.split(/[\s='"]+/);
let index = parts.indexOf(longName);
if (index === -1) {
index = parts.indexOf(shortName);
}
if (index === -1) {
return null;
}
return parts[index + 1];
}