@kingbain/status-page-sveltekit 1.1.9 → 1.1.11

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.
@@ -0,0 +1,32 @@
1
+ name: Pull Request Validation
2
+
3
+ permissions:
4
+ contents: read
5
+
6
+ on:
7
+ pull_request:
8
+ types: [opened, synchronize, reopened, ready_for_review]
9
+
10
+ jobs:
11
+ test-and-build:
12
+ if: github.event.pull_request.draft == false
13
+ runs-on: ubuntu-latest
14
+
15
+ steps:
16
+ - name: Checkout repository
17
+ uses: actions/checkout@v4
18
+
19
+ - name: Setup Node.js
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: 20
23
+ cache: npm
24
+
25
+ - name: Install dependencies
26
+ run: npm ci
27
+
28
+ - name: Run test suite
29
+ run: npm test
30
+
31
+ - name: Build project
32
+ run: npm run build
@@ -7,9 +7,9 @@ on:
7
7
 
8
8
  permissions:
9
9
  contents: write
10
- issues: write
10
+ issues: write
11
11
  pull-requests: write
12
- id-token: write
12
+ id-token: write
13
13
 
14
14
  jobs:
15
15
  release:
@@ -17,13 +17,13 @@ jobs:
17
17
  steps:
18
18
  - name: Check out code
19
19
  uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0 # semantic-release needs full history
20
22
 
21
23
  - name: Set up Node.js
22
24
  uses: actions/setup-node@v4
23
25
  with:
24
26
  node-version-file: '.nvmrc'
25
- registry-url: https://registry.npmjs.org
26
- always-auth: true
27
27
 
28
28
  - name: Install dependencies
29
29
  run: npm ci
@@ -33,7 +33,6 @@ jobs:
33
33
 
34
34
  - name: Run semantic-release
35
35
  env:
36
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN}}
37
- NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
38
- NPM_CONFIG_ACCESS: public
36
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37
+ NPM_CONFIG_PROVENANCE: true
39
38
  run: npx semantic-release
package/README.md CHANGED
@@ -1,38 +1,64 @@
1
- # sv
1
+ # ⬆️ Modified Upptime Status Page (SvelteKit Edition)
2
2
 
