Add build task

This commit is contained in:
Tom Coleman 2022-08-12 14:26:34 +10:00
parent a462193038
commit d9d13d2932
4 changed files with 19 additions and 8 deletions

View File

@ -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+

View File

@ -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
View 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 });
},
};

View File

@ -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 });
},
};