mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-05 08:01:20 +08:00
fix(windows): node.js modules .bin commands does not appear available as executable, so invoke these commands as shell commands
This commit is contained in:
parent
03b6c00902
commit
045a3d71af
@ -30,6 +30,7 @@ export const runCompodoc = (
|
||||
context.logger.info(finalCompodocArgs.join(' '));
|
||||
const child = spawn('npx', finalCompodocArgs, {
|
||||
cwd: context.workspaceRoot,
|
||||
shell: true,
|
||||
});
|
||||
|
||||
child.stdout.on('data', (data) => {
|
||||
|
@ -21,6 +21,7 @@ const runCompodoc = (inputPath: string) => {
|
||||
// (and screwed around with relative paths as well, but couldn't get it working)
|
||||
spawnSync('yarn', ['compodoc', '-p', `${testDir}/tsconfig.json`, '-e', 'json', '-d', tmpDir], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
const output = fs.readFileSync(`${tmpDir}/documentation.json`, 'utf8');
|
||||
try {
|
||||
|
@ -123,6 +123,7 @@ const postinstallAddon = async (addonName: string, isOfficialAddon: boolean) =>
|
||||
}
|
||||
spawnSync('npx', ['jscodeshift', '-t', codemod, configFile], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
skipMsg = null;
|
||||
} catch (err) {
|
||||
|
@ -386,6 +386,7 @@ export abstract class JsPackageManager {
|
||||
cwd: this.cwd,
|
||||
stdio: stdio ?? 'pipe',
|
||||
encoding: 'utf-8',
|
||||
shell: true,
|
||||
});
|
||||
|
||||
if (commandResult.status !== 0) {
|
||||
|
@ -29,12 +29,12 @@ export class JsPackageManagerFactory {
|
||||
}
|
||||
|
||||
function hasNPM(cwd?: string) {
|
||||
const npmVersionCommand = spawnSync('npm', ['--version'], { cwd });
|
||||
const npmVersionCommand = spawnSync('npm', ['--version'], { cwd, shell: true });
|
||||
return npmVersionCommand.status === 0;
|
||||
}
|
||||
|
||||
function getYarnVersion(cwd?: string): 1 | 2 | undefined {
|
||||
const yarnVersionCommand = spawnSync('yarn', ['--version'], { cwd });
|
||||
const yarnVersionCommand = spawnSync('yarn', ['--version'], { cwd, shell: true });
|
||||
|
||||
if (yarnVersionCommand.status !== 0) {
|
||||
return undefined;
|
||||
|
@ -37,6 +37,7 @@ export const link = async ({ target, local, start }: LinkOptions) => {
|
||||
const version = spawnSync('yarn', ['--version'], {
|
||||
cwd: reproDir,
|
||||
stdio: 'pipe',
|
||||
shell: true,
|
||||
}).stdout.toString();
|
||||
|
||||
if (!/^[23]\./.test(version)) {
|
||||
|
@ -73,7 +73,7 @@ const warnPackages = (pkgs: Package[]) =>
|
||||
pkgs.forEach((pkg) => logger.warn(`- ${formatPackage(pkg)}`));
|
||||
|
||||
export const checkVersionConsistency = () => {
|
||||
const lines = spawnSync('npm', ['ls'], { stdio: 'pipe' }).output.toString().split('\n');
|
||||
const lines = spawnSync('npm', ['ls'], { stdio: 'pipe', shell: true }).output.toString().split('\n');
|
||||
const storybookPackages = lines
|
||||
.map(getStorybookVersion)
|
||||
.filter(Boolean)
|
||||
@ -165,6 +165,7 @@ export const upgrade = async ({
|
||||
flags = addExtraFlags(EXTRA_FLAGS, flags, packageManager.retrievePackageJson());
|
||||
const check = spawnSync('npx', ['npm-check-updates@latest', '/storybook/', ...flags], {
|
||||
stdio: 'pipe',
|
||||
shell: true,
|
||||
}).output.toString();
|
||||
logger.info(check);
|
||||
|
||||
|
@ -62,6 +62,7 @@ export async function runCodemod(codemod, { glob, logger, dryRun, rename, parser
|
||||
['jscodeshift', '-t', `${TRANSFORM_DIR}/${codemod}.js`, ...parserArgs, ...files],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ const runWebComponentsAnalyzer = (inputPath: string) => {
|
||||
const customElementsFile = `${tmpDir}/custom-elements.json`;
|
||||
spawnSync('yarn', ['wca', 'analyze', inputPath, '--outFile', customElementsFile], {
|
||||
stdio: 'inherit',
|
||||
shell: true,
|
||||
});
|
||||
const output = fs.readFileSync(customElementsFile, 'utf8');
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user