2016-05-30 00:28:47 +00:00
|
|
|
import "typings-global";
|
|
|
|
import * as plugins from "./npmci.plugins";
|
2016-06-01 03:42:37 +00:00
|
|
|
import {prepare} from "./npmci.prepare";
|
2016-05-30 01:40:07 +00:00
|
|
|
import {bash} from "./npmci.bash";
|
2016-05-30 00:28:47 +00:00
|
|
|
|
2016-06-01 03:42:37 +00:00
|
|
|
export let publish = (serviceArg:string = "npm") => {
|
|
|
|
let done = plugins.q.defer();
|
|
|
|
switch (serviceArg){
|
|
|
|
case "npm":
|
|
|
|
publishNpm()
|
|
|
|
.then(function(){
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
break;
|
|
|
|
case "docker":
|
|
|
|
publishDocker()
|
|
|
|
.then(function(){
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
return done.promise;
|
|
|
|
};
|
2016-05-30 00:28:47 +00:00
|
|
|
|
2016-06-01 03:42:37 +00:00
|
|
|
let publishNpm = function(){
|
|
|
|
let done = plugins.q.defer();
|
|
|
|
prepare("npm")
|
|
|
|
.then(function(){
|
|
|
|
bash("npm publish");
|
|
|
|
plugins.beautylog.ok("Done!") ;
|
|
|
|
done.resolve();
|
|
|
|
});
|
|
|
|
return done.promise;
|
|
|
|
}
|
2016-05-29 20:54:59 +00:00
|
|
|
|
2016-06-01 03:42:37 +00:00
|
|
|
let publishDocker = function(){
|
2016-05-30 00:28:47 +00:00
|
|
|
let done = plugins.q.defer();
|
2016-06-01 03:42:37 +00:00
|
|
|
prepare("docker")
|
|
|
|
.then(function(){
|
|
|
|
bash("docker push");
|
|
|
|
});
|
2016-05-30 00:28:47 +00:00
|
|
|
return done.promise;
|
2016-05-29 20:54:59 +00:00
|
|
|
};
|