diff --git a/npmextra.json b/npmextra.json index e6defc8..74e41d9 100644 --- a/npmextra.json +++ b/npmextra.json @@ -9,12 +9,20 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "projectinfo", - "description": "gather information about projects. supports npm, git etc.", + "description": "A tool for gathering project information, supporting npm, git, and more.", "npmPackagename": "@push.rocks/projectinfo", - "license": "MIT" + "license": "MIT", + "keywords": [ + "project-info", + "npm", + "git", + "typescript", + "package-info", + "repository" + ] } }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis 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. \n\n**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.\n\n### Trademarks\n\nThis 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.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy 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.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index 86c9b74..c8ab429 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/projectinfo", "version": "5.0.2", "private": false, - "description": "gather information about projects. supports npm, git etc.", + "description": "A tool for gathering project information, supporting npm, git, and more.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "type": "module", @@ -16,11 +16,12 @@ "url": "git+https://gitlab.com/pushrocks/projectinfo.git" }, "keywords": [ - "project", + "project-info", "npm", "git", - "info", - "package" + "typescript", + "package-info", + "repository" ], "author": "Lossless GmbH", "license": "MIT", @@ -29,9 +30,9 @@ }, "homepage": "https://gitlab.com/pushrocks/projectinfo#readme", "devDependencies": { - "@gitzone/tsbuild": "^2.1.66", - "@gitzone/tsrun": "^1.2.44", - "@gitzone/tstest": "^1.0.77", + "@git.zone/tsbuild": "^2.1.66", + "@git.zone/tsrun": "^1.2.44", + "@git.zone/tstest": "^1.0.77", "@push.rocks/tapbundle": "^5.0.12", "@types/node": "^20.4.8" }, @@ -56,4 +57,4 @@ "browserslist": [ "last 1 chrome versions" ] -} +} \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index 9681bdd..522d355 100644 --- a/readme.md +++ b/readme.md @@ -1,49 +1,103 @@ # @push.rocks/projectinfo + gather information about projects. supports npm, git etc. -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/projectinfo) -* [gitlab.com (source)](https://gitlab.com/push.rocks/projectinfo) -* [github.com (source mirror)](https://github.com/push.rocks/projectinfo) -* [docs (typedoc)](https://push.rocks.gitlab.io/projectinfo/) +## Install -## Status for master +To install `@push.rocks/projectinfo`, you need a Node.js environment with npm. It's recommended to have TypeScript and ts-node installed for the best development experience. Run the following command: -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/projectinfo/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/projectinfo/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/projectinfo)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/projectinfo)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/projectinfo)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/projectinfo)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/projectinfo)](https://lossless.cloud) +```bash +npm install @push.rocks/projectinfo --save +``` + +This will add it to your project's `package.json` file and download the package into the `node_modules` folder. ## Usage -Use TypeScript for best in class instellisense. +The `@push.rocks/projectinfo` module provides a powerful interface to gather detailed information about your projects, focusing on common project management tools like npm and git. Below are various examples and use cases demonstrating how to use this module effectively. -```javascript -import { ProjectInfo } from 'projectinfo'; +### Setup -let myProjectInfo = new ProjectInfo('/some/path/to/proejct'); -let npmName = myProjectInfo.npm.name; // returns npm name from package.json -let npmVersion = myProjectInfo.npm.version; // returns version from package.json -let gitRepo = myProjectInfo.git.gitrepo; // returns the name of the gitrepo -let gitRemotes = myProjectInfo.git.remotes; // returns array with registered remotes +First, make sure to import `ProjectInfo` from the package in your TypeScript file. Here's how to get started: -// for more info check out the module in your IDE with TypeScript intellisense enabled +```typescript +import { ProjectInfo } from '@push.rocks/projectinfo'; ``` -## Contribution +### Gathering NPM Information -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +If you wish to extract npm-related information such as the project name and version from your `package.json`, you can instantiate `ProjectInfo` and access the `npm` property. -For further information read the linked docs at the top of this readme. +```typescript +const projectInfo = new ProjectInfo('./path/to/your/project'); +console.log(`Project Name: ${projectInfo.npm.name}`); +console.log(`Project Version: ${projectInfo.npm.version}`); +``` -## Legal -> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +This example assumes that your current working directory (`cwd`) is set correctly relative to your project. Adjust `'./path/to/your/project'` as necessary. + +### Accessing Git Information + +Similarly, to extract git-related information, you can access the `git` property. This allows you to get details about the git repository; + +```typescript +console.log(`Git Repository: ${projectInfo.git.gitrepo}`); +// Outputs the git repository name + +console.log(`Git User/Organization: ${projectInfo.git.gituser}`); +// Outputs the git user or organization name +``` + +It is important to note that these git properties are parsed from the local git configuration, so your project needs to be initialized with git and properly configured. + +### Working with Asynchronous Operations + +While the basic usage examples above are synchronous, `@push.rocks/projectinfo` might also offer functionality that requires async/await for operations that involve I/O processes, such as reading files or fetching data from remote APIs. Always refer to the specific method documentation to understand its nature (synchronous or asynchronous) and use it appropriately in your code. + +### Integrating with Other Push.rocks Modules + +The `@push.rocks/projectinfo` package is designed to work seamlessly with other packages from the Push.rocks suite. For instance, it utilizes `@push.rocks/smartfile` for efficient file handling, `@push.rocks/smartpath` for path manipulations, and `@push.rocks/smartpromise` for enhanced promise-based operations. This interconnectivity allows for a more integrated and efficient toolset when managing complex project setups. + +### Advanced Usage and Customization + +For more advanced use cases, such as customizing the way information is gathered or integrating `@push.rocks/projectinfo` into larger workflows, you are encouraged to explore the package's source code and accompanying documentation. The modular design and comprehensive TypeScript typings facilitate customization and extension to meet specific project requirements. + +### Error Handling + +When utilizing `@push.rocks/projectinfo` in your project automation or scripts, make sure to implement proper error handling. This helps in gracefully handling situations where project information might be missing, malformatted, or when underlying tools (npm, git) are not available in the environment. + +```typescript +try { + const projectInfo = new ProjectInfo('./path/to/your/project'); + // Use projectInfo as needed +} catch (error) { + console.error('Failed to gather project info:', error); +} +``` + +### Summary + +`@push.rocks/projectinfo` offers a versatile and powerful API for gathering and managing project information, making it an invaluable tool for developers looking to automate project setups, CI/CD pipelines, or simply organize and access project metadata more efficiently. Its integration with npm and git provides a solid foundation for extracting, analyzing, and utilizing essential project data across various aspects of software development and deployment workflows. + +By leveraging TypeScript for development, users are afforded the benefits of static typing, including better autocompletion, easier refactorings, and improved code quality. This document has outlined basic and advanced usage scenarios, aiming to equip developers with the knowledge to effectively incorporate `@push.rocks/projectinfo` into their projects. + +Note: The examples above are designed to be straightforward and easy to follow. Depending on the complexity and requirements of your specific project, you might need to adapt these examples. Always refer to the official documentation and TypeScript typings for the most accurate and up-to-date information. + +## 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.