Kaynağa Gözat

Add yarn preview:*

Manav Rathi 1 yıl önce
ebeveyn
işleme
5810d2b762
3 değiştirilmiş dosya ile 38 ekleme ve 3 silme
  1. 1 1
      desktop/docs/dev.md
  2. 32 1
      web/docs/dev.md
  3. 5 1
      web/package.json

+ 1 - 1
desktop/docs/dev.md

@@ -31,7 +31,7 @@ are built against `electron`'s packaged `node` version. We use
 to rebuild those modules automatically after each `yarn install` by invoking it
 in as the `postinstall` step in our package.json.
 
-### lint and lint-fix
+### lint, lint-fix
 
 Use `yarn lint` to check that your code formatting is as expected, and that
 there are no linter errors. Use `yarn lint-fix` to try and automatically fix the

+ 32 - 1
web/docs/dev.md

@@ -1,4 +1,35 @@
-# Notes for Developers
+# Development
+
+## Yarn commands
+
+### yarn dev:*
+
+Launch the app in development mode. There is one `yarn dev:foo` for each app,
+e.g. `yarn dev:auth`. `yarn dev` is a shortcut for `yarn dev:photos`.
+
+The ports are different for the main apps (3000), various sidecars (3001, 3002).
+
+### yarn build:*
+
+Build a production export for the app. This is a bunch of static HTML/JS/CSS
+that can be then deployed to any web server.
+
+There is one `yarn build:foo` for each app, e.g. `yarn build:auth`. The output
+will be placed in `apps/<foo>/out`, e.g. `apps/auth/out`.
+
+### yarn preview:*
+
+Build a production export and start a local web server to serve it. This uses
+Python's built in web server, and is okay for quick testing but should not be
+used in production.
+
+The ports are the same as that for `yarn dev:*`
+
+### lint, lint-fix
+
+Use `yarn lint` to check that your code formatting is as expected, and that
+there are no linter errors. Use `yarn lint-fix` to try and automatically fix the
+issues.
 
 ## Monorepo
 

+ 5 - 1
web/package.json

@@ -26,7 +26,11 @@
         "dev:payments": "yarn workspace payments next dev -p 3001",
         "dev:photos": "yarn workspace photos next dev",
         "lint": "yarn prettier --check . && yarn workspaces run eslint .",
-        "lint-fix": "yarn prettier --write . && yarn workspaces run eslint --fix ."
+        "lint-fix": "yarn prettier --write . && yarn workspaces run eslint --fix .",
+        "preview:accounts": "yarn build:accounts && python3 -m http.server -d apps/accounts/out 3001",
+        "preview:auth": "yarn build:auth && python3 -m http.server -d apps/auth/out 3001",
+        "preview:cast": "yarn build:cast && python3 -m http.server -d apps/accounts/out 3001",
+        "preview:photos": "yarn build:photos && python3 -m http.server -d apps/photos/out 3001"
     },
     "resolutions": {
         "libsodium": "0.7.9"