eqxjs-create-silo-repo
v1.0.0
Published
CLI to collect multiple NestJS repositories into one combined app
Downloads
107
Readme
eqxjs-create-silo-repo
A Node.js CLI written in TypeScript that collects multiple NestJS repositories into a single runnable combined application.
Features
- Prompt repository sources one-by-one (interactive) or pass them via flags (non-interactive)
- Accepts local paths or Git URLs (
https://,git@,ssh://) - Git URL sources are added as git submodules under
submodules/ - Optional branch or commit SHA checkout per git submodule, specified inline (
url#ref) or via--ref - Runs
npm installinside every collected repository - Generates a combined NestJS app that imports each repository's
AppModule - Generated app has its own
package.json,tsconfig.json, andmain.tsand is ready to start
Global Installation
Build the project first, then install it globally so the create-silo command is available anywhere:
npm run build
npm install -g .Then use it from any directory:
# Interactive
create-silo
# Non-interactive — local paths
create-silo --repo ../repo-a --repo ../repo-b
# Non-interactive — Git URLs with ref
create-silo --repo https://github.com/acme/repo-a.git --ref main
create-silo --repo https://github.com/acme/repo-a.git#main
# Uninstall
npm uninstall -g eqxjs-create-silo-repoNote: Re-run
npm run buildbefore re-installing whenever the source changes.
Prerequisites
- Node.js >= 18
- Git (required when using Git URL sources)
- The workspace must be a git repository (
git init) before adding Git URL sources
Installation
npm installScripts
| Script | Description |
|---|---|
| npm start | Run the CLI directly via ts-node |
| npm run build | Compile TypeScript to dist/ |
| npm run start:js | Run compiled CLI from dist/ |
| npm test | Run unit tests |
| npm run test:coverage | Run unit tests with 100% coverage enforcement |
Usage
Interactive mode
npm startEnter repository sources one-by-one. Press Enter on an empty line to finish.
Local paths:
Repository #1: ../repo-a
Repository #2: ../repo-b
Repository #3:Git URLs with optional branch or SHA (inline #ref):
Repository #1: https://github.com/acme/repo-a.git#main
Repository #2: [email protected]:acme/repo-b.git#6fc8e8f
Repository #3:YAML config file
Define all repositories in a YAML file and pass it via --config:
# silo.config.yaml
name: my-combined-app # optional — sets the name in combined-app package.json (default: combined-nest-app)
version: 1.2.0 # optional — sets the version in combined-app package.json (default: 1.0.0)
repositories:
- source: https://github.com/acme/repo-a.git
ref: main
- source: [email protected]:acme/repo-b.git
ref: 6fc8e8f
- source: ../local-repo-c# Run with config file
npm start -- --config ./silo.config.yaml
# Mix config file with extra --repo flags
npm start -- --config ./silo.config.yaml --repo ../extra-repoA ready-to-use template is provided in silo.config.example.yaml.
Non-interactive mode
Pass --repo once per repository. Append #ref inline or use --ref immediately after the relevant --repo:
# Local paths
npm start -- --repo ../repo-a --repo ../repo-b
# Git URLs — inline ref
npm start -- --repo https://github.com/acme/repo-a.git#main
# Git URLs — --ref flag
npm start -- --repo https://github.com/acme/repo-a.git --ref main
# Mixed
npm start -- --repo ../repo-a --repo https://github.com/acme/repo-b.git#6fc8e8fRunning the compiled build
npm run build
npm run start:js -- --repo ../repo-a --repo ../repo-bOutput
After the CLI completes, a combined-app/ directory is created:
combined-app/
├── src/
│ ├── app.module.ts # imports each repository AppModule
│ └── main.ts # Nest bootstrap on port 3000 (or $PORT)
├── package.json
└── tsconfig.jsonStart the combined application:
cd combined-app
npm startTesting
The project ships with comprehensive unit tests covering 100% of statements, branches, functions, and lines.
src/
├── lib.ts # All exported pure functions
├── cli.ts # main() entrypoint
└── __tests__/
├── lib.test.ts # Unit tests for all lib functions
└── cli.test.ts # Unit tests for main() with mocked dependenciesRun tests:
# Run tests once
npm test
# Run with coverage report (enforces 100% threshold)
npm run test:coverageCoverage is enforced at 100% for statements, branches, functions, and lines. The CI build will fail if any new code is added without corresponding tests.
Git Submodule Notes
- Git URL repositories are added via
git submodule addintosubmodules/<repo-name>_<index>/ - When a
refis provided the CLI runsgit checkout <ref>inside the submodule after adding it - To remove a submodule run
git submodule deinitandgit rmfor the relevant path
