UNPKG

chromatic

Version:

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

17 lines (14 loc) • 3.12 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]="f66b24e7-0d70-5e71-9f2d-5527bc7608ed")}catch(e){}}(); const e=require(`./chunk-gGpyby2o.cjs`),t=require(`./statsPaths-DxOPEGB1.cjs`),n=require(`./projectFiles-mwJHy1Wr.cjs`),r=require(`./log-kvNRZrIg.cjs`),i=require(`./meowImportMeta-C1QmuJuk.cjs`),a=require(`./readStatsFile-DY1vHZYN.cjs`);let o=require(`fs`),s=require(`path`);s=e.a(s);const{STORYBOOK_BASE_DIR:c}=process.env;async function l(e){let l=i.n(` Usage $ chromatic turbosnap-manifest [-s|--stats-file] [-b|--storybook-base-dir] [-c|--config-dir] [--static-dir] [--externals] [-u|--untraced] 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) --externals <glob> Glob of files that disable TurboSnap when changed, relative to the repository root. Can be specified multiple times. (default: none) --untraced, -u <glob> Glob of files to disregard, with their dependencies, when tracing dependent stories, relative to the repository root. Can be specified multiple times. (default: none) `,{importMeta:i.t,argv:e,description:`Build the TurboSnap 2.0 manifest from a stats file`,flags:{statsFile:{type:`string`,shortFlag:`s`,default:`storybook-static/preview-stats.json`},storybookBaseDir:{type:`string`,shortFlag:`b`,...c&&{default:c}},configDir:{type:`string`,shortFlag:`c`,default:`.storybook`},staticDir:{type:`string`},externals:{type:`string`,isMultiple:!0},untraced:{type:`string`,shortFlag:`u`,isMultiple:!0}}}),u=r.t({},{logPrefix:``,logLevel:`error`});try{let e=await t.k({log:u}),r=t.s({storybookBaseDir:l.flags.storybookBaseDir,gitRootPath:e}),i=s.default.resolve(r,l.flags.statsFile);if(!(0,o.existsSync)(i))return u.error(`No stats file at ${i}\n`),u.error(l.help),process.exit(1);let c=await n.r(await a.t(i),{log:u,projectRoot:r,gitRoot:e,untraced:l.flags.untraced??[],configDir:s.default.resolve(r,l.flags.configDir),staticDirs:(l.flags.staticDir?.split(`,`)??[]).map(e=>s.default.resolve(r,e)),externals:l.flags.externals??[],projectFiles:n.t({log:u})});process.stdout.write(JSON.stringify(n.a(c),void 0,2))}catch(e){u.error(`Error: ${e.message}`),process.exit(1)}}exports.main=l; //# sourceMappingURL=turbosnapManifest-D1I-hXle.cjs.map //# debugId=f66b24e7-0d70-5e71-9f2d-5527bc7608ed