@canyonjs/cli 1.0.30 → 1.0.32
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/dist/index.js +23 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import node_fs from "node:fs";
|
|
|
4
4
|
import node_path from "node:path";
|
|
5
5
|
import axios from "axios";
|
|
6
6
|
var package_namespaceObject = {
|
|
7
|
-
rE: "1.0.
|
|
7
|
+
rE: "1.0.32"
|
|
8
8
|
};
|
|
9
9
|
function mergeNumberMaps(a = {}, b = {}) {
|
|
10
10
|
const result = {
|
|
@@ -61,11 +61,14 @@ function mergeCoverageMaps(target = {}, source = {}) {
|
|
|
61
61
|
}
|
|
62
62
|
async function mapCommand(params, options) {
|
|
63
63
|
console.log('Current working directory:', process.cwd());
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
const isGitHubActions = 'true' === process.env.GITHUB_ACTIONS || !!process.env.GITHUB_EVENT_PATH;
|
|
65
|
+
let githubEvent;
|
|
66
|
+
if (isGitHubActions && process.env.GITHUB_EVENT_PATH) try {
|
|
67
|
+
if (node_fs.existsSync(process.env.GITHUB_EVENT_PATH)) githubEvent = node_fs.readFileSync(process.env.GITHUB_EVENT_PATH, 'utf8');
|
|
68
|
+
else console.log('GITHUB_EVENT_PATH file not found:', process.env.GITHUB_EVENT_PATH);
|
|
69
|
+
} catch (error) {
|
|
70
|
+
console.warn('Failed to read GITHUB_EVENT_PATH:', error);
|
|
71
|
+
}
|
|
69
72
|
const { dsn, repo_id: repoID, sha, provider, build_target, debug, instrument_cwd, filter, scene } = params;
|
|
70
73
|
if (!node_fs.existsSync(node_path.resolve(process.cwd(), '.canyon_output'))) return void console.log('No .canyon_output directory found, skipping upload.');
|
|
71
74
|
const files = node_fs.readdirSync(node_path.resolve(process.cwd(), '.canyon_output'));
|
|
@@ -86,6 +89,15 @@ async function mapCommand(params, options) {
|
|
|
86
89
|
const env_branch = process.env.CI_COMMIT_BRANCH;
|
|
87
90
|
const env_buildID = process.env.CI_JOB_ID;
|
|
88
91
|
const env_buildProvider = 'gitlab_runner';
|
|
92
|
+
let diffData;
|
|
93
|
+
const diffJsonPath = node_path.resolve(process.cwd(), 'diff.json');
|
|
94
|
+
if (node_fs.existsSync(diffJsonPath)) try {
|
|
95
|
+
const diffJsonContent = node_fs.readFileSync(diffJsonPath, 'utf-8');
|
|
96
|
+
diffData = JSON.parse(diffJsonContent);
|
|
97
|
+
console.log(`Found diff.json file: ${diffJsonPath}`);
|
|
98
|
+
} catch (error) {
|
|
99
|
+
console.warn(`Failed to read or parse diff.json: ${error}`);
|
|
100
|
+
}
|
|
89
101
|
let sceneMap;
|
|
90
102
|
if (scene && Array.isArray(scene)) {
|
|
91
103
|
sceneMap = {};
|
|
@@ -110,12 +122,16 @@ async function mapCommand(params, options) {
|
|
|
110
122
|
buildTarget: build_target || '',
|
|
111
123
|
coverage: Object.keys(data),
|
|
112
124
|
build: {
|
|
113
|
-
|
|
125
|
+
provider: isGitHubActions ? 'github_actions' : env_buildProvider,
|
|
126
|
+
event: isGitHubActions ? githubEvent : void 0,
|
|
114
127
|
buildID: env_buildID,
|
|
115
128
|
branch: env_branch
|
|
116
129
|
},
|
|
117
130
|
...sceneMap && {
|
|
118
131
|
scene: sceneMap
|
|
132
|
+
},
|
|
133
|
+
...diffData && {
|
|
134
|
+
diff: diffData
|
|
119
135
|
}
|
|
120
136
|
};
|
|
121
137
|
if ('true' === debug) console.log(p);
|