|
@@ -0,0 +1,52 @@
|
|
|
|
+/*
|
|
|
|
+ * ********************************************************************************************************************
|
|
|
|
+ *
|
|
|
|
+ * :*$@@%$*: ;: ;; ;;
|
|
|
|
+ * :@@%! :!@@%: %! ;%%@@%$ =@@@@@@@%; @%@@@%%%%@@@@@
|
|
|
|
+ * :@%; :$= %%$$$%$$ ;$$ ;$@= !@$
|
|
|
|
+ * =@! %! @ $=;% !@@@%: !$$$$$$$$$$$$$$=
|
|
|
|
+ * =@* %! @ $= % %@= =%@! %=
|
|
|
|
+ * *$%%! @@= ;=$%%%$*: %! @ $= % =%%%%%%@$ *%: =%
|
|
|
|
+ * %@@!: !@@@%=$@@@@%! :*@@$: %! @ $= % $* ;@ @* :%*
|
|
|
|
+ * ;@@! ;!!!;: ;@%: =======@%========* @ $$ % $%*****$@ :@$=*********=@$
|
|
|
|
+ * $@* ;@@@%=!: *@*
|
|
|
|
+ * =@$ ;;;!=%@@@@=! =@!
|
|
|
|
+ * %@$: =@%: :*@@@* %@= Copyright (c) 2016-2019. 北京上格云技术有限公司
|
|
|
|
+ * ;%@@$=$@@%* *@@@$=%@@%;
|
|
|
|
+ * ::;:: ::;:: All rights reserved.
|
|
|
|
+ *
|
|
|
|
+ * ********************************************************************************************************************
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+const Client = require("node-ssh");
|
|
|
|
+const ssh = new Client();
|
|
|
|
+
|
|
|
|
+ssh.connect({
|
|
|
|
+ host: process.env.npm_package_remote_host,
|
|
|
|
+ port: "22",
|
|
|
|
+ username: process.env.npm_package_remote_user,
|
|
|
|
+ password: process.env.npm_package_remote_password
|
|
|
|
+}).then(() => {
|
|
|
|
+ const failedList = [];
|
|
|
|
+ ssh.putDirectory(
|
|
|
|
+ process.env.npm_package_remote_local,
|
|
|
|
+ process.env.npm_package_remote_path,
|
|
|
|
+ {
|
|
|
|
+ recursive: true,
|
|
|
|
+ concurrency: 1,
|
|
|
|
+ tick: function(localPath, remotePath, error) {
|
|
|
|
+ if (error) {
|
|
|
|
+ failedList.push(localPath);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ).then(status => {
|
|
|
|
+ if (failedList.length > 0) {
|
|
|
|
+ console.log("发布失败");
|
|
|
|
+ console.log("failed transfers", failedList.join(", "));
|
|
|
|
+ } else {
|
|
|
|
+ console.log(status ? "发布成功" : "发布失败");
|
|
|
|
+ }
|
|
|
|
+ ssh.dispose();
|
|
|
|
+ });
|
|
|
|
+});
|