mirror of
https://github.com/storybookjs/storybook.git
synced 2025-04-09 00:19:13 +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(' '));
|
context.logger.info(finalCompodocArgs.join(' '));
|
||||||
const child = spawn('npx', finalCompodocArgs, {
|
const child = spawn('npx', finalCompodocArgs, {
|
||||||
cwd: context.workspaceRoot,
|
cwd: context.workspaceRoot,
|
||||||
|
shell: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
child.stdout.on('data', (data) => {
|
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)
|
// (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], {
|
spawnSync('yarn', ['compodoc', '-p', `${testDir}/tsconfig.json`, '-e', 'json', '-d', tmpDir], {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
});
|
});
|
||||||
const output = fs.readFileSync(`${tmpDir}/documentation.json`, 'utf8');
|
const output = fs.readFileSync(`${tmpDir}/documentation.json`, 'utf8');
|
||||||
try {
|
try {
|
||||||
|
@ -123,6 +123,7 @@ const postinstallAddon = async (addonName: string, isOfficialAddon: boolean) =>
|
|||||||
}
|
}
|
||||||
spawnSync('npx', ['jscodeshift', '-t', codemod, configFile], {
|
spawnSync('npx', ['jscodeshift', '-t', codemod, configFile], {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
});
|
});
|
||||||
skipMsg = null;
|
skipMsg = null;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
@ -386,6 +386,7 @@ export abstract class JsPackageManager {
|
|||||||
cwd: this.cwd,
|
cwd: this.cwd,
|
||||||
stdio: stdio ?? 'pipe',
|
stdio: stdio ?? 'pipe',
|
||||||
encoding: 'utf-8',
|
encoding: 'utf-8',
|
||||||
|
shell: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (commandResult.status !== 0) {
|
if (commandResult.status !== 0) {
|
||||||
|
@ -29,12 +29,12 @@ export class JsPackageManagerFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function hasNPM(cwd?: string) {
|
function hasNPM(cwd?: string) {
|
||||||
const npmVersionCommand = spawnSync('npm', ['--version'], { cwd });
|
const npmVersionCommand = spawnSync('npm', ['--version'], { cwd, shell: true });
|
||||||
return npmVersionCommand.status === 0;
|
return npmVersionCommand.status === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getYarnVersion(cwd?: string): 1 | 2 | undefined {
|
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) {
|
if (yarnVersionCommand.status !== 0) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -37,6 +37,7 @@ export const link = async ({ target, local, start }: LinkOptions) => {
|
|||||||
const version = spawnSync('yarn', ['--version'], {
|
const version = spawnSync('yarn', ['--version'], {
|
||||||
cwd: reproDir,
|
cwd: reproDir,
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
shell: true,
|
||||||
}).stdout.toString();
|
}).stdout.toString();
|
||||||
|
|
||||||
if (!/^[23]\./.test(version)) {
|
if (!/^[23]\./.test(version)) {
|
||||||
|
@ -73,7 +73,7 @@ const warnPackages = (pkgs: Package[]) =>
|
|||||||
pkgs.forEach((pkg) => logger.warn(`- ${formatPackage(pkg)}`));
|
pkgs.forEach((pkg) => logger.warn(`- ${formatPackage(pkg)}`));
|
||||||
|
|
||||||
export const checkVersionConsistency = () => {
|
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
|
const storybookPackages = lines
|
||||||
.map(getStorybookVersion)
|
.map(getStorybookVersion)
|
||||||
.filter(Boolean)
|
.filter(Boolean)
|
||||||
@ -165,6 +165,7 @@ export const upgrade = async ({
|
|||||||
flags = addExtraFlags(EXTRA_FLAGS, flags, packageManager.retrievePackageJson());
|
flags = addExtraFlags(EXTRA_FLAGS, flags, packageManager.retrievePackageJson());
|
||||||
const check = spawnSync('npx', ['npm-check-updates@latest', '/storybook/', ...flags], {
|
const check = spawnSync('npx', ['npm-check-updates@latest', '/storybook/', ...flags], {
|
||||||
stdio: 'pipe',
|
stdio: 'pipe',
|
||||||
|
shell: true,
|
||||||
}).output.toString();
|
}).output.toString();
|
||||||
logger.info(check);
|
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],
|
['jscodeshift', '-t', `${TRANSFORM_DIR}/${codemod}.js`, ...parserArgs, ...files],
|
||||||
{
|
{
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,7 @@ const runWebComponentsAnalyzer = (inputPath: string) => {
|
|||||||
const customElementsFile = `${tmpDir}/custom-elements.json`;
|
const customElementsFile = `${tmpDir}/custom-elements.json`;
|
||||||
spawnSync('yarn', ['wca', 'analyze', inputPath, '--outFile', customElementsFile], {
|
spawnSync('yarn', ['wca', 'analyze', inputPath, '--outFile', customElementsFile], {
|
||||||
stdio: 'inherit',
|
stdio: 'inherit',
|
||||||
|
shell: true,
|
||||||
});
|
});
|
||||||
const output = fs.readFileSync(customElementsFile, 'utf8');
|
const output = fs.readFileSync(customElementsFile, 'utf8');
|
||||||
try {
|
try {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user