Wetkitty-templator npm

This commit is contained in:
a.romanov 2020-04-29 16:38:41 +03:00
parent 8a68b2e03e
commit 645455550f
6 changed files with 74 additions and 24 deletions

View File

@ -16,6 +16,7 @@
# wetkitty-templator
Скрипт для быстрой подготовки к выкатке в wetkitty.
1. Проставляет для сервиса image-tag: id последнего коммита в master
2. Создает коммит с commit message последнего коммита feature-ветки
3. Создает ветку с таким же названием, как у feature-ветки
@ -23,7 +24,6 @@
#### Usage
Находясь в корневой директории сервиса в feature-ветке:
```
sh ../wetkitty-templator
```
1. Перейти в корневую директорию сервиса
2. Переключиться на feature-ветку
3. Запустить в консоли команду `wetkitty-templator`

67
npm-shrinkwrap.json generated
View File

@ -1,6 +1,6 @@
{
"name": "@pospolitanv/rbk-templator",
"version": "0.1.4",
"version": "0.1.7",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@ -18,6 +18,11 @@
"resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-1.1.3.tgz",
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw=="
},
"@types/color-name": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ=="
},
"ansi-escapes": {
"version": "3.1.0",
"resolved": "http://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz",
@ -29,11 +34,27 @@
"integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8="
},
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
"integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"requires": {
"color-convert": "^1.9.0"
"@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
},
"dependencies": {
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
}
}
},
"arr-diff": {
@ -243,13 +264,12 @@
}
},
"chalk": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
"integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz",
"integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==",
"requires": {
"ansi-styles": "^3.2.1",
"escape-string-regexp": "^1.0.5",
"supports-color": "^5.3.0"
"ansi-styles": "^4.1.0",
"supports-color": "^7.1.0"
}
},
"change-case": {
@ -1889,6 +1909,16 @@
}
}
},
"shelljs": {
"version": "0.8.4",
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz",
"integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==",
"requires": {
"glob": "^7.0.0",
"interpret": "^1.0.0",
"rechoir": "^0.6.2"
}
},
"signal-exit": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz",
@ -2109,11 +2139,18 @@
}
},
"supports-color": {
"version": "5.5.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
"integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
"version": "7.1.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz",
"integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==",
"requires": {
"has-flag": "^3.0.0"
"has-flag": "^4.0.0"
},
"dependencies": {
"has-flag": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
"integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
}
}
},
"swap-case": {

View File

@ -5,12 +5,14 @@
"plop": "plop"
},
"dependencies": {
"chalk": "latest",
"chalk": "^4.0.0",
"child_process": "^1.0.2",
"plop": "^2.2.0",
"simple-git": "^1.107.0",
"child_process": "^1.0.2"
"shelljs": "^0.8.4"
},
"bin": {
"rbk-templator": "./index.js"
"rbk-templator": "./rbk-templator.js",
"wetkitty-templator": "./wetkitty-templator.js"
}
}

View File

@ -14,13 +14,13 @@ git checkout master
git pull origin master
OLD_IMAGE_TAG=`grep -A 5 "$SERVICE:" macroservice.sls | grep image-tag | grep -o '"[^"]\+"' | sed 's/"//g'`
sed -i '' -e "s/$OLD_IMAGE_TAG/$NEW_IMAGE_TAG/" macroservice.sls
sed -i '' -e "s/$OLD_IMAGE_TAG/$NEW_IMAGE_TAG/" macroservice.sls
git checkout -b $BRANCH
git add macroservice.sls
git status
git commit -m "$MESSAGE"
git push origin $BRANCH
git push origin $BRANCH
echo ""
echo "===================="

11
wetkitty-templator.js Executable file
View File

@ -0,0 +1,11 @@
#!/usr/bin/env node
'use strict';
const fs = require('fs')
const path = require('path');
const root = path.dirname(require.main.filename);
const script = fs.readFileSync(root + "/scripts/wetkitty-templator.sh", "utf8")
const shell = require('shelljs');
shell.exec(script)