Skip to content

Commit

Permalink
chore: add script for disabling debug messages in the release
Browse files Browse the repository at this point in the history
  • Loading branch information
aminya committed Sep 17, 2021
1 parent da284e0 commit d82045e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 4 deletions.
19 changes: 18 additions & 1 deletion .terserrc.js
Original file line number Diff line number Diff line change
@@ -1 +1,18 @@
module.exports = require("terser-config-atomic")
const terserConfig = require("terser-config-atomic")

const compress =
typeof terserConfig.compress !== "boolean"
? {
...terserConfig.compress,
global_defs: {
...terserConfig.compress.global_defs,
"process.env.NODE_DEBUG": false,
"process.env.RUNNER_DEBUG": "0",
},
}
: terserConfig.compress

module.exports = {
...terserConfig,
compress,
}
16 changes: 16 additions & 0 deletions building/debug_remove.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
const { minify } = require("terser")
const { readFileSync, writeFileSync } = require("fs")
const { join, dirname } = require("path")

async function main() {
console.log("Disabling debug messages inside @actions/core")
const file = join(dirname(__dirname), "dist", "setup_cpp.js")
const { code, map } = await minify(readFileSync(file, "utf8"), { sourceMap: true, ...require("../.terserrc.js") })

writeFileSync(file, code)
writeFileSync(`${file}.map`, map)
}

main().catch(function (err) {
throw err
})
3 changes: 1 addition & 2 deletions dist/setup_cpp.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/setup_cpp.js.map

Large diffs are not rendered by default.

0 comments on commit d82045e

Please sign in to comment.