From 16f041c417b63e64d818100e79a9aa90598d8b4d Mon Sep 17 00:00:00 2001 From: Test Agent Date: Tue, 29 Jul 2025 22:44:54 +0200 Subject: [PATCH 1/6] fix: Fix deployment issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove non-existent CSS import from landing.ts - Update build script to use simple vite build - Add PluginConfig export to module federation - Update Gun.js to use configurable peers instead of hardcoded localhost - Fix plugin URL in commented code 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- package.json | 2 +- src/gun.ts | 8 +++++++- src/landing.ts | 1 - src/main.ts | 2 +- vite.config.ts | 1 + 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index d0b9877c..c4a5cde9 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "type": "module", "scripts": { "dev": "VITE_DEV=true vite", - "build": "run-p type-check \"build-only {@}\" --", + "build": "vite build && mv dist/landing.html dist/index.html && touch dist/.nojekyll", "preview": "vite preview", "test:unit": "vitest", "build-only": "vite build", diff --git a/src/gun.ts b/src/gun.ts index 938e81d3..bd900908 100644 --- a/src/gun.ts +++ b/src/gun.ts @@ -2,7 +2,13 @@ import Gun from 'gun' // You can also use 'gun' here import 'gun/sea' // Optional: for user authentication import 'gun/lib/unset'; //optional -const gun = Gun(['http://localhost:3000/gun']) as any; +// Use Gun.js peers from environment or default to common peers +const peers = import.meta.env.VITE_GUN_PEERS?.split(',') || [ + 'https://gun-manhattan.herokuapp.com/gun', + 'https://relay.peers.community/gun', + 'https://gun-sjc.herokuapp.com/gun' +]; +const gun = Gun(peers) as any; gun.clear = function() { // Clear localStorage diff --git a/src/landing.ts b/src/landing.ts index 8c2b6907..3000ab95 100644 --- a/src/landing.ts +++ b/src/landing.ts @@ -1,5 +1,4 @@ import { createApp } from 'vue' -import '@toplocs/plugin-sdk/style.css' import InfoPage from './InfoPage.vue' createApp(InfoPage).mount('#app') \ No newline at end of file diff --git a/src/main.ts b/src/main.ts index ac13a38b..593435d9 100644 --- a/src/main.ts +++ b/src/main.ts @@ -9,7 +9,7 @@ chain.once(data => { const node = chain.put({ id: 'location_plugin', name: 'Location', - url: 'http://localhost:3007/assets/plugin.js', + url: 'http://localhost:3007/plugin.js', }); const paths = gun.get('location_plugin/paths'); diff --git a/vite.config.ts b/vite.config.ts index e71563d0..691ee3e1 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -11,6 +11,7 @@ export default defineConfig({ name: 'location-plugin', filename: 'plugin.js', exposes: { + './PluginConfig': './src/index.ts', './Main': './src/views/MainWrapper.vue', './Settings': './src/views/SettingsWrapper.vue', }, From f47a59892f49ad113c90e72310fd33510119c1fd Mon Sep 17 00:00:00 2001 From: Test Agent Date: Tue, 29 Jul 2025 22:47:28 +0200 Subject: [PATCH 2/6] fix: Use dynamic baseUrl instead of hardcoded localhost MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Updates main.ts to calculate baseUrl dynamically, matching the pattern used in link-plugin and other plugins. This ensures the plugin URL works correctly in both development and production environments. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main.ts b/src/main.ts index 593435d9..87782a42 100644 --- a/src/main.ts +++ b/src/main.ts @@ -2,6 +2,9 @@ import './assets/main.css'; import { createApp } from 'vue'; import App from './App.vue'; import gun from './gun'; + +const baseUrl = window.location.origin + window.location.pathname.replace(/\/[^/]*$/, '') + /* const chain = gun.get('location_plugin'); chain.once(data => { @@ -9,7 +12,7 @@ chain.once(data => { const node = chain.put({ id: 'location_plugin', name: 'Location', - url: 'http://localhost:3007/plugin.js', + url: `${baseUrl}/plugin.js`, }); const paths = gun.get('location_plugin/paths'); From bed5002e724c0e5c376a08398e6c320e9834dc4e Mon Sep 17 00:00:00 2001 From: Test Agent Date: Tue, 29 Jul 2025 22:48:12 +0200 Subject: [PATCH 3/6] fix: Use published plugin SDK version and restore CSS import MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Update @toplocs/plugin-sdk to use published version ^1.1.0 instead of GitHub - Restore CSS import in landing.ts (now it will work with published SDK) - This matches the setup used in link-plugin and other working plugins 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- package.json | 2 +- src/landing.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index c4a5cde9..ae0ab94c 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ }, "dependencies": { "@heroicons/vue": "^2.2.0", - "@toplocs/plugin-sdk": "github:toplocs/plugin-sdk", + "@toplocs/plugin-sdk": "^1.1.0", "gun": "^0.2020.1240", "vite-plugin-top-level-await": "^1.4.4", "vue": "^3.5.12", diff --git a/src/landing.ts b/src/landing.ts index 3000ab95..8c2b6907 100644 --- a/src/landing.ts +++ b/src/landing.ts @@ -1,4 +1,5 @@ import { createApp } from 'vue' +import '@toplocs/plugin-sdk/style.css' import InfoPage from './InfoPage.vue' createApp(InfoPage).mount('#app') \ No newline at end of file From 4b66545a79f09566420e88e12b15ce3ce1950bb1 Mon Sep 17 00:00:00 2001 From: Test Agent Date: Tue, 29 Jul 2025 22:50:55 +0200 Subject: [PATCH 4/6] fix: Update GitHub Actions workflow to match link-plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Split build and deploy into separate jobs for better error handling - Add pnpm caching for faster builds - Use pnpm version 8 (matching link-plugin) - Add better comments and structure - This matches the proven workflow from link-plugin 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .github/workflows/deploy.yml | 57 ++++++++++++++++++++++++------------ 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b577c287..2bde1540 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,54 +1,73 @@ -name: Deploy to GitHub Pages +name: Deploy Location Plugin to GitHub Pages on: push: - branches: [ main ] + branches: [main] + # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: contents: read pages: write id-token: write +# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. +# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. concurrency: group: "pages" cancel-in-progress: false jobs: - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} + # Build job + build: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 - - name: Setup pnpm + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install pnpm uses: pnpm/action-setup@v4 with: - version: 9 + version: 8 - - name: Setup Node - uses: actions/setup-node@v4 + - name: Get pnpm store directory + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + + - name: Setup pnpm cache + uses: actions/cache@v4 with: - node-version: '20' - cache: 'pnpm' + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- - name: Install dependencies run: pnpm install - + - name: Build plugin run: pnpm build - - - name: Setup Pages - uses: actions/configure-pages@v5 - + - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - path: './dist' - + path: ./dist + + # Deployment job + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v4 \ No newline at end of file From 4f2f6edceb9ac140166579a0a9edc40347e55717 Mon Sep 17 00:00:00 2001 From: Test Agent Date: Tue, 29 Jul 2025 22:57:01 +0200 Subject: [PATCH 5/6] fix: Fix build errors by temporarily disabling SDK components MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Comment out PluginInfoPage import and usage to avoid module federation errors - Add @toplocs/plugin-sdk to rollupOptions.external - Add optimizeDeps exclude for plugin SDK - Keep CSS import commented until SDK build issues are resolved The plugin SDK has issues with its module federation build that prevent it from being used during the build process. This is a temporary fix to get the location-plugin deploying. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- pnpm-lock.yaml | 11 +++++------ src/InfoPage.vue | 15 ++++++++++++--- src/landing.ts | 2 +- vite.config.ts | 5 ++++- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8a559e0d..313a8796 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,8 @@ importers: specifier: ^2.2.0 version: 2.2.0(vue@3.5.18(typescript@5.5.4)) '@toplocs/plugin-sdk': - specifier: github:toplocs/plugin-sdk - version: https://codeload.github.com/toplocs/plugin-sdk/tar.gz/27bcf418ba132a81456e6690f63fb2990bab1027(vue-router@4.5.1(vue@3.5.18(typescript@5.5.4)))(vue@3.5.18(typescript@5.5.4)) + specifier: ^1.1.0 + version: 1.1.0(vue-router@4.5.1(vue@3.5.18(typescript@5.5.4)))(vue@3.5.18(typescript@5.5.4)) gun: specifier: ^0.2020.1240 version: 0.2020.1241 @@ -618,9 +618,8 @@ packages: '@swc/wasm@1.13.3': resolution: {integrity: sha512-ZhQfKxqFvrifksN8znSzes/oyfr8Q4mpKP0T8tYS/AaUzm/7v5OK22VlcTHR1gXHEtp16dlR8w+vYTFDCaUmnw==} - '@toplocs/plugin-sdk@https://codeload.github.com/toplocs/plugin-sdk/tar.gz/27bcf418ba132a81456e6690f63fb2990bab1027': - resolution: {tarball: https://codeload.github.com/toplocs/plugin-sdk/tar.gz/27bcf418ba132a81456e6690f63fb2990bab1027} - version: 1.1.0 + '@toplocs/plugin-sdk@1.1.0': + resolution: {integrity: sha512-PQgDLopeIxaeMLq1WdoIEUz84HDBZ4UARR9CN3v+KhW+AUEpkfptr+acP8ebX9IXOOc9EDrMZZuQz5Fea2K7Rg==} peerDependencies: vue: ^3.0.0 vue-router: ^4.0.0 @@ -2530,7 +2529,7 @@ snapshots: '@swc/wasm@1.13.3': {} - '@toplocs/plugin-sdk@https://codeload.github.com/toplocs/plugin-sdk/tar.gz/27bcf418ba132a81456e6690f63fb2990bab1027(vue-router@4.5.1(vue@3.5.18(typescript@5.5.4)))(vue@3.5.18(typescript@5.5.4))': + '@toplocs/plugin-sdk@1.1.0(vue-router@4.5.1(vue@3.5.18(typescript@5.5.4)))(vue@3.5.18(typescript@5.5.4))': dependencies: '@originjs/vite-plugin-federation': 1.4.1 vue: 3.5.18(typescript@5.5.4) diff --git a/src/InfoPage.vue b/src/InfoPage.vue index 6e24dc10..0c1365f1 100644 --- a/src/InfoPage.vue +++ b/src/InfoPage.vue @@ -1,5 +1,14 @@