Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f7774f3599 | |||
| 5e8416d7f7 | |||
| cc99ce58db | |||
| 0adb6d3e7c | |||
| bd1891652a | |||
| 06aa4e9ae6 | |||
| 73aed9f10f | |||
| ee87dbebf5 |
-133
@@ -1,133 +0,0 @@
|
||||
# gitzone ci_default_private
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
before_script:
|
||||
- pnpm install -g pnpm
|
||||
- pnpm install -g @shipzone/npmci
|
||||
- npmci npm prepare
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
auditProductionDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --prod
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
auditDevDependencies:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command pnpm audit --audit-level=high --dev
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
allow_failure: true
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci command npm run build
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
release:
|
||||
stage: release
|
||||
script:
|
||||
- npmci node install stable
|
||||
- npmci npm publish
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# metadata stage
|
||||
# ====================
|
||||
codequality:
|
||||
stage: metadata
|
||||
allow_failure: true
|
||||
only:
|
||||
- tags
|
||||
script:
|
||||
- npmci command npm install -g typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
trigger:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci trigger
|
||||
only:
|
||||
- tags
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
pages:
|
||||
stage: metadata
|
||||
script:
|
||||
- npmci node install lts
|
||||
- npmci command npm install -g @git.zone/tsdoc
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
allow_failure: true
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmRegistryUrl": "registry.npmjs.org"
|
||||
},
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartpnpm",
|
||||
"shortDescription": "pnpm integration utilities",
|
||||
"description": "A library for integrating pnpm package management capabilities within your code.",
|
||||
"npmPackagename": "@push.rocks/smartpnpm",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"pnpm",
|
||||
"package management",
|
||||
"dependency license",
|
||||
"typescript",
|
||||
"node.js"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"registries": [
|
||||
"https://verdaccio.lossless.digital",
|
||||
"https://registry.npmjs.org"
|
||||
],
|
||||
"accessLevel": "public"
|
||||
}
|
||||
},
|
||||
"@git.zone/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"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-05-01 - 1.0.7 - fix(smartpnpm)
|
||||
harden pnpm license parsing and modernize test and package configuration
|
||||
|
||||
- Escape project paths before invoking pnpm and return a typed license map from getDependencyLicenseJson instead of swallowing execution errors.
|
||||
- Migrate tests to @git.zone/tstest with an async node-specific test file and update build, test, and dependency tooling configuration.
|
||||
- Add package exports and include smart config and license files in published package contents.
|
||||
|
||||
## 2026-03-01 - 1.0.6 - maintenance
|
||||
Maintenance updates and repository metadata cleanup across the 1.0.6 release line.
|
||||
|
||||
- Removed the GitLab CI configuration
|
||||
- Updated project description
|
||||
- Updated TypeScript configuration
|
||||
- Refreshed npmextra.json git host settings
|
||||
|
||||
## 2023-10-11 - 1.0.5 to 1.0.1 - core
|
||||
Repeated patch-level core updates across several versions with no distinct changelog-worthy differences between releases.
|
||||
|
||||
- Applied the same `fix(core): update` change through versions 1.0.1, 1.0.2, 1.0.3, 1.0.4, and 1.0.5
|
||||
@@ -0,0 +1,19 @@
|
||||
Copyright (c) 2026 Task Venture Capital GmbH <hello@task.vc>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
+25
-8
@@ -1,18 +1,35 @@
|
||||
{
|
||||
"gitzone": {
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmRegistryUrl": "registry.npmjs.org"
|
||||
},
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "smartpnpm",
|
||||
"description": "use pnpm in your code",
|
||||
"shortDescription": "pnpm integration utilities",
|
||||
"description": "A library for integrating pnpm package management capabilities within your code.",
|
||||
"npmPackagename": "@push.rocks/smartpnpm",
|
||||
"license": "MIT",
|
||||
"projectDomain": "push.rocks"
|
||||
"keywords": [
|
||||
"pnpm",
|
||||
"package management",
|
||||
"dependency license",
|
||||
"typescript",
|
||||
"node.js"
|
||||
]
|
||||
},
|
||||
"release": {
|
||||
"registries": [
|
||||
"https://verdaccio.lossless.digital",
|
||||
"https://registry.npmjs.org"
|
||||
],
|
||||
"accessLevel": "public"
|
||||
}
|
||||
},
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
"@git.zone/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"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+28
-14
@@ -1,28 +1,28 @@
|
||||
{
|
||||
"name": "@push.rocks/smartpnpm",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"private": false,
|
||||
"description": "use pnpm in your code",
|
||||
"description": "A library for integrating pnpm package management capabilities within your code.",
|
||||
"exports": {
|
||||
".": "./dist_ts/index.js"
|
||||
},
|
||||
"main": "dist_ts/index.js",
|
||||
"typings": "dist_ts/index.d.ts",
|
||||
"type": "module",
|
||||
"author": "Task Venture Capital GmbH",
|
||||
"author": "Task Venture Capital GmbH <hello@task.vc>",
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"test": "(tstest test/ --web)",
|
||||
"build": "(tsbuild --web --allowimplicitany)",
|
||||
"buildDocs": "(tsdoc)"
|
||||
"test": "tstest test/",
|
||||
"build": "tsbuild",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@git.zone/tsbuild": "^2.1.25",
|
||||
"@git.zone/tsbundle": "^2.0.5",
|
||||
"@git.zone/tsrun": "^1.2.46",
|
||||
"@git.zone/tstest": "^1.0.44",
|
||||
"@push.rocks/tapbundle": "^5.0.3",
|
||||
"@types/node": "^20.8.4"
|
||||
"@git.zone/tsbuild": "^4.4.0",
|
||||
"@git.zone/tstest": "^3.6.3",
|
||||
"@types/node": "^25.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@push.rocks/smartshell": "^3.0.3"
|
||||
"@push.rocks/smartshell": "^3.3.8"
|
||||
},
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
@@ -36,7 +36,21 @@
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
".smartconfig.json",
|
||||
"license",
|
||||
"npmextra.json",
|
||||
"readme.md"
|
||||
]
|
||||
],
|
||||
"keywords": [
|
||||
"pnpm",
|
||||
"package management",
|
||||
"dependency license",
|
||||
"typescript",
|
||||
"node.js"
|
||||
],
|
||||
"homepage": "https://code.foss.global/push.rocks/smartpnpm",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://code.foss.global/push.rocks/smartpnpm.git"
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+6770
-4853
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
||||
|
||||
@@ -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 | [](https://lossless.cloud)
|
||||
GitLab Pipline Test Coverage | [](https://lossless.cloud)
|
||||
npm | [](https://lossless.cloud)
|
||||
Snyk | [](https://lossless.cloud)
|
||||
TypeScript Support | [](https://lossless.cloud)
|
||||
node Support | [](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||
Code Style | [](https://lossless.cloud)
|
||||
PackagePhobia (total standalone install weight) | [](https://lossless.cloud)
|
||||
PackagePhobia (package size on registry) | [](https://lossless.cloud)
|
||||
BundlePhobia (total size when bundled) | [](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.
|
||||
|
||||
@@ -1,20 +1,21 @@
|
||||
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
|
||||
import * as smartpnpm from '../ts/index.js'
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import * as smartpnpm from '../ts/index.js';
|
||||
|
||||
let testSmartpnpm: smartpnpm.SmartPnpm;
|
||||
|
||||
tap.test('first test', async () => {
|
||||
testSmartpnpm = new smartpnpm.SmartPnpm(process.cwd());
|
||||
expect(testSmartpnpm).toBeInstanceOf(smartpnpm.SmartPnpm);
|
||||
})
|
||||
});
|
||||
|
||||
tap.test('should list depdendencies', async () => {
|
||||
const result = testSmartpnpm.getDependencyLicenseJson();
|
||||
const result = await testSmartpnpm.getDependencyLicenseJson();
|
||||
expect(result).toBeInstanceOf(Object);
|
||||
});
|
||||
|
||||
tap.test('should print license summary', async () => {
|
||||
await testSmartpnpm.printDependencyLicenseSummary();
|
||||
})
|
||||
});
|
||||
|
||||
tap.test('should get a simple array of licenses', async () => {
|
||||
const result = await testSmartpnpm.getDependencyLicenseArray();
|
||||
@@ -23,4 +24,4 @@ tap.test('should get a simple array of licenses', async () => {
|
||||
|
||||
|
||||
|
||||
tap.start()
|
||||
export default tap.start();
|
||||
@@ -1,8 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @pushrocks/commitinfo
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/smartpnpm',
|
||||
version: '1.0.6',
|
||||
description: 'use pnpm in your code'
|
||||
version: '1.0.7',
|
||||
description: 'A library for integrating pnpm package management capabilities within your code.'
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ export interface IPnpmLicenseResult {
|
||||
"description": string;
|
||||
}
|
||||
|
||||
export type TPnpmLicenseMap = Record<string, IPnpmLicenseResult[]>;
|
||||
|
||||
export class SmartPnpm {
|
||||
public projectDir: string;
|
||||
|
||||
@@ -19,18 +21,12 @@ export class SmartPnpm {
|
||||
|
||||
private smartshellInstance = new plugins.smartshell.Smartshell({
|
||||
executor: 'bash',
|
||||
})
|
||||
});
|
||||
|
||||
async getDependencyLicenseJson() {
|
||||
try {
|
||||
// Get store directory
|
||||
const execResult = await this.smartshellInstance.execSilent(`(cd ${this.projectDir} && pnpm licenses list --json)`);
|
||||
const licenseJson: {[key: string]: Array<IPnpmLicenseResult>} = JSON.parse(execResult.stdout);
|
||||
return licenseJson;
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
}
|
||||
async getDependencyLicenseJson(): Promise<TPnpmLicenseMap> {
|
||||
const projectDir = this.projectDir.replace(/(["\\$`])/g, '\\$1');
|
||||
const execResult = await this.smartshellInstance.execSilent(`(cd "${projectDir}" && pnpm licenses list --json)`);
|
||||
return JSON.parse(execResult.stdout) as TPnpmLicenseMap;
|
||||
}
|
||||
|
||||
public async printDependencyLicenseSummary() {
|
||||
@@ -45,7 +41,7 @@ export class SmartPnpm {
|
||||
} else {
|
||||
console.log(`|-- ${refArray.length} packages. Not detailing this license type.`);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public async getDependencyLicenseFlatArray() {
|
||||
|
||||
@@ -2,4 +2,4 @@ import * as smartshell from '@push.rocks/smartshell';
|
||||
|
||||
export {
|
||||
smartshell,
|
||||
}
|
||||
};
|
||||
|
||||
+3
-1
@@ -5,8 +5,10 @@
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"noImplicitAny": true,
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true
|
||||
"verbatimModuleSyntax": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
|
||||
Reference in New Issue
Block a user