update dependencies and README

This commit is contained in:
Philipp Kunz 2017-02-11 20:23:10 +01:00
parent 74374e99d7
commit eab75f03da
22 changed files with 1543 additions and 249 deletions

4
.gitignore vendored
View File

@ -1,6 +1,8 @@
node_modules/ node_modules/
coverage/ coverage/
docs/ pages/
public/
test/ test/
assets/ assets/
.nogit/ .nogit/

View File

@ -1,5 +1,59 @@
# npmdocker # npmdocker
develop npm modules cross platform with docker develop npm modules cross platform with docker
## Availabililty
[![npm](https://gitzone.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/npmdocker)
[![git](https://gitzone.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/gitzone/npmdocker)
[![git](https://gitzone.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/gitzone/npmdocker)
[![docs](https://gitzone.gitlab.io/assets/repo-button-docs.svg)](https://gitzone.gitlab.io/npmdocker/)
## Status for master
[![build status](https://GitLab.com/gitzone/npmdocker/badges/master/build.svg)](https://GitLab.com/gitzone/npmdocker/commits/master)
[![coverage report](https://GitLab.com/gitzone/npmdocker/badges/master/coverage.svg)](https://GitLab.com/gitzone/npmdocker/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/npmdocker.svg)](https://www.npmjs.com/package/npmdocker)
[![Dependency Status](https://david-dm.org/gitzonetools/npmdocker.svg)](https://david-dm.org/gitzonetools/npmdocker)
[![bitHound Dependencies](https://www.bithound.io/github/gitzonetools/npmdocker/badges/dependencies.svg)](https://www.bithound.io/github/gitzonetools/npmdocker/master/dependencies/npm)
[![bitHound Code](https://www.bithound.io/github/gitzonetools/npmdocker/badges/code.svg)](https://www.bithound.io/github/gitzonetools/npmdocker)
[![TypeScript](https://img.shields.io/badge/TypeScript-2.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![node](https://img.shields.io/badge/node->=%206.x.x-blue.svg)](https://nodejs.org/dist/latest-v6.x/docs/api/)
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage ## Usage
npmdocker looks for a npmextra.json at the root of your directory and looks at the npmdocker portion of it. Use TypeScript for best in class instellisense.
### Why does this package exist?
Sometimes you want a clean and fresh linux environment everytime you test your package.
Usually this is the default i CI, but locally behaviour tends to defer.
### Where does it work
The npmdocker package works in everywhere where the docker cli is available. e.g.:
* docker toolbox
* native docker application
* docker in docker
* mounted docker.sock
### How do I use it?
create a npmextra.json in the project's root directory
```json
{
"npmdocker": {
"baseImage": "hosttoday/ht-docker-node:npmts",
"command": "npmci test stable",
"dockerSock": false
}
}
```
option | description
--- | ---
baseImage | the base image that is the context for your project
command | the cli command to run within the the project's directory inside the docker container
dockersSock | wether or not the testcontainer will have access to the docker.sock of the host
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
[![npm](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://git.zone)

View File

@ -2,4 +2,4 @@ FROM hosttoday/ht-docker-node:npmts
COPY ./buildContextDir /workspace COPY ./buildContextDir /workspace
WORKDIR /workspace WORKDIR /workspace
ENV CI=true ENV CI=true
CMD ["npm","run","npmdocker"]; CMD ["npmci","test","stable"];

2
dist/cli.js vendored
View File

@ -1,2 +1,2 @@
#!/usr/bin/env node #!/usr/bin/env node
var index = require("./index.js"); var index = require("../dist/index.js");

2
dist/index.js vendored
View File

@ -11,4 +11,4 @@ promisechain.run()
process.exit(1); process.exit(1);
} }
}); });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsTUFBWSxPQUFPLFdBQU0scUJBQXFCLENBQUMsQ0FBQTtBQUMvQyxNQUFZLFlBQVksV0FBTSwwQkFBMEIsQ0FBQyxDQUFBO0FBSXpELFlBQVksQ0FBQyxHQUFHLEVBQUU7S0FDYixJQUFJL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v';
import * as plugins from "./npmdocker.plugins";
import { IKeyValueObject } from "qenv";
export interface IConfig { export interface IConfig {
baseImage: string; baseImage: string;
command: string; command: string;
@ -8,4 +6,4 @@ export interface IConfig {
exitCode?: number; exitCode?: number;
keyValueObjectArray: IKeyValueObject[]; keyValueObjectArray: IKeyValueObject[];
} }
export declare let run: () => plugins.q.Promise<{}>; export declare let run: () => Promise<{}>;

View File

@ -5,8 +5,8 @@ const paths = require("./npmdocker.paths");
let getQenvKeyValueObject = () => { let getQenvKeyValueObject = () => {
let done = plugins.q.defer(); let done = plugins.q.defer();
let qenvKeyValueObjectArray; let qenvKeyValueObjectArray;
if (plugins.smartfile.fs.fileExistsSync(plugins.path.join(paths.cwd, "qenv.yml"))) { if (plugins.smartfile.fs.fileExistsSync(plugins.path.join(paths.cwd, 'qenv.yml'))) {
qenvKeyValueObjectArray = new plugins.qenv.Qenv(paths.cwd, ".nogit/").keyValueObjectArray; qenvKeyValueObjectArray = new plugins.qenv.Qenv(paths.cwd, '.nogit/').keyValueObjectArray;
} }
else { else {
qenvKeyValueObjectArray = []; qenvKeyValueObjectArray = [];
@ -17,14 +17,12 @@ let getQenvKeyValueObject = () => {
}; };
let buildConfig = (qenvKeyValueObjectArrayArg) => { let buildConfig = (qenvKeyValueObjectArrayArg) => {
let done = plugins.q.defer(); let done = plugins.q.defer();
let config = plugins.npmextra.dataFor({ let npmextra = new plugins.npmextra.Npmextra(paths.cwd);
toolName: "npmdocker", let config = npmextra.dataFor('npmdocker', {
defaultSettings: { baseImage: 'hosttoday/ht-docker-node:npmts',
baseImage: "hosttoday/ht-docker-node:npmts", command: 'npm test',
command: "npm run npmdocker", dockerSock: false,
dockerSock: false, keyValueObjectArray: qenvKeyValueObjectArrayArg
keyValueObjectArray: qenvKeyValueObjectArrayArg
}
}); });
done.resolve(config); done.resolve(config);
return done.promise; return done.promise;
@ -36,4 +34,4 @@ exports.run = () => {
.then(done.resolve); .then(done.resolve);
return done.promise; return done.promise;
}; };
//# source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QUFDLE1BQU0sQ0FBQyxDQUFBO0lBQ3BCLE1BQU0sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFBO0FBQ3JCLENBQUMsQ0FBQTtBQUVVLFFBQUEsR0FBRyxHQUFHO0lBQ2YsSUFBSSxJQUFJLEdBQUcsT0FBTyxDQUFDLENBQUMsQ0FBQyxLQUFLLEVBQUUsQ0FBQTtJQUM1QixxQkFBcUIsRUFBRTtTQUNwQixJQUFJLENBQUMsV0FBVyxDQUFDO1NBQ2pCLElBQUksQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLENBQUE7SUFDckIsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7QUFDckIsQ0FBQyxDQUFBIn0=

View File

@ -1,3 +1 @@
/// <reference types="q" /> export declare let run: (configArg: any) => Promise<{}>;
import * as plugins from "./npmdocker.plugins";
export declare let run: (configArg: any) => plugins.q.Promise<{}>;

File diff suppressed because one or more lines are too long

View File

@ -9,4 +9,4 @@ exports.buildContextDir = plugins.path.join(exports.assets, "buildContextDir");
plugins.smartfile.fs.ensureDirSync(exports.buildContextDir); plugins.smartfile.fs.ensureDirSync(exports.buildContextDir);
// files // files
exports.dockerfile = plugins.path.join(exports.assets, "Dockerfile"); exports.dockerfile = plugins.path.join(exports.assets, "Dockerfile");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnBhdGhzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZG9ja2VyLnBhdGhzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLE9BQU8sV0FBTSxxQkFBcUIsQ0FBQyxDQUFBO0FBRS9DLGNBQWM7QUFDSCxXQUFHLEdBQUcsT0FBTyxDQUFDLEdBQUcsRUFBRSxDQUFDO0FBQ3BCLG1CQUFXLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJL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LENBQUMsY0FBTSxDQUFDLENBQUM7QUFFaEMsUUFBQSxlQUFlLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsY0FBTSxFQUFDLGlCQUFpQixDQUFDLENBQUM7QUFDekUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsYUFBYSxDQUFDLHVCQUFlLENBQUMsQ0FBQztBQUVwRCxRQUFRO0FBQ0csUUFBQSxVQUFVLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsY0FBTSxFQUFFLFlBQVksQ0FBQyxDQUFDIn0=

View File

@ -3,7 +3,7 @@ export import beautylog = require("beautylog");
export import npmextra = require("npmextra"); export import npmextra = require("npmextra");
export import path = require("path"); export import path = require("path");
export import projectinfo = require("projectinfo"); export import projectinfo = require("projectinfo");
export import q = require("q"); export import q = require("smartq");
export import qenv = require("qenv"); export import qenv = require("qenv");
export import shelljs = require("shelljs"); export import shelljs = require("shelljs");
export import smartfile = require("smartfile"); export import smartfile = require("smartfile");

View File

@ -4,9 +4,9 @@ exports.beautylog = require("beautylog");
exports.npmextra = require("npmextra"); exports.npmextra = require("npmextra");
exports.path = require("path"); exports.path = require("path");
exports.projectinfo = require("projectinfo"); exports.projectinfo = require("projectinfo");
exports.q = require("q"); exports.q = require("smartq");
exports.qenv = require("qenv"); exports.qenv = require("qenv");
exports.shelljs = require("shelljs"); exports.shelljs = require("shelljs");
exports.smartfile = require("smartfile"); exports.smartfile = require("smartfile");
exports.smartstring = require("smartstring"); exports.smartstring = require("smartstring");
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1kb2NrZXIucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsUUFBTyxnQkFBZ0IsQ0FBQyxDQUFBO0FBQ1YsaUJBQVMsV0FBVyxXQUFXLENBQUMsQ0FBQztBQUNqQyxnQkFBUSxXQUFXLFVBQVUsQ0FBQyxDQUFDO0FBQy9CLFlBQUksV0FBVyxNQUFNLENBQUMsQ0FBQztBQUN2QixtQkFBVyxXQUFXLGFBQWEsQ0FBQyxDQUFDO0FBQ3JDLFNBQUMsV0FBVyxHQUFHLENBQUMsQ0FBQztBQUNqQixZQUFJLFdBQVcsTUFBTSxDQUFDLENBQUM7QUFDdkIsZUFBTyxXQUFXLFNBQVMsQ0FBQyxDQUFDO0FBQzdCLGlCQUFTLFdBQVcsV0FBVyxDQUFDLENBQUM7QUFDakMsbUJBQVcsV0FBVyxhQUFhLENBQUMsQ0FBQyJ9 //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1kb2NrZXIucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsMEJBQXdCO0FBQ3hCLHlDQUErQztBQUMvQyx1Q0FBNkM7QUFDN0MsK0JBQXFDO0FBQ3JDLDZDQUFtRDtBQUNuRCw4QkFBb0M7QUFDcEMsK0JBQXFDO0FBQ3JDLHFDQUEyQztBQUMzQyx5Q0FBK0M7QUFDL0MsNkNBQW1EIn0=

View File

@ -1,5 +1 @@
/// <reference types="q" /> export declare let run: () => Promise<{}>;
import * as plugins from "./npmdocker.plugins";
import { Ora } from "beautylog";
export declare let npmdockerOra: Ora;
export declare let run: () => plugins.q.Promise<{}>;

View File

@ -1,11 +1,9 @@
"use strict"; "use strict";
const plugins = require("./npmdocker.plugins"); const plugins = require("./npmdocker.plugins");
const beautylog_1 = require("beautylog");
//modules //modules
const ConfigModule = require("./npmdocker.config"); const ConfigModule = require("./npmdocker.config");
const DockerModule = require("./npmdocker.docker"); const DockerModule = require("./npmdocker.docker");
exports.npmdockerOra = new beautylog_1.Ora("npmdocker", "blue"); plugins.beautylog.ora.start();
exports.npmdockerOra.start();
exports.run = () => { exports.run = () => {
let done = plugins.q.defer(); let done = plugins.q.defer();
ConfigModule.run() ConfigModule.run()
@ -15,4 +13,4 @@ exports.run = () => {
}); });
return done.promise; return done.promise;
}; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnByb21pc2VjaGFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5wcm9taXNlY2hhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLHFCQUFxQixDQUFDLENBQUE7QUFFL0MsNEJBQWtCLFdBQVcsQ0FBQyxDQUFBO0FBQzlCLFNBQVM7QUFDVCxNQUFZLFlBQVksV0FBTSxvQkFBb0IsQ0FBQyxDQUFBO0FBQ25ELE1BQVksWUFBWSxXQUFNLG9CQUFvQixDQUFDLENBQUE7QUFFeEMsb0JBQVksR0FBRyxJQUFJLGVBQUcsQ0FBQyxXQUFXLEVBQUMsTUFBTSxDQUFDLENBQUM7QUFDdEQsb0JBQVksQ0FBQyxLQUFLLEVBQUUsQ0FBQztBQUNWLFdBQUcsR0FBRztJQUNiLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsWUFBWSxDQUFDLEdBQUcsRUFBRTtTQUNiLElBQUksQ0FBQyxZQUFZLENBQUMsR0FBRyxDQUFDO1NBQ3RCLElBQUksQ0FBQyxDQUFDLFNBQVM7UUFDWixJQUFJLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQzVCLENBQUMsQ0FBQyxDQUFBO0lBQ04sTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFBIn0= //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnByb21pc2VjaGFpbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5wcm9taXNlY2hhaW4udHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLCtDQUErQztBQUcvQyxTQUFTO0FBQ1QsbURBQW1EO0FBQ25ELG1EQUFtRDtBQUVuRCxPQUFPLENBQUMsU0FBUyxDQUFDLEdBQUcsQ0FBQyxLQUFLLEVBQUUsQ0FBQztBQUNuQixRQUFBLEdBQUcsR0FBRztJQUNiLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxDQUFDLENBQUMsS0FBSyxFQUFFLENBQUM7SUFDN0IsWUFBWSxDQUFDLEdBQUcsRUFBRTtTQUNiLElBQUksQ0FBQyxZQUFZLENBQUMsR0FBRyxDQUFDO1NBQ3RCLElBQUksQ0FBQyxDQUFDLFNBQVM7UUFDWixJQUFJLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBQzVCLENBQUMsQ0FBQyxDQUFBO0lBQ04sTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUM7QUFDeEIsQ0FBQyxDQUFBIn0=

View File

@ -18,4 +18,4 @@ exports.dockerfileSnippet = (optionsArg) => {
CMD [${commandString}]; CMD [${commandString}];
`); `);
}; };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnNuaXBwZXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZG9ja2VyLnNuaXBwZXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQSxNQUFZLE9BQU8sV0FBTSxxQkFBcUIsQ0FBQyxDQUFBO0FBT3BDLHlCQUFpQixHQUFHLENBQUMsVUFBNkI7S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UFBSSxZQUFZLENBQUMsQ0FBQSxDQUFDO1FBQ2hDLEVBQUUsQ0FBQSxDQUFDLENBQUMsQ0FBQyxhQUFhLElBQUksRUFBRSxDQUFDLENBQUMsQ0FBQSxDQUFDO1lBQ3ZCLGFBQWEsR0FBRyxhQUFhLEdBQUcsR0FBRyxDQUFDO1FBQ3hDLENBQUM7UUFDRCxhQUFhLEdBQUcsYUFBYSxHQUFHLEdBQUcsR0FBRyxVQUFVLEdBQUcsR0FBRyxDQUFDO0lBQzNELENBQUM7SUFBQSxDQUFDO0lBQ0YsTUFBTSxDQUFDLE9BQU8sQ0FBQyxXQUFXLENBQUMsTUFBTSxDQUFDLFNBQVMsQ0FBQztlQUNqQyxVQUFVLENBQUMsU0FBUzs7OztlQUlwQixhQUFhO0tBQ3ZCLENBQUMsQ0FBQztBQUNQLENBQUMsQ0FBQSJ9

View File

@ -12,6 +12,7 @@
}, },
"scripts": { "scripts": {
"test": "(npm run clean && npm run compile && npm run setupCheck && npm run check)", "test": "(npm run clean && npm run compile && npm run setupCheck && npm run check)",
"testDev": "(npm run compile && npm run check)",
"clean": "(rm -rf test/)", "clean": "(rm -rf test/)",
"compile": "(npmts --notest)", "compile": "(npmts --notest)",
"setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)", "setupCheck": "(git clone https://gitlab.com/sandboxzone/sandbox-npmts.git test/)",
@ -19,7 +20,7 @@
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+ssh://git@gitlab.com/pushrocks/npmdocker.git" "url": "git+ssh://git@gitlab.com/gitzone/npmdocker.git"
}, },
"keywords": [ "keywords": [
"docker" "docker"
@ -27,23 +28,22 @@
"author": "Lossless GmbH", "author": "Lossless GmbH",
"license": "MIT", "license": "MIT",
"bugs": { "bugs": {
"url": "https://gitlab.com/pushrocks/npmdocker/issues" "url": "https://gitlab.com/gitzone/npmdocker/issues"
}, },
"homepage": "https://gitlab.com/pushrocks/npmdocker#README", "homepage": "https://gitlab.com/gitzone/npmdocker#README",
"devDependencies": { "devDependencies": {
"npmts-g": "^5.2.8" "npmts-g": "^6.0.0"
}, },
"dependencies": { "dependencies": {
"@types/q": "0.x.x",
"@types/shelljs": "0.x.x", "@types/shelljs": "0.x.x",
"beautylog": "^5.0.20", "beautylog": "^6.1.1",
"npmextra": "^1.0.8", "npmextra": "^2.0.3",
"projectinfo": "^1.0.3", "projectinfo": "^3.0.1",
"q": "^1.4.1", "qenv": "^1.1.3",
"qenv": "^1.1.1", "shelljs": "^0.7.6",
"shelljs": "^0.7.3", "smartfile": "^4.1.5",
"smartfile": "^4.0.13", "smartq": "^1.1.0",
"smartstring": "^2.0.17", "smartstring": "^2.0.22",
"typings-global": "^1.0.6" "typings-global": "^1.0.14"
} }
} }

View File

@ -1,48 +1,49 @@
import * as plugins from "./npmdocker.plugins"; import * as plugins from './npmdocker.plugins'
import * as paths from "./npmdocker.paths"; import * as paths from "./npmdocker.paths"
// interfaces // interfaces
import { IKeyValueObject } from "qenv"; import { IKeyValueObject } from 'qenv'
export interface IConfig { export interface IConfig {
baseImage: string; baseImage: string
command: string; command: string
dockerSock: boolean; dockerSock: boolean
exitCode?: number; exitCode?: number
keyValueObjectArray: IKeyValueObject[]; keyValueObjectArray: IKeyValueObject[]
}; };
let getQenvKeyValueObject = () => { let getQenvKeyValueObject = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
let qenvKeyValueObjectArray:IKeyValueObject[]; let qenvKeyValueObjectArray: IKeyValueObject[]
if(plugins.smartfile.fs.fileExistsSync(plugins.path.join(paths.cwd,"qenv.yml"))){ if (plugins.smartfile.fs.fileExistsSync(plugins.path.join(paths.cwd, 'qenv.yml'))) {
qenvKeyValueObjectArray = new plugins.qenv.Qenv(paths.cwd, ".nogit/").keyValueObjectArray; qenvKeyValueObjectArray = new plugins.qenv.Qenv(paths.cwd, '.nogit/').keyValueObjectArray
} else { } else {
qenvKeyValueObjectArray = []; qenvKeyValueObjectArray = []
}; };
done.resolve(qenvKeyValueObjectArray); done.resolve(qenvKeyValueObjectArray)
return done.promise; return done.promise
}; }
let buildConfig = (qenvKeyValueObjectArrayArg:IKeyValueObject) => { let buildConfig = (qenvKeyValueObjectArrayArg: IKeyValueObject) => {
let done = plugins.q.defer(); let done = plugins.q.defer()
let config: IConfig = plugins.npmextra.dataFor({ let npmextra = new plugins.npmextra.Npmextra(paths.cwd)
toolName: "npmdocker", let config = npmextra.dataFor<IConfig>(
defaultSettings: { 'npmdocker',
baseImage: "hosttoday/ht-docker-node:npmts", {
command: "npm run npmdocker", baseImage: 'hosttoday/ht-docker-node:npmts',
dockerSock: false, command: 'npm test',
keyValueObjectArray: qenvKeyValueObjectArrayArg dockerSock: false,
} keyValueObjectArray: qenvKeyValueObjectArrayArg
}); }
done.resolve(config); )
return done.promise done.resolve(config)
}; return done.promise
}
export let run = () => { export let run = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
getQenvKeyValueObject() getQenvKeyValueObject()
.then(buildConfig) .then(buildConfig)
.then(done.resolve); .then(done.resolve)
return done.promise; return done.promise
} }

View File

@ -1,181 +1,208 @@
import * as plugins from "./npmdocker.plugins"; import * as plugins from './npmdocker.plugins';
import * as paths from "./npmdocker.paths"; import * as paths from './npmdocker.paths';
import * as snippets from "./npmdocker.snippets"; import * as snippets from './npmdocker.snippets'
import { npmdockerOra } from "./npmdocker.promisechain";
// interfaces // interfaces
import { IConfig } from "./npmdocker.config"; import { IConfig } from './npmdocker.config'
let config: IConfig; let config: IConfig
/**
* the docker data used to build the internal testing container
*/
let dockerData = { let dockerData = {
imageTag: "npmdocker-temp-image:latest", imageTag: 'npmdocker-temp-image:latest',
containerName: "npmdocker-temp-container", containerName: 'npmdocker-temp-container',
dockerProjectMountString: "", dockerProjectMountString: '',
dockerSockString: "", dockerSockString: '',
dockerEnvString: "" dockerEnvString: ''
}; }
/** /**
* check if docker is available * check if docker is available
*/ */
let checkDocker = () => { let checkDocker = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
npmdockerOra.text("checking docker..."); plugins.beautylog.ora.text('checking docker...')
if (plugins.shelljs.which("docker")) { if (plugins.shelljs.which('docker')) {
plugins.beautylog.ok("Docker found!") plugins.beautylog.ok('Docker found!')
done.resolve(); done.resolve()
} else { } else {
done.reject(new Error("docker not found on this machine")); done.reject(new Error('docker not found on this machine'))
} }
return done.promise; return done.promise
}; }
/** /**
* builds the Dockerfile according to the config in the project * builds the Dockerfile according to the config in the project
*/ */
let buildDockerFile = () => { let buildDockerFile = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
npmdockerOra.text("building Dockerfile..."); plugins.beautylog.ora.text('building Dockerfile...')
let dockerfile: string = snippets.dockerfileSnippet({ let dockerfile: string = snippets.dockerfileSnippet({
baseImage: config.baseImage, baseImage: config.baseImage,
command: config.command command: config.command
}); })
plugins.beautylog.info(`Base image is: ${config.baseImage}`); plugins.beautylog.info(`Base image is: ${config.baseImage}`)
plugins.beautylog.info(`Command is: ${config.command}`); plugins.beautylog.info(`Command is: ${config.command}`)
plugins.smartfile.memory.toFsSync(dockerfile, paths.dockerfile); plugins.smartfile.memory.toFsSync(dockerfile, paths.dockerfile)
plugins.beautylog.ok("Dockerfile created!"); plugins.beautylog.ok('Dockerfile created!')
done.resolve(); done.resolve()
return done.promise return done.promise
}; }
/** /**
* builds the Dockerimage from the built Dockerfile * builds the Dockerimage from the built Dockerfile
*/ */
let buildDockerImage = () => { let buildDockerImage = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
npmdockerOra.text("pulling latest base image from registry..."); plugins.beautylog.ora.text('pulling latest base image from registry...')
plugins.shelljs.exec(`docker pull ${config.baseImage}`, { plugins.shelljs.exec(
silent: true `docker pull ${config.baseImage}`,
}, () => { {
npmdockerOra.text("building Dockerimage..."); silent: true
// are we creating a build context form project ? },
if (process.env.CI == "true") { () => {
npmdockerOra.text("creating build context..."); plugins.beautylog.ora.text('building Dockerimage...')
plugins.smartfile.fs.copySync(paths.cwd, paths.buildContextDir); // are we creating a build context form project ?
if (process.env.CI === 'true') {
plugins.beautylog.ora.text('creating build context...')
plugins.smartfile.fs.copySync(paths.cwd, paths.buildContextDir)
}
plugins.shelljs.exec(
`docker build -f ${paths.dockerfile} -t ${dockerData.imageTag} ${paths.assets}`,
{
silent: true
},
() => {
plugins.beautylog.ok('Dockerimage built!')
done.resolve()
} }
plugins.shelljs.exec(`docker build -f ${paths.dockerfile} -t ${dockerData.imageTag} ${paths.assets}`, { )
silent: true }
}, () => { ) // first pull latest version of baseImage
plugins.beautylog.ok("Dockerimage built!") return done.promise
done.resolve(); }
});
}); // first pull latest version of baseImage
return done.promise
};
let buildDockerProjectMountString = () => { let buildDockerProjectMountString = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
if (process.env.CI != "true") { if (process.env.CI !== 'true') {
dockerData.dockerProjectMountString = `-v ${paths.cwd}:/workspace`; dockerData.dockerProjectMountString = `-v ${paths.cwd}:/workspace`
}; };
done.resolve(); done.resolve()
return done.promise; return done.promise
} }
/**
* builds an environment string that docker cli understands
*/
let buildDockerEnvString = () => { let buildDockerEnvString = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
for (let keyValueObjectArg of config.keyValueObjectArray) { for (let keyValueObjectArg of config.keyValueObjectArray) {
let envString = dockerData.dockerEnvString = dockerData.dockerEnvString + `-e ${keyValueObjectArg.key}=${keyValueObjectArg.value} ` let envString = dockerData.dockerEnvString = dockerData.dockerEnvString + `-e ${keyValueObjectArg.key}=${keyValueObjectArg.value} `
}; };
done.resolve(); done.resolve()
return done.promise; return done.promise
} }
/**
* creates string to mount the docker.sock inside the testcontainer
*/
let buildDockerSockString = () => { let buildDockerSockString = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
if (config.dockerSock) { if (config.dockerSock) {
dockerData.dockerSockString = `-v /var/run/docker.sock:/var/run/docker.sock` dockerData.dockerSockString = `-v /var/run/docker.sock:/var/run/docker.sock`
}; };
done.resolve() done.resolve()
return done; return done
}; }
/** /**
* creates a container by running the built Dockerimage * creates a container by running the built Dockerimage
*/ */
let runDockerImage = () => { let runDockerImage = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
npmdockerOra.text("starting Container..."); plugins.beautylog.ora.text('starting Container...')
npmdockerOra.end(); plugins.beautylog.ora.end()
plugins.beautylog.log("now running Dockerimage"); plugins.beautylog.log('now running Dockerimage')
config.exitCode = plugins.shelljs.exec(`docker run ${dockerData.dockerProjectMountString} ${dockerData.dockerSockString} ${dockerData.dockerEnvString} --name ${dockerData.containerName} ${dockerData.imageTag}`).code; config.exitCode = plugins.shelljs.exec(`docker run ${dockerData.dockerProjectMountString} ${dockerData.dockerSockString} ${dockerData.dockerEnvString} --name ${dockerData.containerName} ${dockerData.imageTag}`).code
done.resolve(); done.resolve()
return done.promise; return done.promise
}; }
/**
* cleans up: deletes the test container
*/
let deleteDockerContainer = () => { let deleteDockerContainer = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
plugins.shelljs.exec(`docker rm -f ${dockerData.containerName}`, { plugins.shelljs.exec(`docker rm -f ${dockerData.containerName}`, {
silent: true silent: true
}); })
done.resolve(); done.resolve()
return done.promise return done.promise
}; }
/**
* cleans up deletes the test image
*/
let deleteDockerImage = () => { let deleteDockerImage = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
plugins.shelljs.exec(`docker rmi ${dockerData.imageTag}`, { plugins.shelljs.exec(`docker rmi ${dockerData.imageTag}`, {
silent: true silent: true
}); })
done.resolve(); done.resolve()
return done.promise return done.promise
}; }
/**
* cleans up, deletes the build context
*/
let deleteBuildContext = () => { let deleteBuildContext = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
plugins.smartfile.fs.remove(paths.buildContextDir) plugins.smartfile.fs.remove(paths.buildContextDir)
.then(done.resolve); .then(() => {
return done.promise; done.resolve()
}; })
return done.promise
}
let preClean = () => { let preClean = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
deleteDockerImage() deleteDockerImage()
.then(deleteDockerContainer) .then(deleteDockerContainer)
.then(() => { .then(() => {
plugins.beautylog.ok("ensured clean Docker environment!"); plugins.beautylog.ok('ensured clean Docker environment!')
done.resolve(); done.resolve()
}); })
}; }
let postClean = () => { let postClean = () => {
let done = plugins.q.defer(); let done = plugins.q.defer()
deleteDockerContainer() deleteDockerContainer()
.then(deleteDockerImage) .then(deleteDockerImage)
.then(deleteBuildContext) .then(deleteBuildContext)
.then(() => { .then(() => {
plugins.beautylog.ok("cleaned up!"); plugins.beautylog.ok('cleaned up!')
done.resolve(); done.resolve()
}); })
} }
export let run = (configArg) => { export let run = (configArg) => {
let done = plugins.q.defer(); let done = plugins.q.defer()
config = configArg; config = configArg
checkDocker() checkDocker()
.then(preClean) .then(preClean)
.then(buildDockerFile) .then(buildDockerFile)
.then(buildDockerImage) .then(buildDockerImage)
.then(buildDockerProjectMountString) .then(buildDockerProjectMountString)
.then(buildDockerEnvString) .then(buildDockerEnvString)
.then(buildDockerSockString) .then(buildDockerSockString)
.then(runDockerImage) .then(runDockerImage)
.then(postClean) .then(postClean)
.then(() => { .then(() => {
done.resolve(config); done.resolve(config);
}).catch(err => {console.log(err)}); }).catch(err => { console.log(err) })
return done.promise; return done.promise
} }

View File

@ -3,7 +3,7 @@ export import beautylog = require("beautylog");
export import npmextra = require("npmextra"); export import npmextra = require("npmextra");
export import path = require("path"); export import path = require("path");
export import projectinfo = require("projectinfo"); export import projectinfo = require("projectinfo");
export import q = require("q"); export import q = require("smartq");
export import qenv = require("qenv"); export import qenv = require("qenv");
export import shelljs = require("shelljs"); export import shelljs = require("shelljs");
export import smartfile = require("smartfile"); export import smartfile = require("smartfile");

View File

@ -1,12 +1,11 @@
import * as plugins from "./npmdocker.plugins"; import * as plugins from "./npmdocker.plugins";
import * as paths from "./npmdocker.paths"; import * as paths from "./npmdocker.paths";
import {Ora} from "beautylog";
//modules //modules
import * as ConfigModule from "./npmdocker.config"; import * as ConfigModule from "./npmdocker.config";
import * as DockerModule from "./npmdocker.docker"; import * as DockerModule from "./npmdocker.docker";
export let npmdockerOra = new Ora("npmdocker","blue"); plugins.beautylog.ora.start();
npmdockerOra.start();
export let run = () => { export let run = () => {
let done = plugins.q.defer(); let done = plugins.q.defer();
ConfigModule.run() ConfigModule.run()

3
tslint.json Normal file
View File

@ -0,0 +1,3 @@
{
"extends": "tslint-config-standard"
}

1216
yarn.lock Normal file

File diff suppressed because it is too large Load Diff