mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-01-13 11:13:09 +00:00
* add tests-browser package * rename to browser * add playwright and experiment with karma * add lock * remove karma * remove readme * replace default app, rename * add and configure playwright * up package-lock * use @waku/create-app, add scripts to handle it * remove tsconfig * update playwright script * move dependency to root * set folder * up * try install step * add playwright dep * remove step * add es module utils * fix import issue * run on master * use image prop * use dotenv-flow, set .env.local * add log, use dotenv-flow * add env var to ci * add env vars to CI * return install of deps * return container & log build step * upgrade @waku/create-app * fix firefox in container problem
56 lines
1.4 KiB
JavaScript
56 lines
1.4 KiB
JavaScript
#!/usr/bin/env node
|
|
import "dotenv-flow/config";
|
|
import { execSync } from "child_process";
|
|
import path from "path";
|
|
|
|
import { __dirname } from "./utils.js";
|
|
|
|
const EXAMPLE_NAME = process.env.EXAMPLE_NAME;
|
|
const EXAMPLE_PATH = path.resolve(__dirname, "..", EXAMPLE_NAME);
|
|
|
|
const BUILD_FOLDER = "build";
|
|
const BUILD_PATH = path.resolve(EXAMPLE_PATH, BUILD_FOLDER);
|
|
|
|
// required by web-chat example
|
|
const WEB_CHAT_BUILD_PATH = path.resolve(EXAMPLE_PATH, "web-chat");
|
|
|
|
run();
|
|
|
|
function run() {
|
|
cleanPrevBuildIfExists();
|
|
buildExample();
|
|
renameBuildFolderForWebChat();
|
|
}
|
|
|
|
function cleanPrevBuildIfExists() {
|
|
try {
|
|
console.log("Cleaning previous build if exists.");
|
|
execSync(`rm -rf ${BUILD_PATH}`, { stdio: "ignore" });
|
|
} catch (error) {
|
|
console.error(`Failed to clean previous build: ${error.message}`);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
function buildExample() {
|
|
try {
|
|
console.log("Building example at", EXAMPLE_PATH);
|
|
execSync(`cd ${EXAMPLE_PATH} && npm run build`, { stdio: "pipe" });
|
|
} catch (error) {
|
|
console.error(`Failed to build example: ${error.message}`);
|
|
throw error;
|
|
}
|
|
}
|
|
|
|
function renameBuildFolderForWebChat() {
|
|
try {
|
|
console.log("Renaming example's build folder.");
|
|
execSync(`mv ${BUILD_PATH} ${WEB_CHAT_BUILD_PATH}`, { stdio: "ignore" });
|
|
} catch (error) {
|
|
console.error(
|
|
`Failed to rename build folder for web-chat: ${error.message}`
|
|
);
|
|
throw error;
|
|
}
|
|
}
|