diff --git a/scripts/task.ts b/scripts/task.ts index 7c91fcb0ed60..ab5888178ed6 100644 --- a/scripts/task.ts +++ b/scripts/task.ts @@ -42,6 +42,7 @@ export const extraAddons = ['a11y', 'storysource']; export type Path = string; export type TemplateDetails = { key: TemplateKey; + selectedTask: TaskKey; template: Template; codeDir: Path; sandboxDir: Path; @@ -327,18 +328,16 @@ async function run() { const { task: taskKey, startFrom, junit, ...optionValues } = allOptionValues; - // In case other tasks need to know - process.env.SELECTED_TASK = taskKey; - const finalTask = tasks[taskKey]; const { template: templateKey } = optionValues; const template = TEMPLATES[templateKey]; const templateSandboxDir = templateKey && join(sandboxDir, templateKey.replace('/', '-')); - const details = { + const details: TemplateDetails = { key: templateKey, template, codeDir, + selectedTask: taskKey, sandboxDir: templateSandboxDir, builtSandboxDir: templateKey && join(templateSandboxDir, 'storybook-static'), junitFilename: junit && getJunitFilename(taskKey), diff --git a/scripts/tasks/dev.ts b/scripts/tasks/dev.ts index a566b5375e29..08a6c038a447 100644 --- a/scripts/tasks/dev.ts +++ b/scripts/tasks/dev.ts @@ -14,11 +14,9 @@ export const dev: Task = { async ready() { return (await detectFreePort(PORT)) !== PORT; }, - async run({ sandboxDir, codeDir }, { dryRun, debug }) { + async run({ sandboxDir, codeDir, selectedTask }, { dryRun, debug }) { const controller = new AbortController(); - const devCommand = `yarn storybook --port ${PORT}${ - process.env.SELECTED_TASK === 'dev' ? '' : ' --ci' - }`; + const devCommand = `yarn storybook --port ${PORT}${selectedTask === 'dev' ? '' : ' --ci'}`; exec( devCommand,