CONTRIBUTING.md 1.9 KB

Development

The repository uses Rush for monorepo management.

Install Rush globally

$ npm i -g @microsoft/rush

Get code

The build script only works inside Git repositories, so, always use git to clone this repository. "Download ZIP" option in GitHub code menu or source code tarball in GitHub releases will NOT work.

git clone https://github.com/yume-chan/ya-webadb.git
cd ya-webadb

Install dependencies

$ rush update

Everyday commands

  • Build all packages:

    $ rush build
    
    • Watch changes and rebuild in all libraries:
    $ rush build:watch
    
  • Start demo's dev-server:

    $ cd apps/demo
    $ npm run dev
    

    Usually you need two terminals to run both 2 and 3 for testing your changes.

    Deploy Demo

    The demo is built with Next.js, a full-stack React framework, which usually requires a Node.js environment to run.

    However, since the demo doesn't have any server-side code, the most simple deployment method is to use the Static HTML Export feature of Next.js. It generates pre-rendered, fully static HTML files, that can be deployed to any static website hosting services (e.g. GitHub Pages).

    To export static deployable HTML files, after running rush build command, run:

    cd apps/demo
    npx next export
    

This will create an out folder containing exported HTML files and all required resource files.

FAQ

1. WebUSB and File downloading doesn't when developing/self-host?

WebUSB and Service Worker (which is used for file downloading) requires Secure Context (HTTPS or localhost).

If you access the development server using IP address, that will not work.

You can add a self issued SSL certificate, or add the URL to chrome://flags/#unsafely-treat-insecure-origin-as-secure.