瀏覽代碼

Prevent empty layout configs

Kevin van Zonneveld 9 年之前
父節點
當前提交
e1096d4c0c
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      website/update.js

+ 6 - 1
website/update.js

@@ -7,11 +7,16 @@ var uppyRoot = path.dirname(__dirname)
 
 var configPath = webRoot + '/themes/uppy/_config.yml'
 var version = require(uppyRoot + '/package.json').version
+var configTemplate = '# Uppy versions, auto updated by update.js\nuppy_version: 0.0.1\n\nuppy_dev_size: "0.0"\nuppy_min_size: "0.0"\nuppy_gz_size: "0.0"'
 var config
 try {
   config = fs.readFileSync(configPath, 'utf-8')
 } catch (e) {
-  config = '# Uppy versions, auto updated by update.js\nuppy_version: 0.0.1\n\nuppy_dev_size: "0.0"\nuppy_min_size: "0.0"\nuppy_gz_size: "0.0"'
+
+}
+
+if (!config || !config.trim()) {
+  config = configTemplate
 }
 
 // Inject current Uppy version and sizes in website's _config.yml