You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2021/02/19 01:34:23 UTC
[skywalking-website] branch master updated: Optimization: Quit
deployment when error (#220)
This is an automated email from the ASF dual-hosted git repository.
wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking-website.git
The following commit(s) were added to refs/heads/master by this push:
new acb9760 Optimization: Quit deployment when error (#220)
acb9760 is described below
commit acb97604e04c1235d19a7a595c187f8451688071
Author: Juntao Zhang <jt...@163.com>
AuthorDate: Fri Feb 19 09:34:15 2021 +0800
Optimization: Quit deployment when error (#220)
---
doc.sh | 2 +-
docs.js | 23 +++++++++++++++--------
2 files changed, 16 insertions(+), 9 deletions(-)
diff --git a/doc.sh b/doc.sh
index 0399397..9012447 100755
--- a/doc.sh
+++ b/doc.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-
+set -o errexit
repo=$1
repoUrl=$2
diff --git a/docs.js b/docs.js
index 6841fc1..34837b5 100644
--- a/docs.js
+++ b/docs.js
@@ -1,4 +1,5 @@
const fs = require("fs");
+const process = require("process");
const path = require("path");
const YAML = require('yamljs');
const axios = require('axios');
@@ -10,11 +11,17 @@ const layoutTemplateFile = '/themes/docsy/layouts/projectDoc/baseof.html';
init();
async function init() {
- const targetPath = path.join(__dirname, layoutTemplateFile)
- const result = await loadYaml(docConfig)
- const {tpl, docsInfo} = await traverseDocsList(result)
- await generateLayoutTemplate(targetPath, tpl)
- handleDocsFiles(docsInfo)
+ try{
+ const targetPath = path.join(__dirname, layoutTemplateFile)
+ const result = await loadYaml(docConfig)
+ const {tpl, docsInfo} = await traverseDocsList(result)
+ await generateLayoutTemplate(targetPath, tpl)
+ handleDocsFiles(docsInfo)
+ }catch (err){
+ console.log(err);
+ process.exit(1)
+ }
+
}
function readDirSync(path, docInfo, replaceMarkdownText) {
@@ -37,7 +44,7 @@ function readDirSync(path, docInfo, replaceMarkdownText) {
function readFile(filePath, docInfo, replaceMarkdownText) {
fs.readFile(filePath, function (err, data) {
if (err) {
- console.log("happen an error when read file , error is " + err);
+ throw err
} else {
let codeTxt = data.toString();
codeTxt = replaceMarkdownText(codeTxt, docInfo, filePath)
@@ -93,7 +100,7 @@ layout: baseof
function writeFile(filePath, codeTxt) {
fs.writeFile(filePath, codeTxt, function (err) {
if (err) {
- console.log("happen an error when write file , error is " + err);
+ throw err
}
});
}
@@ -115,7 +122,7 @@ async function traverseDocsList(result) {
const res = await axios.get(`https://api.github.com/repos/apache/${repo}/commits?page=1&per_page=1`)
commitId = res.data[0].sha;
} catch (err) {
- console.log(err);
+ throw err
}
}
if (commitId) {