Node LTS 22.16.0
Install dependencies
npm install
Start development server and watch for changes in the src/ directory.
npm run dev
Open http://localhost:3000/ in your browser.
Deploy a new version of the site to Cloudflare workers.
npm run deploy
Build the site locally into the dist/ folder.
npm run build
In the dist/ folder run npx http-server and open the link in browser.
Unit tests are run with Jest.
npm test
Update dependencies to latest
npx npm-check-updates -u
Update browserslist data
npx update-browserslist-db@latest
Cloudflare Content-Security-Policy header
- Rules > Transform Rules > Modify Response Header
- Create Rule
Rule name: CSP
All incoming requests
Then... Add
Header name: Content-Security-Policy
Value:
default-src 'self'; connect-src 'self' https://cloudflareinsights.com; script-src 'self' https://static.cloudflareinsights.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' 'unsafe-inline' https://fonts.gstatic.com; img-src 'self' data:;
Place at, Select order: First
npm run devornpm start- start a local server for developing the sitenpm run deploy- deploy the site to Cloudflarenpm run build- build the site into thedist/directorynpm test- run unit tests