1.101.0 • Published 1 month ago

tln-cli v1.101.0

Weekly downloads
144
License
gpl-3.0
Repository
github
Last release
1 month ago

Talan CLI - Advanced Component Management System

Talan CLI (tln) is an open-source framework for managing third-party components from a wide range of ecosystems (Java, Node.js, C++, Golang, Angular etc.). tln helps to create fully isolated development environments, uniformly manage mono- & multi- repo configurations, build smooth onboarding experience, melt borders between local development environments and CI/CT/CD setups, get maximum from Polyglot Programming Polyglot Persistence (4Ps) design.

Upcoming 2.x release will bring a new key feature: AaC - Architecture-as-Code.

Similar or related projects

Brew, Conan, Meta, Lerna, SDKMAN, jEnv, Chocolatey

Prerequisites

  • Install Nodejs 16.x or higher (https://nodejs.org)

    Linux

    curl -sL https://deb.nodesource.com/setup_16.x -o nodesource_setup.sh && sudo bash nodesource_setup.sh && sudo apt-get install -y nodejs && node -v
  • Make sure that wget is accessible via command line (Linux/MacOS)

  • Make sure that Powershell script can be executed (Windows):
    set-executionpolicy remotesigned
    or
    set-ExecutionPolicy unrestricted
  • Install tln-cli
    npm i -g tln-cli && tln --version

Quick start ~3 min

  • Create folder where all your projects will be located

    • Linux/MacOs
      cd ~
    • Windows (you can use any disk, disk d: is used for demonstration purpose)
      d:
      cd /
    mkdir projects && cd projects && tln config --terse
  • Create folder for the hellotalan project (inside projects folder)

    mkdir hellotalan && cd hellotalan && tln config --terse
  • Edit .tln.conf file to get next configuration (you can just copy-paste it)
    module.exports = {
      options: async (tln, args) => {},
      env: async (tln, env) => {},
      dotenvs: async (tln) => [],
      inherits: async (tln) => [],
      depends: async (tln) => ['openjdk-18', 'mvn-3.8.6', 'go-1.19.2', 'node-16.18.0', 'kubectl-1.23.13', 'firebase-11.15.0'],
      steps: async (tln) => [],
      components: async (tln) => []
    }
  • Next command will install all components were listed inside depends section from .tln.conf. Components will be installed inside projects folder and will not affect any other already installed software.
    tln install --depends
  • Check version of installed components
    tln versions --depends
    [java]
    openjdk version "18" 2022-03-22
    OpenJDK Runtime Environment (build 18+36-2087)
    OpenJDK 64-Bit Server VM (build 18+36-2087, mixed mode, sharing)
    [maven]
    Apache Maven 3.8.6 (84538c9988a25aec085021c365c560670ad80f63)
    Maven home: /root/projects/maven/mvn-3.8.6
    Java version: 1.8.0_342, vendor: Private Build, runtime: /usr/lib/jvm/java-8-openjdk-amd64/jre
    Default locale: en, platform encoding: UTF-8
    OS name: "linux", version: "4.15.0-194-generic", arch: "amd64", family: "unix"
    [golang]
    go version go1.19.2 linux/amd64
    [node]
    v16.18.0
    [npm]
    8.19.2
    [kubectl]
    Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.13", GitCommit:"592eca05be27f7d927d0b25cbb4241d75a9574bf", GitTreeState:"clean", BuildDate:"2022-10-12T10:57:16Z", GoVersion:"go1.17.13", Compiler:"gc", Platform:"linux/amd64"}
    [firebase]
    11.15.0

tln architecture & in-depth details

Real life scenario ~15 min

Let's say, you've joined Calbro.com company to head software project development. You will need to build new service as part of multiple already in-production applications. Your first steps are: configure local development environment, checkout existing projects and create initial structure for the new one.

Calbro projects home

  • First step is to configure Calbro components

    • Linux/MacOs
      > cd ~/projects
    • Windows
      > d:
      > cd /projects
    > mkdir calbro
    > cd calbro

    For the next command replace Alice account name and email with your own (for this tutorial, please use your Github account)

    > tln config --terse -e TLN_GIT_USER=Alice -e TLN_GIT_EMAIL=alice@calbro.com --inherit git
  • If you check created configuration file .tln.conf, you will see following JSON structure

    module.exports = {
      options: async (tln, args) => {},
      env: async (tln, env) => {
        env.TLN_GIT_USER = 'Alice';
        env.TLN_GIT_EMAIL = 'alice@calbro.com';
      },
      dotenvs: async (tln) => [],
      inherits: async (tln) => ['git'],
      depends: async (tln) => [],
      steps: async (tln) => [],
      components: async (tln) => []
    }

    This information will be used by all subsequent git calls.

Checkout, configure & build existing projects

Calbo is a big company and has a lot of teams and ongoing projects. You know that Calbro is using tln to deal with internal complexity, so onboarding should be straightforward.

  • You are part of teamone team and this should be reflected as part of your local dev environment

    > mkdir teamone
    > cd teamone
    
    # for ssh access
    > tln config --repo git@github.com:project-talan/calbro-teamone-tln.git
    # for https access
    # tln config --repo https://github.com/project-talan/tln-calbro-teamone.git
    
    > tln ls

    Two last commands will do the magic: get teamone list of projects and display them to you

    Configuration file .tln/.tlf.conf can unhide more details

    module.exports = {
      options: async (tln) => [],
      dotenvs: async (tln) => [],
      inherits: async (tln) => [],
      depends: async (tln) => [],
      env: async (tln, env) => {
        env.TLN_GIT_SSH_PREFIX = 'git@github.com:';
        env.TLN_GIT_HTTPS_PREFIX = 'https://github.com/';  
        env.TLN_GIT_ORIGIN = `${env.TLN_GIT_USER}/${env.TLN_COMPONENT_ID}.git`;
        env.TLN_GIT_UPSTREAM = `project-talan/${env.TLN_COMPONENT_ID}.git`;
      },
      steps: async (tln) => [],
      components: async (tln) => [
        { id: 'calbro-scanner' },
        { id: 'calbro-portal' }
      ]
    }
  • At this point, you are ready to get source code of the existing projects, build it and start checking implemented functionality

    # for ssh access
    > tln clone calbro-scanner:calbro-portal
    # for https access
    # tln clone calbro-scanner:calbro-portal -- --https
    
    > tln install calbro-portal:calbro-scanner --depends
    > tln prereq:init -r
    > tln build -r
    • First command will use git clone and your credentials were defined early inside .tln.conf
    • Second will install all necessary third-parties components
    • Third one will generate .env file if any, using template, and run initialization commands like npm i
    • The last command will recursivelly build all components

Skeleton for the new project

You project is still at early stage, there are a lot of uncertainty, but you have to push it forward.

It's also not clear will be project based on SOA or Microservices or even N-tier, so you are ok to start with mono repo, but at the same time you want to build structure which can be splitted later if needed.

Calbro software development culture also includes recommendation to reuse wide range of project templates and you will follow this practice too.

  • This is how your initial concept looks like:

    • Admin Frontend - Angular, a couple of developers have joined your team recently with necessary skills, Admin Backend - Nodejs
    • API service - Go, since this is general company strategy and your project should be aligned with it
    • Auth service will utilize Nodejs again, since it will be handled by the developer who will be working on Admin part
    • You need to have two types of persistent storages - SQL & NoSQL, because initial analysis shows that we can't have "shoes for all feets" approach
    • Managment wants to go with mobile-first approach, so you will try satisfy this requirement by using Cordova and reuse our Javascript based frontend
    • Main portal web part will use React, because it's cool
    • We also need Java to build our automated test framework
  • So, here we go (you can copy commands below into create.sh script and execute them in a single run)

    mkdir calbro-reporting && \
    cd calbro-reporting && \
    tln init-repo && \
    tln config --terse && git add . && git commit -m"empty repo" && \
    tln subtree-add -- --prefix static/admin --subtree https://github.com/project-talan/tln-angular.git --ref master && \
    tln subtree-add -- --prefix static/portal --subtree https://github.com/project-talan/tln-react.git --ref master && \
    tln subtree-add -- --prefix services/admin --subtree https://github.com/project-talan/tln-nodejs.git --ref master && \
    tln subtree-add -- --prefix services/api --subtree https://github.com/project-talan/tln-golang.git --ref master && \
    tln subtree-add -- --prefix services/auth --subtree https://github.com/project-talan/tln-nodejs.git --ref master && \
    tln subtree-add -- --prefix dbs/mongo --subtree https://github.com/project-talan/tln-mongodb.git --ref master && \
    tln subtree-add -- --prefix dbs/postgresql --subtree https://github.com/project-talan/tln-postgresql.git --ref master && \
    tln subtree-add -- --prefix mobile/cordova --subtree https://github.com/project-talan/tln-cordova.git --ref master && \
    tln subtree-add -- --prefix qa/api --subtree https://github.com/project-talan/tln-java.git --ref master && \
    tln subtree-add -- --prefix qa/load --subtree https://github.com/project-talan/tln-java.git --ref master && \
    tln subtree-add -- --prefix qa/e2e --subtree https://github.com/project-talan/tln-java.git --ref master && \
    tln config dbs:mobile:qa:services:static --terse && \
    git add . && git commit -m"Initial skeleton" && \
    cd ..

    Windows (create.cmd)

    mkdir calbro-reporting && ^
    cd calbro-reporting && ^
    tln init-repo && ^
    tln config --terse && git add . && git commit -m"empty repo" && ^
    tln subtree-add -- --prefix static/admin --subtree https://github.com/project-talan/tln-angular.git --ref master && ^
    tln subtree-add -- --prefix static/portal --subtree https://github.com/project-talan/tln-react.git --ref master && ^
    tln subtree-add -- --prefix services/admin --subtree https://github.com/project-talan/tln-nodejs.git --ref master && ^
    tln subtree-add -- --prefix services/api --subtree https://github.com/project-talan/tln-golang.git --ref master && ^
    tln subtree-add -- --prefix services/auth --subtree https://github.com/project-talan/tln-nodejs.git --ref master && ^
    tln subtree-add -- --prefix dbs/mongo --subtree https://github.com/project-talan/tln-mongodb.git --ref master && ^
    tln subtree-add -- --prefix dbs/postgresql --subtree https://github.com/project-talan/tln-postgresql.git --ref master && ^
    tln subtree-add -- --prefix mobile/cordova --subtree https://github.com/project-talan/tln-cordova.git --ref master && ^
    tln subtree-add -- --prefix qa/api --subtree https://github.com/project-talan/tln-java.git --ref master && ^
    tln subtree-add -- --prefix qa/load --subtree https://github.com/project-talan/tln-java.git --ref master && ^
    tln subtree-add -- --prefix qa/e2e --subtree https://github.com/project-talan/tln-java.git --ref master && ^
    tln config dbs:mobile:qa:services:static --terse && ^
    git add . && git commit -m"Initial skeleton" && ^
    cd ..
  • Initial structure is ready and we can verify mounted subtrees

    > tln ls-subtrees calbro-reporting
    PrefixSubtreeRef
    static/adminhttps://github.com/project-talan/tln-angular.gitmaster
    static/portalhttps://github.com/project-talan/tln-react.gitmaster
    services/adminhttps://github.com/project-talan/tln-nodejs.gitmaster
    services/apihttps://github.com/project-talan/tln-golang.gitmaster
    services/authhttps://github.com/project-talan/tln-nodejs.gitmaster
    dbs/mongohttps://github.com/project-talan/tln-mongodb.gitmaster
    dbs/postgresqlhttps://github.com/project-talan/tln-postgresql.gitmaster
    mobile/cordovahttps://github.com/project-talan/tln-cordova.gitmaster
    qa/apihttps://github.com/project-talan/tln-java.gitmaster
    qa/loadhttps://github.com/project-talan/tln-java.gitmaster
    qa/e2ehttps://github.com/project-talan/tln-java.gitmaster
  • And the final step is to observe ready to use development environment structure with all necessary dependencies

    > tln ls / -d 5 --all --installed-only
    /
    ├ angular
    │ ├ angular-9.1.8
    │ └ angular-9.1.7
    ├ calbro
    │ └ teamone
    │   ├ calbro-portal
    │   ├ calbro-reporting
    │   │ ├ dbs
    │   │ │ ├ mongo
    │   │ │ └ postgresql
    │   │ ├ mobile
    │   │ │ └ cordova
    │   │ ├ qa
    │   │ │ ├ api
    │   │ │ ├ e2e
    │   │ │ └ load
    │   │ ├ services
    │   │ │ ├ admin
    │   │ │ ├ api
    │   │ │ └ auth
    │   │ └ static
    │   │   ├ admin
    │   │   └ portal
    │   └ calbro-scanner
    ├ cordova
    │ └ cordova-9.0.0
    ├ golang
    │ └ go-1.14.4
    ├ hellotalan
    ├ java
    │ ├ openjdk-14.0.1
    │ └ openjdk-11.0.2
    ├ maven
    │ └ mvn-3.6.3
    └ nodejs
      └ node-14.4.0
1.101.0

1 month ago

1.100.0

2 months ago

1.99.0

2 months ago

1.98.0

3 months ago

1.97.0

4 months ago

1.96.0

5 months ago

1.94.0

6 months ago

1.95.1

5 months ago

1.95.0

5 months ago

1.93.0

6 months ago

1.92.0

7 months ago

1.90.0

8 months ago

1.82.0

12 months ago

1.86.0

10 months ago

1.83.0

11 months ago

1.87.0

9 months ago

1.84.0

11 months ago

1.89.0

9 months ago

1.88.0

9 months ago

1.91.0

8 months ago

1.85.0

11 months ago

1.79.0

1 year ago

1.80.0

1 year ago

1.76.0

1 year ago

1.78.0

1 year ago

1.81.0

12 months ago

1.77.0

1 year ago

1.70.0

1 year ago

1.74.0

1 year ago

1.68.0

2 years ago

1.71.0

1 year ago

1.75.0

1 year ago

1.69.0

2 years ago

1.72.0

1 year ago

1.73.0

1 year ago

1.67.0

2 years ago

1.64.0

2 years ago

1.65.0

2 years ago

1.66.0

2 years ago

1.56.0

2 years ago

1.63.0

2 years ago

1.55.0

2 years ago

1.57.0

2 years ago

1.60.0

2 years ago

1.58.0

2 years ago

1.61.0

2 years ago

1.53.0

2 years ago

1.59.0

2 years ago

1.62.0

2 years ago

1.51.0

2 years ago

1.52.0

2 years ago

1.48.0

2 years ago

1.49.0

2 years ago

1.50.0

2 years ago

1.47.0

2 years ago

1.39.1

2 years ago

1.39.0

2 years ago

1.40.0

2 years ago

1.42.0

2 years ago

1.44.0

2 years ago

1.46.0

2 years ago

1.41.0

2 years ago

1.43.0

2 years ago

1.45.0

2 years ago

1.37.0

2 years ago

1.36.0

3 years ago

1.38.0

2 years ago

1.35.0

3 years ago

1.34.0

3 years ago

1.33.0

3 years ago

1.32.0

3 years ago

1.31.0

3 years ago

1.30.0

3 years ago

1.29.0

3 years ago

1.28.0

3 years ago

1.27.0

3 years ago

1.25.0

3 years ago

1.26.0

3 years ago

1.24.0

3 years ago

1.21.0

3 years ago

1.23.0

3 years ago

1.22.0

3 years ago

1.20.0

3 years ago

1.19.0

3 years ago

1.18.0

3 years ago

1.17.0

3 years ago

1.16.0

3 years ago

1.15.0

3 years ago

1.14.11

3 years ago

1.14.10

3 years ago

1.14.9

3 years ago

1.14.8

3 years ago

1.14.7

3 years ago

1.14.6

3 years ago

1.14.5

3 years ago

1.14.4

3 years ago

1.14.3

3 years ago

1.14.2

3 years ago

1.14.1

3 years ago

1.14.0

4 years ago

1.13.0

4 years ago

1.12.1

4 years ago

1.12.0

4 years ago

1.11.0

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.7.0

4 years ago

1.6.0

4 years ago

1.5.0

4 years ago

1.4.1

4 years ago

1.4.0

4 years ago

1.3.1

4 years ago

1.3.0

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.6.7

4 years ago

0.6.6

4 years ago

0.6.5

4 years ago

0.6.4

4 years ago

0.6.3

5 years ago

0.6.2

5 years ago

0.6.1

5 years ago

0.6.0

5 years ago

0.5.0

5 years ago

0.4.0

5 years ago

0.3.1

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago