@git.zone/cli 1.9.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/ci_default/.gitea/workflows/default_nottags.yaml +66 -0
- package/assets/templates/ci_default/.gitea/workflows/default_tags.yaml +124 -0
- package/assets/templates/ci_default_gitlab/.gitlab-ci.yml +128 -0
- package/assets/templates/ci_default_private/.gitea/workflows/default_nottags.yaml +66 -0
- package/assets/templates/ci_default_private/.gitea/workflows/default_tags.yaml +124 -0
- package/assets/templates/ci_default_private_gitlab/.gitlab-ci.yml +133 -0
- package/assets/templates/ci_docker/.gitea/workflows/docker_nottags.yaml +71 -0
- package/assets/templates/ci_docker/.gitea/workflows/docker_tags.yaml +106 -0
- package/assets/templates/ci_docker_gitlab/.gitlab-ci.yml +107 -0
- package/assets/templates/cli/cli.child.ts +4 -0
- package/assets/templates/cli/cli.js +4 -0
- package/assets/templates/cli/cli.ts.js +5 -0
- package/assets/templates/dockerfile_service/Dockerfile +46 -0
- package/assets/templates/dockerfile_service/dockerignore +4 -0
- package/assets/templates/gitignore/_gitignore +23 -0
- package/assets/templates/license_mit/license +19 -0
- package/assets/templates/meta/.meta.json +3 -0
- package/assets/templates/meta/.smartscaf.yml +5 -0
- package/assets/templates/meta/package.json +11 -0
- package/assets/templates/npm/.package.json +28 -0
- package/assets/templates/npm/.smartscaf.yml +24 -0
- package/assets/templates/npm/test/test.ts +8 -0
- package/assets/templates/npm/ts/index.ts +3 -0
- package/assets/templates/npm/ts/some.plugins.ts +7 -0
- package/assets/templates/npmextra/npmextra.json +18 -0
- package/assets/templates/readme/readme.md +5 -0
- package/assets/templates/service/.package.json +34 -0
- package/assets/templates/service/.smartscaf.yml +21 -0
- package/assets/templates/service/npmextra.json +24 -0
- package/assets/templates/service/ts/00_commitinfo_data.ts +8 -0
- package/assets/templates/service/ts/index.ts +4 -0
- package/assets/templates/service/ts/some.classes.some.db.ts +30 -0
- package/assets/templates/service/ts/some.classes.some.ts +27 -0
- package/assets/templates/service/ts/some.paths.ts +9 -0
- package/assets/templates/service/ts/some.plugins.ts +25 -0
- package/assets/templates/tsconfig_update/tsconfig.json +14 -0
- package/assets/templates/vscode/.vscode/launch.json +11 -0
- package/assets/templates/vscode/.vscode/settings.json +26 -0
- package/assets/templates/wcc/.package.json +47 -0
- package/assets/templates/wcc/.smartscaf.yml +20 -0
- package/assets/templates/wcc/ts_web/elements/first-element.ts +47 -0
- package/assets/templates/wcc/ts_web/elements/index.ts +1 -0
- package/assets/templates/wcc/ts_web/index.ts +1 -0
- package/assets/templates/wcc/ts_web/pages/index.ts +2 -0
- package/assets/templates/wcc/ts_web/pages/page1.ts +5 -0
- package/assets/templates/wcc/ts_web/pages/page2.ts +5 -0
- package/assets/templates/wcc_update/html/index.html +25 -0
- package/assets/templates/wcc_update/html/index.ts +10 -0
- package/assets/templates/website/.package.json +40 -0
- package/assets/templates/website/.smartscaf.yml +17 -0
- package/assets/templates/website/Dockerfile +3 -0
- package/assets/templates/website/npmextra.json +24 -0
- package/assets/templates/website/qenv.yml +1 -0
- package/assets/templates/website/readme.md +1 -0
- package/assets/templates/website/ts/ffb.paths.ts +7 -0
- package/assets/templates/website/ts/ffb.plugins.ts +14 -0
- package/assets/templates/website/ts/index.ts +12 -0
- package/assets/templates/website/ts_web/elements/header.ts +62 -0
- package/assets/templates/website/ts_web/index.ts +63 -0
- package/assets/templates/website_update/html/index.html +110 -0
- package/cli.js +4 -0
- package/dist_ts/00_commitinfo_data.d.ts +8 -0
- package/dist_ts/00_commitinfo_data.js +9 -0
- package/dist_ts/classes.gitzoneconfig.d.ts +31 -0
- package/dist_ts/classes.gitzoneconfig.js +21 -0
- package/dist_ts/classes.project.d.ts +11 -0
- package/dist_ts/classes.project.js +23 -0
- package/dist_ts/gitzone.cli.d.ts +1 -0
- package/dist_ts/gitzone.cli.js +82 -0
- package/dist_ts/gitzone.config.d.ts +28 -0
- package/dist_ts/gitzone.config.js +21 -0
- package/dist_ts/gitzone.logging.d.ts +2 -0
- package/dist_ts/gitzone.logging.js +14 -0
- package/dist_ts/gitzone.monitor.d.ts +1 -0
- package/dist_ts/gitzone.monitor.js +2 -0
- package/dist_ts/gitzone.paths.d.ts +4 -0
- package/dist_ts/gitzone.paths.js +6 -0
- package/dist_ts/gitzone.plugins.d.ts +10 -0
- package/dist_ts/gitzone.plugins.js +11 -0
- package/dist_ts/index.d.ts +1 -0
- package/dist_ts/index.js +10 -0
- package/dist_ts/mod_audit/index.d.ts +1 -0
- package/dist_ts/mod_audit/index.js +2 -0
- package/dist_ts/mod_commit/index.d.ts +1 -0
- package/dist_ts/mod_commit/index.js +68 -0
- package/dist_ts/mod_commit/mod.plugins.d.ts +5 -0
- package/dist_ts/mod_commit/mod.plugins.js +6 -0
- package/dist_ts/mod_deprecate/index.d.ts +1 -0
- package/dist_ts/mod_deprecate/index.js +34 -0
- package/dist_ts/mod_deprecate/mod.plugins.d.ts +4 -0
- package/dist_ts/mod_deprecate/mod.plugins.js +5 -0
- package/dist_ts/mod_format/format.classes.project.d.ts +8 -0
- package/dist_ts/mod_format/format.classes.project.js +20 -0
- package/dist_ts/mod_format/format.cleanup.d.ts +2 -0
- package/dist_ts/mod_format/format.cleanup.js +18 -0
- package/dist_ts/mod_format/format.copy.d.ts +2 -0
- package/dist_ts/mod_format/format.copy.js +5 -0
- package/dist_ts/mod_format/format.gitignore.d.ts +2 -0
- package/dist_ts/mod_format/format.gitignore.js +19 -0
- package/dist_ts/mod_format/format.license.d.ts +2 -0
- package/dist_ts/mod_format/format.license.js +23 -0
- package/dist_ts/mod_format/format.npmextra.d.ts +5 -0
- package/dist_ts/mod_format/format.npmextra.js +59 -0
- package/dist_ts/mod_format/format.packagejson.d.ts +2 -0
- package/dist_ts/mod_format/format.packagejson.js +104 -0
- package/dist_ts/mod_format/format.prettier.d.ts +2 -0
- package/dist_ts/mod_format/format.prettier.js +51 -0
- package/dist_ts/mod_format/format.readme.d.ts +2 -0
- package/dist_ts/mod_format/format.readme.js +40 -0
- package/dist_ts/mod_format/format.templates.d.ts +5 -0
- package/dist_ts/mod_format/format.templates.js +67 -0
- package/dist_ts/mod_format/index.d.ts +1 -0
- package/dist_ts/mod_format/index.js +30 -0
- package/dist_ts/mod_format/mod.plugins.d.ts +11 -0
- package/dist_ts/mod_format/mod.plugins.js +12 -0
- package/dist_ts/mod_helpers/index.d.ts +1 -0
- package/dist_ts/mod_helpers/index.js +10 -0
- package/dist_ts/mod_helpers/mod.plugins.d.ts +3 -0
- package/dist_ts/mod_helpers/mod.plugins.js +4 -0
- package/dist_ts/mod_meta/index.d.ts +1 -0
- package/dist_ts/mod_meta/index.js +25 -0
- package/dist_ts/mod_meta/meta.classes.meta.d.ts +53 -0
- package/dist_ts/mod_meta/meta.classes.meta.js +174 -0
- package/dist_ts/mod_meta/meta.interfaces.d.ts +5 -0
- package/dist_ts/mod_meta/meta.interfaces.js +2 -0
- package/dist_ts/mod_meta/meta.plugins.d.ts +6 -0
- package/dist_ts/mod_meta/meta.plugins.js +7 -0
- package/dist_ts/mod_open/index.d.ts +1 -0
- package/dist_ts/mod_open/index.js +12 -0
- package/dist_ts/mod_open/mod.plugins.d.ts +4 -0
- package/dist_ts/mod_open/mod.plugins.js +5 -0
- package/dist_ts/mod_standard/index.d.ts +1 -0
- package/dist_ts/mod_standard/index.js +25 -0
- package/dist_ts/mod_standard/mod.plugins.d.ts +3 -0
- package/dist_ts/mod_standard/mod.plugins.js +4 -0
- package/dist_ts/mod_start/index.d.ts +6 -0
- package/dist_ts/mod_start/index.js +22 -0
- package/dist_ts/mod_start/mod.plugins.d.ts +3 -0
- package/dist_ts/mod_start/mod.plugins.js +5 -0
- package/dist_ts/mod_template/index.d.ts +8 -0
- package/dist_ts/mod_template/index.js +47 -0
- package/dist_ts/mod_template/mod.plugins.d.ts +5 -0
- package/dist_ts/mod_template/mod.plugins.js +6 -0
- package/dist_ts/paths.d.ts +4 -0
- package/dist_ts/paths.js +6 -0
- package/dist_ts/plugins.d.ts +11 -0
- package/dist_ts/plugins.js +11 -0
- package/license +19 -0
- package/npmextra.json +34 -0
- package/package.json +107 -0
- package/readme.hints.md +1 -0
- package/readme.md +207 -0
- package/ts/00_commitinfo_data.ts +8 -0
- package/ts/classes.gitzoneconfig.ts +47 -0
- package/ts/classes.project.ts +28 -0
- package/ts/gitzone.cli.ts +101 -0
- package/ts/gitzone.logging.ts +15 -0
- package/ts/index.ts +9 -0
- package/ts/mod_audit/index.ts +1 -0
- package/ts/mod_commit/index.ts +73 -0
- package/ts/mod_commit/mod.plugins.ts +7 -0
- package/ts/mod_deprecate/index.ts +37 -0
- package/ts/mod_deprecate/mod.plugins.ts +6 -0
- package/ts/mod_format/format.cleanup.ts +19 -0
- package/ts/mod_format/format.copy.ts +6 -0
- package/ts/mod_format/format.gitignore.ts +21 -0
- package/ts/mod_format/format.license.ts +24 -0
- package/ts/mod_format/format.npmextra.ts +70 -0
- package/ts/mod_format/format.packagejson.ts +120 -0
- package/ts/mod_format/format.prettier.ts +58 -0
- package/ts/mod_format/format.readme.ts +47 -0
- package/ts/mod_format/format.templates.ts +71 -0
- package/ts/mod_format/index.ts +38 -0
- package/ts/mod_format/mod.plugins.ts +13 -0
- package/ts/mod_helpers/index.ts +10 -0
- package/ts/mod_helpers/mod.plugins.ts +5 -0
- package/ts/mod_meta/index.ts +26 -0
- package/ts/mod_meta/meta.classes.meta.ts +234 -0
- package/ts/mod_meta/meta.interfaces.ts +3 -0
- package/ts/mod_meta/meta.plugins.ts +8 -0
- package/ts/mod_open/index.ts +15 -0
- package/ts/mod_open/mod.plugins.ts +5 -0
- package/ts/mod_standard/index.ts +29 -0
- package/ts/mod_standard/mod.plugins.ts +4 -0
- package/ts/mod_start/index.ts +26 -0
- package/ts/mod_start/mod.plugins.ts +6 -0
- package/ts/mod_template/index.ts +52 -0
- package/ts/mod_template/mod.plugins.ts +7 -0
- package/ts/paths.ts +9 -0
- package/ts/plugins.ts +21 -0
package/readme.md
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
# @git.zone/cli
|
|
2
|
+
|
|
3
|
+
A CLI toolbelt to streamline local development cycles by using various gitzone utilities.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
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:
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
npm install -g @git.zone/cli
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
This will add the `gitzone` or `gzone` command to your PATH, allowing you to use the tool from any directory.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
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`.
|
|
18
|
+
|
|
19
|
+
### Getting Started
|
|
20
|
+
|
|
21
|
+
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.
|
|
22
|
+
|
|
23
|
+
#### Initialize a New Project
|
|
24
|
+
|
|
25
|
+
`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:
|
|
26
|
+
|
|
27
|
+
```shell
|
|
28
|
+
gitzone template [templatename]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Replace `[templatename]` with one of the following:
|
|
32
|
+
- `npm`: A standard npm module with TypeScript support, testing, and CI/CD setup.
|
|
33
|
+
- `website`: A LitElement-based website with e2e testing, bundling, and service worker support.
|
|
34
|
+
- `element`: A LitElement standard setup for creating web components.
|
|
35
|
+
|
|
36
|
+
Example of starting a new npm project:
|
|
37
|
+
1. Open your terminal and navigate to the directory where you want to create your project.
|
|
38
|
+
2. Execute the following command:
|
|
39
|
+
```shell
|
|
40
|
+
gitzone template npm
|
|
41
|
+
```
|
|
42
|
+
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.
|
|
43
|
+
|
|
44
|
+
#### Committing Changes
|
|
45
|
+
|
|
46
|
+
To standardize commit messages and increment versions based on change types (fix, feat, breaking change):
|
|
47
|
+
|
|
48
|
+
```shell
|
|
49
|
+
gitzone commit
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
This command will prompt you with a series of questions to help construct a standardized commit message and create a new commit.
|
|
53
|
+
|
|
54
|
+
#### Deprecating a Package
|
|
55
|
+
|
|
56
|
+
To deprecate an old package in favor of a new one:
|
|
57
|
+
|
|
58
|
+
```shell
|
|
59
|
+
gitzone deprecate
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
This command will prompt you for the old and new package names and will automatically deprecate the old package on npm.
|
|
63
|
+
|
|
64
|
+
#### Opening CI/CD Settings
|
|
65
|
+
|
|
66
|
+
Quickly open the CI/CD settings page of your project repository:
|
|
67
|
+
|
|
68
|
+
```shell
|
|
69
|
+
gitzone open ci
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Example Commands
|
|
73
|
+
|
|
74
|
+
#### Project Setup and Initialization
|
|
75
|
+
|
|
76
|
+
Let's go through how to scaffold a new web component project:
|
|
77
|
+
|
|
78
|
+
1. Navigate to your desired directory.
|
|
79
|
+
2. Run the following command:
|
|
80
|
+
```shell
|
|
81
|
+
gitzone template element
|
|
82
|
+
```
|
|
83
|
+
3. Follow the prompts to set up your web component project.
|
|
84
|
+
|
|
85
|
+
#### Managing Project Lifecycle
|
|
86
|
+
|
|
87
|
+
Commands to manage your project's lifecycle:
|
|
88
|
+
|
|
89
|
+
- **Commit Changes:**
|
|
90
|
+
```shell
|
|
91
|
+
gitzone commit
|
|
92
|
+
```
|
|
93
|
+
- **Deprecate a Package:**
|
|
94
|
+
```shell
|
|
95
|
+
gitzone deprecate
|
|
96
|
+
```
|
|
97
|
+
- **Format Project Files:**
|
|
98
|
+
```shell
|
|
99
|
+
gitzone format
|
|
100
|
+
```
|
|
101
|
+
- **Regenerate Readme:**
|
|
102
|
+
```shell
|
|
103
|
+
gitzone readme
|
|
104
|
+
```
|
|
105
|
+
- **Update Local Repositories:**
|
|
106
|
+
```shell
|
|
107
|
+
gitzone update
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
#### Advanced Scenarios
|
|
111
|
+
|
|
112
|
+
##### Formatting
|
|
113
|
+
|
|
114
|
+
To ensure consistent formatting using Prettier:
|
|
115
|
+
|
|
116
|
+
```shell
|
|
117
|
+
gitzone format
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
##### Building the Project
|
|
121
|
+
|
|
122
|
+
To build your project as defined in your `package.json`:
|
|
123
|
+
|
|
124
|
+
```shell
|
|
125
|
+
npm run build
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
##### Git and Version Control
|
|
129
|
+
|
|
130
|
+
Check the current project version:
|
|
131
|
+
|
|
132
|
+
```shell
|
|
133
|
+
gitzone -v
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
To synchronize local repositories with remotes:
|
|
137
|
+
|
|
138
|
+
```shell
|
|
139
|
+
gitzone update
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
##### Metadata and Configuration
|
|
143
|
+
|
|
144
|
+
To initialize or update metadata:
|
|
145
|
+
|
|
146
|
+
```shell
|
|
147
|
+
gitzone meta init
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Continuous Integration and Delivery (CI/CD)
|
|
151
|
+
|
|
152
|
+
#### Running Tests
|
|
153
|
+
|
|
154
|
+
To execute tests defined in your `package.json`:
|
|
155
|
+
|
|
156
|
+
```shell
|
|
157
|
+
npm test
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### Building Documentation
|
|
161
|
+
|
|
162
|
+
Generate documentation:
|
|
163
|
+
|
|
164
|
+
```shell
|
|
165
|
+
npm run buildDocs
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### Troubleshooting and Debugging
|
|
169
|
+
|
|
170
|
+
#### Detailed Logs
|
|
171
|
+
|
|
172
|
+
Enable detailed logging for troubleshooting:
|
|
173
|
+
|
|
174
|
+
```shell
|
|
175
|
+
gitzone --loglevel=debug
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
#### Cleaning Up
|
|
179
|
+
|
|
180
|
+
To clean up project artifacts:
|
|
181
|
+
|
|
182
|
+
```shell
|
|
183
|
+
gitzone clean
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Summary
|
|
187
|
+
|
|
188
|
+
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.
|
|
189
|
+
|
|
190
|
+
## License and Legal Information
|
|
191
|
+
|
|
192
|
+
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.
|
|
193
|
+
|
|
194
|
+
**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.
|
|
195
|
+
|
|
196
|
+
### Trademarks
|
|
197
|
+
|
|
198
|
+
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.
|
|
199
|
+
|
|
200
|
+
### Company Information
|
|
201
|
+
|
|
202
|
+
Task Venture Capital GmbH
|
|
203
|
+
Registered at District court Bremen HRB 35230 HB, Germany
|
|
204
|
+
|
|
205
|
+
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
|
206
|
+
|
|
207
|
+
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.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import * as paths from './paths.js';
|
|
3
|
+
|
|
4
|
+
export type TGitzoneProjectType = 'npm' | 'service' | 'wcc' | 'website';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* type of the actual gitzone data
|
|
8
|
+
*/
|
|
9
|
+
export interface IGitzoneConfigData {
|
|
10
|
+
projectType: TGitzoneProjectType;
|
|
11
|
+
module: {
|
|
12
|
+
githost: string;
|
|
13
|
+
gitscope: string;
|
|
14
|
+
gitrepo: string;
|
|
15
|
+
description: string;
|
|
16
|
+
npmPackageName: string;
|
|
17
|
+
license: string;
|
|
18
|
+
projectDomain: string;
|
|
19
|
+
};
|
|
20
|
+
copy: {[key: string]: string}
|
|
21
|
+
npmciOptions: {
|
|
22
|
+
npmAccessLevel: 'public' | 'private';
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* gitzone config
|
|
28
|
+
*/
|
|
29
|
+
export class GitzoneConfig {
|
|
30
|
+
public static async fromCwd() {
|
|
31
|
+
const gitzoneConfig = new GitzoneConfig();
|
|
32
|
+
await gitzoneConfig.readConfigFromCwd();
|
|
33
|
+
return gitzoneConfig;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
public data: IGitzoneConfigData;
|
|
37
|
+
|
|
38
|
+
public async readConfigFromCwd() {
|
|
39
|
+
const npmextraInstance = new plugins.npmextra.Npmextra(paths.cwd);
|
|
40
|
+
this.data = npmextraInstance.dataFor<IGitzoneConfigData>('gitzone', {});
|
|
41
|
+
this.data.npmciOptions = npmextraInstance.dataFor<IGitzoneConfigData['npmciOptions']>('npmci', {
|
|
42
|
+
npmAccessLevel: 'public',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
constructor() {}
|
|
47
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import * as plugins from './plugins.js'
|
|
2
|
+
import * as paths from './paths.js';
|
|
3
|
+
|
|
4
|
+
import { GitzoneConfig } from './classes.gitzoneconfig.js';
|
|
5
|
+
import type { TGitzoneProjectType } from './classes.gitzoneconfig.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* the Project class is a tool to work with a gitzone project
|
|
9
|
+
*/
|
|
10
|
+
export class Project {
|
|
11
|
+
public static async fromCwd() {
|
|
12
|
+
const gitzoneConfig = await GitzoneConfig.fromCwd();
|
|
13
|
+
const project = new Project(gitzoneConfig);
|
|
14
|
+
if (!project.gitzoneConfig.data.projectType) {
|
|
15
|
+
throw new Error('Please define a project type');
|
|
16
|
+
}
|
|
17
|
+
return project;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
public gitzoneConfig: GitzoneConfig;
|
|
21
|
+
public get type(): TGitzoneProjectType {
|
|
22
|
+
return this.gitzoneConfig.data.projectType;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
constructor(gitzoneConfigArg: GitzoneConfig) {
|
|
26
|
+
this.gitzoneConfig = gitzoneConfigArg;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
import * as paths from './paths.js';
|
|
3
|
+
import { GitzoneConfig } from './classes.gitzoneconfig.js';
|
|
4
|
+
|
|
5
|
+
const gitzoneSmartcli = new plugins.smartcli.Smartcli();
|
|
6
|
+
|
|
7
|
+
export let run = async () => {
|
|
8
|
+
const done = plugins.smartpromise.defer();
|
|
9
|
+
|
|
10
|
+
// get packageInfo
|
|
11
|
+
const projectInfo = new plugins.projectinfo.ProjectInfo(paths.packageDir);
|
|
12
|
+
|
|
13
|
+
// check for updates
|
|
14
|
+
const smartupdateInstance = new plugins.smartupdate.SmartUpdate();
|
|
15
|
+
await smartupdateInstance.check(
|
|
16
|
+
'gitzone',
|
|
17
|
+
projectInfo.npm.version,
|
|
18
|
+
'http://gitzone.gitlab.io/gitzone/changelog.html'
|
|
19
|
+
);
|
|
20
|
+
console.log('---------------------------------------------');
|
|
21
|
+
gitzoneSmartcli.addVersion(projectInfo.npm.version);
|
|
22
|
+
|
|
23
|
+
// ======> Standard task <======
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* standard task
|
|
27
|
+
*/
|
|
28
|
+
gitzoneSmartcli.standardCommand().subscribe(async (argvArg) => {
|
|
29
|
+
const modStandard = await import('./mod_standard/index.js');
|
|
30
|
+
await modStandard.run();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
// ======> Specific tasks <======
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* commit something
|
|
37
|
+
*/
|
|
38
|
+
gitzoneSmartcli.addCommand('commit').subscribe(async (argvArg) => {
|
|
39
|
+
const modCommit = await import('./mod_commit/index.js');
|
|
40
|
+
await modCommit.run(argvArg);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* deprecate a package on npm
|
|
45
|
+
*/
|
|
46
|
+
gitzoneSmartcli.addCommand('deprecate').subscribe(async (argvArg) => {
|
|
47
|
+
const modDeprecate = await import('./mod_deprecate/index.js');
|
|
48
|
+
await modDeprecate.run();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* Update all files that comply with the gitzone standard
|
|
53
|
+
*/
|
|
54
|
+
gitzoneSmartcli.addCommand('format').subscribe(async (argvArg) => {
|
|
55
|
+
const config = GitzoneConfig.fromCwd();
|
|
56
|
+
const modFormat = await import('./mod_format/index.js');
|
|
57
|
+
await modFormat.run();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* run meta commands
|
|
62
|
+
*/
|
|
63
|
+
gitzoneSmartcli.addCommand('meta').subscribe(async (argvArg) => {
|
|
64
|
+
const config = GitzoneConfig.fromCwd();
|
|
65
|
+
const modMeta = await import('./mod_meta/index.js');
|
|
66
|
+
modMeta.run(argvArg);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* open assets
|
|
71
|
+
*/
|
|
72
|
+
gitzoneSmartcli.addCommand('open').subscribe(async (argvArg) => {
|
|
73
|
+
const modOpen = await import('./mod_open/index.js');
|
|
74
|
+
modOpen.run(argvArg);
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* add a readme to a project
|
|
79
|
+
*/
|
|
80
|
+
gitzoneSmartcli.addCommand('template').subscribe(async (argvArg) => {
|
|
81
|
+
const modTemplate = await import('./mod_template/index.js');
|
|
82
|
+
modTemplate.run(argvArg);
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* start working on a project
|
|
87
|
+
*/
|
|
88
|
+
gitzoneSmartcli.addCommand('start').subscribe(async (argvArg) => {
|
|
89
|
+
const modTemplate = await import('./mod_start/index.js');
|
|
90
|
+
modTemplate.run(argvArg);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
gitzoneSmartcli.addCommand('helpers').subscribe(async (argvArg) => {
|
|
94
|
+
const modHelpers = await import('./mod_helpers/index.js');
|
|
95
|
+
modHelpers.run(argvArg);
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
// start parsing of the cli
|
|
99
|
+
gitzoneSmartcli.startParse();
|
|
100
|
+
return await done.promise;
|
|
101
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as plugins from './plugins.js';
|
|
2
|
+
|
|
3
|
+
export const logger = new plugins.smartlog.Smartlog({
|
|
4
|
+
minimumLogLevel: 'silly',
|
|
5
|
+
logContext: {
|
|
6
|
+
company: 'Task Venture Capital GmbH',
|
|
7
|
+
companyunit: 'Lossless Cloud',
|
|
8
|
+
containerName: 'local',
|
|
9
|
+
environment: 'local',
|
|
10
|
+
runtime: 'node',
|
|
11
|
+
zone: 'gitzone',
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
logger.addLogDestination(new plugins.smartlogDestinationLocal.DestinationLocal());
|
package/ts/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export const runCli = async () => {
|
|
2
|
+
const early = await import('@push.rocks/early');
|
|
3
|
+
early.start('gitzone');
|
|
4
|
+
const plugins = await import('./plugins.js');
|
|
5
|
+
const gitzoneCli = await import('./gitzone.cli.js');
|
|
6
|
+
early.stop().then(() => {
|
|
7
|
+
gitzoneCli.run();
|
|
8
|
+
});
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import * as paths from '../paths.js';
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
// this file contains code to create commits in a consistent way
|
|
2
|
+
|
|
3
|
+
import * as plugins from './mod.plugins.js';
|
|
4
|
+
import * as paths from '../paths.js';
|
|
5
|
+
import { logger } from '../gitzone.logging.js';
|
|
6
|
+
|
|
7
|
+
export const run = async (argvArg: any) => {
|
|
8
|
+
const commitInteract = new plugins.smartinteract.SmartInteract();
|
|
9
|
+
commitInteract.addQuestions([
|
|
10
|
+
{
|
|
11
|
+
type: 'list',
|
|
12
|
+
name: `commitType`,
|
|
13
|
+
message: `Choose TYPE of the commit:`,
|
|
14
|
+
choices: [`fix`, `feat`, `BREAKING CHANGE`],
|
|
15
|
+
default: `fix`,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
type: 'input',
|
|
19
|
+
name: `commitScope`,
|
|
20
|
+
message: `What is the SCOPE of the commit:`,
|
|
21
|
+
default: `core`,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
type: `input`,
|
|
25
|
+
name: `commitDescription`,
|
|
26
|
+
message: `What is the DESCRIPTION of the commit?`,
|
|
27
|
+
default: `update`,
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
type: 'confirm',
|
|
31
|
+
name: `pushToOrigin`,
|
|
32
|
+
message: `Do you want to push this version now?`,
|
|
33
|
+
default: true,
|
|
34
|
+
},
|
|
35
|
+
]);
|
|
36
|
+
const answerBucket = await commitInteract.runQueue();
|
|
37
|
+
const commitString = createCommitStringFromAnswerBucket(answerBucket);
|
|
38
|
+
const commitVersionType = (() => {
|
|
39
|
+
switch (answerBucket.getAnswerFor('commitType')) {
|
|
40
|
+
case 'fix':
|
|
41
|
+
return 'patch';
|
|
42
|
+
case 'feat':
|
|
43
|
+
return 'minor';
|
|
44
|
+
case 'BREAKING CHANGE':
|
|
45
|
+
return 'major';
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
|
|
49
|
+
logger.log('info', `OK! Creating commit with message '${commitString}'`);
|
|
50
|
+
const smartshellInstance = new plugins.smartshell.Smartshell({
|
|
51
|
+
executor: 'bash',
|
|
52
|
+
sourceFilePaths: [],
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
logger.log('info', `Baking commitinfo into code`);
|
|
56
|
+
const commitInfo = new plugins.commitinfo.CommitInfo(paths.cwd, commitVersionType);
|
|
57
|
+
await commitInfo.writeIntoPotentialDirs();
|
|
58
|
+
|
|
59
|
+
logger.log('info', `Staging files for commit:`);
|
|
60
|
+
await smartshellInstance.exec(`git add -A`);
|
|
61
|
+
await smartshellInstance.exec(`git commit -m "${commitString}"`);
|
|
62
|
+
await smartshellInstance.exec(`npm version ${commitVersionType}`);
|
|
63
|
+
if (answerBucket.getAnswerFor('pushToOrigin') && !(process.env.CI === 'true')) {
|
|
64
|
+
await smartshellInstance.exec(`git push origin master --follow-tags`);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const createCommitStringFromAnswerBucket = (answerBucket: plugins.smartinteract.AnswerBucket) => {
|
|
69
|
+
const commitType = answerBucket.getAnswerFor('commitType');
|
|
70
|
+
const commitScope = answerBucket.getAnswerFor('commitScope');
|
|
71
|
+
const commitDescription = answerBucket.getAnswerFor('commitDescription');
|
|
72
|
+
return `${commitType}(${commitScope}): ${commitDescription}`;
|
|
73
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as plugins from './mod.plugins.js';
|
|
2
|
+
|
|
3
|
+
import { logger } from '../gitzone.logging.js';
|
|
4
|
+
|
|
5
|
+
export const run = async () => {
|
|
6
|
+
const smartInteract = new plugins.smartinteract.SmartInteract([
|
|
7
|
+
{
|
|
8
|
+
name: `oldPackageName`,
|
|
9
|
+
message: `Whats the name of the OLD package?`,
|
|
10
|
+
type: `input`,
|
|
11
|
+
default: ``,
|
|
12
|
+
validate: (stringInput) => {
|
|
13
|
+
return stringInput !== '' && !process.env.CI;
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: `newPackageName`,
|
|
18
|
+
message: `Whats the name of the NEW package?`,
|
|
19
|
+
type: `input`,
|
|
20
|
+
default: ``,
|
|
21
|
+
validate: (stringInput) => {
|
|
22
|
+
return stringInput !== '' && !process.env.CI;
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
]);
|
|
26
|
+
const answerBucket = await smartInteract.runQueue();
|
|
27
|
+
const oldPackageName = answerBucket.getAnswerFor(`oldPackageName`);
|
|
28
|
+
const newPackageName = answerBucket.getAnswerFor(`newPackageName`);
|
|
29
|
+
logger.log('info', `Deprecating package ${oldPackageName} in favour of ${newPackageName}`);
|
|
30
|
+
const smartshellInstance = new plugins.smartshell.Smartshell({
|
|
31
|
+
executor: 'bash',
|
|
32
|
+
});
|
|
33
|
+
await smartshellInstance.exec(
|
|
34
|
+
`npm deprecate ${oldPackageName}@* ` +
|
|
35
|
+
`"${oldPackageName} has been deprecated in favour of ${newPackageName} - please upgrade asap!!!"`
|
|
36
|
+
);
|
|
37
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as plugins from './mod.plugins.js';
|
|
2
|
+
import * as paths from '../paths.js';
|
|
3
|
+
|
|
4
|
+
import { logger } from '../gitzone.logging.js';
|
|
5
|
+
import { Project } from '../classes.project.js';
|
|
6
|
+
|
|
7
|
+
const filesToDelete = ['defaults.yml', 'yarn.lock', 'package-lock.json', 'tslint.json'];
|
|
8
|
+
|
|
9
|
+
export const run = async (projectArg: Project) => {
|
|
10
|
+
for (const relativeFilePath of filesToDelete) {
|
|
11
|
+
const fileExists = plugins.smartfile.fs.fileExistsSync(relativeFilePath);
|
|
12
|
+
if (fileExists) {
|
|
13
|
+
logger.log('info', `Found ${relativeFilePath}! Removing it!`);
|
|
14
|
+
plugins.smartfile.fs.removeSync(plugins.path.join(paths.cwd, relativeFilePath));
|
|
15
|
+
} else {
|
|
16
|
+
logger.log('info', `Project is free of ${relativeFilePath}`);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as plugins from './mod.plugins.js';
|
|
2
|
+
import * as paths from '../paths.js';
|
|
3
|
+
|
|
4
|
+
import { Project } from '../classes.project.js';
|
|
5
|
+
|
|
6
|
+
import { logger } from '../gitzone.logging.js';
|
|
7
|
+
const gitignorePath = plugins.path.join(paths.cwd, './.gitignore');
|
|
8
|
+
|
|
9
|
+
export const run = async (projectArg: Project) => {
|
|
10
|
+
const gitignoreExists = await plugins.smartfile.fs.fileExists(gitignorePath);
|
|
11
|
+
const templateModule = await import('../mod_template/index.js');
|
|
12
|
+
const ciTemplate = await templateModule.getTemplate('gitignore');
|
|
13
|
+
if (gitignoreExists) {
|
|
14
|
+
// lets get the existing gitignore file
|
|
15
|
+
const existingGitIgnoreString = plugins.smartfile.fs.toStringSync(gitignorePath);
|
|
16
|
+
let customPart = existingGitIgnoreString.split('# custom\n')[1];
|
|
17
|
+
customPart ? null : (customPart = '');
|
|
18
|
+
}
|
|
19
|
+
ciTemplate.writeToDisk(paths.cwd);
|
|
20
|
+
logger.log('info', 'Added a .gitignore!');
|
|
21
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as plugins from './mod.plugins.js';
|
|
2
|
+
import * as paths from '../paths.js';
|
|
3
|
+
import { Project } from '../classes.project.js';
|
|
4
|
+
|
|
5
|
+
import { logger } from '../gitzone.logging.js';
|
|
6
|
+
|
|
7
|
+
const incompatibleLicenses: string[] = [
|
|
8
|
+
"AGPL",
|
|
9
|
+
"GPL",
|
|
10
|
+
"SSPL",
|
|
11
|
+
];
|
|
12
|
+
|
|
13
|
+
export const run = async (projectArg: Project) => {
|
|
14
|
+
const licenseChecker = await plugins.smartlegal.createLicenseChecker();
|
|
15
|
+
const licenseCheckResult = await licenseChecker.excludeLicenseWithinPath(paths.cwd, incompatibleLicenses);
|
|
16
|
+
if (licenseCheckResult.failingModules.length === 0) {
|
|
17
|
+
logger.log('info', 'Success -> licenses passed!');
|
|
18
|
+
} else {
|
|
19
|
+
logger.log('error', 'Error -> licenses failed. Here is why:');
|
|
20
|
+
for (const failedModule of licenseCheckResult.failingModules) {
|
|
21
|
+
console.log(`${failedModule.name} fails with license ${failedModule.license}`);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
};
|