@networkpro/web 1.5.2 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CODE_OF_CONDUCT.md +1 -0
- package/LICENSE.md +5 -39
- package/README.md +319 -39
- package/cspell.json +65 -0
- package/eslint.config.mjs +2 -1
- package/jsconfig.json +2 -1
- package/netlify-functions/cspReport.js +68 -0
- package/netlify.toml +17 -8
- package/package.json +52 -56
- package/playwright.config.js +21 -19
- package/postcss.config.mjs +1 -0
- package/scripts/auditScripts.js +1 -0
- package/scripts/bundleCss.js +1 -0
- package/scripts/checkEnv.js +1 -0
- package/scripts/checkNode.js +46 -19
- package/scripts/checkVersions.js +1 -0
- package/scripts/flattenHeaders.js +1 -0
- package/scripts/validateHeaders.js +1 -0
- package/src/app.d.ts +14 -3
- package/src/app.html +7 -49
- package/src/global.d.ts +1 -0
- package/src/hooks.client.ts +16 -7
- package/src/hooks.server.js +91 -0
- package/src/lib/components/Badges.svelte +1 -0
- package/src/lib/components/ContainerSection.svelte +1 -0
- package/src/lib/components/FullWidthSection.svelte +15 -1
- package/src/lib/components/LegalNav.svelte +1 -0
- package/src/lib/components/Logo.svelte +1 -0
- package/src/lib/components/MetaTags.svelte +1 -0
- package/src/lib/components/PWAInstallButton.svelte +1 -0
- package/src/lib/components/RedirectPage.svelte +20 -12
- package/src/lib/components/SocialMedia.svelte +1 -0
- package/src/lib/components/foss/FossFeatures.svelte +58 -4
- package/src/lib/components/foss/FossItemContent.svelte +2 -1
- package/src/lib/components/layout/Footer.svelte +4 -1
- package/src/lib/components/layout/HeaderDefault.svelte +2 -1
- package/src/lib/components/layout/HeaderHome.svelte +2 -1
- package/src/lib/data/fossData.js +271 -68
- package/src/lib/images.js +10 -1
- package/src/lib/img/logo-web.png +0 -0
- package/src/lib/img/logo-web.webp +0 -0
- package/src/lib/img/posts/eauth.png +0 -0
- package/src/lib/img/posts/eauth.webp +0 -0
- package/src/lib/index.js +1 -0
- package/src/lib/meta.js +1 -1
- package/src/lib/pages/AboutContent.svelte +1 -0
- package/src/lib/pages/FossContent.svelte +2 -1
- package/src/lib/pages/HomeContent.svelte +1 -0
- package/src/lib/pages/LicenseContent.svelte +33 -3
- package/src/lib/pages/PrivacyContent.svelte +33 -12
- package/src/lib/pages/TermsConditionsContent.svelte +3 -0
- package/src/lib/pages/TermsUseContent.svelte +3 -0
- package/src/lib/registerServiceWorker.js +35 -31
- package/src/lib/styles/css/default.css +1 -0
- package/src/lib/styles/css/global.css +1 -0
- package/src/lib/styles/css/normalize.css +1 -0
- package/src/lib/styles/css/offline.css +1 -0
- package/src/lib/styles/css/style.css +1 -0
- package/src/lib/styles/fa-global.css +1 -0
- package/src/lib/styles/global.min.css +1 -0
- package/src/lib/styles/index.js +2 -1
- package/src/lib/types/metadata.js +1 -0
- package/src/lib/unregisterServiceWorker.js +1 -0
- package/src/lib/utils/utm.js +1 -0
- package/src/routes/+error.svelte +1 -0
- package/src/routes/+layout.js +7 -1
- package/src/routes/+layout.svelte +8 -6
- package/src/routes/+page.server.js +1 -0
- package/src/routes/+page.svelte +1 -0
- package/src/routes/about/+page.server.js +1 -0
- package/src/routes/about/+page.svelte +1 -0
- package/src/routes/api/mock-csp/+server.js +22 -0
- package/src/routes/consultation/+page.svelte +1 -0
- package/src/routes/contact/+page.svelte +1 -0
- package/src/routes/foss-spotlight/+page.server.js +1 -0
- package/src/routes/foss-spotlight/+page.svelte +1 -0
- package/src/routes/license/+page.server.js +1 -0
- package/src/routes/license/+page.svelte +1 -0
- package/src/routes/privacy-policy/+page.server.js +1 -0
- package/src/routes/privacy-policy/+page.svelte +1 -0
- package/src/routes/privacy-rights/+page.svelte +1 -0
- package/src/routes/terms-conditions/+page.server.js +1 -0
- package/src/routes/terms-conditions/+page.svelte +1 -0
- package/src/routes/terms-of-use/+page.server.js +1 -0
- package/src/routes/terms-of-use/+page.svelte +1 -0
- package/src/service-worker.d.ts +8 -0
- package/src/service-worker.js +56 -28
- package/static/disableSw.js +12 -0
- package/static/docs/Home.md +63 -0
- package/static/docs/extensions.md +58 -0
- package/static/sitemap.xml +7 -7
- package/stylelint.config.js +4 -7
- package/svelte.config.js +1 -0
- package/tests/e2e/app.spec.js +59 -21
- package/tests/e2e/mobile.spec.js +50 -29
- package/tests/unit/auditScripts.test.js +1 -0
- package/tests/unit/checkEnv.test.js +1 -0
- package/tests/unit/checkVersions.test.js +1 -0
- package/tests/unit/cspReport.test.js +81 -0
- package/tests/unit/demo.test.js +1 -0
- package/tests/unit/routes/page.svelte.test.js +1 -0
- package/tests/unit/unregisterServiceWorker.test.js +1 -0
- package/tests/unit/utm.test.js +1 -0
- package/{tsconfig.custom.json → tsconfig.custom.jsonc} +2 -1
- package/vite.config.js +1 -0
- package/vitest.config.client.js +1 -0
- package/vitest.config.server.js +1 -0
- package/_headers +0 -9
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<!-- =========================================================================
|
|
2
2
|
CODE_OF_CONDUCT.md
|
|
3
3
|
|
|
4
|
+
Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
5
|
SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
6
|
This file is part of Network Pro.
|
|
6
7
|
========================================================================== -->
|
package/LICENSE.md
CHANGED
|
@@ -1,47 +1,10 @@
|
|
|
1
1
|
<!-- =========================================================================
|
|
2
2
|
LICENSE.md
|
|
3
3
|
|
|
4
|
+
Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
5
|
SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
6
|
This file is part of Network Pro.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<!--
|
|
9
|
-
Copyright © 2025 Network Pro Strategies (Network Pro)
|
|
10
|
-
|
|
11
|
-
---
|
|
12
|
-
|
|
13
|
-
I. Creative Commons Attribution 4.0 International
|
|
14
|
-
|
|
15
|
-
Network Pro (the "Licensed Material") is licensed under Creative Commons Attribution 4.0 International ("CC BY 4.0"). To view a copy of this license, visit https://creativecommons.org/licenses/by/4.0/.
|
|
16
|
-
|
|
17
|
-
Per the terms of the License, you are free to distribute, remix, adapt, and build upon the Licensed Material for any purpose, even commercially. You must give appropriate credit, provide a link to the License, and indicate if changes were made.
|
|
18
|
-
|
|
19
|
-
The Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable.
|
|
20
|
-
|
|
21
|
-
Permissions beyond the scope of this License—or instead of those permitted by this License—may be available as further defined within this document.
|
|
22
|
-
|
|
23
|
-
SPDX Reference: https://spdx.org/licenses/CC-BY-4.0.html
|
|
24
|
-
Canonical URL: https://creativecommons.org/licenses/by/4.0/
|
|
25
|
-
|
|
26
|
-
---
|
|
27
|
-
|
|
28
|
-
II. GNU General Public License
|
|
29
|
-
|
|
30
|
-
Network Pro is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ("GNU GPL") as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
31
|
-
|
|
32
|
-
This material is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
33
|
-
|
|
34
|
-
See the GNU General Public License for more details.
|
|
35
|
-
|
|
36
|
-
SPDX Reference: https://spdx.org/licenses/GPL-3.0-or-later.html
|
|
37
|
-
Canonical URL: https://www.gnu.org/licenses/gpl-3.0.html
|
|
38
|
-
|
|
39
|
-
---
|
|
40
|
-
|
|
41
|
-
Author: Scott Lopez
|
|
42
|
-
Email: <contact@neteng.pro>
|
|
43
|
-
Web: <https://bio.neteng.pro>
|
|
44
|
-
-->
|
|
7
|
+
====================================================================== -->
|
|
45
8
|
|
|
46
9
|
[SPDX-License-Identifier](https://spdx.dev/learn/handling-license-info/):
|
|
47
10
|
`CC-BY-4.0 OR GPL-3.0-or-later`
|
|
@@ -53,6 +16,9 @@ Web: <https://bio.neteng.pro>
|
|
|
53
16
|
**Network Pro Strategies**
|
|
54
17
|
**Effective Date:** May 18, 2025
|
|
55
18
|
|
|
19
|
+
**Official Version Notice**
|
|
20
|
+
This document is provided for convenience only. In the event of any discrepancy, the authoritative version is the one published at [https://netwk.pro](https://netwk.pro).
|
|
21
|
+
|
|
56
22
|
|
|
57
23
|
|
|
58
24
|
<!-- markdownlint-disable MD001 -->
|
package/README.md
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- =====================================================================
|
|
2
|
+
README.md
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
4
|
+
Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
5
|
+
SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
6
|
+
This file is part of Network Pro.
|
|
7
|
+
====================================================================== -->
|
|
8
|
+
|
|
9
|
+
# 🌐 Network Pro™ — Web Presence
|
|
10
|
+
|
|
11
|
+
> **Locking Down Networks, Unlocking Confidence™**
|
|
12
|
+
> _Security, Networking, Privacy — Network Pro™_
|
|
5
13
|
|
|
6
14
|
|
|
7
15
|
|
|
@@ -11,29 +19,38 @@
|
|
|
11
19
|
|
|
12
20
|
## 🚀 Project Overview
|
|
13
21
|
|
|
14
|
-
This
|
|
22
|
+
This GitHub repository powers the official web presence of **[Network Pro Strategies](https://netwk.pro/about)** — 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.
|
|
15
23
|
|
|
16
24
|
Built with [SvelteKit](https://kit.svelte.dev/) and deployed via [Netlify](https://www.netlify.com/).
|
|
17
|
-
Blog and documentation subsites built with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) and deployed via [GitHub Pages](https://pages.github.com/).
|
|
25
|
+
[Blog](https://github.com/netwk-pro/blog) and [documentation](https://github.com/netwk-pro/docs) subsites built with [Material for MkDocs](https://squidfunk.github.io/mkdocs-material/) and deployed via [GitHub Pages](https://pages.github.com/).
|
|
26
|
+
|
|
18
27
|
All infrastructure and data flows are designed with **maximum transparency, self-hosting, and user privacy** in mind.
|
|
19
28
|
|
|
20
29
|
### 📁 Repository Structure
|
|
21
30
|
|
|
22
31
|
```bash
|
|
23
32
|
.
|
|
33
|
+
├── .github/workflows # CI workflows and automation
|
|
34
|
+
├── .vscode/ # Recommended VS Code settings, extensions
|
|
35
|
+
├── netlify-functions/
|
|
36
|
+
│ └── cspReport.js # Serverless function to receive and log CSP violation reports
|
|
37
|
+
├── scripts/ # Utility scripts
|
|
24
38
|
├── src/
|
|
25
|
-
│ ├── lib/
|
|
26
|
-
│ ├── routes/
|
|
27
|
-
│ ├── hooks.client.ts
|
|
28
|
-
│
|
|
29
|
-
├──
|
|
30
|
-
|
|
31
|
-
├──
|
|
32
|
-
├──
|
|
39
|
+
│ ├── lib/ # Reusable components, styles, utilities
|
|
40
|
+
│ ├── routes/ # SvelteKit routes (+page.svelte, +page.server.js)
|
|
41
|
+
│ ├── hooks.client.ts # Handles PWA install prompt and logs client errors
|
|
42
|
+
│ ├── hooks.server.js # Injects CSP headers and permissions policy
|
|
43
|
+
│ ├── app.html # SvelteKit entry HTML with CSP/meta/bootentry
|
|
44
|
+
│ └── service-worker.js # Custom Service Worker
|
|
45
|
+
├── static/ # Static assets served at root
|
|
46
|
+
├── tests/
|
|
47
|
+
│ ├── e2e/ # End-to-end Playwright tests
|
|
48
|
+
│ └── unit/ # Vite unit tests
|
|
49
|
+
├── netlify.toml # Netlify configuration
|
|
33
50
|
└── ...
|
|
34
51
|
```
|
|
35
52
|
|
|
36
|
-
|
|
53
|
+
---
|
|
37
54
|
|
|
38
55
|
## 🛠 Getting Started
|
|
39
56
|
|
|
@@ -52,27 +69,287 @@ Edit .env to configure your environment mode:
|
|
|
52
69
|
ENV_MODE=dev # Options: dev, test, ci, preview, prod
|
|
53
70
|
```
|
|
54
71
|
|
|
55
|
-
>
|
|
56
|
-
> Use
|
|
72
|
+
> `ENV_MODE` is used for tooling and workflows — not by SvelteKit itself.
|
|
73
|
+
> Use `VITE_`-prefixed env variables for runtime values.
|
|
57
74
|
|
|
58
75
|
|
|
59
76
|
|
|
60
|
-
###
|
|
77
|
+
### 🧰 Local Setup Scripts
|
|
78
|
+
|
|
79
|
+
To streamline onboarding and enforce project conventions, you may use the optional helper scripts:
|
|
80
|
+
|
|
81
|
+
| File/Script | Description |
|
|
82
|
+
| ---------------------------------- | --------------------------------------------------------------------------------- |
|
|
83
|
+
| `.env.template` | Template for local environment variables |
|
|
84
|
+
| `scripts/checkNode.js` | Validates your Node.js and npm versions |
|
|
85
|
+
| `scripts/bootstrap.local.sh` (TBD) | Interactive setup for local configuration and tooling |
|
|
86
|
+
| `.vscode/` | Editor recommendations compatible with [VSCodium](https://vscodium.com) / VS Code |
|
|
87
|
+
|
|
88
|
+
To get started quickly:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
cp .env.template .env
|
|
92
|
+
npm install
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
> You can also use `bootstrap.local.sh` to automate the steps above and more (optional).
|
|
96
|
+
> `ENV_MODE` controls local tooling behavior — it is not used by the app runtime directly.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
#### 💾 Version Enforcement
|
|
101
|
+
|
|
102
|
+
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`:
|
|
103
|
+
|
|
104
|
+
```json
|
|
105
|
+
"engines": {
|
|
106
|
+
"node": ">=22.0.0 <25",
|
|
107
|
+
"npm": ">=11.0.0 <12"
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Version compliance is **softly enforced** after installation via a postinstall lifecycle hook:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
npm run check:node
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
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.
|
|
118
|
+
|
|
119
|
+
**_Node Version Check (snippet from `scripts/checkNode.js`)_**
|
|
120
|
+
|
|
121
|
+
```javascript
|
|
122
|
+
const semver = require("semver");
|
|
123
|
+
const { engines } = require("../package.json");
|
|
124
|
+
|
|
125
|
+
const requiredNode = engines.node;
|
|
126
|
+
const requiredNpm = engines.npm;
|
|
127
|
+
const isPostInstall = process.env.npm_lifecycle_event === "postinstall";
|
|
128
|
+
|
|
129
|
+
let hasError = false;
|
|
130
|
+
|
|
131
|
+
if (!semver.satisfies(process.version, requiredNode)) {
|
|
132
|
+
const msg = `Node.js ${process.version} does not satisfy required range: ${requiredNode}`;
|
|
133
|
+
isPostInstall ? console.warn(`⚠️ ${msg}`) : console.error(`❌ ${msg}`);
|
|
134
|
+
if (!isPostInstall) hasError = true;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const npmVersion = require("child_process")
|
|
138
|
+
.execSync("npm -v")
|
|
139
|
+
.toString()
|
|
140
|
+
.trim();
|
|
141
|
+
|
|
142
|
+
if (!semver.satisfies(npmVersion, requiredNpm)) {
|
|
143
|
+
const msg = `npm ${npmVersion} does not satisfy required range: ${requiredNpm}`;
|
|
144
|
+
isPostInstall ? console.warn(`⚠️ ${msg}`) : console.error(`❌ ${msg}`);
|
|
145
|
+
if (!isPostInstall) hasError = true;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (!hasError) {
|
|
149
|
+
console.log("✅ Node and npm versions are valid.");
|
|
150
|
+
} else {
|
|
151
|
+
process.exit(1);
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
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.
|
|
156
|
+
|
|
157
|
+
To manually verify your environment:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
node -v # Should fall within engines.node
|
|
161
|
+
npm -v # Should fall within engines.npm
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
## 🛡️ Configuration
|
|
167
|
+
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
### 🔐 `hooks.server.js`
|
|
171
|
+
|
|
172
|
+
Located at src/hooks.server.js, this file is responsible for injecting dynamic security headers. It includes:
|
|
173
|
+
|
|
174
|
+
- Content Security Policy (CSP) with support for relaxed directives (inline scripts allowed)
|
|
175
|
+
- Permissions Policy to explicitly disable unnecessary browser APIs
|
|
176
|
+
- X-Content-Type-Options, X-Frame-Options, and Referrer-Policy headers
|
|
177
|
+
|
|
178
|
+
> 💡 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 <script> tags.
|
|
179
|
+
|
|
180
|
+
To re-enable nonce generation for inline scripts in the future:
|
|
181
|
+
|
|
182
|
+
1. Uncomment the nonce generation and injection logic in hooks.server.js.
|
|
183
|
+
2. Add nonce="**cspNonce**" to inline <script> blocks in app.html or route templates.
|
|
184
|
+
|
|
185
|
+
> 💡 The `[headers]` block in `netlify.toml` has been deprecated — all headers are now set dynamically from within SvelteKit.
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
### 🧭 `hooks.client.ts`
|
|
190
|
+
|
|
191
|
+
This lightweight hook enhances client experience:
|
|
192
|
+
|
|
193
|
+
- Handles the `beforeinstallprompt` event to support progressive web app (PWA) install flows
|
|
194
|
+
- Provides a `handleError()` hook that logs uncaught client-side errors
|
|
195
|
+
|
|
196
|
+
Located at `src/hooks.client.ts`, it is automatically used by the SvelteKit runtime during client boot.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
### 📣 CSP Report Handler
|
|
201
|
+
|
|
202
|
+
To receive and inspect CSP violation reports in development or production, the repo includes a Netlify-compatible function at:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
netlify-functions/csp-report.js
|
|
206
|
+
```
|
|
61
207
|
|
|
62
|
-
This
|
|
208
|
+
This function receives reports sent to `/functions/csp-report` and logs them to the console. You can later integrate with logging tools or alerts (e.g., via email, Slack, or SIEM ingestion).
|
|
63
209
|
|
|
64
|
-
-
|
|
65
|
-
- asdf
|
|
66
|
-
- Volta
|
|
67
|
-
- GitHub Actions
|
|
210
|
+
Make sure to include the `report-uri` directive in your CSP header:
|
|
68
211
|
|
|
69
212
|
```bash
|
|
70
|
-
|
|
71
|
-
npm -v
|
|
213
|
+
Content-Security-Policy: ...; report-uri /.netlify/functions/csp-report;
|
|
72
214
|
```
|
|
73
215
|
|
|
74
216
|
|
|
75
217
|
|
|
218
|
+
## 🧪 Testing
|
|
219
|
+
|
|
220
|
+
This project uses a mix of automated performance, accessibility, and end-to-end testing tools to maintain quality across environments and deployments.
|
|
221
|
+
|
|
222
|
+
| Tool | Purpose | Usage Context |
|
|
223
|
+
| ------------------------------------------------------------ | ---------------------------------------------------- | ------------------- |
|
|
224
|
+
| [`@playwright/test`](https://playwright.dev/docs/test-intro) | End-to-end testing framework with browser automation | Local + CI |
|
|
225
|
+
| [`@lhci/cli`](https://github.com/GoogleChrome/lighthouse-ci) | Lighthouse CI — automated performance audits | CI (optional local) |
|
|
226
|
+
| [`lighthouse`](https://github.com/GoogleChrome/lighthouse) | Manual/scripted Lighthouse runs via CLI | Local (global) |
|
|
227
|
+
|
|
228
|
+
> **Note:** `lighthouse` is intended to be installed globally (`npm i -g lighthouse`) or run via the `lighthouse` npm script, which uses the locally installed binary if available. You can also run Lighthouse through Chrome DevTools manually if preferred.
|
|
229
|
+
|
|
230
|
+
<!-- markdownlint-disable MD028 -->
|
|
231
|
+
|
|
232
|
+
> CI uses Chrome for Lighthouse audits. For local experimentation, you may run Lighthouse manually using [Brave](https://brave.com), which can reveal differences related to privacy features or tracking protection.
|
|
233
|
+
|
|
234
|
+
<!-- markdownlint-enable MD028 -->
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
### Testing Configuration Files
|
|
239
|
+
|
|
240
|
+
| File | Description | Usage Context |
|
|
241
|
+
| ---------------------- | ------------------------------------------------------------------------ | ------------- |
|
|
242
|
+
| `playwright.config.js` | Configures Playwright test environment (browsers, timeouts, base URL) | Local + CI |
|
|
243
|
+
| `.lighthouserc.cjs` | Lighthouse CI config for defining audit targets, budgets, and assertions | CI |
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
|
|
247
|
+
### Running Tests
|
|
248
|
+
|
|
249
|
+
Local testing via Playwright:
|
|
250
|
+
|
|
251
|
+
```bash
|
|
252
|
+
npm run test:client # Run client-side unit tests with Vitest
|
|
253
|
+
npm run test:server # Run server-side unit tests with Vitest
|
|
254
|
+
npm run test:all # Run full test suite
|
|
255
|
+
npm run test:watch # Watch mode for client tests
|
|
256
|
+
npm run test:coverage # Collect code coverage reports
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Audit your app using Lighthouse:
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Run Lighthouse CI (via @lhci/cli) using the current build
|
|
263
|
+
npm run lhci:run
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Manual auditing with Lighthouse (e.g., via Brave or Chrome):
|
|
267
|
+
|
|
268
|
+
```bash
|
|
269
|
+
# Install globally (if not already installed)
|
|
270
|
+
npm install -g lighthouse
|
|
271
|
+
|
|
272
|
+
# Run Lighthouse manually against a deployed site
|
|
273
|
+
lighthouse https://netwk.pro --view
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
You can also audit locally using Chrome DevTools → Lighthouse tab for on-the-fly testing and preview reports.
|
|
277
|
+
|
|
278
|
+
> The repo uses `@lhci/cli` for CI-based audits. It is installed as a dev dependency and does not require a global install.
|
|
279
|
+
|
|
280
|
+
<!-- markdownlint-disable MD028 -->
|
|
281
|
+
|
|
282
|
+
> To trace the exact Chrome version and audit timestamp used in CI:
|
|
283
|
+
>
|
|
284
|
+
> ```bash
|
|
285
|
+
> cat .lighthouseci/chrome-version.txt
|
|
286
|
+
> ```
|
|
287
|
+
|
|
288
|
+
<!-- markdownlint-disable MD028 -->
|
|
289
|
+
|
|
290
|
+
---
|
|
291
|
+
|
|
292
|
+
## 🛠 Recommended Toolchain
|
|
293
|
+
|
|
294
|
+
To streamline development and align with project conventions, we recommend the following setup — especially for contributors without a strong existing preference.
|
|
295
|
+
|
|
296
|
+
| Tool | Description |
|
|
297
|
+
| ------------------------------------------------------------------------ | --------------------------------------------------------- |
|
|
298
|
+
| **[VSCodium](https://vscodium.com/)** | Fully open-source alternative to VS Code (telemetry-free) |
|
|
299
|
+
| **[Prettier](https://prettier.io/)** | Code formatter for JS, TS, Svelte, Markdown, etc. |
|
|
300
|
+
| **[ESLint](https://eslint.org/)** | JavaScript/TypeScript linter with Svelte support |
|
|
301
|
+
| **[Stylelint](https://stylelint.io/)** | Linting for CSS, SCSS, and inline styles in Svelte |
|
|
302
|
+
| **[markdownlint](https://github.com/DavidAnson/markdownlint)** | Markdown style checker and linter |
|
|
303
|
+
| **[markdownlint-cli2](https://github.com/DavidAnson/markdownlint-cli2)** | Config-based CLI linter for Markdown |
|
|
304
|
+
| **[EditorConfig](https://editorconfig.org/)** | Consistent line endings, spacing, and indentation |
|
|
305
|
+
| **[Volta](https://volta.sh) / [nvm](https://github.com/nvm-sh/nvm)** | Node.js version manager for consistent tooling |
|
|
306
|
+
|
|
307
|
+
> The `.vscode/` folder includes editor recommendations compatible with **VSCodium**. These are non-enforced and optional, but align with our formatter, linter, and language server configs.
|
|
308
|
+
|
|
309
|
+
Install dev tooling:
|
|
310
|
+
|
|
311
|
+
```bash
|
|
312
|
+
npm install --include=dev
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
Run all format and lint checks:
|
|
316
|
+
|
|
317
|
+
```bash
|
|
318
|
+
npm run lint:all
|
|
319
|
+
npm run format
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
To auto-fix issues:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
npm run lint:fix
|
|
326
|
+
npm run format:fix
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
---
|
|
330
|
+
|
|
331
|
+
## ⚙️ Tooling Configuration
|
|
332
|
+
|
|
333
|
+
All linting, formatting, and version settings are defined in versioned project config files:
|
|
334
|
+
|
|
335
|
+
| File | Purpose |
|
|
336
|
+
| ------------------------- | ---------------------------------------------------------- |
|
|
337
|
+
| `.prettierrc` | Prettier formatting rules |
|
|
338
|
+
| `.prettierignore` | Files that should be ignored by Prettier |
|
|
339
|
+
| `eslint.config.mjs` | ESLint config with SvelteKit support |
|
|
340
|
+
| `stylelint.config.js` | CSS/SASS/Svelte style rules |
|
|
341
|
+
| `.stylelintignore` | Files that should be ignored by Stylelint |
|
|
342
|
+
| `.editorconfig` | Base indentation and line ending settings |
|
|
343
|
+
| `.nvmrc`, `.node-version` | Node.js version constraints for `nvm`, `asdf`, and `Volta` |
|
|
344
|
+
| `.vscode/extensions.json` | Suggested extensions for VSCodium |
|
|
345
|
+
| `.vscode/settings.json` | Default workspace settings (non-binding) |
|
|
346
|
+
| `.vscode/customData.json` | Custom CSS data for FontAwesome classes |
|
|
347
|
+
| `cspell.json` | Custom words and exclusions for spell checking |
|
|
348
|
+
|
|
349
|
+
These are the same rules used by CI and automation, so aligning your local setup avoids surprises later.
|
|
350
|
+
|
|
351
|
+
> Note: `.vscode/extensions.json` defines a minimal recommended dev stack for VSCodium / VS Code. These extensions are **optional but thoughtfully curated** to improve developer experience without introducing bloat.
|
|
352
|
+
|
|
76
353
|
---
|
|
77
354
|
|
|
78
355
|
## 📜 Available Scripts
|
|
@@ -81,13 +358,14 @@ The following CLI commands are available via `npm run <script>` or `pnpm run <sc
|
|
|
81
358
|
|
|
82
359
|
### 🔄 Development
|
|
83
360
|
|
|
84
|
-
| Script | Description
|
|
85
|
-
| --------------- |
|
|
86
|
-
| `dev` | Start development server with Vite
|
|
87
|
-
| `preview` | Preview production build locally
|
|
88
|
-
| `build` | Build the project with Vite
|
|
89
|
-
| `
|
|
90
|
-
| `
|
|
361
|
+
| Script | Description |
|
|
362
|
+
| --------------- | ------------------------------------------------------------------------ |
|
|
363
|
+
| `dev` | Start development server with Vite |
|
|
364
|
+
| `preview` | Preview production build locally |
|
|
365
|
+
| `build` | Build the project with Vite |
|
|
366
|
+
| `dev:netlify` | Start local dev server using Netlify Dev (emulates serverless + headers) |
|
|
367
|
+
| `build:netlify` | Build using Netlify CLI |
|
|
368
|
+
| `css:bundle` | Bundle and minify CSS |
|
|
91
369
|
|
|
92
370
|
---
|
|
93
371
|
|
|
@@ -98,7 +376,7 @@ The following CLI commands are available via `npm run <script>` or `pnpm run <sc
|
|
|
98
376
|
| `prepare` | Run SvelteKit sync |
|
|
99
377
|
| `check` | Run SvelteKit sync and type check with `svelte-check` |
|
|
100
378
|
| `check:watch` | Watch mode for type checks |
|
|
101
|
-
| `check:node` | Validate Node &
|
|
379
|
+
| `check:node` | Validate Node & npm versions match package.json `engines` |
|
|
102
380
|
| `checkout` | Full local validation: check versions, test, lint, typecheck |
|
|
103
381
|
| `verify` | Alias for `checkout` |
|
|
104
382
|
|
|
@@ -114,8 +392,12 @@ The following CLI commands are available via `npm run <script>` or `pnpm run <sc
|
|
|
114
392
|
|
|
115
393
|
---
|
|
116
394
|
|
|
395
|
+
<!-- markdownlint-disable MD024 -->
|
|
396
|
+
|
|
117
397
|
### 🧪 Testing
|
|
118
398
|
|
|
399
|
+
<!-- markdownlint-enable MD024 -->
|
|
400
|
+
|
|
119
401
|
| Script | Description |
|
|
120
402
|
| --------------- | -------------------------------------------- |
|
|
121
403
|
| `test` | Alias for `test:all` |
|
|
@@ -144,12 +426,10 @@ The following CLI commands are available via `npm run <script>` or `pnpm run <sc
|
|
|
144
426
|
|
|
145
427
|
### 💡 Lighthouse / Performance
|
|
146
428
|
|
|
147
|
-
| Script
|
|
148
|
-
|
|
|
149
|
-
| `lhci`
|
|
150
|
-
| `
|
|
151
|
-
| `lighthouse:local` | Build site, preview, and run Lighthouse locally |
|
|
152
|
-
| `lhci:run` | Run Lighthouse CI autorun |
|
|
429
|
+
| Script | Description |
|
|
430
|
+
| ---------- | ------------------------- |
|
|
431
|
+
| `lhci` | Alias for Lighthouse CI |
|
|
432
|
+
| `lhci:run` | Run Lighthouse CI autorun |
|
|
153
433
|
|
|
154
434
|
---
|
|
155
435
|
|
|
@@ -185,7 +465,7 @@ Source code, branding, and visual assets are subject to reuse and distribution t
|
|
|
185
465
|
|
|
186
466
|
|
|
187
467
|
|
|
188
|
-
## 🙋♂️
|
|
468
|
+
## 🙋♂️Questions?
|
|
189
469
|
|
|
190
470
|
Reach out via [netwk.pro/contact](https://netwk.pro/contact), open an issue on this repo, or email us directly at `contact (at) s.neteng.pro`.
|
|
191
471
|
|
package/cspell.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "0.2",
|
|
3
|
+
"language": "en",
|
|
4
|
+
"words": [
|
|
5
|
+
"acode",
|
|
6
|
+
"autorun",
|
|
7
|
+
"beforeinstallprompt",
|
|
8
|
+
"bootentry",
|
|
9
|
+
"Embedder",
|
|
10
|
+
"Ente",
|
|
11
|
+
"esbuild",
|
|
12
|
+
"foss",
|
|
13
|
+
"geolocation",
|
|
14
|
+
"homescreen",
|
|
15
|
+
"lhci",
|
|
16
|
+
"lighthouseci",
|
|
17
|
+
"lighthouserc",
|
|
18
|
+
"lightningcss",
|
|
19
|
+
"linksheet",
|
|
20
|
+
"Maricopa",
|
|
21
|
+
"mdsvex",
|
|
22
|
+
"neteng",
|
|
23
|
+
"NETPRO",
|
|
24
|
+
"netwk",
|
|
25
|
+
"networkpro",
|
|
26
|
+
"Nextcloud",
|
|
27
|
+
"noopener",
|
|
28
|
+
"noreferrer",
|
|
29
|
+
"nosniff",
|
|
30
|
+
"nosw",
|
|
31
|
+
"obtainium",
|
|
32
|
+
"SIEM",
|
|
33
|
+
"stylelintignore",
|
|
34
|
+
"Subsite",
|
|
35
|
+
"subsites",
|
|
36
|
+
"urlcheck",
|
|
37
|
+
"vcard",
|
|
38
|
+
"vite",
|
|
39
|
+
"vitest",
|
|
40
|
+
"webfonts"
|
|
41
|
+
],
|
|
42
|
+
"ignorePaths": [
|
|
43
|
+
".gitignore",
|
|
44
|
+
".gitattributes",
|
|
45
|
+
"static/sitemap.xml",
|
|
46
|
+
"static/robots.txt",
|
|
47
|
+
"src/lib/styles/**",
|
|
48
|
+
"**/node_modules/**",
|
|
49
|
+
"**/dist/**",
|
|
50
|
+
"**/.svelte-kit/**",
|
|
51
|
+
"**/.vite/**",
|
|
52
|
+
"**/coverage/**",
|
|
53
|
+
"**/playwright-report/**"
|
|
54
|
+
],
|
|
55
|
+
"ignoreWords": [],
|
|
56
|
+
"enableFiletypes": [
|
|
57
|
+
"javascript",
|
|
58
|
+
"typescript",
|
|
59
|
+
"json",
|
|
60
|
+
"markdown",
|
|
61
|
+
"html",
|
|
62
|
+
"svelte"
|
|
63
|
+
],
|
|
64
|
+
"useGitignore": true
|
|
65
|
+
}
|
package/eslint.config.mjs
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
/* ==========================================================================
|
|
2
2
|
eslint.config.mjs
|
|
3
3
|
|
|
4
|
+
Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
4
5
|
SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
5
6
|
This file is part of Network Pro.
|
|
6
|
-
|
|
7
|
+
========================================================================= */
|
|
7
8
|
|
|
8
9
|
import js from "@eslint/js"; // Provides ESLint core rules and recommended config
|
|
9
10
|
import eslintConfigPrettier from "eslint-config-prettier"; // Prettier config to disable conflicting ESLint rules
|
package/jsconfig.json
CHANGED
|
@@ -18,7 +18,8 @@ This file is part of Network Pro.
|
|
|
18
18
|
"strict": true,
|
|
19
19
|
"moduleResolution": "bundler"
|
|
20
20
|
},
|
|
21
|
-
"exclude": ["vite.config.js"] // Exclude the config file if needed
|
|
21
|
+
"exclude": ["vite.config.js"], // Exclude the config file if needed
|
|
22
|
+
"include": ["src", "src/global.d.ts", "src/service-worker.js"]
|
|
22
23
|
|
|
23
24
|
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
|
|
24
25
|
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* ==========================================================================
|
|
2
|
+
netlify-functions/cspReport.js
|
|
3
|
+
|
|
4
|
+
Copyright © 2025 Network Pro Strategies (Network Pro™)
|
|
5
|
+
SPDX-License-Identifier: CC-BY-4.0 OR GPL-3.0-or-later
|
|
6
|
+
This file is part of Network Pro.
|
|
7
|
+
========================================================================== */
|
|
8
|
+
|
|
9
|
+
import nodemailer from "nodemailer";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Netlify Function: CSP violation report handler
|
|
13
|
+
*
|
|
14
|
+
* @param {import('@netlify/functions').HandlerEvent} event - Incoming Netlify request
|
|
15
|
+
* @returns {Promise<import('@netlify/functions').HandlerResponse>} - Netlify-compatible HTTP response
|
|
16
|
+
*/
|
|
17
|
+
export async function handler(event) {
|
|
18
|
+
try {
|
|
19
|
+
if (event.httpMethod !== "POST") {
|
|
20
|
+
return {
|
|
21
|
+
statusCode: 405,
|
|
22
|
+
body: "Method Not Allowed",
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (!event.body) {
|
|
27
|
+
return {
|
|
28
|
+
statusCode: 400,
|
|
29
|
+
body: "No body provided",
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** @type {Record<string, any>} */
|
|
34
|
+
const report = JSON.parse(event.body);
|
|
35
|
+
const violation = report["csp-report"] || report;
|
|
36
|
+
|
|
37
|
+
const shouldSendEmail =
|
|
38
|
+
process.env.MAIL_ENABLED !== "false" && process.env.NODE_ENV !== "test";
|
|
39
|
+
|
|
40
|
+
if (shouldSendEmail) {
|
|
41
|
+
const transporter = nodemailer.createTransport({
|
|
42
|
+
host: process.env.SMTP_HOST,
|
|
43
|
+
port: 465,
|
|
44
|
+
secure: true,
|
|
45
|
+
auth: {
|
|
46
|
+
user: process.env.SMTP_USER,
|
|
47
|
+
pass: process.env.SMTP_PASS,
|
|
48
|
+
},
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
await transporter.sendMail({
|
|
52
|
+
from: `"CSP Reporter" <${process.env.SMTP_USER}>`,
|
|
53
|
+
to: process.env.NOTIFY_EMAIL,
|
|
54
|
+
subject: "🚨 CSP Violation Detected",
|
|
55
|
+
text: JSON.stringify(violation, null, 2),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
return {
|
|
60
|
+
statusCode: 204,
|
|
61
|
+
};
|
|
62
|
+
} catch (error) {
|
|
63
|
+
return {
|
|
64
|
+
statusCode: 400,
|
|
65
|
+
body: `Invalid JSON: ${error instanceof Error ? error.message : "Unknown error"}`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|