create-ut
v1.3.7
Published
Tool for creating UT microservices and applications
Maintainers
Readme
create-ut
Tool for creating applications, microservices, ports, etc.,
based on UnderTree framework.
Usage
Use with npm init
User creates application, microservice, port or anything else by running:
create
applicationin the current folder namedimpl-*npm init ut npm init ut app[-kind]create
applicationin a new folder namedimpl-namenpm init ut app[-kind] impl-namecreate
microservicein the current folder namedut-*npm init ut ms[-kind] npm init ut service[-kind] npm init ut microservice[-kind]create
microservicein new folder namedut-namenpm init ut ms[-kind] ut-name npm init ut service[-kind] ut-name npm init ut microservice[-kind] ut-namecreate
portin the current folder namedut-port-*npm init ut port[-kind]create
portin new folder namedut-port-namenpm init ut port[-kind] ut-port-namemodify a local repo based on its
.ut-createdefinitionnpm init ut path-to-repo
Algorithm
Clone latest version of package
impl-application[-kind]orut-microservice[-kind]. Obtain repository by usingpackage-jsonin a way similar to:const gitUrl = async () => await require('package-json')('impl-application', {registryUrl: 'nexus.softwaregroup.com'})).repository.url }Require the module
.ut-createin the cloned folder, having the following structure:module.exports = { params: { schema: { properties: { id: { type: 'string', title: 'Package identifier' }, title: { type: 'string', title: 'Package title' }, userName: { type: 'string', title: 'User name', default: 'based on output from git config --get user.email' } }, required: ['id', 'title', 'userName'] }, uiSchema: { } }, rename: ({id, title, userName}) => [{ files: 'server/**/*.js', replace: [ /implementation: 'product'/, `implementation: '${id}'` ] }, { files: 'server/**/*.json', replace: [ /"implementation": "product"/, `"implementation": '${id}'` ] }, { files: 'ut_*_rc', // example is for YAML based rc replace: [[ /database: impl-firstName-lastName/, `database: impl-${userName.split('.').join('-')}` ],[ /user: firstName\.lastName/, `user: ${userName}` ]] } /*etc*/] };Use
ut-form-jsonschemato create a form based on theparamsproperty increate.js. Usually the following parameters are required:- package
id- for example "agency" - package
title- for example "Agency banking" - developer
userName- as used by gitfirst.last@softwaregroup.com, can be retrieved withgit config --get user.email
Start the default browser with the form URL and wait for the form to be submitted
- package
Do string replacement by using the information returned by the
renamefunction increate.js. The propertyfilesspecifies a glob pattern for files to be searched. The string or regular expression inreplacearray first element is used to find text to be replaced by the expression in thereplacearray second element (as in string.replace). Ifreplaceis array of arrays, apply the replacement multiple times.Change git remote:
git remote set-url origin git@xxx:yyy/zzz.gitCreate Jenkins job
TODO add description
Configure git web hook to trigger Jenkins job
TODO add description
