Skip to content

Commit

Permalink
build-command: show the path of the built WebOn in green text after s…
Browse files Browse the repository at this point in the history
…uccessful builds
  • Loading branch information
nomo-app committed Dec 5, 2023
1 parent 00369a3 commit c860cd0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
12 changes: 7 additions & 5 deletions src/build-webon/build-webon.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkDir, logFatal } from "../util/util";
import { checkDir, getDebugPath, logFatal } from "../util/util";
import { existsSync, mkdirSync, unlinkSync, renameSync } from "fs";
import * as path from "path";
import tar from "tar";
Expand Down Expand Up @@ -66,7 +66,11 @@ export async function buildWebOn(assetDir: string): Promise<void> {

try {
await createTarFile(outDirPath, tarFilePath);
console.log("\x1b[32m", "Build and packaging completed!", "\x1b[0m");
console.log(
"\x1b[32m",
"WebOn build completed: " + getDebugPath(tarFilePath),
"\x1b[0m"
);
} catch (error) {
console.error(`Error during build: ${error}`);
}
Expand All @@ -76,9 +80,7 @@ async function createTarFile(
outDirPath: string,
tarFilePath: string
): Promise<void> {
console.log(
`Creating new webon ${path.basename(tarFilePath)}: ${tarFilePath}`
);
console.log(`Creating WebOn: ${tarFilePath}`);
try {
await tar.create(
{
Expand Down
4 changes: 2 additions & 2 deletions test/e2e/build-webon-test/packaging-completed.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {

test("nextjs_sample tar.gz build", async () => {
const output = await runE2ETest("build test_assets/nextjs_sample/out/");
expect(output).toContain("Build and packaging completed!");
expect(output).toContain("WebOn build completed: ");
const existsFile = fs.existsSync("test_assets/nextjs_sample/out/nomo.tar.gz");
expect(existsFile).toBe(true);
await new Promise((resolve) => setTimeout(resolve, 5000));
Expand All @@ -15,7 +15,7 @@ test("nextjs_sample tar.gz build", async () => {

test("cra_sample tar.gz build", async () => {
const output = await runE2ETest("build test_assets/cra_sample/out/");
expect(output).toContain("Build and packaging completed!");
expect(output).toContain("WebOn build completed: ");
const existsFile = fs.existsSync("test_assets/cra_sample/out/nomo.tar.gz");
expect(existsFile).toBe(true);
fs.unlinkSync("test_assets/cra_sample/out/nomo.tar.gz");
Expand Down

0 comments on commit c860cd0

Please sign in to comment.