mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-21 05:02:39 +08:00
Add build task
This commit is contained in:
parent
a462193038
commit
d9d13d2932
@ -506,19 +506,14 @@ jobs:
|
||||
at: .
|
||||
- run:
|
||||
name: Building Sandboxes
|
||||
command: yarn build-sandboxes --cadence ci --junit test-results/build.xml
|
||||
working_directory: code
|
||||
- run:
|
||||
name: Build index.html
|
||||
command: yarn create-built-sandboxes-index --cadence ci --output "../built-sandboxes"
|
||||
background: true
|
||||
command: yarn task --task build --template $(yarn get-template ci) --force --no-before --junit
|
||||
working_directory: code
|
||||
- store_test_results:
|
||||
path: code/test-results
|
||||
- persist_to_workspace:
|
||||
root: .
|
||||
paths:
|
||||
- built-sandboxes
|
||||
- sandbox
|
||||
test-runner-sandboxes:
|
||||
executor:
|
||||
class: medium+
|
||||
|
@ -8,6 +8,7 @@ import { bootstrap } from './tasks/bootstrap';
|
||||
import { publish } from './tasks/publish';
|
||||
import { create } from './tasks/create';
|
||||
import { smokeTest } from './tasks/smoke-test';
|
||||
import { build } from './tasks/build';
|
||||
|
||||
import TEMPLATES from '../code/lib/cli/src/repro-templates';
|
||||
|
||||
@ -38,6 +39,7 @@ export const tasks = {
|
||||
publish,
|
||||
create,
|
||||
'smoke-test': smokeTest,
|
||||
build,
|
||||
};
|
||||
|
||||
type TaskKey = keyof typeof tasks;
|
||||
|
14
scripts/tasks/build.ts
Normal file
14
scripts/tasks/build.ts
Normal file
@ -0,0 +1,14 @@
|
||||
import { pathExists } from 'fs-extra';
|
||||
import { join } from 'path';
|
||||
import type { Task } from '../task';
|
||||
import { exec } from '../utils/exec';
|
||||
|
||||
export const build: Task = {
|
||||
before: ['create'],
|
||||
async ready(_, { sandboxDir }) {
|
||||
return pathExists(join(sandboxDir, 'storybook-static'));
|
||||
},
|
||||
async run(_, { sandboxDir }) {
|
||||
return exec(`yarn build-storybook --quiet`, { cwd: sandboxDir });
|
||||
},
|
||||
};
|
@ -7,6 +7,6 @@ export const smokeTest: Task = {
|
||||
return false;
|
||||
},
|
||||
async run(_, { sandboxDir }) {
|
||||
return exec(`'yarn storybook --smoke-test --quiet`, { cwd: sandboxDir });
|
||||
return exec(`yarn storybook --smoke-test --quiet`, { cwd: sandboxDir });
|
||||
},
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user