@michijs/dev-server 0.7.11 → 0.7.12

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.
@@ -14,14 +14,19 @@ const devServerListener = process.env.NODE_ENV === "DEVELOPMENT"
14
14
  : [];
15
15
  export const connections = [];
16
16
  const getCurrentCommitSha = () => {
17
- const headPath = join(".git", "HEAD");
18
- const headContent = fs.readFileSync(headPath, "utf-8").trim();
19
- if (headContent.startsWith("ref:")) {
20
- const refPath = join(".git", headContent.split(" ")[1]);
21
- return fs.readFileSync(refPath, "utf-8").trim();
17
+ try {
18
+ const headPath = join(".git", "HEAD");
19
+ const headContent = fs.readFileSync(headPath, "utf-8").trim();
20
+ if (headContent.startsWith("ref:")) {
21
+ const refPath = join(".git", headContent.split(" ")[1]);
22
+ return fs.readFileSync(refPath, "utf-8").trim();
23
+ }
24
+ else {
25
+ return headContent;
26
+ }
22
27
  }
23
- else {
24
- return headContent;
28
+ catch {
29
+ return "";
25
30
  }
26
31
  };
27
32
  const commitSha = getCurrentCommitSha();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@michijs/dev-server",
3
3
  "license": "MIT",
4
- "version": "0.7.11",
4
+ "version": "0.7.12",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/michijs/dev-server.git"