From b4c8afe3fa532b4dc5f3360c12105796b2341110 Mon Sep 17 00:00:00 2001 From: xavier skip Date: Sun, 4 May 2025 19:44:38 +0800 Subject: [PATCH 1/2] readme add "Build & run" --- README.md | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/README.md b/README.md index 9488043..2e7d8de 100644 --- a/README.md +++ b/README.md @@ -31,6 +31,79 @@ Stream data through multiple QRCodes [Live demo](https://qrss.netlify.app/) +## Build & run + +1. Install Dependencies + +You need install [Node.js](https://nodejs.org) first.The project uses `pnpm` as its package manager. First, ensure you have `pnpm` installed: + +```bash +npm install -g pnpm +``` + +Then, install the project dependencies: + +```bash +pnpm install +``` + +2. Build the Project + +Build the project using the command specified in the `package.json` and `netlify.toml`: + +```bash +pnpm run build +``` + +This will generate the output in the `.output` directory. + +Alternatively, if you want to run the development server to test changes: + +```bash +pnpm run dev +``` + +3. Serve the Project Locally + +if your target environment have `Node.js`, you can copy entire `.output` directory to where you want.You can preview this build using: + +```bash +node .output/server/index.mjs +``` + +if your target environment don't have `Node.js`, you cat just host those static files. + +```bash +cd .output/public +python -m http.server +``` + +You will usually encounter the following errors. + +``` +Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/plain". Strict MIME type checking is enforced for module scripts per HTML spec. +``` + +you need a custom web server, Run in the `.output/public` directory: + +```python +# python custom_http_server.py +from http.server import SimpleHTTPRequestHandler, HTTPServer + +class CustomHandler(SimpleHTTPRequestHandler): + def end_headers(self): + self.extensions_map.update({ + ".js": "application/javascript", + }) + super().end_headers() + +ADDR = '0.0.0.0' +PORT = 8000 +with HTTPServer((ADDR, PORT), CustomHandler) as httpd: + print(f"Serving on http://{ADDR}:{PORT}") + httpd.serve_forever() +``` + ## Sub-packages - [QiFi CLI](./packages/cli) - CLI for streaming QR code file transmission From a0f1f7796cbb168c941a427a6ea3c18ec0e2ee8d Mon Sep 17 00:00:00 2001 From: xavier skip Date: Mon, 5 May 2025 14:05:56 +0800 Subject: [PATCH 2/2] readme bold the entry --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2e7d8de..1711727 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Stream data through multiple QRCodes ## Build & run -1. Install Dependencies +**1. Install Dependencies** You need install [Node.js](https://nodejs.org) first.The project uses `pnpm` as its package manager. First, ensure you have `pnpm` installed: @@ -47,7 +47,7 @@ Then, install the project dependencies: pnpm install ``` -2. Build the Project +**2. Build the Project** Build the project using the command specified in the `package.json` and `netlify.toml`: @@ -63,7 +63,7 @@ Alternatively, if you want to run the development server to test changes: pnpm run dev ``` -3. Serve the Project Locally +**3. Serve the Project Locally** if your target environment have `Node.js`, you can copy entire `.output` directory to where you want.You can preview this build using: