@flisk/analyze-tracking 0.1.1 → 0.1.2
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 +1 -1
- package/bin/{analyze-tracking.js → cli.js} +24 -9
- package/package.json +3 -3
- package/src/cli.js +0 -11
package/README.md
CHANGED
|
@@ -2,21 +2,37 @@
|
|
|
2
2
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const { execSync } = require('child_process');
|
|
5
|
+
const commandLineArgs = require('command-line-args')
|
|
5
6
|
const { run } = require('../src/index');
|
|
6
7
|
|
|
7
8
|
// Parse command-line arguments
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
const optionDefinitions = [
|
|
10
|
+
{
|
|
11
|
+
name: 'targetDir',
|
|
12
|
+
type: String,
|
|
13
|
+
defaultOption: true,
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
name: 'repository',
|
|
17
|
+
alias: 'r',
|
|
18
|
+
type: String,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'output',
|
|
22
|
+
alias: 'o',
|
|
23
|
+
type: String,
|
|
24
|
+
defaultValue: 'tracking-schema.yaml',
|
|
25
|
+
},
|
|
26
|
+
]
|
|
27
|
+
const options = commandLineArgs(optionDefinitions);
|
|
28
|
+
const { targetDir, output, repository } = options;
|
|
13
29
|
|
|
14
30
|
if (!targetDir) {
|
|
15
31
|
console.error('Please provide the path to the repository.');
|
|
16
32
|
process.exit(1);
|
|
17
33
|
}
|
|
18
34
|
|
|
19
|
-
//
|
|
35
|
+
// Get the repository URL using Git
|
|
20
36
|
function getRepositoryUrl() {
|
|
21
37
|
try {
|
|
22
38
|
const repoUrl = execSync('git config --get remote.origin.url', { cwd: targetDir, encoding: 'utf8' });
|
|
@@ -27,7 +43,6 @@ function getRepositoryUrl() {
|
|
|
27
43
|
}
|
|
28
44
|
}
|
|
29
45
|
|
|
30
|
-
|
|
31
|
-
const repository = repositoryUrl || getRepositoryUrl();
|
|
46
|
+
const repositoryUrl = repository || getRepositoryUrl();
|
|
32
47
|
|
|
33
|
-
run(path.resolve(targetDir),
|
|
48
|
+
run(path.resolve(targetDir), repositoryUrl, output);
|
package/package.json
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@flisk/analyze-tracking",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Analyzes tracking code in a project and generates data schemas",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"bin": {
|
|
7
|
-
"analyze-tracking": "bin/
|
|
7
|
+
"analyze-tracking": "bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"scripts": {
|
|
10
|
-
"start": "node bin/analyze-tracking.js",
|
|
11
10
|
"test": "jest"
|
|
12
11
|
},
|
|
13
12
|
"repository": {
|
|
@@ -24,6 +23,7 @@
|
|
|
24
23
|
"@typescript-eslint/parser": "^8.1.0",
|
|
25
24
|
"acorn": "^8.12.1",
|
|
26
25
|
"acorn-walk": "^8.3.3",
|
|
26
|
+
"command-line-args": "^6.0.0",
|
|
27
27
|
"js-yaml": "^4.1.0",
|
|
28
28
|
"typescript": "^5.5.4"
|
|
29
29
|
},
|
package/src/cli.js
DELETED