3
- Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli).
3
+ > **Note:** This repository is a **modified fork** loosely based on the [original Upptime static site generator](https://github.com/upptime/status-page). It’s been updated to use a modern web stack (SvelteKit, Vite, GitHub Actions, semantic-release) instead of the legacy Sapper setup.
4
4
 
5
- ## Creating a project
5
+ This project still provides an embeddable, static status page for monitoring uptime, but with improved developer ergonomics, automated releases, and a streamlined build pipeline.
6
6
 
7
- If you're seeing this, you've probably already done this step. Congrats!
7
+ ---
8
8
 
9
- ```bash
10
- # create a new project in the current directory
11
- npx sv create
9
+ | | Status |
10
+ | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
11
+ | Build | [![Node CI](https://github.com/KingBain/status-page-sveltekit/actions/workflows/release.yml/badge.svg)](https://github.com/KingBain/status-page-sveltekit/actions) [![Dependencies](https://img.shields.io/librariesio/github/KingBain/status-page-sveltekit)](https://libraries.io/github/KingBain/status-page-sveltekit) [![GitHub release (latest by date)](https://img.shields.io/github/v/release/KingBain/status-page-sveltekit)](https://github.com/KingBain/status-page-sveltekit/releases) |
12
12
 
13
- # create a new project in my-app
14
- npx sv create my-app
15
- ```
16
13
 
17
- ## Developing
14
+ ---
18
15
 
19
- Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server:
16
+ ## 🎁 Contributing
20
17
 
21
- ```bash
22
- npm run dev
18
+ Contributions and feedback are welcome! This repository has diverged from the original Upptime project, so please:
23
19
 
24
- # or start the server and open the app in a new browser tab
25
- npm run dev -- --open
26
- ```
20
+ 1. Read our [Contributing Guidelines](https://github.com/KingBain/status-page-sveltekit/blob/main/CONTRIBUTING.md).
21
+ 2. Follow our [Code of Conduct](https://github.com/KingBain/status-page-sveltekit/blob/main/CODE_OF_CONDUCT.md).
22
+ 3. Open issues or pull requests on this repository for bugs and enhancements.
23
+
24
+ ## 💻 Local Development
25
+
26
+ > **Tip:** This project includes a Dev Container definition for a consistent development environment. In VS Code, install the Remote Containers extension and select **Reopen in Container** (or run `Dev Containers: Reopen in Container` from the command palette).
27
+
28
+ 1. **Install dependencies**
29
+
30
+ ```bash
31
+ npm ci
32
+ ```
33
+
34
+ 2. **Run in development mode**
27
35
 
28
- ## Building
36
+ ```bash
37
+ npm run dev
38
+ ```
29
39
 
30
- To create a production version of your app:
40
+ 3. **Build for production**
31
41
 
32
- ```bash
33
- npm run build
42
+ ```bash
43
+ npm run build
44
+ ```
45
+
46
+ 4. **Preview the production build**
47
+
48
+ ```bash
49
+ npm run preview
50
+ ```
51
+
52
+ ## 🧪 Testing the Package
53
+
54
+ To try out this custom status page package, update your `.upptimerc.yml` configuration:
55
+
56
+ ```yaml
57
+ customStatusWebsitePackage: "@kingbain/status-page-sveltekit"
34
58
  ```
35
59
 
36
- You can preview the production build with `npm run preview`.
60
+ Then configure and run the standard Upptime Site CI GitHub Action (for example, using `upptime/actions/site@v2`) in your CI workflow to regenerate the status page with this custom package.
61
+
62
+ ## 🚀 Release & Deployment
37
63
 
38
- > To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment.
64
+ * **Automated Releases:** We use `semantic-release` and GitHub Actions to bump versions, generate changelogs, publish to npm, and create GitHub Releases on every merge to `main`.
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@kingbain/status-page-sveltekit",
3
3
  "private": false,
4
- "version": "1.1.9",
4
+ "version": "1.1.11",
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "provenance": true
8
+ },
5
9
  "type": "module",
6
10
  "repository": "https://github.com/KingBain/status-page-sveltekit",
7
11
  "scripts": {
@@ -25,8 +29,8 @@
25
29
  "@eslint/compat": "^1.2.5",
26
30
  "@eslint/js": "^9.18.0",
27
31
  "@semantic-release/commit-analyzer": "^13.0.1",
28
- "@semantic-release/github": "^11.0.3",
29
- "@semantic-release/npm": "^12.0.2",
32
+ "@semantic-release/github": "^12.0.6",
33
+ "@semantic-release/npm": "^13.1.4",
30
34
  "@semantic-release/release-notes-generator": "^14.0.3",
31
35
  "@sveltejs/adapter-auto": "^4.0.0",
32
36
  "@sveltejs/kit": "^2.25.0",
@@ -41,7 +45,7 @@
41
45
  "prettier": "^3.4.2",
42
46
  "prettier-plugin-svelte": "^3.3.3",
43
47
  "rollup": "^4.36.0",
44
- "semantic-release": "^24.2.7",
48
+ "semantic-release": "^25.0.3",
45
49
  "svelte": "^5.0.0",
46
50
  "svelte-check": "^4.0.0",
47
51
  "typescript": "^5.0.0",
@@ -26,13 +26,16 @@
26
26
  )
27
27
  ).data;
28
28
  incidents = incidents.map((incident, index) => {
29
+ const body = incident.body || '';
29
30
  incident.showHeading =
30
31
  index === 0 ||
31
32
  new Date(incidents[index - 1].created_at).toLocaleDateString() !==
32
33
  new Date(incident.created_at).toLocaleDateString();
33
34
  incident.metadata = {};
34
- if (incident.body.includes('<!--')) {
35
- const summary = incident.body.split('<!--')[1].split('-->')[0];
35
+ const commentStart = '<' + '!--';
36
+ const commentEnd = '--' + '>';
37
+ if (body.includes(commentStart)) {
38
+ const summary = body.split(commentStart)[1].split(commentEnd)[0];
36
39
  const lines = summary
37
40
  .split('\n')
38
41
  .filter((i) => i.trim())
@@ -30,9 +30,12 @@
30
30
  })
31
31
  )
32
32
  ).data;
33
+ const body = incident.body || '';
33
34
  incident.metadata = {};
34
- if (incident.body.includes('<!--')) {
35
- const summary = incident.body.split('<!--')[1].split('-->')[0];
35
+ const commentStart = '<' + '!--';
36
+ const commentEnd = '--' + '>';
37
+ if (body.includes(commentStart)) {
38
+ const summary = body.split(commentStart)[1].split(commentEnd)[0];
36
39
  const lines = summary
37
40
  .split('\n')
38
41
  .filter((i) => i.trim())
@@ -2,7 +2,22 @@
2
2
  import Nav from '$lib/components/Nav.svelte';
3
3
  import config from '$lib/data/config.json';
4
4
  import snarkdown from 'snarkdown';
5
+ import { onMount } from 'svelte';
5
6
  export let segment;
7
+
8
+ onMount(() => {
9
+ const customJs = config['status-website']?.js;
10
+ if (!customJs || typeof document === 'undefined') return;
11
+
12
+ const script = document.createElement('script');
13
+ script.setAttribute('data-status-website-script', 'true');
14
+ script.textContent = customJs;
15
+ document.body.appendChild(script);
16
+
17
+ return () => {
18
+ script.remove();
19
+ };
20
+ });
6
21
  </script>
7
22
 
8
23
  <svelte:head>
@@ -70,12 +85,9 @@
70
85
  <meta name={meta.name} content={meta.content} />
71
86
  {/each}
72
87
  {/if}
73
- {#if config['status-website'].css}
88
+ {#if (config['status-website'] || {}).css}
74
89
  {@html `<style>${config['status-website'].css}</style>`}
75
90
  {/if}
76
- {#if config['status-website'].js}
77
- {@html `<script>${config['status-website'].js}</script>`}
78
- {/if}
79
91
  </svelte:head>
80
92
 
81
93
  {#if (config['status-website'] || {}).customBodyHtml}