@leverege/build-tools 2.1.1 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -13
- package/lib/web/dnsify/CloudflareAPI.js +4 -12
- package/lib/web/dnsify/index.js +1 -3
- package/lib/web/packleate/Packleator.js +12 -36
- package/lib/web/packleate/index.js +1 -3
- package/package.json +14 -10
- package/src/dirty-git +19 -0
- package/src/helmup +6 -1
- package/src/k8x +11 -0
- package/src/prune-git +18 -0
- package/src/pull-git +18 -0
package/README.md
CHANGED
|
@@ -1,32 +1,40 @@
|
|
|
1
1
|
# Leverege Build Tools
|
|
2
2
|
|
|
3
|
-
A collection of build tools for all Leverege code.
|
|
3
|
+
A collection of build / support tools for all Leverege code.
|
|
4
4
|
|
|
5
5
|
## Installing
|
|
6
6
|
|
|
7
7
|
Install build-tools
|
|
8
8
|
|
|
9
9
|
```
|
|
10
|
-
npm install
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
And add the script you want in package.json like
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
"scripts": {
|
|
17
|
-
"circleate": "circleate"
|
|
18
|
-
}
|
|
10
|
+
npm install -g @leverege/build-tools
|
|
19
11
|
```
|
|
20
12
|
|
|
21
13
|
## Tool Descriptions
|
|
22
|
-
Most of these tools should be bootstrapped with a template, but if you need descriptions of the tools:
|
|
23
14
|
|
|
24
15
|
* **circleate**: bootstrap .circleci config repo
|
|
25
16
|
* **decrypt-secrets**: decrypts secrets (env, service accounts)
|
|
26
17
|
* **dockreate**: bootstrap docker repo
|
|
27
18
|
* **encrypt-secrets**: encrypts secrets (env, service accounts)
|
|
19
|
+
* **packleate**: DESCRIPTION
|
|
20
|
+
|
|
21
|
+
Helm Helpers:
|
|
22
|
+
* **overwhelm**: DESCRIPTION
|
|
23
|
+
* **helmify**: DESCRIPTION
|
|
24
|
+
* **helmup**: DESCRIPTION
|
|
25
|
+
* **helmdn**: DESCRIPTION
|
|
26
|
+
|
|
27
|
+
Kubernetes Helpers:
|
|
28
|
+
* **k8x**: DESCRIPTION
|
|
29
|
+
|
|
30
|
+
Git Helpers:
|
|
31
|
+
* **git-tar**: DESCRIPTION
|
|
32
|
+
* **dirty-git**: DESCRIPTION
|
|
33
|
+
* **prune-git**: DESCRIPTION
|
|
34
|
+
* **pull-git**: DESCRIPTION
|
|
28
35
|
|
|
29
36
|
## Authors
|
|
30
37
|
|
|
31
|
-
* **John Phelps**
|
|
32
|
-
* **Yitaek Hwang**
|
|
38
|
+
* **John Phelps**
|
|
39
|
+
* **Yitaek Hwang**
|
|
40
|
+
* **Michael Quinn**
|
|
@@ -47,9 +47,7 @@ var path = require('path');
|
|
|
47
47
|
var _require = require('util'),
|
|
48
48
|
promisify = _require.promisify;
|
|
49
49
|
|
|
50
|
-
var CloudflareAPI =
|
|
51
|
-
/*#__PURE__*/
|
|
52
|
-
function () {
|
|
50
|
+
var CloudflareAPI = /*#__PURE__*/function () {
|
|
53
51
|
function CloudflareAPI(options) {
|
|
54
52
|
_classCallCheck(this, CloudflareAPI);
|
|
55
53
|
|
|
@@ -71,9 +69,7 @@ function () {
|
|
|
71
69
|
_createClass(CloudflareAPI, [{
|
|
72
70
|
key: "decrypt",
|
|
73
71
|
value: function () {
|
|
74
|
-
var _decrypt = _asyncToGenerator(
|
|
75
|
-
/*#__PURE__*/
|
|
76
|
-
regeneratorRuntime.mark(function _callee() {
|
|
72
|
+
var _decrypt = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
77
73
|
var projectId,
|
|
78
74
|
keyRingId,
|
|
79
75
|
cryptoKeyId,
|
|
@@ -163,9 +159,7 @@ function () {
|
|
|
163
159
|
}, {
|
|
164
160
|
key: "deleteSecrets",
|
|
165
161
|
value: function () {
|
|
166
|
-
var _deleteSecrets = _asyncToGenerator(
|
|
167
|
-
/*#__PURE__*/
|
|
168
|
-
regeneratorRuntime.mark(function _callee2() {
|
|
162
|
+
var _deleteSecrets = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
169
163
|
var deleteFile;
|
|
170
164
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
171
165
|
while (1) {
|
|
@@ -192,9 +186,7 @@ function () {
|
|
|
192
186
|
}, {
|
|
193
187
|
key: "createDNSRecord",
|
|
194
188
|
value: function () {
|
|
195
|
-
var _createDNSRecord = _asyncToGenerator(
|
|
196
|
-
/*#__PURE__*/
|
|
197
|
-
regeneratorRuntime.mark(function _callee3() {
|
|
189
|
+
var _createDNSRecord = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
198
190
|
return regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
199
191
|
while (1) {
|
|
200
192
|
switch (_context3.prev = _context3.next) {
|
package/lib/web/dnsify/index.js
CHANGED
|
@@ -97,9 +97,7 @@ function main() {
|
|
|
97
97
|
}
|
|
98
98
|
|
|
99
99
|
function _main() {
|
|
100
|
-
_main = _asyncToGenerator(
|
|
101
|
-
/*#__PURE__*/
|
|
102
|
-
regeneratorRuntime.mark(function _callee() {
|
|
100
|
+
_main = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
103
101
|
var CF;
|
|
104
102
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
105
103
|
while (1) {
|
|
@@ -74,9 +74,7 @@ var tar = require('tar');
|
|
|
74
74
|
|
|
75
75
|
var semver = require('semver');
|
|
76
76
|
|
|
77
|
-
var Packleator =
|
|
78
|
-
/*#__PURE__*/
|
|
79
|
-
function () {
|
|
77
|
+
var Packleator = /*#__PURE__*/function () {
|
|
80
78
|
function Packleator(options) {
|
|
81
79
|
_classCallCheck(this, Packleator);
|
|
82
80
|
|
|
@@ -99,9 +97,7 @@ function () {
|
|
|
99
97
|
_createClass(Packleator, [{
|
|
100
98
|
key: "run",
|
|
101
99
|
value: function () {
|
|
102
|
-
var _run = _asyncToGenerator(
|
|
103
|
-
/*#__PURE__*/
|
|
104
|
-
regeneratorRuntime.mark(function _callee2() {
|
|
100
|
+
var _run = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
105
101
|
var _this = this;
|
|
106
102
|
|
|
107
103
|
var deps;
|
|
@@ -151,12 +147,8 @@ function () {
|
|
|
151
147
|
callback();
|
|
152
148
|
});
|
|
153
149
|
});
|
|
154
|
-
},
|
|
155
|
-
|
|
156
|
-
function () {
|
|
157
|
-
var _ref = _asyncToGenerator(
|
|
158
|
-
/*#__PURE__*/
|
|
159
|
-
regeneratorRuntime.mark(function _callee(err) {
|
|
150
|
+
}, /*#__PURE__*/function () {
|
|
151
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(err) {
|
|
160
152
|
var _this$outputPackageJs, name, version, fileName;
|
|
161
153
|
|
|
162
154
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
@@ -241,9 +233,7 @@ function () {
|
|
|
241
233
|
}, {
|
|
242
234
|
key: "rebuildPackageJson",
|
|
243
235
|
value: function () {
|
|
244
|
-
var _rebuildPackageJson = _asyncToGenerator(
|
|
245
|
-
/*#__PURE__*/
|
|
246
|
-
regeneratorRuntime.mark(function _callee3() {
|
|
236
|
+
var _rebuildPackageJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
|
|
247
237
|
var _this2 = this;
|
|
248
238
|
|
|
249
239
|
var packageJson, tarredPackages, _packageJson$dependen, dependencies, _packageJson$devDepen, devDependencies;
|
|
@@ -290,9 +280,7 @@ function () {
|
|
|
290
280
|
}, {
|
|
291
281
|
key: "rebuildPackageLockJson",
|
|
292
282
|
value: function () {
|
|
293
|
-
var _rebuildPackageLockJson = _asyncToGenerator(
|
|
294
|
-
/*#__PURE__*/
|
|
295
|
-
regeneratorRuntime.mark(function _callee4() {
|
|
283
|
+
var _rebuildPackageLockJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {
|
|
296
284
|
var packageLockJson, tarredPackages, recurseDeps;
|
|
297
285
|
return regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
298
286
|
while (1) {
|
|
@@ -341,9 +329,7 @@ function () {
|
|
|
341
329
|
}, {
|
|
342
330
|
key: "copyFiles",
|
|
343
331
|
value: function () {
|
|
344
|
-
var _copyFiles = _asyncToGenerator(
|
|
345
|
-
/*#__PURE__*/
|
|
346
|
-
regeneratorRuntime.mark(function _callee5() {
|
|
332
|
+
var _copyFiles = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee5() {
|
|
347
333
|
var _this3 = this;
|
|
348
334
|
|
|
349
335
|
var startsWith, endsWith;
|
|
@@ -403,9 +389,7 @@ function () {
|
|
|
403
389
|
}, {
|
|
404
390
|
key: "pack",
|
|
405
391
|
value: function () {
|
|
406
|
-
var _pack = _asyncToGenerator(
|
|
407
|
-
/*#__PURE__*/
|
|
408
|
-
regeneratorRuntime.mark(function _callee6(name, version, dir) {
|
|
392
|
+
var _pack = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee6(name, version, dir) {
|
|
409
393
|
var fileName;
|
|
410
394
|
return regeneratorRuntime.wrap(function _callee6$(_context6) {
|
|
411
395
|
while (1) {
|
|
@@ -456,9 +440,7 @@ function () {
|
|
|
456
440
|
}, {
|
|
457
441
|
key: "cleanup",
|
|
458
442
|
value: function () {
|
|
459
|
-
var _cleanup = _asyncToGenerator(
|
|
460
|
-
/*#__PURE__*/
|
|
461
|
-
regeneratorRuntime.mark(function _callee7() {
|
|
443
|
+
var _cleanup = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee7() {
|
|
462
444
|
return regeneratorRuntime.wrap(function _callee7$(_context7) {
|
|
463
445
|
while (1) {
|
|
464
446
|
switch (_context7.prev = _context7.next) {
|
|
@@ -490,9 +472,7 @@ function () {
|
|
|
490
472
|
}, {
|
|
491
473
|
key: "npmInstall",
|
|
492
474
|
value: function () {
|
|
493
|
-
var _npmInstall = _asyncToGenerator(
|
|
494
|
-
/*#__PURE__*/
|
|
495
|
-
regeneratorRuntime.mark(function _callee8() {
|
|
475
|
+
var _npmInstall = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee8() {
|
|
496
476
|
var _this4 = this;
|
|
497
477
|
|
|
498
478
|
var dir,
|
|
@@ -546,9 +526,7 @@ function () {
|
|
|
546
526
|
}, {
|
|
547
527
|
key: "getPrivateDeps",
|
|
548
528
|
value: function () {
|
|
549
|
-
var _getPrivateDeps = _asyncToGenerator(
|
|
550
|
-
/*#__PURE__*/
|
|
551
|
-
regeneratorRuntime.mark(function _callee9(depth) {
|
|
529
|
+
var _getPrivateDeps = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee9(depth) {
|
|
552
530
|
var _this5 = this;
|
|
553
531
|
|
|
554
532
|
return regeneratorRuntime.wrap(function _callee9$(_context9) {
|
|
@@ -593,9 +571,7 @@ function () {
|
|
|
593
571
|
}, {
|
|
594
572
|
key: "getPackageJson",
|
|
595
573
|
value: function () {
|
|
596
|
-
var _getPackageJson = _asyncToGenerator(
|
|
597
|
-
/*#__PURE__*/
|
|
598
|
-
regeneratorRuntime.mark(function _callee10() {
|
|
574
|
+
var _getPackageJson = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee10() {
|
|
599
575
|
var dir,
|
|
600
576
|
lock,
|
|
601
577
|
lockModifier,
|
|
@@ -109,9 +109,7 @@ function main() {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
function _main() {
|
|
112
|
-
_main = _asyncToGenerator(
|
|
113
|
-
/*#__PURE__*/
|
|
114
|
-
regeneratorRuntime.mark(function _callee() {
|
|
112
|
+
_main = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
115
113
|
var packleator;
|
|
116
114
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
117
115
|
while (1) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@leverege/build-tools",
|
|
3
|
-
"version": "2.1.
|
|
4
|
-
"description": "A package
|
|
3
|
+
"version": "2.1.3",
|
|
4
|
+
"description": "A package containing leverege developer tool support",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"build": "npm run compile",
|
|
@@ -16,25 +16,29 @@
|
|
|
16
16
|
"bin": {
|
|
17
17
|
"circleate": "src/circleate",
|
|
18
18
|
"decrypt-secrets": "src/decrypt-secrets",
|
|
19
|
-
"
|
|
19
|
+
"dirty-git": "src/dirty-git",
|
|
20
20
|
"dnsify": "lib/server/dnsify/index.js",
|
|
21
|
+
"dockreate": "src/dockreate",
|
|
21
22
|
"encrypt-secrets": "src/encrypt-secrets",
|
|
22
23
|
"getfbcfg": "src/getfbcfg",
|
|
23
24
|
"getjson": "src/getjson",
|
|
24
25
|
"git-tar": "src/git-tar",
|
|
25
|
-
"helmify": "src/helmify",
|
|
26
26
|
"helmdn": "src/helmdn",
|
|
27
|
+
"helmify": "src/helmify",
|
|
27
28
|
"helmup": "src/helmup",
|
|
29
|
+
"k8x": "src/k8x",
|
|
28
30
|
"overwhelm": "src/overwhelm",
|
|
29
31
|
"packleate": "lib/web/packleate/index.js",
|
|
30
32
|
"pkgck": "src/pkgck",
|
|
31
|
-
"pkglint": "src/pkglint"
|
|
33
|
+
"pkglint": "src/pkglint",
|
|
34
|
+
"prune-git": "src/prune-git",
|
|
35
|
+
"pull-git": "src/pull-git"
|
|
32
36
|
},
|
|
33
37
|
"author": "Leverege Devs",
|
|
34
38
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
35
39
|
"dependencies": {
|
|
36
40
|
"@google-cloud/kms": "^1.6.3",
|
|
37
|
-
"async": "^3.
|
|
41
|
+
"async": "^3.2.0",
|
|
38
42
|
"chalk": "^3.0.0",
|
|
39
43
|
"cloudflare": "^2.7.0",
|
|
40
44
|
"command-line-args": "^5.1.1",
|
|
@@ -54,12 +58,12 @@
|
|
|
54
58
|
},
|
|
55
59
|
"devDependencies": {
|
|
56
60
|
"@babel/cli": "^7.8.4",
|
|
57
|
-
"@babel/core": "^7.8.
|
|
61
|
+
"@babel/core": "^7.8.7",
|
|
58
62
|
"@babel/plugin-proposal-class-properties": "^7.8.3",
|
|
59
63
|
"@babel/plugin-proposal-optional-chaining": "^7.8.3",
|
|
60
|
-
"@babel/preset-env": "^7.8.
|
|
61
|
-
"@babel/register": "^7.8.
|
|
62
|
-
"@leverege/eslint-config-leverege": "^2.0.
|
|
64
|
+
"@babel/preset-env": "^7.8.7",
|
|
65
|
+
"@babel/register": "^7.8.6",
|
|
66
|
+
"@leverege/eslint-config-leverege": "^2.0.10",
|
|
63
67
|
"core-js": "^3.6.4"
|
|
64
68
|
}
|
|
65
69
|
}
|
package/src/dirty-git
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
CLEAN="\e[32m✔\e[0m"
|
|
4
|
+
DIRTY="\e[31m✘\e[0m"
|
|
5
|
+
STASH="\e[33;44m$\e[0m"
|
|
6
|
+
|
|
7
|
+
clear
|
|
8
|
+
printf "${CLEAN} clean ${DIRTY} dirty ${STASH} stashed\n\n"
|
|
9
|
+
for dir in $@;
|
|
10
|
+
do
|
|
11
|
+
[ ! -d $dir ] || [ ! -d $dir/.git ] && continue
|
|
12
|
+
cd $dir &>/dev/null
|
|
13
|
+
branch=`git symbolic-ref --short HEAD`
|
|
14
|
+
[[ `git status --porcelain` ]] && status="$DIRTY" || status="$CLEAN"
|
|
15
|
+
scount=`git stash list | wc -l`
|
|
16
|
+
[ $scount -gt 0 ] && stash="\e[33;44m$\e[0m" || stash=" "
|
|
17
|
+
cd - &>/dev/null
|
|
18
|
+
printf "${status} %-28s ${stash} %s\n" $dir $branch
|
|
19
|
+
done
|
package/src/helmup
CHANGED
|
@@ -159,7 +159,12 @@ function monitoringHelp(){
|
|
|
159
159
|
export POD_NAME=\$(kubectl get pods --namespace monitoring -l 'app=prometheus,component=alertmanager' -o jsonpath='{.items[0].metadata.name}')
|
|
160
160
|
kubectl --namespace monitoring port-forward \$POD_NAME 9093
|
|
161
161
|
|
|
162
|
-
`color
|
|
162
|
+
`color g "Proxy to Grafana (the charts you're looking for):"`
|
|
163
|
+
export GRAFANA_POD=\$(kubectl --namespace monitoring get pods -l 'app.kubernetes.io/instance=grafana' -o jsonpath='{.items[0].metadata.name}')
|
|
164
|
+
kubectl --namespace monitoring port-forward \$GRAFANA_POD 3000 &
|
|
165
|
+
sleep 2; open http://localhost:3000/d/stackdriver/stackdriver?orgId=1
|
|
166
|
+
|
|
167
|
+
`color toast "Save monitoring login to Keeweb"` => `color r "admin / $MONPASS"`
|
|
163
168
|
|
|
164
169
|
`color g "Show this helpful message again with"` => `color r "helmup monitoring-wtf"`
|
|
165
170
|
|
package/src/k8x
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
[ -f overwhelm.yaml ] && [ -f package.json ] && npm run ahoy
|
|
4
|
+
|
|
5
|
+
pod=$(kubectl get pods --all-namespaces -owide | fzf | awk '{print $1, $2}')
|
|
6
|
+
cmd=${@:-"bash"}
|
|
7
|
+
|
|
8
|
+
kubecmd="kubectl exec -it --namespace $pod -- $cmd"
|
|
9
|
+
echo " run=[${kubecmd}]"
|
|
10
|
+
|
|
11
|
+
eval ${kubecmd}
|
package/src/prune-git
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
printf "\n"
|
|
4
|
+
for dir in $@;
|
|
5
|
+
do
|
|
6
|
+
[ ! -d $dir ] && continue
|
|
7
|
+
[ ! -d $dir/.git ] && continue
|
|
8
|
+
cd $dir &>/dev/null
|
|
9
|
+
if [[ `git status --porcelain` ]];
|
|
10
|
+
then
|
|
11
|
+
printf "\e[31m✘\e[0m ${dir} - no prune\n"
|
|
12
|
+
else
|
|
13
|
+
printf "\e[32m✔\e[0m ${dir} - clean, pruning...\n"
|
|
14
|
+
git gc; git remote prune origin
|
|
15
|
+
fi
|
|
16
|
+
cd - &>/dev/null
|
|
17
|
+
done
|
|
18
|
+
printf "\n"
|
package/src/pull-git
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
printf "\n"
|
|
4
|
+
for dir in $@;
|
|
5
|
+
do
|
|
6
|
+
[ ! -d $dir ] || [ ! -d $dir/.git ] && continue
|
|
7
|
+
cd $dir &>/dev/null
|
|
8
|
+
if [[ `git status --porcelain` ]];
|
|
9
|
+
then
|
|
10
|
+
printf "\e[31m✘\e[0m ${dir} - dirty, not pulling\n"
|
|
11
|
+
else
|
|
12
|
+
printf "\e[32m✔\e[0m ${dir} - clean, pulling...\n"
|
|
13
|
+
# find . -not \( -path \*ark -prune -o -path \*helm-elasticsearch -prune \) -name values.yaml -exec rm {} \;
|
|
14
|
+
git pull
|
|
15
|
+
fi
|
|
16
|
+
cd - &>/dev/null
|
|
17
|
+
done
|
|
18
|
+
printf "\n"
|