mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-31 05:03:21 +08:00
25 lines
687 B
TypeScript
25 lines
687 B
TypeScript
import type { Task } from '../task';
|
|
import { exec } from '../utils/exec';
|
|
|
|
export const chromatic: Task = {
|
|
before: ['build'],
|
|
junit: true,
|
|
async ready() {
|
|
return false;
|
|
},
|
|
async run({ key, sandboxDir, builtSandboxDir, junitFilename }, { dryRun, debug }) {
|
|
const tokenEnvVarName = `CHROMATIC_TOKEN_${key.toUpperCase().replace(/\/|-|\./g, '_')}`;
|
|
const token = process.env[tokenEnvVarName];
|
|
|
|
await exec(
|
|
`npx chromatic \
|
|
--exit-zero-on-changes \
|
|
--storybook-build-dir=${builtSandboxDir} \
|
|
--junit-report=${junitFilename} \
|
|
--projectToken=${token}`,
|
|
{ cwd: sandboxDir },
|
|
{ dryRun, debug }
|
|
);
|
|
},
|
|
};
|