make-mp-data 1.0.10 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +5 -3
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -76,14 +76,15 @@ async function main(config) {
76
76
  // weigh events for random selection
77
77
  const weightedEvents = events
78
78
  .reduce((acc, event) => {
79
- for (let i = 0; i < event.weight; i++) {
79
+ const weight = event.weight || 1;
80
+ for (let i = 0; i < weight; i++) {
80
81
  acc.push(event);
81
82
  }
82
83
  return acc;
83
84
  }, [])
84
- .filter((e) => e.weight > 0)
85
85
  .filter((e) => !e.isFirstEvent);
86
86
 
87
+
87
88
  const firstEvents = events.filter((e) => e.isFirstEvent);
88
89
  const eventData = [];
89
90
  const userProfilesData = [];
@@ -317,7 +318,8 @@ function buildFileNames(config) {
317
318
  const { format = "csv", groupKeys = [], lookupTables = [] } = config;
318
319
  const extension = format === "csv" ? "csv" : "json";
319
320
  const current = dayjs.utc().format("MM-DD-HH");
320
- const writeDir = mkdir('./data');
321
+ let writeDir = null;
322
+ if (config.writeToDisk) writeDir = mkdir('./data');
321
323
 
322
324
  const writePaths = {
323
325
  eventFiles: [path.join(writeDir, `events-${current}.${extension}`)],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "make-mp-data",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "description": "builds all mixpanel primitives for a given project",
5
5
  "main": "index.js",
6
6
  "scripts": {