add functionality
This commit is contained in:
parent
d82e28f5d1
commit
c13ab8e428
32
.gitlab-ci.yml
Normal file
32
.gitlab-ci.yml
Normal file
@ -0,0 +1,32 @@
|
||||
image: hosttoday/ht-docker-node
|
||||
|
||||
stages:
|
||||
- test
|
||||
- release
|
||||
|
||||
testLTS:
|
||||
stage: test
|
||||
script:
|
||||
- npmci install 4
|
||||
- npm install
|
||||
- npm test
|
||||
tags:
|
||||
- docker
|
||||
|
||||
testSTABLE:
|
||||
stage: test
|
||||
script:
|
||||
- npmci install stable
|
||||
- npm install
|
||||
- npm test
|
||||
tags:
|
||||
- docker
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npm -v
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- docker
|
@ -0,0 +1 @@
|
||||
{}
|
@ -25,6 +25,7 @@
|
||||
"dependencies": {
|
||||
"beautylog": "^5.0.6",
|
||||
"commander": "^2.9.0",
|
||||
"q": "^1.4.1",
|
||||
"shelljs": "^0.7.0",
|
||||
"smartfile": "^3.0.10",
|
||||
"typings-global": "^1.0.3"
|
||||
|
23
ts/index.ts
23
ts/index.ts
@ -2,6 +2,9 @@
|
||||
import "typings-global";
|
||||
import * as plugins from "./npmci.plugins";
|
||||
|
||||
import {install} from "./npmci.install";
|
||||
import {test} from "./npmci.test";
|
||||
import {publish} from "./npmci.publish";
|
||||
|
||||
|
||||
let command;
|
||||
@ -9,10 +12,10 @@ let commandOption;
|
||||
|
||||
plugins.commander
|
||||
.version('0.0.1')
|
||||
.arguments('<cmd> [node]')
|
||||
.action(function (commandArg, commandOptionArg) {
|
||||
command = commandArg;
|
||||
commandOption = commandOptionArg;
|
||||
.arguments('<commandarg> [commandoptionarg]')
|
||||
.action(function (commandarg, commandoptionarg) {
|
||||
command = commandarg;
|
||||
commandOption = commandoptionarg;
|
||||
});
|
||||
|
||||
plugins.commander.parse(process.argv);
|
||||
@ -24,7 +27,15 @@ if (typeof command === 'undefined') {
|
||||
|
||||
switch (command){
|
||||
case "install":
|
||||
|
||||
install(commandOption);
|
||||
break;
|
||||
case "test":
|
||||
test(commandOption);
|
||||
break;
|
||||
case "publish":
|
||||
publish();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
shelljs.exec("bash -c \"source /usr/local/nvm/nvm.sh && nvm install "+ commandOption + " nvm alias default " + commandOption + "\"");
|
@ -1,3 +1,22 @@
|
||||
import "typings-global";
|
||||
import * as plugins from "./npmci.plugins";
|
||||
export let install = (versionArg) => {
|
||||
if(versionArg = )
|
||||
let done = plugins.q.defer();
|
||||
let version:string;
|
||||
if(versionArg = "lts"){
|
||||
version = "4";
|
||||
} else {
|
||||
version = versionArg;
|
||||
};
|
||||
plugins.beautylog.log("now installing " + "node ".green + ("version " + version).yellow);
|
||||
plugins.shelljs.exec(
|
||||
"bash -c \"source /usr/local/nvm/nvm.sh && nvm install "+
|
||||
version +
|
||||
" nvm alias default " +
|
||||
version +
|
||||
"\""
|
||||
);
|
||||
plugins.beautylog.success("Node version " + version + " successfully installed!");
|
||||
done.resolve();
|
||||
return done.promise;
|
||||
}
|
@ -1,4 +1,6 @@
|
||||
import "typings-global";
|
||||
export import beautylog = require("beautylog");
|
||||
export let commander = require("commander");
|
||||
export let q = require("q");
|
||||
export let shelljs = require("shelljs");
|
||||
export import smartfile = require("smartfile");
|
@ -1,6 +1,15 @@
|
||||
import "typings-global";
|
||||
import * as plugins from "./npmci.plugins";
|
||||
|
||||
let npmrcPrefix:string = "//registry.npmjs.org/:_authToken=";
|
||||
let npmToken:string;
|
||||
let npmToken:string = process.env.NPMCITOKEN;
|
||||
let npmrcFileString = npmrcPrefix + npmToken;
|
||||
|
||||
|
||||
export let publish = () => {
|
||||
let done = plugins.q.defer();
|
||||
|
||||
plugins.smartfile.memory.toFs(npmrcFileString,{fileName:".npmrc",filePath:"/root/"});
|
||||
plugins.shelljs.exec("npm publish");
|
||||
return done.promise;
|
||||
};
|
@ -1,3 +1,14 @@
|
||||
export let test = () => {
|
||||
|
||||
import "typings-global";
|
||||
import * as plugins from "./npmci.plugins";
|
||||
import {install} from "./npmci.install";
|
||||
export let test = (versionArg) => {
|
||||
let done = plugins.q.defer();
|
||||
install(versionArg)
|
||||
.then(function(){
|
||||
plugins.beautylog.info("now starting tests:");
|
||||
plugins.shelljs.exec("npm test");
|
||||
plugins.beautylog.success("test finished");
|
||||
done.resolve();
|
||||
})
|
||||
return done.promise;
|
||||
}
|
Loading…
Reference in New Issue
Block a user