@kubev2v/types
Advanced tools
Comparing version 0.0.3 to 0.0.4
{ | ||
"name": "@kubev2v/types", | ||
"version": "0.0.3", | ||
"version": "0.0.4", | ||
"description": "Typescript interfaces and types for forklift", | ||
"license": "Apache-2.0", | ||
"type": "module", | ||
"private": false, | ||
@@ -20,7 +21,18 @@ "repository": { | ||
"clean:all": "npm run clean -- ./node_modules ./.rollup.cache", | ||
"build": "rollup -c --bundleConfigAsCjs", | ||
"build": "rollup -c", | ||
"start": "rollup -c --bundleConfigAsCjs --watch", | ||
"lint": "eslint .", | ||
"lint:fix": "eslint . --fix" | ||
}, | ||
"devDependencies": { | ||
"@rollup/plugin-typescript": "^11.1.6", | ||
"@typescript-eslint/eslint-plugin": "^7.2.0", | ||
"eslint": "^8.57.0", | ||
"eslint-config-prettier": "^9.1.0", | ||
"eslint-plugin-prettier": "^5.1.3", | ||
"install": "^0.13.0", | ||
"npm": "^10.5.0", | ||
"prettier": "^3.2.5", | ||
"rollup": "^4.13.0" | ||
} | ||
} |
@@ -5,47 +5,20 @@ # @kubev2v/types | ||
| Subdirectory | Auto generated | Description | Contents | | ||
|---------------------------|----------------|-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ||
| [constants](./src/constants) | Auto | Contains auto-generated Openshift Web Console model constants. | Auto-generated models, that can be manually adjusted. | | ||
| [models](./src/models) | Auto | Contains auto-generated types for Kubernetes (k8s) models used in the project. | Kubernetes (k8s) models used in the project, auto-generated from API definitions or other sources. | | ||
| [types](./src/types) | Manual | Contains manually created helper types and non-Kubernetes types used by the inventory API. | - Helper types: Manually created types that assist in various tasks within the project.<br>- Non-Kubernetes types: Types that are used by the inventory API. | | ||
## Auto generated | ||
## Auto generating new version | ||
Auto generated [types](/src/generated): | ||
The typescript files are auto generated using forklift CRDs available from [<root>/ci/yaml/crds](/ci/yaml/crds). | ||
- [Forklift types](/src/generated/forklift/README.md) | ||
- [Kubernetes types](/src/generated/kubernetes/README.md) | ||
- [Kubevirt types](/src/generated/kubevirt/README.md) | ||
to generate new API version, update the CRDs in [<root>/ci/yaml/crds](/ci/yaml/crds), and then: | ||
## Manual | ||
a. run | ||
``` bash | ||
bash ./ci/update-types-package.sh | ||
``` | ||
Manual [types](/src/types). | ||
b. manually cleanup the generated code. | ||
c. manually create or clean generated index files | ||
d. run linter fix for final touch. | ||
``` bash | ||
npm run lint:fix | ||
``` | ||
| CRD | Ref | | ||
| ------------| --------| | ||
| Openshift | https://github.com/openshift/api/tree/master/console/v1 | | ||
| Forklift | https://github.com/kubev2v/forklift/tree/main/operator/config/crd/bases | | ||
The script use the CRDs to generate OpenAPI file, and use that file to create model files. | ||
## Lint | ||
Auto generated files will contain linting errors, you can run `npm run lint:fix` to cleanup the code after auto-re-generation. | ||
## Manual overrides | ||
After auto generation is done, some manual tweeks can be done. | ||
### Setting the models color and abbr. | ||
The model constant is auto generated with `abbr` that defaults to first two letters of the kind, and undefined `color`. | ||
The [model constants](src/generated/forklift/constants) are auto generated with `abbr` that defaults to first two letters of the kind, and undefined `color`. | ||
It is sometimes advisable to manual change the defaults. | ||
for example: | ||
For example: | ||
@@ -74,12 +47,1 @@ ``` ts | ||
``` | ||
## Tools | ||
The auto generation script [update-types-package](/ci/update-types-package.sh) is a bash script | ||
that run the auto generation proccess. | ||
| Tools | Descroption | URL | | ||
| ------| ----------- | --- | | ||
| crdtoapi | create OpenAPI file from CRDs | https://github.com/yaacov/crdtoapi | | ||
| crdtomodel | create k8s model constants from CRDs | https://github.com/yaacov/crdtoapi | | ||
| openapi-generator-cli | create typescript interfaces from the OpenAPI file | https://github.com/OpenAPITools/openapi-generator-cli | |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
Yes
2887694
9
6
44904
46