fix(package): include npmdocker with npm @gitzone scope

This commit is contained in:
Philipp Kunz 2018-05-18 13:09:14 +02:00
parent 4f23b61e14
commit 551b8d0cde
20 changed files with 219 additions and 212 deletions

View File

@ -1,13 +1,16 @@
# npmdocker
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)
@ -19,21 +22,25 @@ develop npm modules cross platform with docker
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
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
* 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
@ -46,15 +53,15 @@ create a npmextra.json in the project's root directory
}
```
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
| 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)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://gitzone.gitlab.io/assets/repo-footer.svg)](https://git.zone)

1
dist/index.d.ts vendored
View File

@ -0,0 +1 @@
export {};

2
dist/index.js vendored
View File

@ -2,4 +2,4 @@
Object.defineProperty(exports, "__esModule", { value: true });
const cli = require("./npmdocker.cli");
cli.run();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLHVDQUFzQztBQUV0QyxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUEifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUNBLHVDQUF1QztBQUV2QyxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUMifQ==

View File

@ -20,7 +20,6 @@ const DockerModule = require("./npmdocker.docker");
* Since yarn is out and there is heavy caching going on,
* pure download stats are just not reliable enough for us anymore
* Feel free to dig into the smartanalytics package, if you are interested in how it works.
* It is just an https call to Google Analytics.
* Our privacy policy can be found here: https://lossless.gmbh/privacy.html
*/
let npmdockerAnalytics = new plugins.smartanalytics.Analytics({
@ -35,8 +34,7 @@ let npmdockerCli = new plugins.smartcli.Smartcli();
exports.run = () => {
npmdockerCli.standardTask().then((argvArg) => __awaiter(this, void 0, void 0, function* () {
plugins.beautylog.figletSync('npmdocker');
let configArg = yield ConfigModule.run()
.then(DockerModule.run);
let configArg = yield ConfigModule.run().then(DockerModule.run);
if (configArg.exitCode === 0) {
plugins.beautylog.success('container ended all right!');
}
@ -82,4 +80,4 @@ exports.run = () => {
}));
npmdockerCli.startParse();
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmNsaS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5jbGkudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLCtDQUE4QztBQUc5QyxVQUFVO0FBQ1YsbURBQWtEO0FBQ2xELG1EQUFrRDtBQUdsRDs7Ozs7Ozs7OztHQVVHO0FBQ0gsSUFBSSxrQkFBa0IsR0FBRyxJQUFJLE9BQU8sQ0FBQyxjQUFjLENBQUMsU0FBUyxDQUFDO0lBQzVELFdBQVcsRUFBRSw2QkFBNkI7SUFDMUMsT0FBTyxFQUFFLFdBQVc7SUFDcEIsU0FBUyxFQUFFLFNBQVM7Q0FDckIsQ0FBQyxDQUFBO0FBQ0Ysa0JBQWtCLENBQUMsV0FBVyxDQUFDLGtCQUFrQixFQUFFO0lBQ2pELFFBQVEsRUFBRSxVQUFVO0NBQ3JCLENBQUMsQ0FBQTtBQUVGLElBQUksWUFBWSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLEVBQUUsQ0FBQTtBQUV2QyxRQUFBLEdBQUcsR0FBRyxHQUFHLEVBQUU7SUFDcEIsWUFBWSxDQUFDLFlBQVksRUFBRSxDQUFDLElBQUksQ0FBQyxDQUFPLE9BQU8sRUFBRSxFQUFFO1FBQ2pELE9BQU8sQ0FBQyxTQUFTLENBQUMsVUFBVSxDQUFDLFdBQVcsQ0FBQyxDQUFBO1FBQ3pDLElBQUksU0FBUyxHQUFHLE1BQU0sWUFBWSxDQUFDLEdBQUcsRUFBRTthQUNyQyxJ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0FBQyxVQUFVLEVBQUUsQ0FBQztBQUM1QixDQUFDLENBQUMifQ==

View File

@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./npmdocker.plugins");
const paths = require("./npmdocker.paths");
;
let getQenvKeyValueObject = () => __awaiter(this, void 0, void 0, function* () {
let qenvKeyValueObjectArray;
if (plugins.smartfile.fs.fileExistsSync(plugins.path.join(paths.cwd, 'qenv.yml'))) {
@ -36,4 +35,4 @@ exports.run = () => __awaiter(this, void 0, void 0, function* () {
let config = yield getQenvKeyValueObject().then(buildConfig);
return config;
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLmNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWRvY2tlci5jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7OztBQUFBLCtDQUE4QztBQUM5QywyQ0FBMEM7QUFXekMsQ0FBQztBQUVGLElBQUkscUJBQXFCLEdBQUcsR0FBUyxFQUFFO0lBQ3JDLElBQUksdUJBQTBDLENBQUE7SUFDOUMsRUFBRSxDQUFDLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsY0FBYyxDQUFDLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxHQUFHLEVBQUUsVUFBVSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDbEYsdUJBQXVCLEdBQUcsSUFBSSxPQUFPLENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsR0FBRyxFQUFFLFNBQVMsQ0FBQyxDQUFDLG1CQUFtQixDQUFBO0lBQzNGLENBQUM7SUFBQyxJQUFJLENBQUMsQ0FBQztRQUNOLHVCQUF1QixHQUFHL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LE1BQU0sQ0FBQztBQUNoQixDQUFDLENBQUEsQ0FBQyJ9

File diff suppressed because one or more lines are too long

View File

@ -7,4 +7,4 @@ exports.packageBase = plugins.path.join(__dirname, '../');
exports.assets = plugins.path.join(exports.packageBase, 'assets/');
plugins.smartfile.fs.ensureDirSync(exports.assets);
exports.npmdockerFile = plugins.path.join(exports.cwd, 'npmdocker');
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnBhdGhzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZG9ja2VyLnBhdGhzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQThDO0FBRTlDLGNBQWM7QUFDSCxRQUFBLEdBQUcsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUE7QUFDbkIsUUFBQSxXQUFXLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFBO0FBQ2pELFFBQUEsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLG1CQUFXLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDN0QsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsYUFBYSxDQUFDLGNBQU0sQ0FBQyxDQUFBO0FBQy9CLFFBQUEsYUFBYSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFdBQUcsRUFBRSxXQUFXLENBQUMsQ0FBQSJ9
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnBhdGhzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZG9ja2VyLnBhdGhzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQStDO0FBRS9DLGNBQWM7QUFDSCxRQUFBLEdBQUcsR0FBRyxPQUFPLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDcEIsUUFBQSxXQUFXLEdBQUcsT0FBTyxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsU0FBUyxFQUFFLEtBQUssQ0FBQyxDQUFDO0FBQ2xELFFBQUEsTUFBTSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLG1CQUFXLEVBQUUsU0FBUyxDQUFDLENBQUM7QUFDOUQsT0FBTyxDQUFDLFNBQVMsQ0FBQyxFQUFFLENBQUMsYUFBYSxDQUFDLGNBQU0sQ0FBQyxDQUFDO0FBQ2hDLFFBQUEsYUFBYSxHQUFHLE9BQU8sQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLFdBQUcsRUFBRSxXQUFXLENBQUMsQ0FBQyJ9

View File

@ -1,4 +1,3 @@
import 'typings-global';
import * as beautylog from 'beautylog';
import * as npmextra from 'npmextra';
import * as path from 'path';

View File

@ -1,6 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const beautylog = require("beautylog");
exports.beautylog = beautylog;
const npmextra = require("npmextra");
@ -23,4 +22,4 @@ const smartshell = require("smartshell");
exports.smartshell = smartshell;
const smartstring = require("smartstring");
exports.smartstring = smartstring;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1kb2NrZXIucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2Qix1Q0FBc0M7QUFhcEMsOEJBQVM7QUFaWCxxQ0FBb0M7QUFhbEMsNEJBQVE7QUFaViw2QkFBNEI7QUFhMUIsb0JBQUk7QUFaTiwyQ0FBMEM7QUFheEMsa0NBQVc7QUFaYiw0QkFBMkI7QUFhekIsY0FBQztBQVpILDZCQUE0QjtBQWExQixvQkFBSTtBQVpOLGlEQUFnRDtBQWE5Qyx3Q0FBYztBQVpoQixxQ0FBb0M7QUFhbEMsNEJBQVE7QUFaVix1Q0FBc0M7QUFhcEMsOEJBQVM7QUFaWCx5Q0FBd0M7QUFhdEMsZ0NBQVU7QUFaWiwyQ0FBMEM7QUFheEMsa0NBQVcifQ==
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9ucG1kb2NrZXIucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLHVDQUF1QztBQWFyQyw4QkFBUztBQVpYLHFDQUFxQztBQWFuQyw0QkFBUTtBQVpWLDZCQUE2QjtBQWEzQixvQkFBSTtBQVpOLDJDQUEyQztBQWF6QyxrQ0FBVztBQVpiLDRCQUE0QjtBQWExQixjQUFDO0FBWkgsNkJBQTZCO0FBYTNCLG9CQUFJO0FBWk4saURBQWlEO0FBYS9DLHdDQUFjO0FBWmhCLHFDQUFxQztBQWFuQyw0QkFBUTtBQVpWLHVDQUF1QztBQWFyQyw4QkFBUztBQVpYLHlDQUF5QztBQWF2QyxnQ0FBVTtBQVpaLDJDQUEyQztBQWF6QyxrQ0FBVyJ9

View File

@ -29,4 +29,4 @@ ENTRYPOINT ["npmdocker"]
CMD ["runinside"]
`);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtZG9ja2VyLnNuaXBwZXRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtZG9ja2VyLnNuaXBwZXRzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBQUEsK0NBQStDO0FBTy9DLElBQUksc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QUEsK0NBQStDO0FBTy9DLElBQUksc0JBQXNCLEdBQUcsQ0FBQyxVQUE4QixFQUFFLEVBQUU7SUFDOUQsSUFBSSxPQUFPLENBQUMsR0FBRyxDQUFDLEVBQUUsRUFBRTtRQUNsQixPQUFPLG9CQUFvQixDQUFDO0tBQzdCO1NBQU07UUFDTCxPQUFPLHlDQUF5QyxDQUFDO0tBQ2xEO0FBQ0gsQ0FBQyxDQUFDO0FBRUYsSUFBSSwwQkFBMEIsR0FBRyxDQUFDLFVBQThCLEVBQUUsRUFBRTtJQUNsRSxJQUFJLFVBQVUsQ0FBQyxTQUFTLEtBQUssb0NBQW9DLEVBQUU7UUFDakUsT0FBTywrQkFBK0IsQ0FBQztLQUN4QztTQUFNO1FBQ0wsT0FBTyxtRUFBbUUsQ0FBQztLQUM1RTtBQUNILENBQUMsQ0FBQztBQUVTLFFBQUEsaUJBQWlCLEdBQUcsQ0FBQyxVQUE4QixFQUFVLEVBQUU7SUFDeEUsT0FBTyxPQUFPLENBQUMsV0FBVyxDQUFDLE1BQU0sQ0FBQyxTQUFTLENBQ3pDO09BQ0csVUFBVSxDQUFDLFNBQVM7O0VBRXpCLDBCQUEwQixDQUFDLFVBQVUsQ0FBQztFQUN0QyxzQkFBc0IsQ0FBQyxVQUFVLENBQUM7Ozs7O0NBS25DLENBQ0UsQ0FBQztBQUNKLENBQUMsQ0FBQyJ9

