A tool for gathering project information, supporting npm, git, and more.
Go to file
2024-05-29 14:11:27 +02:00
.gitea/workflows fix(core): update 2023-08-08 18:06:23 +02:00
.vscode fix(core): update 2022-04-18 22:17:10 +02:00
test fix(core): update 2023-08-08 18:06:23 +02:00
ts fix(core): update 2023-08-08 18:06:23 +02:00
.gitignore fix(core): update 2020-06-01 22:45:45 +00:00
LICENSE Initial commit 2016-02-20 03:45:25 +01:00
npmextra.json update tsconfig 2024-04-14 17:15:51 +02:00
package.json update description 2024-05-29 14:11:27 +02:00
pnpm-lock.yaml fix(core): update 2023-08-08 18:06:23 +02:00
readme.hints.md update tsconfig 2024-04-14 17:15:51 +02:00
readme.md update tsconfig 2024-04-14 17:15:51 +02:00
tsconfig.json update npmextra.json: githost 2024-04-01 21:33:28 +02:00

@push.rocks/projectinfo

gather information about projects. supports npm, git etc.

Install

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:

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

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.

Setup

First, make sure to import ProjectInfo from the package in your TypeScript file. Here's how to get started:

import { ProjectInfo } from '@push.rocks/projectinfo';

Gathering NPM Information

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.

const projectInfo = new ProjectInfo('./path/to/your/project');
console.log(`Project Name: ${projectInfo.npm.name}`);
console.log(`Project Version: ${projectInfo.npm.version}`);

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;

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.

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.

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 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.