@flisk/analyze-tracking 0.6.0 → 0.7.0
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.
- package/README.md +113 -24
- package/package.json +1 -1
- package/src/analyze/analyzeGoFile.js +968 -0
- package/src/analyze/go2json.js +1069 -0
- package/src/analyze/index.js +4 -0
- package/src/analyze/pythonTrackingAnalyzer.py +1 -1
package/src/analyze/index.js
CHANGED
|
@@ -5,6 +5,7 @@ const { analyzeJsFile } = require('./analyzeJsFile');
|
|
|
5
5
|
const { analyzeTsFile } = require('./analyzeTsFile');
|
|
6
6
|
const { analyzePythonFile } = require('./analyzePythonFile');
|
|
7
7
|
const { analyzeRubyFile } = require('./analyzeRubyFile');
|
|
8
|
+
const { analyzeGoFile } = require('./analyzeGoFile');
|
|
8
9
|
|
|
9
10
|
async function analyzeDirectory(dirPath, customFunction) {
|
|
10
11
|
const allEvents = {};
|
|
@@ -23,6 +24,7 @@ async function analyzeDirectory(dirPath, customFunction) {
|
|
|
23
24
|
const isTsFile = /\.(tsx?)$/.test(file);
|
|
24
25
|
const isPythonFile = /\.(py)$/.test(file);
|
|
25
26
|
const isRubyFile = /\.(rb)$/.test(file);
|
|
27
|
+
const isGoFile = /\.(go)$/.test(file);
|
|
26
28
|
|
|
27
29
|
if (isJsFile) {
|
|
28
30
|
events = analyzeJsFile(file, customFunction);
|
|
@@ -32,6 +34,8 @@ async function analyzeDirectory(dirPath, customFunction) {
|
|
|
32
34
|
events = await analyzePythonFile(file, customFunction);
|
|
33
35
|
} else if (isRubyFile) {
|
|
34
36
|
events = await analyzeRubyFile(file, customFunction);
|
|
37
|
+
} else if (isGoFile) {
|
|
38
|
+
events = await analyzeGoFile(file, customFunction);
|
|
35
39
|
} else {
|
|
36
40
|
console.info(`Skipping file ${file} because it is not a supported file type`);
|
|
37
41
|
continue;
|
|
@@ -136,7 +136,7 @@ class TrackingVisitor(ast.NodeVisitor):
|
|
|
136
136
|
if obj_id == 'amplitude' and method_name == 'track':
|
|
137
137
|
return 'amplitude'
|
|
138
138
|
# Rudderstack
|
|
139
|
-
if obj_id == '
|
|
139
|
+
if obj_id == 'rudder_analytics' and method_name == 'track':
|
|
140
140
|
return 'rudderstack'
|
|
141
141
|
# mParticle
|
|
142
142
|
if obj_id == 'mParticle' and method_name == 'logEvent':
|