View File

@ -1 +1 @@
Docs for npmpage coming soon.
Docs for npmpage coming soon.

View File

@ -1,11 +1,13 @@
{
"npmts":{
"mode":"default",
"cli":true
},
"npmci": {
"npmGlobalTools": [
"npmts"
]
}
"npmts": {
"mode": "default",
"cli": true
},
"npmci": {
"npmGlobalTools": [
"@gitzone/npmts",
"ts-node"
],
"npmAccessLevel": "public"
}
}

View File

@ -1,5 +1,5 @@
{
"name": "npmdocker",
"name": "@gitzone/npmdocker",
"version": "1.2.18",
"description": "develop npm modules cross platform with docker",
"main": "dist/index.js",

View File

@ -1,4 +1,4 @@
import * as plugins from './npmdocker.plugins'
import * as cli from './npmdocker.cli'
import * as plugins from './npmdocker.plugins';
import * as cli from './npmdocker.cli';
cli.run()
cli.run();

View File

@ -1,10 +1,9 @@
import * as plugins from './npmdocker.plugins'
import * as paths from './npmdocker.paths'
import * as plugins from './npmdocker.plugins';
import * as paths from './npmdocker.paths';
// modules
import * as ConfigModule from './npmdocker.config'
import * as DockerModule from './npmdocker.docker'
import * as ConfigModule from './npmdocker.config';
import * as DockerModule from './npmdocker.docker';
/**
* smartanalytics
@ -20,67 +19,68 @@ let npmdockerAnalytics = new plugins.smartanalytics.Analytics({
apiEndPoint: 'https://pubapi.lossless.one',
appName: 'npmdocker',
projectId: 'gitzone'
})
});
npmdockerAnalytics.recordEvent('npmtoolexecution', {
somedata: 'somedata'
})
});
let npmdockerCli = new plugins.smartcli.Smartcli()
let npmdockerCli = new plugins.smartcli.Smartcli();
export let run = () => {
npmdockerCli.standardTask().then(async (argvArg) => {
plugins.beautylog.figletSync('npmdocker')
let configArg = await ConfigModule.run()
.then(DockerModule.run)
npmdockerCli.standardTask().then(async argvArg => {
plugins.beautylog.figletSync('npmdocker');
let configArg = await ConfigModule.run().then(DockerModule.run);
if (configArg.exitCode === 0) {
plugins.beautylog.success('container ended all right!')
plugins.beautylog.success('container ended all right!');
} else {
plugins.beautylog.error(`container ended with error! Exit Code is ${configArg.exitCode}`)
process.exit(1)
plugins.beautylog.error(`container ended with error! Exit Code is ${configArg.exitCode}`);
process.exit(1);
}
})
});
/**
* this command is executed inside docker and meant for use from outside docker
*/
npmdockerCli.addCommand('runinside').then(async (argvArg) => {
plugins.beautylog.ok('Allright. We are now in Docker!')
plugins.beautylog.log('now trying to run your specified command')
let configArg = await ConfigModule.run()
npmdockerCli.addCommand('runinside').then(async argvArg => {
plugins.beautylog.ok('Allright. We are now in Docker!');
plugins.beautylog.log('now trying to run your specified command');
let configArg = await ConfigModule.run();
await plugins.smartshell.exec(configArg.command).then(response => {
if (response.exitCode !== 0) {
process.exit(1)
process.exit(1);
}
})
})
});
});
npmdockerCli.addCommand('clean').then(async (argvArg) => {
plugins.beautylog.ora.start()
plugins.beautylog.ora.text('cleaning up docker env...')
npmdockerCli.addCommand('clean').then(async argvArg => {
plugins.beautylog.ora.start();
plugins.beautylog.ora.text('cleaning up docker env...');
if (argvArg.all) {
plugins.beautylog.ora.text('killing any running docker containers...')
await plugins.smartshell.exec(`docker kill $(docker ps -q)`)
plugins.beautylog.ora.text('killing any running docker containers...');
await plugins.smartshell.exec(`docker kill $(docker ps -q)`);
plugins.beautylog.ora.text('removing stopped containers...')
await plugins.smartshell.exec(`docker rm $(docker ps -a -q)`)
plugins.beautylog.ora.text('removing stopped containers...');
await plugins.smartshell.exec(`docker rm $(docker ps -a -q)`);
plugins.beautylog.ora.text('removing images...')
await plugins.smartshell.exec(`docker rmi $(docker images -q -f dangling=true)`)
plugins.beautylog.ora.text('removing images...');
await plugins.smartshell.exec(`docker rmi $(docker images -q -f dangling=true)`);
plugins.beautylog.ora.text('removing all other images...')
await plugins.smartshell.exec(`docker rmi $(docker images -a -q)`)
plugins.beautylog.ora.text('removing all other images...');
await plugins.smartshell.exec(`docker rmi $(docker images -a -q)`);
plugins.beautylog.ora.text('removing all volumes...')
await plugins.smartshell.exec(`docker volume rm $(docker volume ls -f dangling=true -q)`)
plugins.beautylog.ora.text('removing all volumes...');
await plugins.smartshell.exec(`docker volume rm $(docker volume ls -f dangling=true -q)`);
}
plugins.beautylog.ora.endOk('docker environment now is clean!')
})
plugins.beautylog.ora.endOk('docker environment now is clean!');
});
npmdockerCli.addCommand('speedtest').then(async (argvArg) => {
plugins.beautylog.figletSync('npmdocker')
plugins.beautylog.ok('Starting speedtest')
await plugins.smartshell.exec(`docker pull tianon/speedtest && docker run --rm tianon/speedtest`)
})
npmdockerCli.addCommand('speedtest').then(async argvArg => {
plugins.beautylog.figletSync('npmdocker');
plugins.beautylog.ok('Starting speedtest');
await plugins.smartshell.exec(
`docker pull tianon/speedtest && docker run --rm tianon/speedtest`
);
});
npmdockerCli.startParse()
}
npmdockerCli.startParse();
};

