summaryrefslogtreecommitdiff
path: root/webpack/_helpers.js
blob: 64d4a7b29ff3c79fcec7b5acab9fd4fd1317d9b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/**
 * @prettier
 */

const { gitDescribeSync } = require("git-describe")

function getRepoInfo() {
  try {
    return gitDescribeSync(__dirname)
  } catch (e) {
    console.error(e)
    return {
      hash: "noGit",
      dirty: false,
    }
  }
}

function getDevtool(sourcemaps, minimize) {
  if (!sourcemaps) return false
  return minimize ? "source-map" : "cheap-module-source-map"
}

module.exports = {
  getRepoInfo,
  getDevtool,
}