commaid2 v0.6.4
___ ___ ___ ___ ___ _____
/ /\ / /\ /__/\ /__/\ / /\ ___ / /::\
/ /:/ / /::\ | |::\ | |::\ / /::\ / /\ / /:/\:\
/ /:/ / /:/\:\ | |:|:\ | |:|:\ / /:/\:\ / /:/ / /:/ \:\
/ /:/ ___ / /:/ \:\ __|__|:|\:\ __|__|:|\:\ / /:/~/::\ /__/::\ /__/:/ \__\:|
/__/:/ / /\ /__/:/ \__\:\ /__/::::| \:\ /__/::::| \:\ /__/:/ /:/\:\ \__\/\:\__ \ \:\ / /:/
\ \:\ / /:/ \ \:\ / /:/ \ \:\~~\__\/ \ \:\~~\__\/ \ \:\/:/__\/ \ \:\/\ \ \:\ /:/
\ \:\ /:/ \ \:\ /:/ \ \:\ \ \:\ \ \::/ \__\::/ \ \:\/:/
\ \:\/:/ \ \:\/:/ \ \:\ \ \:\ \ \:\ /__/:/ \ \::/
\ \::/ \ \::/ \ \:\ \ \:\ \ \:\ \__\/ \__\/
\__\/ \__\/ \__\/ \__\/ \__\/
Commaid
Manage several projects simultaneously in one place
Important:
This project includes code adapted from PM2 by Strzelewicz Alexandre, available at PM2, licensed under the GNU AGPL 3.0 license.
Requirements
Install Node.js version >=10.0.0
You can install Node.js easily with NVM or ASDF.
Install
Using NPM:
npm install -g commaid
Configurations
Project's config folder
Config folder is defined as ~/.commaid
by default.
Note: Config folder path could be changed by modifying CONFIG_FOLDER
constants inside src/constants.ts
.
Project's config file
Config file's name is projects-config.json
by default.
Note: Config file name could be changed by modifying CONFIG_FILE
constants inside src/constants.ts
.
{
"cwd": "/Users/user-name/Documents/code",
"user": "general_user",
"projects": {
"freeCodeCamp": {
"user": "specific_user",
"originUrl": "git@github.com:freeCodeCamp/freeCodeCamp.git",
"branches": {
"main": "main",
"dev": "develop"
}
},
"pm2": {
"isRunnable": false,
"cwd": "/Users/user-name/Documents/code2",
"originUrl": "git@github.com:Unitech/pm2.git",
"branches": {
"main": "master",
"dev": "development"
}
}
}
}
Attributes available
1. General:
| Field | Required | Type | Description |
| ------------- | -------- | ----------------------------- | ------------------------------------------------------------------------------- |
| projects
| TRUE | Project 2 array | Could be empty, projects to work with. |
| cwd
| TRUE | string | Projects main location. |
| user
| FALSE | string | General project's git user. This value will be replaced on project's url. |
| commands
| FALSE | Commands 4 | Possible executable accions in a project. |
| scripts
| FALSE | Scripts 5* | Executable scripts. |
2. Project:
| Field | Required | Type | Description |
| ------------- | -------- | ---------------------- | --------------------------------------------------------------------------------- |
| isRunnable
| FALSE | boolean | Represent whether or not project is capable of being executed, true by default. |
| originUrl
| TRUE | string | Git project's url, could be the https or ssh url. This value could use <user>
key to replace with the user defined dynamically. |
| branches
| TRUE | string | Project's branches 3. |
| cwd
| FALSE | string | Specific project's location. |
| user
| FALSE | string | Specific project's git user. This value will be replaced on project's url. |
| commands
| FALSE | string | Possible executable accions in a project. |
| scripts
| FALSE | Scripts 5 | Executable scripts. |
3. Commands:
| Field | Required | Type | Description |
| ---------------------- | -------- | ------- | ------------------------------------------------- |
| clone
| FALSE | string | Project's name. |
| install
| FALSE | string | Git project's url, could be the https or ssh url. |
| update
| FALSE | string | Project's base branch. |
4. Scripts:
- Important: All projects defined should keep the same scripts structure.
Field | Required | Type | Description |
---|---|---|---|
x | FALSE | string | Executable script. You could define the number of branches you want. |
5. Branches:
- Important: All projects defined should keep the same branch structure.
Field | Required | Type | Description |
---|---|---|---|
main | TRUE | string | Base project's branch. |
x | FALSE | string | Other branches. You could define the number of branches you want. |
Usage
There are some facilities that have been created to improve your mental health working with several projects.
Generate initial config file
Generate a default file with sample values into config folder.
commaid init
clone
projects
Clone the projects defined on projects
in CONFIG_FILE
.
The workind directory for these projects corresponds to the one defined on cwd
in CONFIG_FILE
.
commaid clone [options]
Options
-s --stop-on-error Stop process on installation error
-p --projects [projects...] List of projects to be affected (default: all)
- Clone ALL projects.
commaid clone
- Clone ALL projects, stopping on errors.
commaid clone -s
commaid clone --stop-on-error
- Clone SOME projects.
commaid clone -p project1 project2
- Clone SOME projects, stopping on errors.
commaid clone -p project1 project2 -s
commaid clone -p project1 project2 --stop-on-error
install
projects
Install the projects defined on projects
in CONFIG_FILE
.
The workind directory for these projects corresponds to the one defined on cwd
in CONFIG_FILE
.
commaid install [options]
Options
-s --stop-on-error Stop process on installation error
-p --projects [projects...] List of projects to be affected (default: all)
- Install ALL projects.
commaid install
- Install ALL projects, stopping on errors.
commaid install -s
commaid install --stop-on-error
- Install SOME projects.
commaid install -p project1 project2
- Install SOME projects, stopping on errors.
commaid install -p project1 project2 -s
commaid install -p project1 project2 --stop-on-error
update
projects
Update a branch into the projects defined on projects
in CONFIG_FILE
.
The workind directory for these projects corresponds to the one defined on cwd
in CONFIG_FILE
.
commaid update <branch> [options]
Options
-s --stop-on-error Stop process on installation error
-p --projects [projects...] List of projects to be affected (default: all)
- Update ALL projects.
commaid update main
- Update ALL projects, stopping on errors.
commaid update main -s
commaid update main --stop-on-error
- Update SOME projects.
commaid update main -p project1 project2
- Update SOME projects, stopping on errors.
commaid update main -p project1 project2 -s
commaid update main -p project1 project2 --stop-on-error
exec command
on projects
Exec a command into the projects defined on defined on projects
in CONFIG_FILE
.
The workind directory for these projects corresponds to the one defined on cwd
in CONFIG_FILE
.
commaid exec [options] -c <command> [-- <args>]
Options
-s --stop-on-error Stop process on installation error
-p --projects [projects...] List of projects to be affected (default: all)
- Exec a command on ALL projects.
commaid exec -c npm run test
# Using command args
commaid exec -c npm run test -- -u -t="ColorPicker"
- Exec a command on ALL projects, stopping on errors.
commaid exec -s -c npm run test
commaid exec --stop-on-error -c npm run test
# Using command args
commaid exec -s -c npm run test -- -u -t="ColorPicker"
commaid exec --stop-on-error -c npm run test -- -u -t="ColorPicker"
- Exec a command on SOME projects.
commaid exec -p project1 project2 -c npm run test
# Using command args
commaid exec -p project1 project2 -c npm run test -- -u -t="ColorPicker"
- Exec a command on SOME projects, stopping on errors.
commaid exec -p project1 project2 -s -c npm run test
commaid exec -p project1 project2 --stop-on-error -c npm run test
# Using command args
commaid exec -p project1 project2 -s -c npm run test -- -u -t="ColorPicker"
commaid exec -p project1 project2 --stop-on-error -c npm run test -- -u -t="ColorPicker"
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.