View File

@ -1,43 +1,40 @@
import * as plugins from './npmdocker.plugins'
import * as paths from "./npmdocker.paths"
import * as plugins from './npmdocker.plugins';
import * as paths from './npmdocker.paths';
// interfaces
import { IKeyValueObject } from 'qenv'
import { IKeyValueObject } from 'qenv';
export interface IConfig {
baseImage: string
command: string
dockerSock: boolean
exitCode?: number
keyValueObjectArray: IKeyValueObject[]
};
baseImage: string;
command: string;
dockerSock: boolean;
exitCode?: number;
keyValueObjectArray: IKeyValueObject[];
}
let getQenvKeyValueObject = async () => {
let qenvKeyValueObjectArray: IKeyValueObject[]
let qenvKeyValueObjectArray: IKeyValueObject[];
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 {
qenvKeyValueObjectArray = []
qenvKeyValueObjectArray = [];
}
return qenvKeyValueObjectArray
}
return qenvKeyValueObjectArray;
};
let buildConfig = async (qenvKeyValueObjectArrayArg: IKeyValueObject[]) => {
let npmextra = new plugins.npmextra.Npmextra(paths.cwd)
let config = npmextra.dataFor<IConfig>(
'npmdocker',
{
baseImage: 'hosttoday/ht-docker-node:npmdocker',
init: 'rm -rf node_nodules/ && yarn install',
command: 'npmci npm test',
dockerSock: false,
keyValueObjectArray: qenvKeyValueObjectArrayArg
}
)
return config
}
let npmextra = new plugins.npmextra.Npmextra(paths.cwd);
let config = npmextra.dataFor<IConfig>('npmdocker', {
baseImage: 'hosttoday/ht-docker-node:npmdocker',
init: 'rm -rf node_nodules/ && yarn install',
command: 'npmci npm test',
dockerSock: false,
keyValueObjectArray: qenvKeyValueObjectArrayArg
});
return config;
};
export let run = async (): Promise<IConfig> => {
let config = await getQenvKeyValueObject().then(buildConfig)
return config
}
let config = await getQenvKeyValueObject().then(buildConfig);
return config;
};

