Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(live-preview): expose current package version [] #358

Merged
merged 2 commits into from
Oct 16, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/live-preview-sdk/src/helpers/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as packageJson from '../../package.json';
import { version } from '../../package.json';
import { CONTENTFUL_ORIGINS, LIVE_PREVIEW_SDK_SOURCE } from '../constants';
import { PostMessageMethods } from '../messages';
import type { EditorMessage, MessageFromSDK } from '../messages';
Expand All @@ -15,7 +15,7 @@ export function sendMessageToEditor(method: PostMessageMethods, data: EditorMess
from: 'live-preview',
source: LIVE_PREVIEW_SDK_SOURCE,
location: window.location.href,
version: packageJson.version || '2.2.0',
version,
};

debug.log('Send message', message);
Expand Down
3 changes: 3 additions & 0 deletions packages/live-preview-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import './styles.css';

import { type DocumentNode } from 'graphql';

import { version } from '../package.json';
import { getAllTaggedEntries } from './fieldTaggingUtils';
import {
sendMessageToEditor,
Expand Down Expand Up @@ -29,6 +30,8 @@ import {
TagAttributes,
} from './types';

export const VERSION = version;

export interface ContentfulLivePreviewInitConfig {
locale: string;
debugMode?: boolean;
Expand Down