浏览代码

Fix updating _config.yml if it does not yet exist.

Renée Kooi 6 年之前
父节点
当前提交
1c27adb858
共有 1 个文件被更改,包括 10 次插入2 次删除
  1. 10 2
      website/update.js

+ 10 - 2
website/update.js

@@ -119,9 +119,17 @@ async function injectBuiltFiles () {
   })
 }
 
+async function readConfig () {
+  try {
+    const buf = await promisify(fs.readFile)(configPath, 'utf8')
+    return YAML.safeLoad(buf)
+  } catch (err) {
+    return {}
+  }
+}
+
 async function update () {
-  const buf = await promisify(fs.readFile)(configPath, 'utf8')
-  const config = YAML.safeLoad(buf)
+  const config = await readConfig()
 
   config.uppy_version = version
   config.uppy_version_anchor = version.replace(/[^\d]+/g, '')