Allow changing the code at build time
continuous-integration/drone/push Build is passing Details

main
Clément FRÉVILLE 2 years ago
parent fc4e57cb0b
commit b083271b92

@ -1,6 +1,6 @@
# naive-keypad # naive-keypad
# Build the browser application ## Build the browser application
Ensure you have [Node.js](https://nodejs.org) installed. Then run: Ensure you have [Node.js](https://nodejs.org) installed. Then run:
@ -8,3 +8,13 @@ Ensure you have [Node.js](https://nodejs.org) installed. Then run:
npm install npm install
npm run build npm run build
``` ```
Copy the contents of the `dist` directory to your web server, and there you go!
## Changing the code
You may during the build process override the code of the keypad:
```sh
VITE_KEYPAD_CODE=7894 npm run build
```

@ -1,6 +1,6 @@
import './style.css'; import './style.css';
const CODE = '1234'; const CODE = import.meta.env.VITE_KEYPAD_CODE || '1234';
let builder = ''; let builder = '';
const display = document.getElementById('display') as HTMLDivElement; const display = document.getElementById('display') as HTMLDivElement;

@ -4,6 +4,7 @@
"useDefineForClassFields": true, "useDefineForClassFields": true,
"module": "ESNext", "module": "ESNext",
"lib": ["ES2020", "DOM", "DOM.Iterable"], "lib": ["ES2020", "DOM", "DOM.Iterable"],
"types": ["vite/client"],
"skipLibCheck": true, "skipLibCheck": true,
/* Bundler mode */ /* Bundler mode */

Loading…
Cancel
Save