async function runNpmScript()

in scripts/deno/check-npm-scripts.ts [88:112]


async function runNpmScript(pkgPath: string, script: string) {
	// Skip these scripts as they are long-running
	if (
		[
			'dev',
			'start',
			'storybook',
			'create-icons',
			'update-readme',
			'e2e:ui',
		].includes(script)
	) {
		return { result: 'skipping', error: '' };
	}

	const command = new Deno.Command('pnpm', {
		args: ['run', script],
		cwd: pkgPath,
	});
	const { success, stdout, stderr } = await command.output();
	if (success) {
		return new TextDecoder().decode(stdout);
	}
	throw new Error(new TextDecoder().decode(stderr));
}