Skip to content

Strip special characters from vite output #6588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
- Fix an issue preventing Vite applications from being emulated on Windows. (#6411)
- Addressed an issue preventing Astro applications from being deployed from Windows. (#5709)
- Fixed an issue preventing Angular apps using ng-deploy from being emulated or deployed. (#6584)
- Warn if a Web Framework is outside a well known version range on deploy/emulate. (#6562)
- Use Web Framework's well known version range in `firebase init hosting`. (#6562)
- Limit Web Framework's generated Cloud Function name to 20 characters, fixing deploys for some. (#6260)
- Limit Web Framework's generated Cloud Function name to 23 characters, fixing deploys for some. (#6260)
4 changes: 3 additions & 1 deletion src/frameworks/vite/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { spawn } from "cross-spawn";
import { existsSync } from "fs";
import { copy, pathExists } from "fs-extra";
import { join } from "path";
import stripAnsi from "strip-ansi";
import { FrameworkType, SupportLevel } from "../interfaces";
import { promptOnce } from "../../prompt";
import {
Expand Down Expand Up @@ -105,7 +106,8 @@ export async function getDevModeHandle(dir: string) {
const serve = spawn(cli, [], { cwd: dir });
serve.stdout.on("data", (data: any) => {
process.stdout.write(data);
const match = data.toString().match(/(http:\/\/.+:\d+)/);
const dataWithoutAnsiCodes = stripAnsi(data.toString());
const match = dataWithoutAnsiCodes.match(/(http:\/\/.+:\d+)/);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could strip ansi only if there's a match to avoid doing it unnecessarily?

if (match) resolve(match[1]);
});
serve.stderr.on("data", (data: any) => {
Expand Down