Skip to content

Commit 7b80a40

Browse files
authored
feat(segment): expose plugin also as a dynamic (#955)
Signed-off-by: Tomas Coufal <[email protected]>
1 parent c080b4d commit 7b80a40

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

plugins/analytics-provider-segment/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,12 @@
1010
"types": "dist/index.d.ts"
1111
},
1212
"backstage": {
13-
"role": "frontend-plugin-module"
13+
"role": "frontend-plugin"
1414
},
1515
"scripts": {
1616
"start": "backstage-cli package start",
1717
"build": "backstage-cli package build",
18+
"export-dynamic": "janus-cli package export-dynamic-plugin",
1819
"tsc": "tsc",
1920
"lint": "backstage-cli package lint",
2021
"test": "backstage-cli package test --passWithNoTests --coverage",
@@ -44,6 +45,7 @@
4445
"@backstage/core-app-api": "1.11.0",
4546
"@backstage/dev-utils": "1.0.22",
4647
"@backstage/test-utils": "1.4.4",
48+
"@janus-idp/cli": "1.4.3",
4749
"@testing-library/dom": "9.3.3",
4850
"@testing-library/jest-dom": "5.17.0",
4951
"@testing-library/react": "12.1.5",
@@ -55,6 +57,7 @@
5557
},
5658
"files": [
5759
"dist",
60+
"dist-scalprum",
5861
"config.d.ts"
5962
],
6063
"configSchema": "config.d.ts"

plugins/analytics-provider-segment/src/index.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,20 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
import {
17+
analyticsApiRef,
18+
configApiRef,
19+
createApiFactory,
20+
identityApiRef,
21+
} from '@backstage/core-plugin-api';
22+
23+
import { SegmentAnalytics } from './apis/implementations/AnalyticsApi';
24+
1625
export { analyticsModuleSegment } from './plugin';
1726
export * from './apis/implementations/AnalyticsApi';
27+
export const SegmentAnalyticsApi = createApiFactory({
28+
api: analyticsApiRef,
29+
deps: { configApi: configApiRef, identityApi: identityApiRef },
30+
factory: ({ configApi, identityApi }) =>
31+
SegmentAnalytics.fromConfig(configApi, identityApi),
32+
});

0 commit comments

Comments
 (0)