View File

@ -1,11 +1,11 @@
import * as plugins from './npmdocker.plugins'
import * as paths from './npmdocker.paths'
import * as snippets from './npmdocker.snippets'
import * as plugins from './npmdocker.plugins';
import * as paths from './npmdocker.paths';
import * as snippets from './npmdocker.snippets';
// 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
@ -16,134 +16,137 @@ let dockerData = {
dockerProjectMountString: '',
dockerSockString: '',
dockerEnvString: ''
}
};
/**
* check if docker is available
*/
let checkDocker = () => {
let done = plugins.q.defer()
plugins.beautylog.ora.text('checking docker...')
let done = plugins.q.defer();
plugins.beautylog.ora.text('checking docker...');
if (plugins.smartshell.which('docker')) {
plugins.beautylog.ok('Docker found!')
done.resolve()
plugins.beautylog.ok('Docker found!');
done.resolve();
} 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
*/
let buildDockerFile = () => {
let done = plugins.q.defer()
plugins.beautylog.ora.text('building Dockerfile...')
let done = plugins.q.defer();
plugins.beautylog.ora.text('building Dockerfile...');
let dockerfile: string = snippets.dockerfileSnippet({
baseImage: config.baseImage,
command: config.command
})
plugins.beautylog.info(`Base image is: ${config.baseImage}`)
plugins.beautylog.info(`Command is: ${config.command}`)
plugins.smartfile.memory.toFsSync(dockerfile, plugins.path.join(paths.cwd, 'npmdocker'))
plugins.beautylog.ok('Dockerfile created!')
plugins.beautylog.ora.stop()
done.resolve()
return done.promise
}
});
plugins.beautylog.info(`Base image is: ${config.baseImage}`);
plugins.beautylog.info(`Command is: ${config.command}`);
plugins.smartfile.memory.toFsSync(dockerfile, plugins.path.join(paths.cwd, 'npmdocker'));
plugins.beautylog.ok('Dockerfile created!');
plugins.beautylog.ora.stop();
done.resolve();
return done.promise;
};
/**
* builds the Dockerimage from the built Dockerfile
*/
let buildDockerImage = async () => {
plugins.beautylog.info('pulling latest base image from registry...')
await plugins.smartshell.exec(
`docker pull ${config.baseImage}`
)
plugins.beautylog.ora.text('building Dockerimage...')
plugins.beautylog.info('pulling latest base image from registry...');
await plugins.smartshell.exec(`docker pull ${config.baseImage}`);
plugins.beautylog.ora.text('building Dockerimage...');
let execResult = await plugins.smartshell.execSilent(
`docker build -f npmdocker -t ${dockerData.imageTag} ${paths.cwd}`
)
);
if (execResult.exitCode !== 0) {
console.log(execResult.stdout)
process.exit(1)
console.log(execResult.stdout);
process.exit(1);
}
plugins.beautylog.ok('Dockerimage built!')
}
plugins.beautylog.ok('Dockerimage built!');
};
let buildDockerProjectMountString = async () => {
if (process.env.CI !== 'true') {
dockerData.dockerProjectMountString = `-v ${paths.cwd}:/workspace`
};
}
dockerData.dockerProjectMountString = `-v ${paths.cwd}:/workspace`;
}
};
/**
* builds an environment string that docker cli understands
*/
let buildDockerEnvString = async () => {
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} `);
}
}
};
/**
* creates string to mount the docker.sock inside the testcontainer
*/
let buildDockerSockString = async () => {
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`;
}
};
/**
* creates a container by running the built Dockerimage
*/
let runDockerImage = async () => {
let done = plugins.q.defer()
plugins.beautylog.ora.text('starting Container...')
plugins.beautylog.ora.end()
plugins.beautylog.log('now running Dockerimage')
config.exitCode = (await plugins.smartshell.exec(`docker run ${dockerData.dockerProjectMountString} ${dockerData.dockerSockString} ${dockerData.dockerEnvString} --name ${dockerData.containerName} ${dockerData.imageTag}`)).exitCode
}
let done = plugins.q.defer();
plugins.beautylog.ora.text('starting Container...');
plugins.beautylog.ora.end();
plugins.beautylog.log('now running Dockerimage');
config.exitCode = (await plugins.smartshell.exec(
`docker run ${dockerData.dockerProjectMountString} ${dockerData.dockerSockString} ${
dockerData.dockerEnvString
} --name ${dockerData.containerName} ${dockerData.imageTag}`
)).exitCode;
};
/**
* cleans up: deletes the test container
*/
let deleteDockerContainer = async () => {
await plugins.smartshell.execSilent(`docker rm -f ${dockerData.containerName}`)
}
await plugins.smartshell.execSilent(`docker rm -f ${dockerData.containerName}`);
};
/**
* cleans up deletes the test image
*/
let deleteDockerImage = async () => {
await plugins.smartshell.execSilent(`docker rmi ${dockerData.imageTag}`).then(async (response) => {
await plugins.smartshell.execSilent(`docker rmi ${dockerData.imageTag}`).then(async response => {
if (response.exitCode !== 0) {
console.log(response.stdout)
console.log(response.stdout);
}
})
}
});
};
let preClean = async () => {
await deleteDockerImage()
.then(deleteDockerContainer)
.then(async () => {
plugins.beautylog.ok('ensured clean Docker environment!')
})
}
plugins.beautylog.ok('ensured clean Docker environment!');
});
};
let postClean = async () => {
await deleteDockerContainer()
.then(deleteDockerImage)
.then(async () => {
plugins.beautylog.ok('cleaned up!')
})
plugins.smartfile.fs.removeSync(paths.npmdockerFile)
}
plugins.beautylog.ok('cleaned up!');
});
plugins.smartfile.fs.removeSync(paths.npmdockerFile);
};
export let run = async (configArg: IConfig): Promise<IConfig> => {
plugins.beautylog.ora.start()
config = configArg
plugins.beautylog.ora.start();
config = configArg;
let resultConfig = await checkDocker()
.then(preClean)
.then(buildDockerFile)
@ -153,6 +156,8 @@ export let run = async (configArg: IConfig): Promise<IConfig> => {
.then(buildDockerSockString)
.then(runDockerImage)
.then(postClean)
.catch(err => { console.log(err) })
return config
}
.catch(err => {
console.log(err);
});
return config;
};

