JSPM

  • Created
  • Published
  • Downloads 157
  • Score
    100M100P100Q93890F
  • License CC-BY-4.0 OR GPL-3.0-or-later

Locking Down Networks, Unlocking Confidence | Security, Networking, Privacy — Network Pro Strategies

Package Exports

    This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@networkpro/web) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

    Readme

    🌐 Network Pro™ — Web Presence

    Locking Down Networks, Unlocking Confidence™
    Security, Networking, Privacy — Network Pro™

     

    Netlify Status NPM Version Build and Publish to Registries
    Code Style: Prettier stylelint Contributor Covenant

    🚀 Project Overview

    This GitHub repository powers the official web presence of Network Pro Strategies — a privacy-first consultancy specializing in cybersecurity, network engineering, and information security. We also lead public advocacy efforts promoting digital privacy and responsible cyber policy.

    Built with SvelteKit and deployed via Netlify.
    Blog and documentation subsites built with Material for MkDocs and deployed via GitHub Pages.

    All infrastructure and data flows are designed with maximum transparency, self-hosting, and user privacy in mind.

    📁 Repository Structure

    .
    ├── .github/workflows     # CI workflows and automation
    ├── .vscode/              # Recommended VS Code settings, extensions
    ├── netlify-functions/
    │   └── cspReport.js      # Serverless function to receive and log CSP violation reports
    ├── scripts/              # Utility scripts
    ├── src/
    │   ├── lib/              # Reusable components, styles, utilities
    │   ├── routes/           # SvelteKit routes (+page.svelte, +page.server.js)
    │   ├── hooks.client.ts   # Handles PWA install prompt and logs client errors
    │   ├── hooks.server.js   # Injects CSP headers and permissions policy
    │   ├── app.html          # SvelteKit entry HTML with CSP/meta/bootentry
    │   └── service-worker.js # Custom Service Worker
    ├── static/               # Static assets served at root
    ├── tests/
    │   ├── e2e/              # End-to-end Playwright tests
    │   └── unit/             # Vite unit tests
    ├── netlify.toml          # Netlify configuration
    └── ...

    🛠 Getting Started

    📦 Environment Setup

    git clone https://github.com/netwk-pro/netwk-pro.github.io.git
    cd netwk-pro.github.io
    cp .env.template .env
    npm install

    Edit .env to configure your environment mode:

    ENV_MODE=dev  # Options: dev, test, ci, preview, prod

    ENV_MODE is used for tooling and workflows — not by SvelteKit itself.
    Use VITE_-prefixed env variables for runtime values.

     

    🧰 Local Setup Scripts

    To streamline onboarding and enforce project conventions, you may use the optional helper scripts:

    File/Script Description
    .env.template Template for local environment variables
    scripts/checkNode.js Validates your Node.js and npm versions
    scripts/bootstrap.local.sh (TBD) Interactive setup for local configuration and tooling
    .vscode/ Editor recommendations compatible with VSCodium / VS Code

    To get started quickly:

    cp .env.template .env
    npm install

    You can also use bootstrap.local.sh to automate the steps above and more (optional).
    ENV_MODE controls local tooling behavior — it is not used by the app runtime directly.


    💾 Version Enforcement

    To ensure consistent environments across contributors and CI systems, this project enforces specific Node.js and npm versions via the "engines" field in package.json:

    "engines": {
      "node": ">=22.0.0 <25",
      "npm": ">=11.0.0 <12"
    }

    Version compliance is softly enforced after installation via a postinstall lifecycle hook:

    npm run check:node

    This script runs scripts/checkNode.js, which compares your current Node.js and npm versions against the required ranges. During the install phase, it will log warnings for out-of-range versions but allow installation to continue. In all other contexts (manual runs, CI workflows, etc.), it will fail with a descriptive error if the versions are out of spec.

    Node Version Check (snippet from scripts/checkNode.js)

    const semver = require("semver");
    const { engines } = require("../package.json");
    
    const requiredNode = engines.node;
    const requiredNpm = engines.npm;
    const isPostInstall = process.env.npm_lifecycle_event === "postinstall";
    
    let hasError = false;
    
    if (!semver.satisfies(process.version, requiredNode)) {
      const msg = `Node.js ${process.version} does not satisfy required range: ${requiredNode}`;
      isPostInstall ? console.warn(`⚠️  ${msg}`) : console.error(`${msg}`);
      if (!isPostInstall) hasError = true;
    }
    
    const npmVersion = require("child_process")
      .execSync("npm -v")
      .toString()
      .trim();
    
    if (!semver.satisfies(npmVersion, requiredNpm)) {
      const msg = `npm ${npmVersion} does not satisfy required range: ${requiredNpm}`;
      isPostInstall ? console.warn(`⚠️  ${msg}`) : console.error(`${msg}`);
      if (!isPostInstall) hasError = true;
    }
    
    if (!hasError) {
      console.log("✅ Node and npm versions are valid.");
    } else {
      process.exit(1);
    }

    For full compatibility, .nvmrc and .node-version files are provided to work seamlessly with version managers like nvm, asdf, and Volta. This ensures consistent environments across local development, CI pipelines, and deployment targets.

    To manually verify your environment:

    node -v     # Should fall within engines.node
    npm -v      # Should fall within engines.npm

     

    🛡️ Configuration

    This project includes custom runtime configuration files for enhancing security, error handling, and PWA functionality. These modules are used by the framework during server- and client-side lifecycle hooks.

    🔐 hooks.server.js

    Located at src/hooks.server.js, this file is responsible for injecting dynamic security headers. It includes:

    • Content Security Policy (CSP) with support for relaxed directives (inline scripts allowed)
    • Permissions Policy to explicitly disable unnecessary browser APIs
    • X-Content-Type-Options, X-Frame-Options, and Referrer-Policy headers

    💡 The CSP nonce feature has been disabled. Inline scripts are now allowed through the policy using the "script-src 'self' 'unsafe-inline'" directive. If you wish to use nonces in the future, you can re-enable them by uncommenting the relevant sections in hooks.server.js and modifying your inline