cli/readme.md
2024-06-21 19:48:43 +02:00

208 lines
5.9 KiB
Markdown

# @git.zone/cli
A CLI toolbelt to streamline local development cycles by using various gitzone utilities.
## Install
To install the `@git.zone/cli` tool, you need to have Node.js and npm installed on your machine. Once you have those set up, you can install the CLI tool globally using the following command:
```shell
npm install -g @git.zone/cli
```
This will add the `gitzone` or `gzone` command to your PATH, allowing you to use the tool from any directory.
## Usage
The `gitzone` CLI is designed to streamline various aspects of the local development cycle, including project setup, maintenance, and deployment. Below, we'll go through several scenarios that demonstrate the capabilities of `gitzone`.
### Getting Started
To start using `gitzone`, you need to initialize a new project or use it with an existing one. This section will guide you through the initial setup and provide examples of the core commands.
#### Initialize a New Project
`gitzone` can create several types of projects, including standard npm modules, websites using LitElement, and custom web components. To create a new project, you can use the following command:
```shell
gitzone template [templatename]
```
Replace `[templatename]` with one of the following:
- `npm`: A standard npm module with TypeScript support, testing, and CI/CD setup.
- `website`: A LitElement-based website with e2e testing, bundling, and service worker support.
- `element`: A LitElement standard setup for creating web components.
Example of starting a new npm project:
1. Open your terminal and navigate to the directory where you want to create your project.
2. Execute the following command:
```shell
gitzone template npm
```
3. Follow the interactive prompts to set up your project. You will be asked to provide information such as the project name, description, GitHub repository, etc.
#### Committing Changes
To standardize commit messages and increment versions based on change types (fix, feat, breaking change):
```shell
gitzone commit
```
This command will prompt you with a series of questions to help construct a standardized commit message and create a new commit.
#### Deprecating a Package
To deprecate an old package in favor of a new one:
```shell
gitzone deprecate
```
This command will prompt you for the old and new package names and will automatically deprecate the old package on npm.
#### Opening CI/CD Settings
Quickly open the CI/CD settings page of your project repository:
```shell
gitzone open ci
```
### Example Commands
#### Project Setup and Initialization
Let's go through how to scaffold a new web component project:
1. Navigate to your desired directory.
2. Run the following command:
```shell
gitzone template element
```
3. Follow the prompts to set up your web component project.
#### Managing Project Lifecycle
Commands to manage your project's lifecycle:
- **Commit Changes:**
```shell
gitzone commit
```
- **Deprecate a Package:**
```shell
gitzone deprecate
```
- **Format Project Files:**
```shell
gitzone format
```
- **Regenerate Readme:**
```shell
gitzone readme
```
- **Update Local Repositories:**
```shell
gitzone update
```
#### Advanced Scenarios
##### Formatting
To ensure consistent formatting using Prettier:
```shell
gitzone format
```
##### Building the Project
To build your project as defined in your `package.json`:
```shell
npm run build
```
##### Git and Version Control
Check the current project version:
```shell
gitzone -v
```
To synchronize local repositories with remotes:
```shell
gitzone update
```
##### Metadata and Configuration
To initialize or update metadata:
```shell
gitzone meta init
```
### Continuous Integration and Delivery (CI/CD)
#### Running Tests
To execute tests defined in your `package.json`:
```shell
npm test
```
#### Building Documentation
Generate documentation:
```shell
npm run buildDocs
```
### Troubleshooting and Debugging
#### Detailed Logs
Enable detailed logging for troubleshooting:
```shell
gitzone --loglevel=debug
```
#### Cleaning Up
To clean up project artifacts:
```shell
gitzone clean
```
### Summary
The `gitzone` CLI tool provides a comprehensive suite of commands that streamline project setup, lifecycle management, and deployment, which are indispensable for modern development workflows. By familiarizing yourself with the different commands, you can maximize your productivity and focus on what really matters—writing code. Whether you are starting a new project, maintaining an existing one, or deploying your work, `gitzone` is your toolbelt for efficient development cycles.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.