View File

@ -1,8 +1,8 @@
import * as plugins from "./npmdocker.plugins"
import * as plugins from './npmdocker.plugins';
// directories
export let cwd = process.cwd()
export let packageBase = plugins.path.join(__dirname, '../')
export let assets = plugins.path.join(packageBase, 'assets/')
plugins.smartfile.fs.ensureDirSync(assets)
export let npmdockerFile = plugins.path.join(cwd, 'npmdocker')
export let cwd = process.cwd();
export let packageBase = plugins.path.join(__dirname, '../');
export let assets = plugins.path.join(packageBase, 'assets/');
plugins.smartfile.fs.ensureDirSync(assets);
export let npmdockerFile = plugins.path.join(cwd, 'npmdocker');

View File

@ -1,15 +1,14 @@
import 'typings-global'
import * as beautylog from 'beautylog'
import * as npmextra from 'npmextra'
import * as path from 'path'
import * as projectinfo from 'projectinfo'
import * as q from 'smartq'
import * as qenv from 'qenv'
import * as smartanalytics from 'smartanalytics'
import * as smartcli from 'smartcli'
import * as smartfile from 'smartfile'
import * as smartshell from 'smartshell'
import * as smartstring from 'smartstring'
import * as beautylog from 'beautylog';
import * as npmextra from 'npmextra';
import * as path from 'path';
import * as projectinfo from 'projectinfo';
import * as q from 'smartq';
import * as qenv from 'qenv';
import * as smartanalytics from 'smartanalytics';
import * as smartcli from 'smartcli';
import * as smartfile from 'smartfile';
import * as smartshell from 'smartshell';
import * as smartstring from 'smartstring';
export {
beautylog,
@ -23,4 +22,4 @@ export {
smartfile,
smartshell,
smartstring
}
};

View File

@ -1,25 +1,25 @@
import * as plugins from "./npmdocker.plugins";
import * as plugins from './npmdocker.plugins';
export interface IDockerfileSnippet {
baseImage: string
command: string
baseImage: string;
command: string;
}
let getMountSolutionString = (optionsArg: IDockerfileSnippet) => {
if (process.env.CI) {
return 'COPY ./ /workspace'
return 'COPY ./ /workspace';
} else {
return '# not copying workspcae since not in CI'
return '# not copying workspcae since not in CI';
}
}
};
let getGlobalPreparationString = (optionsArg: IDockerfileSnippet) => {
if (optionsArg.baseImage !== 'hosttoday/ht-docker-node:npmdocker') {
return 'RUN yarn global add npmdocker'
return 'RUN yarn global add npmdocker';
} else {
return '# not installing npmdocker since it is included in the base image'
return '# not installing npmdocker since it is included in the base image';
}
}
};
export let dockerfileSnippet = (optionsArg: IDockerfileSnippet): string => {
return plugins.smartstring.indent.normalize(
@ -33,5 +33,5 @@ ENV CI=true
ENTRYPOINT ["npmdocker"]
CMD ["runinside"]
`
)
}
);
};