From bd1891652a0ba681743938d663a5f82a5d589995 Mon Sep 17 00:00:00 2001 From: Philipp Kunz Date: Sun, 14 Apr 2024 18:09:12 +0200 Subject: [PATCH] update tsconfig --- npmextra.json | 13 ++++- package.json | 11 +++- readme.hints.md | 1 + readme.md | 144 +++++++++++++++++++++++++++++++++++++++--------- 4 files changed, 139 insertions(+), 30 deletions(-) create mode 100644 readme.hints.md diff --git a/npmextra.json b/npmextra.json index ac452ab..11b68b9 100644 --- a/npmextra.json +++ b/npmextra.json @@ -5,17 +5,24 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "smartpnpm", - "description": "use pnpm in your code", + "description": "A library for integrating pnpm package management capabilities within your code.", "npmPackagename": "@push.rocks/smartpnpm", "license": "MIT", - "projectDomain": "push.rocks" + "projectDomain": "push.rocks", + "keywords": [ + "pnpm", + "package management", + "dependency license", + "typescript", + "node.js" + ] } }, "npmci": { "npmGlobalTools": [], "npmAccessLevel": "public" }, - "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 6fffb24..81c25fb 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/smartpnpm", "version": "1.0.6", "private": false, - "description": "use pnpm in your code", + "description": "A library for integrating pnpm package management capabilities within your code.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "type": "module", @@ -38,5 +38,12 @@ "cli.js", "npmextra.json", "readme.md" + ], + "keywords": [ + "pnpm", + "package management", + "dependency license", + "typescript", + "node.js" ] -} +} \ 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 fb0bc18..56421c9 100644 --- a/readme.md +++ b/readme.md @@ -1,36 +1,130 @@ # @push.rocks/smartpnpm use pnpm in your code -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartpnpm) -* [gitlab.com (source)](https://gitlab.com/push.rocks/smartpnpm) -* [github.com (source mirror)](https://github.com/push.rocks/smartpnpm) -* [docs (typedoc)](https://push.rocks.gitlab.io/smartpnpm/) +## Install -## Status for master +To add `@push.rocks/smartpnpm` to your project, run the following command: -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartpnpm/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartpnpm/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartpnpm)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartpnpm)](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/smartpnpm)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartpnpm)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartpnpm)](https://lossless.cloud) +```bash +pnpm add @push.rocks/smartpnpm --save +``` + +Ensure that you have `pnpm` installed globally on your system. If not, you can install it via npm with: + +```bash +npm install -g pnpm +``` ## Usage -Use TypeScript for best in class intellisense. -## Contribution +This TypeScript guide assumes you have basic knowledge of TypeScript and its ecosystem. To get the most out of `@push.rocks/smartpnpm`, ensure your environment is set up for TypeScript execution. -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). :) +### Getting Started -For further information read the linked docs at the top of this readme. +First, import `SmartPnpm` from `@push.rocks/smartpnpm` in your TypeScript file: -## 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) +```typescript +import { SmartPnpm } from '@push.rocks/smartpnpm'; +``` + +Instantiate `SmartPnpm` with the directory path of the project you want to manage with pnpm. This is typically the root directory of your project: + +```typescript +const smartPnpm = new SmartPnpm('/path/to/your/project'); +``` + +### Retrieving Dependency License Information + +One of the core features of `@push.rocks/smartpnpm` is the ability to retrieve license information for all dependencies within a project. This can be especially useful for license compliance and audit purposes. + +#### Get Dependency License JSON + +To get an overview of the licenses used by your project's dependencies in JSON format, use the `getDependencyLicenseJson` method: + +```typescript +async function printDependencyLicenses() { + const licenseInfo = await smartPnpm.getDependencyLicenseJson(); + console.log(licenseInfo); +} + +printDependencyLicenses(); +``` + +This method returns a JSON object where each key is a license type, and the value is an array of packages licensed under that type. + +#### Print Dependency License Summary + +To print a summary of the license usage directly to the console, the `printDependencyLicenseSummary` method can be utilized: + +```typescript +async function printLicenseSummary() { + await smartPnpm.printDependencyLicenseSummary(); +} + +printLicenseSummary(); +``` + +This method prints a concise summary, making it easy to see how many packages are using each license type. + +#### Get License Information as Flat Array + +If you prefer to work with a flat array of all dependencies, regardless of their license type, you can use the `getDependencyLicenseFlatArray` method: + +```typescript +async function getLicensesFlatArray() { + const licenseArray = await smartPnpm.getDependencyLicenseFlatArray(); + console.log(licenseArray); +} + +getLicensesFlatArray(); +``` + +This method returns an array where each element is an object containing the license information of a single package. + +#### Retrieve All License Types + +To get an array of all the license types used by the dependencies of your project, you can use the `getDependencyLicenseArray` method: + +```typescript +async function getLicenseTypes() { + const licenseTypes = await smartPnpm.getDependencyLicenseArray(); + console.log(licenseTypes); +} + +getLicenseTypes(); +``` + +This method provides a simple list of all unique license types found in your project's dependencies. + +### Advanced Use Cases + +`@push.rocks/smartpnpm` offers flexibility for integrating pnpm functionality into your code. Here are advanced scenarios you might consider: + +- **Automating License Checks**: Integrate `@push.rocks/smartpnpm` into your CI/CD pipeline to ensure that only compatible licenses are used in your project. +- **Custom Reporting**: Use the provided methods to generate custom reports or dashboards showcasing your project's compliance with licensing requirements. +- **Dependency Management Automation**: Beyond license checks, you can extend the functionality to automate other dependency management tasks, combining the power of `@push.rocks/smartshell` with `@push.rocks/smartpnpm`. + +### Conclusion + +`@push.rocks/smartpnpm` facilitates direct interaction with pnpm, enhancing your project's dependency management and compliance processes within a TypeScript environment. By leveraging its capabilities, you can better manage your project's dependencies, ensure compliance with license requirements, and automate your workflows effectively. + +For specific use cases or troubleshooting, refer to the official `pnpm` documentation alongside this guide to address your project's particular needs. + +## 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.