Skip to content

Commit 3fd6bb1

Browse files
Switch to relative paths in app manifest (#36)
## Motivation for the change, related issues We want to host a private Playground instance and are seeking to eliminate places where `playground.wordpress.net` is hard-coded. It turns out that URLs within app manifests can be relative, so we can remove mention of playground.wordpress.net from manifest.json. ## Implementation details This PR: - Converts paths in manifest.json to relative paths - Removes the manifest-related operations in the build step because both the built website and the dev version (via `npm run dev`) are installable as PWAs - Moves `manifest.json` into the website package's `public/` folder so Vite stops moving and mangling the filename. ## Testing Instructions (or ideally a Blueprint) - CI Test built app: - Run `npx nx build playground-website` - Run `php -S 127.0.0.1:7778 -t dist/packages/playground/wasm-wordpress-net` to start a web server - Visit `https://127.0.0.1:7778` in Chrome and note the site is installable as a PWA Test dev: - Run `npm run dev` - Visit the dev site in Chrome and note the site is installable as a PWA
1 parent e3ec1d9 commit 3fd6bb1

File tree

3 files changed

+7
-94
lines changed

3 files changed

+7
-94
lines changed

packages/playground/website/manifest.json renamed to packages/playground/website/public/manifest.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,31 @@
22
"theme_color": "#ffffff",
33
"background_color": "#ffffff",
44
"display": "standalone",
5-
"scope": "https://playground.wordpress.net/",
6-
"start_url": "https://playground.wordpress.net/",
5+
"scope": "/",
6+
"start_url": "/",
77
"short_name": "WordPress Playground",
88
"description": "WordPress Playground",
99
"name": "WordPress Playground",
1010
"icons": [
1111
{
12-
"src": "https://playground.wordpress.net/logo-192.png",
12+
"src": "logo-192.png",
1313
"sizes": "192x192",
1414
"type": "image/png"
1515
},
1616
{
17-
"src": "https://playground.wordpress.net/logo-256.png",
17+
"src": "logo-256.png",
1818
"sizes": "256x256",
1919
"type": "image/png"
2020
},
2121
{
22-
"src": "https://playground.wordpress.net/logo-384.png",
22+
"src": "logo-384.png",
2323
"sizes": "384x384",
2424
"type": "image/png"
2525
},
2626
{
27-
"src": "https://playground.wordpress.net/logo-512.png",
27+
"src": "logo-512.png",
2828
"sizes": "512x512",
2929
"type": "image/png"
3030
}
3131
]
32-
}
32+
}

packages/playground/website/vite.config.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import { copyFileSync, existsSync } from 'node:fs';
2020
import { join } from 'node:path';
2121
import { buildVersionPlugin } from '../../vite-extensions/vite-build-version';
2222
import { listAssetsRequiredForOfflineMode } from '../../vite-extensions/vite-list-assets-required-for-offline-mode';
23-
import { addManifestJson } from '../../vite-extensions/vite-manifest';
2423
import virtualModule from '../../vite-extensions/vite-virtual-module';
2524

2625
const proxy: CommonServerOptions['proxy'] = {
@@ -131,14 +130,6 @@ export default defineConfig(({ command, mode }) => {
131130
}
132131
},
133132
} as Plugin,
134-
/**
135-
* Add `manifest.json` file to the `dist/` directory when building.
136-
* While in development, modify the `manifest.json` file to use the local
137-
* server URL.
138-
*/
139-
addManifestJson({
140-
manifestPath: path('./manifest.json'),
141-
}) as Plugin,
142133
/**
143134
* Generate a list of files needed for the website to function offline.
144135
*/

packages/vite-extensions/vite-manifest.ts

Lines changed: 0 additions & 78 deletions
This file was deleted.

0 commit comments

Comments
 (0)