From c9629872e013958b4f9b72f97a55be59b62e5c56 Mon Sep 17 00:00:00 2001
From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com>
Date: Sun, 14 Jul 2024 08:35:53 +1000
Subject: [PATCH 1/5] chore: Refactor project configuration settings
- Delete unused .release-it.json configuration file
- Clean up project by removing unnecessary files
---
.release-it.json | 7 -------
1 file changed, 7 deletions(-)
delete mode 100644 .release-it.json
diff --git a/.release-it.json b/.release-it.json
deleted file mode 100644
index 2cd8f78..0000000
--- a/.release-it.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "$schema": "https://unpkg.com/release-it@17/schema/release-it.json",
- "github": {
- "release": false
- },
- "npm": false
-}
\ No newline at end of file
From 3a57a37fb9e082f328c35f91a4a31fd44af79314 Mon Sep 17 00:00:00 2001
From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com>
Date: Sun, 14 Jul 2024 08:44:54 +1000
Subject: [PATCH 2/5] refactor: Refactor Plausible configuration properties and
URLs
- Refactored PlausibleAnalytics component to use dataDomain and sourceDomain properties
- Updated Config interface to include sourceDomain property
- Updated plugin test cases to reflect changes in configuration properties
---
plugins/plausible/config.d.ts | 7 ++++++-
.../src/components/PlausibleAnalytics.tsx | 14 +++++---------
plugins/plausible/src/plugin.test.tsx | 5 +++--
3 files changed, 14 insertions(+), 12 deletions(-)
diff --git a/plugins/plausible/config.d.ts b/plugins/plausible/config.d.ts
index e809364..8f1067a 100644
--- a/plugins/plausible/config.d.ts
+++ b/plugins/plausible/config.d.ts
@@ -8,6 +8,11 @@ export interface Config {
/**
* @visibility frontend
*/
- domain: string;
+ dataDomain: string;
+
+ /**
+ * @visibility frontend
+ */
+ soureDomain: string;
};
}
diff --git a/plugins/plausible/src/components/PlausibleAnalytics.tsx b/plugins/plausible/src/components/PlausibleAnalytics.tsx
index c2ec17c..b326847 100644
--- a/plugins/plausible/src/components/PlausibleAnalytics.tsx
+++ b/plugins/plausible/src/components/PlausibleAnalytics.tsx
@@ -4,17 +4,13 @@ import React from 'react';
export const PlausibleAnalytics = () => {
const config = useApi(configApiRef);
const enabled = config.getOptionalBoolean('plausible.enabled') ?? false;
- const domain = config.getOptionalString('plausible.domain');
+ const dataDomain = config.getOptionalString('plausible.dataDomain');
+ const sourceDomain = config.getOptionalString('plausible.sourceDomain');
+ const source = `https://${sourceDomain}/js/script.js`;
- if (!enabled || !domain) {
+ if (!enabled || !dataDomain || !sourceDomain) {
return null;
}
- return (
-
- );
+ return ;
};
diff --git a/plugins/plausible/src/plugin.test.tsx b/plugins/plausible/src/plugin.test.tsx
index 84b8f73..2964350 100644
--- a/plugins/plausible/src/plugin.test.tsx
+++ b/plugins/plausible/src/plugin.test.tsx
@@ -38,7 +38,8 @@ describe('PlausibleAnalytics', () => {
const config = mockConfigApi({
plausible: {
enabled: true,
- domain: 'example.com',
+ dataDomain: 'example.com',
+ sourceDomain: 'plausible.example.com',
},
});
const { container } = render(
@@ -51,7 +52,7 @@ describe('PlausibleAnalytics', () => {
expect(scriptTag).toHaveAttribute('data-domain', 'example.com');
expect(scriptTag).toHaveAttribute(
'src',
- 'https://plausible.io/js/script.js',
+ 'https://plausible.example.com/js/script.js',
);
expect(scriptTag).toHaveAttribute('defer');
});
From b6bbe0d073fd3b9c7d2eaa16ed33bbf658a334c1 Mon Sep 17 00:00:00 2001
From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com>
Date: Sun, 14 Jul 2024 08:45:18 +1000
Subject: [PATCH 3/5] feat: Update app configuration to disable `plausible`
feature
- Added new fields and removed old field in app-config.production.yaml under `plausible`
- Disabled the `plausible` feature in app-config.yaml for the app configuration
---
app-config.production.yaml | 4 +++-
app-config.yaml | 3 +--
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/app-config.production.yaml b/app-config.production.yaml
index 31c2ad5..f349d22 100644
--- a/app-config.production.yaml
+++ b/app-config.production.yaml
@@ -34,4 +34,6 @@ catalog:
target: ../../examples/acme-corp.yaml
plausible:
- domain: ${PLAUSIBLE_DOMAIN}
+ enabled: true
+ dataDomain: ${PLAUSIBLE_DATA_DOMAIN}
+ sourceDomain: ${PLAUSIBLE_SOURCE_DOMAIN}
diff --git a/app-config.yaml b/app-config.yaml
index ac2ace1..aec6e99 100644
--- a/app-config.yaml
+++ b/app-config.yaml
@@ -73,5 +73,4 @@ catalog:
- allow: [Component, System, API, Resource, Location, Template, User, Group]
plausible:
- enabled: true
- domain: ${PLAUSIBLE_DOMAIN}
+ enabled: false
From 4ebd0aec7126bf8f6b8a74a7ddd872b515f909c0 Mon Sep 17 00:00:00 2001
From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com>
Date: Sun, 14 Jul 2024 08:45:49 +1000
Subject: [PATCH 4/5] chore: Update environment variable names for data and
source domains
- Update environment variable name from PLAUSIBLE_DOMAIN to PLAUSIBLE_DATA_DOMAIN
- Add new environment variable PLAUSIBLE_SOURCE_DOMAIN
- Ensure all relevant files are updated with the new environment variable names.
---
.env.example | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/.env.example b/.env.example
index ee5dc77..b067006 100644
--- a/.env.example
+++ b/.env.example
@@ -2,6 +2,7 @@ GITHUB_TOKEN=
# Plausible
BASE_URL=http://plausible.localhost
-PLAUSIBLE_DOMAIN=http://plausible.localhost
+PLAUSIBLE_DATA_DOMAIN=http://backstage.localhost
+PLAUSIBLE_SOURCE_DOMAIN=http://plausible.localhost
SECRET_KEY_BASE=
TOTP_VAULT_KEY=
\ No newline at end of file
From 08d839272aaa05523929300c2b24b90d44f1036d Mon Sep 17 00:00:00 2001
From: Johnny Huynh <27847622+johnnyhuy@users.noreply.github.com>
Date: Sun, 14 Jul 2024 09:07:21 +1000
Subject: [PATCH 5/5] docs: Update configuration settings and fix typing errors
- Fix typo in `sourceDomain` property in `Config` interface in `plugins/plausible/config.d.ts`
---
plugins/plausible/config.d.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/plugins/plausible/config.d.ts b/plugins/plausible/config.d.ts
index 8f1067a..d3e81c5 100644
--- a/plugins/plausible/config.d.ts
+++ b/plugins/plausible/config.d.ts
@@ -13,6 +13,6 @@ export interface Config {
/**
* @visibility frontend
*/
- soureDomain: string;
+ sourceDomain: string;
};
}