Skip to content

Commit

Permalink
feat(segment): expose plugin also as a dynamic (#955)
Browse files Browse the repository at this point in the history
Signed-off-by: Tomas Coufal <[email protected]>
  • Loading branch information
tumido authored Nov 22, 2023
1 parent c080b4d commit 7b80a40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
5 changes: 4 additions & 1 deletion plugins/analytics-provider-segment/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,12 @@
"types": "dist/index.d.ts"
},
"backstage": {
"role": "frontend-plugin-module"
"role": "frontend-plugin"
},
"scripts": {
"start": "backstage-cli package start",
"build": "backstage-cli package build",
"export-dynamic": "janus-cli package export-dynamic-plugin",
"tsc": "tsc",
"lint": "backstage-cli package lint",
"test": "backstage-cli package test --passWithNoTests --coverage",
Expand Down Expand Up @@ -44,6 +45,7 @@
"@backstage/core-app-api": "1.11.0",
"@backstage/dev-utils": "1.0.22",
"@backstage/test-utils": "1.4.4",
"@janus-idp/cli": "1.4.3",
"@testing-library/dom": "9.3.3",
"@testing-library/jest-dom": "5.17.0",
"@testing-library/react": "12.1.5",
Expand All @@ -55,6 +57,7 @@
},
"files": [
"dist",
"dist-scalprum",
"config.d.ts"
],
"configSchema": "config.d.ts"
Expand Down
15 changes: 15 additions & 0 deletions plugins/analytics-provider-segment/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
analyticsApiRef,
configApiRef,
createApiFactory,
identityApiRef,
} from '@backstage/core-plugin-api';

import { SegmentAnalytics } from './apis/implementations/AnalyticsApi';

export { analyticsModuleSegment } from './plugin';
export * from './apis/implementations/AnalyticsApi';
export const SegmentAnalyticsApi = createApiFactory({
api: analyticsApiRef,
deps: { configApi: configApiRef, identityApi: identityApiRef },
factory: ({ configApi, identityApi }) =>
SegmentAnalytics.fromConfig(configApi, identityApi),
});

0 comments on commit 7b80a40

Please sign in to comment.