mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-02 05:03:44 +08:00
Fix up env vars replacement
This commit is contained in:
parent
de2d8057d1
commit
423da00284
@ -168,13 +168,16 @@ async function run() {
|
||||
});
|
||||
}
|
||||
|
||||
// Do some simple variable substitution
|
||||
const templateEnv = template.toUpperCase().replace(/\/-/, '_');
|
||||
// Do some simple variable substitution using a #TEMPLATE_X syntax
|
||||
const templateEnv = template.toUpperCase().replace(/\/|-/g, '_');
|
||||
toRun = toRun.replace('#TEMPLATE_ENV', templateEnv);
|
||||
const templateDir = template.replace('/', '-');
|
||||
toRun = toRun.replace('#TEMPLATE_DIR', templateDir);
|
||||
toRun = toRun.replace('#TEMPLATE', template);
|
||||
|
||||
// Also substitute environment variables into command
|
||||
toRun = toRun.replace(/\$([A-Z_]+)/, (_, name) => process.env[name]);
|
||||
|
||||
const execaOptions = cd ? { cwd: join(sandboxDir, templateDir) } : {};
|
||||
if (parallel) {
|
||||
toAwait.push(runCommand(toRun, execaOptions, { step, template }));
|
||||
|
Loading…
x
Reference in New Issue
Block a user