mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-21 05:02:39 +08:00
Update build scripts to async import execa
This commit is contained in:
parent
74a70c90fa
commit
f1017f15d0
@ -1,7 +1,6 @@
|
||||
/* eslint-disable no-console */
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const execa = require('execa');
|
||||
const { join } = require('path');
|
||||
|
||||
function getCommand(watch, dir) {
|
||||
@ -55,11 +54,13 @@ function handleExit(code, stderr, errorCallback) {
|
||||
}
|
||||
|
||||
async function run({ watch, dir, silent, errorCallback }) {
|
||||
const execa = await import('execa');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const command = getCommand(watch, dir);
|
||||
|
||||
if (command !== '') {
|
||||
const child = execa.command(command, {
|
||||
const child = execa.execaCommand(command, {
|
||||
cwd: join(__dirname, '..'),
|
||||
buffer: false,
|
||||
env: { BABEL_MODE: path.basename(dir) },
|
||||
|
@ -1,7 +1,6 @@
|
||||
/* eslint-disable no-console */
|
||||
const fs = require('fs-extra');
|
||||
const path = require('path');
|
||||
const execa = require('execa');
|
||||
|
||||
function getCommand(watch) {
|
||||
const args = [
|
||||
@ -41,11 +40,13 @@ function handleExit(code, stderr, errorCallback) {
|
||||
}
|
||||
|
||||
async function run({ optimized, watch, silent, errorCallback }) {
|
||||
const execa = await import('execa');
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const [command, tscOnly] = getCommand(watch);
|
||||
|
||||
if (tscOnly || optimized) {
|
||||
const child = execa.command(command, {
|
||||
const child = execa.execaCommand(command, {
|
||||
buffer: false,
|
||||
});
|
||||
let stderr = '';
|
||||
|
Loading…
x
Reference in New Issue
Block a user