hdoc-tools 0.37.0 → 0.38.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/hdoc.js +26 -0
- package/package.json +1 -1
package/hdoc.js
CHANGED
@@ -7,6 +7,32 @@
|
|
7
7
|
|
8
8
|
const packageFile = path.join(__dirname, "package.json");
|
9
9
|
|
10
|
+
const originalConsoleLog = console.log;
|
11
|
+
|
12
|
+
console.log = (...args) => {
|
13
|
+
if (process.env.GITHUB_ACTIONS !== 'true') {
|
14
|
+
// If not running in GitHub Actions, send args to the original console.log
|
15
|
+
originalConsoleLog(...args);
|
16
|
+
|
17
|
+
} else {
|
18
|
+
// If running in GitHub Actions, escape % and \ characters so printf doesn't throw an error
|
19
|
+
const escapedArgs = args.map(arg => {
|
20
|
+
if (typeof arg === 'string') {
|
21
|
+
return arg.replace(/%/g, '%%').replace(/\\/g, '\\\\');
|
22
|
+
}
|
23
|
+
return arg;
|
24
|
+
});
|
25
|
+
// Use the original console.log with escaped arguments
|
26
|
+
originalConsoleLog(...escapedArgs);
|
27
|
+
}
|
28
|
+
};
|
29
|
+
|
30
|
+
if (process.env.GITHUB_ACTIONS === 'true') {
|
31
|
+
console.log("\nRunning in GitHub Actions environment\n");
|
32
|
+
} else {
|
33
|
+
console.log("\nRunning in non-GitHub Actions environment\n");
|
34
|
+
}
|
35
|
+
|
10
36
|
let console_color = true;
|
11
37
|
|
12
38
|
const { info, error } = console;
|