mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-28 05:10:17 +08:00
21 lines
605 B
TypeScript
21 lines
605 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(templateKey, { sandboxDir, builtSandboxDir, junitFilename }) {
|
|
const tokenEnvVarName = `CHROMATIC_TOKEN_${templateKey.toUpperCase().replace(/\/|-/g, '_')}`;
|
|
const token = process.env[tokenEnvVarName];
|
|
return exec(
|
|
`npx chromatic --storybook-build-dir=${builtSandboxDir} \
|
|
--junit-report=${junitFilename} \
|
|
--projectToken=${token}`,
|
|
{ cwd: sandboxDir }
|
|
);
|
|
},
|
|
};
|