local development setup
Clone, npm install, serve test.html over HTTPS.
Release later: Build and release process. Manual checks: Testing and validation.
Tools#
| Tool | Why |
|---|---|
| Node 18+ | esbuild, jsdoc |
| npm 7+ | lockfile v3 |
| Python 3 | run_server |
| OpenSSL | certs for that script |
| Git | clone |
Clone#
git clone https://github.com/tashifkhan/jsjiit.git
cd jsjiit
npm install
prepare runs npm run build, so dist/ appears after install.
Dev deps from package.json: [email protected], jsdoc@^4.0.4.
Tree#
flowchart TB repo[clone] repo --> src[src/*.js] repo --> test[test.html] repo --> run[run_server] repo --> build[build.mjs] repo --> dist[dist/ after prepare]
.gitignore: .vscode, docs, node_modules, cert.pem, key.pem, dist.
HTTPS server#
run_server is a Python 3 script (shebang #!/usr/bin/python). It:
- Runs
openssl req -nodes -x509 -newkey rsa:4096 ... -subj /CN=mylocalhost - Serves the current directory with
HTTPServer+ssl.PROTOCOL_TLS_SERVER - Listens on
https://localhost:8000
./run_server
flowchart LR openssl[openssl x509] --> pem[key.pem cert.pem] pem --> httpd[HTTPServer TLS] httpd --> page[test.html]
Trust the self-signed cert in the browser once. The CN is mylocalhost while the host is localhost. Expect a name mismatch warning.
test.html#
flowchart TD form[user + pass inputs] --> main[window.main] main --> login[WebPortal.student_login] login --> fb[fill_feedback_form EXCELLENT]
The live script imports ./src/index.js (not the CDN). After login it currently submits feedback as "EXCELLENT". Attendance / exam / grade calls are commented out. Do not click Submit against a real account unless you want that feedback POST.
Commented import lines show older CDN versions (0.0.17 and unpinned latest).
Edit cycle#
flowchart LR save[save wrapper.js] --> reload[reload test.html] reload --> module[browser module cache]
Source modules load unbundled. A hard reload is enough. You do not need npm run build until you want dist/.
flowchart TB srcEdit[src change] --> optional[npm run build] optional --> dist[dist/jsjiit*.esm.js]