From 5eb07f1ad7e8f7379a1595cc3dce93432cd45e3b Mon Sep 17 00:00:00 2001 From: Phil Kunz Date: Mon, 28 Aug 2017 17:11:47 +0200 Subject: [PATCH] add git module and kvStore --- dist/mod_git/index.d.ts | 6 ++++++ dist/mod_git/index.js | 33 +++++++++++++++++++++++++++++++++ dist/mod_git/mod.plugins.d.ts | 1 + dist/mod_git/mod.plugins.js | 7 +++++++ dist/npmci.config.d.ts | 2 ++ dist/npmci.config.js | 6 +++++- dist/npmci.mods.d.ts | 2 ++ dist/npmci.mods.js | 3 ++- ts/mod_git/index.ts | 24 ++++++++++++++++++++++++ ts/mod_git/mod.plugins.ts | 1 + ts/npmci.config.ts | 7 +++++++ ts/npmci.mods.ts | 2 ++ 12 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 dist/mod_git/index.d.ts create mode 100644 dist/mod_git/index.js create mode 100644 dist/mod_git/mod.plugins.d.ts create mode 100644 dist/mod_git/mod.plugins.js create mode 100644 ts/mod_git/index.ts create mode 100644 ts/mod_git/mod.plugins.ts diff --git a/dist/mod_git/index.d.ts b/dist/mod_git/index.d.ts new file mode 100644 index 0000000..078e2f4 --- /dev/null +++ b/dist/mod_git/index.d.ts @@ -0,0 +1,6 @@ +/** + * handle cli input + * @param argvArg + */ +export declare let handleCli: (argvArg: any) => Promise; +export declare let mirror: () => Promise; diff --git a/dist/mod_git/index.js b/dist/mod_git/index.js new file mode 100644 index 0000000..7a8ff91 --- /dev/null +++ b/dist/mod_git/index.js @@ -0,0 +1,33 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const plugins = require("./mod.plugins"); +/** + * handle cli input + * @param argvArg + */ +exports.handleCli = (argvArg) => __awaiter(this, void 0, void 0, function* () { + if (argvArg._.length >= 2) { + let action = argvArg._[1]; + switch (action) { + case 'mirror': + yield exports.mirror(); + break; + default: + plugins.beautylog.error(`>>npmci git ...<< action >>${action}<< not supported`); + } + } + else { + plugins.beautylog.log(`>>npmci git ...<< cli arguments invalid... Please read the documentation.`); + } +}); +exports.mirror = () => __awaiter(this, void 0, void 0, function* () { +}); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZ2l0L2luZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFBQSx5Q0FBd0M7QUFFeEM7OztHQUdHO0FBQ1EsUUFBQSxTQUFTLEdBQUcsQ0FBTyxPQUFPO0lBQ25DLEVBQUUsQ0FBQyxDQUFDLE9BQU8sQ0FBQyxDQUFDLENBQUMsTUFBTSxJQUFJLENBQUMsQ0FBQyxDQUFDLENBQUM7UUFDMUIsSUFBSSxNQUFNLEdBQVcsT0FBTyxDQUFDLENBQUMsQ0FBRSxDQUFDLENBQUUsQ0FBQTtRQUNuQyxNQUFNLENBQUMsQ0FBQyxNQUFNLENBQUMsQ0FBQyxDQUFDO1lBQ2YsS0FBSyxRQUFRO2dCQUNYLE1BQU0sY0FBTSxFQUFFLENBQUE7Z0JBQ2QsS0FBSyxDQUFBO1lBQ1A7Z0JBQ0UsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsOEJBQThCLE1BQU0sa0JBQWtCLENBQUMsQ0FBQTtRQUNuRixDQUFDO0lBQ0gsQ0FBQztJQUFDLElBQUksQ0FBQyxDQUFDO1FBQ04sT0FBTyxDQUFDLFNBQVMsQ0FBQyxHQUFHLENBQUMsMkVBQTJFLENBQUMsQ0FBQTtJQUNwRyxDQUFDO0FBQ0gsQ0FBQyxDQUFBLENBQUE7QUFFVSxRQUFBLE1BQU0sR0FBRztBQUVwQixDQUFDLENBQUEsQ0FBQSJ9 \ No newline at end of file diff --git a/dist/mod_git/mod.plugins.d.ts b/dist/mod_git/mod.plugins.d.ts new file mode 100644 index 0000000..27d1e74 --- /dev/null +++ b/dist/mod_git/mod.plugins.d.ts @@ -0,0 +1 @@ +export * from '../npmci.plugins'; diff --git a/dist/mod_git/mod.plugins.js b/dist/mod_git/mod.plugins.js new file mode 100644 index 0000000..8b93b2d --- /dev/null +++ b/dist/mod_git/mod.plugins.js @@ -0,0 +1,7 @@ +"use strict"; +function __export(m) { + for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; +} +Object.defineProperty(exports, "__esModule", { value: true }); +__export(require("../npmci.plugins")); +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi90cy9tb2RfZ2l0L21vZC5wbHVnaW5zLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsc0NBQWdDIn0= \ No newline at end of file diff --git a/dist/npmci.config.d.ts b/dist/npmci.config.d.ts index 6f046d2..bd43e4a 100644 --- a/dist/npmci.config.d.ts +++ b/dist/npmci.config.d.ts @@ -1,4 +1,6 @@ +import { KeyValueStore } from 'npmextra'; export interface INpmciOptions { globalNpmTools: string[]; } +export declare let kvStorage: KeyValueStore; export declare let getConfig: () => Promise; diff --git a/dist/npmci.config.js b/dist/npmci.config.js index b8943ca..1c8f33f 100644 --- a/dist/npmci.config.js +++ b/dist/npmci.config.js @@ -10,6 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", { value: true }); const plugins = require("./npmci.plugins"); const paths = require("./npmci.paths"); +const npmci_env_1 = require("./npmci.env"); +const npmextra_1 = require("npmextra"); +// instantiate a kvStorage for the current directory +exports.kvStorage = new npmextra_1.KeyValueStore('custom', npmci_env_1.repo.repo); exports.getConfig = () => __awaiter(this, void 0, void 0, function* () { let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd); let defaultConfig = { @@ -18,4 +22,4 @@ exports.getConfig = () => __awaiter(this, void 0, void 0, function* () { let npmciConfig = npmciNpmextra.dataFor('npmci', defaultConfig); return npmciConfig; }); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBTTNCLFFBQUEsU0FBUyxHQUFHO0lBQ3JCLElBQUksYUFBYSxHQUFHLElBQUksT0FBTyxDQUFDLFFBQVEsQ0FBQyxRQUFRLENBQUMsS0FBSyxDQUFDLEdBQUcsQ0FBQyxDQUFBO0lBQzVELElBQUksYUFBYSxHQUFrQjtRQUNqQyxjQUFjLEVBQUUsRUFBRTtLQUNuQixDQUFBO0lBQ0QsSUFBSSxXQUFXLEdBQUcsYUFBYSxDQUFDLE9BQU8sQ0FBZ0IsT0FBTyxFQUFFLGFBQWEsQ0FBQyxDQUFBO0lBQzlFLE1BQU0sQ0FBQyxXQUFXLENBQUE7QUFDcEIsQ0FBQyxDQUFBLENBQUEifQ== \ No newline at end of file +//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kuY29uZmlnLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvbnBtY2kuY29uZmlnLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7QUFFQSwyQ0FBMEM7QUFDMUMsdUNBQXNDO0FBRXRDLDJDQUFrQztBQUVsQyx1Q0FBd0M7QUFNeEMsb0RBQW9EO0FBQ3pDLFFBQUEsU0FBUyxHQUFHLElBQUksd0JBQWEsQ0FBQyxRQUFRLEVBQUUsZ0JBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQTtBQUVsRCxRQUFBLFNBQVMsR0FBRztJQUNyQixJQUFJLGFBQWEsR0FBRyxJQUFJLE9BQU8sQ0FBQyxRQUFRLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxHQUFHLENBQUMsQ0FBQTtJQUM1RCxJQUFJLGFBQWEsR0FBa0I7UUFDakMsY0FBYyxFQUFFLEVBQUU7S0FDbkIsQ0FBQTtJQUNELElBQUksV0FBVyxHQUFHLGFBQWEsQ0FBQyxPQUFPLENBQWdCLE9BQU8sRUFBRSxhQUFhLENBQUMsQ0FBQTtJQUM5RSxNQUFNLENBQUMsV0FBVyxDQUFBO0FBQ3BCLENBQUMsQ0FBQSxDQUFBIn0= \ No newline at end of file diff --git a/dist/npmci.mods.d.ts b/dist/npmci.mods.d.ts index e74d7a5..9786a20 100644 --- a/dist/npmci.mods.d.ts +++ b/dist/npmci.mods.d.ts @@ -2,6 +2,7 @@ import * as _modClean from './mod_clean/index'; import * as _modCloudflare from './mod_cloudflare/index'; import * as _modCommand from './mod_command/index'; import * as _modDocker from './mod_docker/index'; +import * as _modGit from './mod_git/index'; import * as _modNpm from './mod_npm/index'; import * as _modNode from './mod_node/index'; import * as _modSsh from './mod_ssh/index'; @@ -10,6 +11,7 @@ import { LazyModule } from 'smartsystem'; export declare let modClean: LazyModule; export declare let modCloudflare: LazyModule; export declare let modCommand: LazyModule; +export declare let modGit: LazyModule; export declare let modDocker: LazyModule; export declare let modNode: LazyModule; export declare let modNpm: LazyModule; diff --git a/dist/npmci.mods.js b/dist/npmci.mods.js index de534f2..9b7f5b0 100644 --- a/dist/npmci.mods.js +++ b/dist/npmci.mods.js @@ -4,9 +4,10 @@ const smartsystem_1 = require("smartsystem"); exports.modClean = new smartsystem_1.LazyModule('./mod_clean/index', __dirname); exports.modCloudflare = new smartsystem_1.LazyModule('./mod_cloudflare/index', __dirname); exports.modCommand = new smartsystem_1.LazyModule('./mod_command/index', __dirname); +exports.modGit = new smartsystem_1.LazyModule('./mod_git/index', __dirname); exports.modDocker = new smartsystem_1.LazyModule('./mod_docker/index', __dirname); exports.modNode = new smartsystem_1.LazyModule('./mod_node/index', __dirname); exports.modNpm = new smartsystem_1.LazyModule('./mod_npm/index', __dirname); exports.modSsh = new smartsystem_1.LazyModule('./mod_ssh/index', __dirname); exports.modTrigger = new smartsystem_1.LazyModule('./mod_trigger/index', __dirname); -//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibnBtY2kubW9kcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL25wbWNpLm1vZHMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFTQSw2Q0FBd0M7QUFFN0IsUUFBQSxRQUFRLEdBQUcsSUFBSSx3QkFBVSxDQUFtQixtQkFBbUIsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUMzRSxRQUFBLGFBQWEsR0FBRyxJQUFJLHdCQUFVLENBQXdCLHdCQUF3QixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQzFGLFFBQUEsVUFBVSxHQUFHLElBQUksd0JBQVUsQ0FBcUIscUJBQXFCLEVBQUUsU0FBUyxDQUFDLENBQUE7QUFDakYsUUFBQSxTQUFTLEdBQUcsSUFBSSx3QkFBVSxDQUFvQixvQkFBb0IsRUFBRSxTQUFTLENBQUMsQ0FBQTtBQUM5RSxRQUFBLE9BQU8sR0FBRyxJQUFJLHdCQUFVLENBQWtCLGtCQUFrQixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQ3hFLFFBQUEsTUFBTSxHQUFHLElBQUksd0JBQVUsQ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FBRyxJQUFJLHdCQUFVLENBQWlCLGlCQUFpQixFQUFFLFNBQVMsQ0FBQyxDQUFBO0FBQ3JFLFFBQUEsVUFBVSxHQUFHLElBQUksd0JBQVUsQ0FBcUIscUJBQXFCLEVBQUUsU0FBUyxDQUFDLENBQUEifQ== \ No newline at end of file diff --git a/ts/mod_git/index.ts b/ts/mod_git/index.ts new file mode 100644 index 0000000..4208d08 --- /dev/null +++ b/ts/mod_git/index.ts @@ -0,0 +1,24 @@ +import * as plugins from './mod.plugins' + +/** + * handle cli input + * @param argvArg + */ +export let handleCli = async (argvArg) => { + if (argvArg._.length >= 2) { + let action: string = argvArg._[ 1 ] + switch (action) { + case 'mirror': + await mirror() + break + default: + plugins.beautylog.error(`>>npmci git ...<< action >>${action}<< not supported`) + } + } else { + plugins.beautylog.log(`>>npmci git ...<< cli arguments invalid... Please read the documentation.`) + } +} + +export let mirror = async () => { + +} diff --git a/ts/mod_git/mod.plugins.ts b/ts/mod_git/mod.plugins.ts new file mode 100644 index 0000000..f9883a8 --- /dev/null +++ b/ts/mod_git/mod.plugins.ts @@ -0,0 +1 @@ +export * from '../npmci.plugins' diff --git a/ts/npmci.config.ts b/ts/npmci.config.ts index 54e2ac2..2e9bbf9 100644 --- a/ts/npmci.config.ts +++ b/ts/npmci.config.ts @@ -3,10 +3,17 @@ import * as q from 'q' import * as plugins from './npmci.plugins' import * as paths from './npmci.paths' +import { repo } from './npmci.env' + +import { KeyValueStore } from 'npmextra' + export interface INpmciOptions { globalNpmTools: string[] } +// instantiate a kvStorage for the current directory +export let kvStorage = new KeyValueStore('custom', repo.user + repo.repo) + export let getConfig = async (): Promise => { let npmciNpmextra = new plugins.npmextra.Npmextra(paths.cwd) let defaultConfig: INpmciOptions = { diff --git a/ts/npmci.mods.ts b/ts/npmci.mods.ts index 1ebbeb9..1c037bc 100644 --- a/ts/npmci.mods.ts +++ b/ts/npmci.mods.ts @@ -2,6 +2,7 @@ import * as _modClean from './mod_clean/index' import * as _modCloudflare from './mod_cloudflare/index' import * as _modCommand from './mod_command/index' import * as _modDocker from './mod_docker/index' +import * as _modGit from './mod_git/index' import * as _modNpm from './mod_npm/index' import * as _modNode from './mod_node/index' import * as _modSsh from './mod_ssh/index' @@ -12,6 +13,7 @@ import { LazyModule } from 'smartsystem' export let modClean = new LazyModule('./mod_clean/index', __dirname) export let modCloudflare = new LazyModule('./mod_cloudflare/index', __dirname) export let modCommand = new LazyModule('./mod_command/index', __dirname) +export let modGit = new LazyModule('./mod_git/index', __dirname) export let modDocker = new LazyModule('./mod_docker/index', __dirname) export let modNode = new LazyModule('./mod_node/index', __dirname) export let modNpm = new LazyModule('./mod_npm/index', __dirname)