make-mp-data 2.1.0 → 2.1.1

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 +9 -8
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -188,22 +188,23 @@ async function main(config) {
188
188
 
189
189
  // ! DATA GENERATION ENDS HERE
190
190
 
191
- // Step 10: flush lookup tables to disk (always as CSVs)
191
+ // Step 10: Send to Mixpanel (if token provided)
192
+ // IMPORTANT: Must happen BEFORE flushing to disk, because flush() clears the arrays
193
+ let importResults;
194
+ if (validatedConfig.token) {
195
+ importResults = await sendToMixpanel(context);
196
+ }
197
+
198
+ // Step 11: Flush lookup tables to disk (always as CSVs)
192
199
  if (validatedConfig.writeToDisk) {
193
200
  await flushLookupTablesToDisk(storage, validatedConfig);
194
201
  }
195
202
 
196
- // Step 11: Flush other storage containers to disk (if writeToDisk enabled)
203
+ // Step 12: Flush other storage containers to disk (if writeToDisk enabled)
197
204
  if (validatedConfig.writeToDisk) {
198
205
  await flushStorageToDisk(storage, validatedConfig);
199
206
  }
200
207
 
201
- // Step 12: Send to Mixpanel (if token provided)
202
- let importResults;
203
- if (validatedConfig.token) {
204
- importResults = await sendToMixpanel(context);
205
- }
206
-
207
208
  // Step 13: Compile results
208
209
  jobTimer.stop(false);
209
210
  const { start, end, delta, human } = jobTimer.report(false);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "make-mp-data",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "builds all mixpanel primitives for a given project",
5
5
  "type": "module",
6
6
  "main": "index.js",