Skip to content

Commit

Permalink
version and module type for npm
Browse files Browse the repository at this point in the history
  • Loading branch information
prabrishac committed Jun 30, 2020
1 parent 5b35995 commit 12f2fff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
9 changes: 8 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ import globals from "rollup-plugin-node-globals";
import json from "rollup-plugin-json";
import gzipPlugin from "rollup-plugin-gzip";
import brotli from "rollup-plugin-brotli";
import { version } from "./package.json";
import * as webPackage from "./package.json";
import * as npmPackage from "./dist/rudder-sdk-js/package.json";


let distFileName = "";
let version = webPackage.version;
let moduleType = "web";
switch (process.env.ENV) {
case "prod":
switch (process.env.ENC) {
Expand Down Expand Up @@ -50,6 +54,8 @@ if (process.env.NPM == "true") {
format: "umd",
name: "rudderanalytics",
});
version = npmPackage.version;
moduleType = "npm";
} else {
outputFiles.push({
file: distFileName,
Expand All @@ -72,6 +78,7 @@ export default {
"process.browser": process.env.NODE_ENV != "true",
"process.prod": process.env.ENV == "prod",
"process.package_version": version,
"process.module_type": moduleType
}),
resolve({
jsnext: true,
Expand Down
3 changes: 1 addition & 2 deletions utils/constants.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { version } from "../package.json";
// Message Type enumeration
const MessageType = {
TRACK: "track",
Expand Down Expand Up @@ -70,7 +69,7 @@ const RudderIntegrationPlatform = {
};

const BASE_URL = "https://hosted.rudderlabs.com"; // default to RudderStack
const CONFIG_URL = `https://api.rudderlabs.com/sourceConfig/?p=web&v=${version}`;
const CONFIG_URL = "https://api.rudderlabs.com/sourceConfig/?p=process.module_type&v=process.package_version";

const FLUSH_QUEUE_SIZE = 30;

Expand Down

0 comments on commit 12f2fff

Please sign in to comment.