UNPKG

chromatic

Version:

Automate visual testing across browsers. Gather UI feedback. Versioned documentation.

15 lines (12 loc) 2.53 kB
!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]="d2c3969f-c3d7-5854-9dd5-d1f0dbb09f01")}catch(e){}}(); const e=require(`./chunk-gGpyby2o.cjs`),t=require(`./meow-CbdXCBsh.cjs`),n=require(`./getStorybookProjectRoot-DlbLndZv.cjs`),r=require(`./projectFiles-Dh2Zexvl.cjs`),i=require(`./log-ECzXUtHc.cjs`),a=require(`./readStatsFile-4CPsbHL1.cjs`);let o=require(`fs`),s=require(`path`);s=e.a(s);var c=e.a(t.t());const{STORYBOOK_BASE_DIR:l}=process.env;async function u(e){let t=(0,c.default)(` Usage $ chromatic turbosnap-manifest [-s|--stats-file] [-b|--storybook-base-dir] [-c|--config-dir] [--static-dir] Options --stats-file, -s <filepath> Path to preview-stats.json, relative to the Storybook project root. (default: 'storybook-static/preview-stats.json') --storybook-base-dir, -b <dirname> Relative path from repository root to Storybook project root. Alternatively, set STORYBOOK_BASE_DIR. Use when your Storybook is located in a subdirectory of your repository. (default: the current directory) --config-dir, -c <dirname> Storybook config directory, relative to the Storybook project root. (default: '.storybook') --static-dir <dirnames> Comma-separated static directories, relative to the Storybook project root. (default: none) `,{argv:e,description:`Build the TurboSnap v2 manifest from a stats file`,flags:{statsFile:{type:`string`,alias:`s`,default:`storybook-static/preview-stats.json`},storybookBaseDir:{type:`string`,alias:`b`,...l&&{default:l}},configDir:{type:`string`,alias:`c`,default:`.storybook`},staticDir:{type:`string`}}}),u=i.t({},{logPrefix:``,logLevel:`error`});try{let e=n.t({storybookBaseDir:t.flags.storybookBaseDir,gitRootPath:await n.C({log:u})}),i=s.default.resolve(e,t.flags.statsFile);if(!(0,o.existsSync)(i))return u.error(`No stats file at ${i}\n`),u.error(t.help),process.exit(1);let c=await r.r(await a.t(i),{log:u,projectRoot:e,configDir:s.default.resolve(e,t.flags.configDir),staticDirs:(t.flags.staticDir?.split(`,`)??[]).map(t=>s.default.resolve(e,t)),projectFiles:r.t(u)});process.stdout.write(JSON.stringify(r.a(c),void 0,2))}catch(e){u.error(`Error: ${e.message}`),process.exit(1)}}exports.main=u; //# sourceMappingURL=turbosnapManifest-doTDJiPz.cjs.map //# debugId=d2c3969f-c3d7-5854-9dd5-d1f0dbb09f01