@01/kube-tools
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -0,1 +1,3 @@ | ||
import "core-js/features/array/flat"; | ||
export * from "./kube-deploy"; | ||
export * from "./kube-build"; |
@@ -35,3 +35,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
/******/ // eslint-disable-next-line no-unused-vars | ||
/******/ var hotCurrentHash = "f06f402583c221778a95"; | ||
/******/ var hotCurrentHash = "d0990af95b7e0ec677fa"; | ||
/******/ var hotRequestTimeout = 10000; | ||
@@ -775,2 +775,5 @@ /******/ var hotCurrentModuleData = {}; | ||
// EXTERNAL MODULE: external "core-js/features/array/flat" | ||
var flat_ = __webpack_require__("core-js/features/array/flat"); | ||
// EXTERNAL MODULE: external "tslib" | ||
@@ -836,3 +839,3 @@ var external_tslib_ = __webpack_require__("tslib"); | ||
var name = _a.name, chart = _a.chart, values = _a.values, imageTag = _a["image.tag"], _b = _a.__values, env = _b.env, replicas = _b.replicas, image = _b.image; | ||
console.log(" \u2699\uFE0F Configuration\n \n \uD83D\uDCE6 Service name : " + name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + imageTag + "\n \uD83D\uDCBF Image repository : " + image.repository + "\n \uD83D\uDCBF Image pullPolicy : " + image.pullPolicy + "\n \uD83D\uDC7E Replicas : " + replicas + "\n \uD83D\uDCCB Chart : " + chart + "\n \uD83D\uDCDD Values : " + values + "\n "); | ||
console.log(" \u2699\uFE0F Deployment Configuration\n \n \uD83D\uDCE6 Service name : " + name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + imageTag + "\n \uD83D\uDCBF Image repository : " + image.repository + "\n \uD83D\uDCBF Image pullPolicy : " + image.pullPolicy + "\n \uD83D\uDC7E Replicas : " + replicas + "\n \uD83D\uDCCB Chart : " + chart + "\n \uD83D\uDCDD Values : " + values + "\n "); | ||
} | ||
@@ -927,7 +930,189 @@ var logError = function (prop, msg) { | ||
// CONCATENATED MODULE: ./src/components/docker/docker-args.ts | ||
/** | ||
* Spread args object to command line arguments | ||
* @param args | ||
*/ | ||
function spreadArgs(args, prefix) { | ||
if (prefix === void 0) { prefix = "--"; } | ||
var resultArgs = []; | ||
Object.keys(args).forEach(function (name) { | ||
var value = args[name]; | ||
var argName = name.startsWith(prefix) ? name : prefix + name; | ||
var emptyName = prefix + "_"; | ||
if (Array.isArray(value)) { | ||
value.forEach(function (_value) { | ||
if (argName !== emptyName) | ||
resultArgs.push(argName); | ||
if (_value !== "") | ||
resultArgs.push(_value); | ||
}); | ||
} | ||
else { | ||
if (argName !== emptyName) | ||
resultArgs.push(argName); | ||
if (value !== "") | ||
resultArgs.push(value); | ||
} | ||
}); | ||
return resultArgs.filter(function (arg) { return arg; }); | ||
} | ||
// CONCATENATED MODULE: ./src/components/docker/docker-build.ts | ||
var docker_build_cwd = process.cwd(); | ||
var edgeFolderName = docker_build_cwd.substring(docker_build_cwd.lastIndexOf("/") + 1, docker_build_cwd.length); | ||
var defaultBuildOptions = { | ||
file: docker_build_cwd + "/Dockerfile", | ||
"build-arg": ["NPM_TOKEN"], | ||
context: "." | ||
}; | ||
/** | ||
* Merge default and given options | ||
* @param options | ||
*/ | ||
var getOptions = function (options) { | ||
var __options = external_tslib_["__assign"]({}, defaultBuildOptions, options); | ||
// prettier-ignore | ||
var _a = __options.t, t = _a === void 0 ? "" : _a, _b = __options.tag, tag = _b === void 0 ? "" : _b, _c = __options.f, f = _c === void 0 ? "" : _c, _d = __options.file, file = _d === void 0 ? "" : _d, _e = __options.context, context = _e === void 0 ? "." : _e, _rest = external_tslib_["__rest"](__options, ["t", "tag", "f", "file", "context"]); | ||
return { | ||
tag: tag || t, | ||
file: file || f, | ||
context: context, | ||
rest: _rest | ||
}; | ||
}; | ||
/** | ||
* Docker build wrapper with default tag and NPM_TOKEN build-arg | ||
* @param options | ||
* @param launchOptions | ||
*/ | ||
function dockerBuild(options, launchOptions) { | ||
if (options === void 0) { options = {}; } | ||
if (launchOptions === void 0) { launchOptions = {}; } | ||
return external_tslib_["__awaiter"](this, void 0, void 0, function () { | ||
var _a, file, tag, context, rest, USER; | ||
return external_tslib_["__generator"](this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_a = getOptions(options), file = _a.file, tag = _a.tag, context = _a.context, rest = _a.rest; | ||
if (!tag) { | ||
USER = process.env.USER; | ||
tag = edgeFolderName + "." + USER + ".dev:" + Date.now(); | ||
} | ||
return [4 /*yield*/, Object(launcher_["launch"])(external_tslib_["__assign"]({ cmds: [ | ||
"docker", "build" | ||
].concat(spreadArgs(rest), [ | ||
"--file", file | ||
], (tag ? ["--tag", tag] : []), [ | ||
context | ||
]) }, launchOptions))]; | ||
case 1: | ||
/** | ||
* Build docker image | ||
*/ | ||
// prettier-ignore | ||
return [2 /*return*/, _b.sent()]; | ||
} | ||
}); | ||
}); | ||
} | ||
// CONCATENATED MODULE: ./src/components/docker/docker.ts | ||
var minimist = __webpack_require__("minimist"); | ||
function docker(cmd, options, launchOptions) { | ||
if (options === void 0) { options = {}; } | ||
if (launchOptions === void 0) { launchOptions = {}; } | ||
return external_tslib_["__awaiter"](this, void 0, void 0, function () { | ||
var _options; | ||
return external_tslib_["__generator"](this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
_options = options; | ||
if (typeof options === "string") { | ||
_options = minimist([options]); | ||
} | ||
if (Array.isArray(options)) { | ||
_options = minimist(options); | ||
} | ||
if (!(cmd === "build")) return [3 /*break*/, 2]; | ||
return [4 /*yield*/, dockerBuild(_options, launchOptions)]; | ||
case 1: return [2 /*return*/, _a.sent()]; | ||
case 2: return [4 /*yield*/, Object(launcher_["launch"])(external_tslib_["__assign"]({ cmds: ["docker", cmd].concat(spreadArgs(_options)) }, launchOptions))]; | ||
case 3: return [2 /*return*/, _a.sent()]; | ||
} | ||
}); | ||
}); | ||
} | ||
// CONCATENATED MODULE: ./src/components/docker/index.ts | ||
// CONCATENATED MODULE: ./src/kube-build.ts | ||
var kube_build_chalk = __webpack_require__("chalk"); | ||
var kube_build_white = kube_build_chalk.white, kube_build_red = kube_build_chalk.red, kube_build_bgRed = kube_build_chalk.bgRed; | ||
function kube_build_printConfig(_a) { | ||
var app = _a.app, tag = _a.tag, _b = _a.values, env = _b.env, image = _b.image; | ||
console.log(" \u2699\uFE0F Build Configuration\n\n \uD83D\uDCE6 Service name : " + app.name + "\n \uD83C\uDF0D Environment : " + env + "\n \uD83D\uDCBF Image tag : " + tag + "\n \uD83D\uDCBF Image repository : " + image.repository + "\n "); | ||
} | ||
var kube_build_logError = function (prop, msg) { | ||
return console.log(kube_build_red("\nOops \uD83D\uDE2C, Did you forgot to pass option " + kube_build_bgRed(kube_build_white(" " + prop + " ")) + "?. Please tell me, " + msg + "!\n ")); | ||
}; | ||
function kubeBuild(_options) { | ||
return external_tslib_["__awaiter"](this, void 0, void 0, function () { | ||
var config, tag, dockerOptions, options, e_1; | ||
return external_tslib_["__generator"](this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
config = { app: {}, basePath: ".", values: {} }; | ||
if (!_options.config) { | ||
kube_build_logError(" config ", "Please provide a config file!"); | ||
process.exit(1); | ||
return [2 /*return*/]; | ||
} | ||
if (_options.config) { | ||
config = loadConfig(_options.config); | ||
} | ||
tag = config.app["image.tag"]; | ||
dockerOptions = { | ||
tag: tag | ||
}; | ||
options = external_tslib_["__assign"]({}, _options, dockerOptions); | ||
delete options.config; | ||
kube_build_printConfig(config); | ||
_a.label = 1; | ||
case 1: | ||
_a.trys.push([1, 3, , 4]); | ||
return [4 /*yield*/, dockerBuild(options)]; | ||
case 2: | ||
_a.sent(); | ||
return [2 /*return*/, 0]; | ||
case 3: | ||
e_1 = _a.sent(); | ||
console.error(e_1); | ||
return [2 /*return*/, 1]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
} | ||
// CONCATENATED MODULE: ./src/index.ts | ||
/* concated harmony reexport kubeDeploy */__webpack_require__.d(__webpack_exports__, "kubeDeploy", function() { return kubeDeploy; }); | ||
/* concated harmony reexport kubeBuild */__webpack_require__.d(__webpack_exports__, "kubeBuild", function() { return kubeBuild; }); | ||
/***/ }), | ||
@@ -957,2 +1142,16 @@ | ||
/***/ "core-js/features/array/flat": | ||
/***/ (function(module, exports) { | ||
module.exports = require("core-js/features/array/flat"); | ||
/***/ }), | ||
/***/ "minimist": | ||
/***/ (function(module, exports) { | ||
module.exports = require("minimist"); | ||
/***/ }), | ||
/***/ "path": | ||
@@ -959,0 +1158,0 @@ /***/ (function(module, exports) { |
{ | ||
"name": "@01/kube-tools", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"author": "Nidin Vinayakan <01@01alchemist.com>", | ||
@@ -23,3 +23,3 @@ "repository": "git@github.com:01alchemist/kube-tools.git", | ||
"bin": { | ||
"kube": "./cli/index", | ||
"kube-build": "./cli/kube-build", | ||
"kube-deploy": "./cli/kube-deploy" | ||
@@ -32,3 +32,3 @@ }, | ||
"precommit": "lint-staged", | ||
"test": "echo no tests", | ||
"test": "jest --config=jest.json", | ||
"prettier": "prettier --write '**/*.{js,json,ts,gql,graphql}'", | ||
@@ -46,6 +46,7 @@ "lint": "prettier --check '**/*.{js,json,ts,gql,graphql}'" | ||
"minimist": "1.2.0", | ||
"source-map-support": "^0.5.12" | ||
"source-map-support": "^0.5.12", | ||
"core-js": "3.1.4" | ||
}, | ||
"devDependencies": { | ||
"@01/launcher": "1.0.3", | ||
"@01/launcher": "1.0.8", | ||
"@types/jest": "24.0.13", | ||
@@ -52,0 +53,0 @@ "@types/minimist": "1.2.0", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
97039
17
1168
1
4
5
+ Addedcore-js@3.1.4
+ Addedcore-js@3.1.4(transitive)