Skip to content

Commit bd6e017

Browse files
committed
fix: inline package version
Not shipping the whole package.json in the bundle anymore. Thanks @tomchen! Closes #1322
1 parent 992ef83 commit bd6e017

4 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/api.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { util } from "./util";
22
import logger from "./logger";
33
import type { PeerJSOption } from "./optionInterfaces";
4-
import { version } from "../package.json";
4+
import { version } from "./version";
55

66
export class API {
77
constructor(private readonly _options: PeerJSOption) {}

lib/socket.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { EventEmitter } from "eventemitter3";
22
import logger from "./logger";
33
import { ServerMessageType, SocketEventType } from "./enums";
4-
import { version } from "../package.json";
4+
import { version } from "./version";
55

66
/**
77
* An abstraction on top of WebSockets to provide fastest

lib/version.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const version = "1.5.4";

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,8 @@
164164
"contributors": "git-authors-cli --print=false && prettier --write package.json && git add package.json package-lock.json && git commit -m \"chore(contributors): update and sort contributors list\"",
165165
"check": "tsc --noEmit && tsc -p e2e/tsconfig.json --noEmit",
166166
"watch": "parcel watch",
167-
"build": "rm -rf dist && parcel build",
167+
"build": "npm run build:version && rm -rf dist && parcel build",
168+
"build:version": "echo \"export const version = \\\"$(node -p \"require('./package.json').version\")\\\";\" > lib/version.ts",
168169
"prepublishOnly": "npm run build",
169170
"test": "jest",
170171
"test:watch": "jest --watch",

0 commit comments

Comments
 (0)