Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0dbcfca79b | |||
| 4a20f31b99 | |||
| 9e79ea4e70 | |||
| ecc5dee2ee | |||
| 5ac7470e24 | |||
| 3f9e0f2907 | |||
| c3bc4630bd | |||
| 3d346b0515 | |||
| 6d12041154 | |||
| db6b2aa8c1 | |||
| fd4bd1919e | |||
| 8c4404ff68 | |||
| f2e91b8e1b | |||
| 31bcc5f8c2 | |||
| 216eabe035 |
66
.gitea/workflows/default_nottags.yaml
Normal file
66
.gitea/workflows/default_nottags.yaml
Normal file
@@ -0,0 +1,66 @@
|
||||
name: Default (not tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags-ignore:
|
||||
- '**'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Install pnpm and npmci
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
|
||||
- name: Run npm prepare
|
||||
run: npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
124
.gitea/workflows/default_tags.yaml
Normal file
124
.gitea/workflows/default_tags.yaml
Normal file
@@ -0,0 +1,124 @@
|
||||
name: Default (tags)
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*'
|
||||
|
||||
env:
|
||||
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
|
||||
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
|
||||
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
|
||||
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
|
||||
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
|
||||
|
||||
jobs:
|
||||
security:
|
||||
runs-on: ubuntu-latest
|
||||
continue-on-error: true
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Audit production dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --prod
|
||||
continue-on-error: true
|
||||
|
||||
- name: Audit development dependencies
|
||||
run: |
|
||||
npmci command npm config set registry https://registry.npmjs.org
|
||||
npmci command pnpm audit --audit-level=high --dev
|
||||
continue-on-error: true
|
||||
|
||||
test:
|
||||
if: ${{ always() }}
|
||||
needs: security
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Test stable
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm test
|
||||
|
||||
- name: Test build
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
npmci npm build
|
||||
|
||||
release:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Release
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm publish
|
||||
|
||||
metadata:
|
||||
needs: test
|
||||
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ${{ env.IMAGE }}
|
||||
continue-on-error: true
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Prepare
|
||||
run: |
|
||||
pnpm install -g pnpm
|
||||
pnpm install -g @shipzone/npmci
|
||||
npmci npm prepare
|
||||
|
||||
- name: Code quality
|
||||
run: |
|
||||
npmci command npm install -g typescript
|
||||
npmci npm install
|
||||
|
||||
- name: Trigger
|
||||
run: npmci trigger
|
||||
|
||||
- name: Build docs and upload artifacts
|
||||
run: |
|
||||
npmci node install stable
|
||||
npmci npm install
|
||||
pnpm install -g @git.zone/tsdoc
|
||||
npmci command tsdoc
|
||||
continue-on-error: true
|
||||
127
.gitlab-ci.yml
127
.gitlab-ci.yml
@@ -1,127 +0,0 @@
|
||||
# gitzone ci_default
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- .npmci_cache/
|
||||
key: '$CI_BUILD_STAGE'
|
||||
|
||||
stages:
|
||||
- security
|
||||
- test
|
||||
- release
|
||||
- metadata
|
||||
|
||||
# ====================
|
||||
# security stage
|
||||
# ====================
|
||||
mirror:
|
||||
stage: security
|
||||
script:
|
||||
- npmci git mirror
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
audit:
|
||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||
stage: security
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci command npm install --ignore-scripts
|
||||
- npmci command npm config set registry https://registry.npmjs.org
|
||||
- npmci command npm audit --audit-level=high
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
|
||||
# ====================
|
||||
# test stage
|
||||
# ====================
|
||||
|
||||
testStable:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- npmci node install stable
|
||||
- npmci npm install
|
||||
- npmci npm test
|
||||
coverage: /\d+.?\d+?\%\s*coverage/
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- priv
|
||||
|
||||
testBuild:
|
||||
stage: test
|
||||
script:
|
||||
- npmci npm prepare
|
||||
- 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
|
||||
script:
|
||||
- npmci command npm install -g tslint typescript
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||
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 @gitzone/tsdoc
|
||||
- npmci npm prepare
|
||||
- npmci npm install
|
||||
- npmci command tsdoc
|
||||
tags:
|
||||
- lossless
|
||||
- docker
|
||||
- notpriv
|
||||
only:
|
||||
- tags
|
||||
artifacts:
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- public
|
||||
allow_failure: true
|
||||
34
.smartconfig.json
Normal file
34
.smartconfig.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"@git.zone/cli": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "code.foss.global",
|
||||
"gitscope": "push.rocks",
|
||||
"gitrepo": "projectinfo",
|
||||
"description": "A tool for gathering project information, supporting npm, git, and more.",
|
||||
"npmPackagename": "@push.rocks/projectinfo",
|
||||
"license": "MIT",
|
||||
"keywords": [
|
||||
"project-info",
|
||||
"npm",
|
||||
"git",
|
||||
"typescript",
|
||||
"package-info",
|
||||
"repository"
|
||||
]
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"@ship.zone/szci": {
|
||||
"npmGlobalTools": []
|
||||
}
|
||||
}
|
||||
24
.vscode/launch.json
vendored
24
.vscode/launch.json
vendored
@@ -2,28 +2,10 @@
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "current file",
|
||||
"type": "node",
|
||||
"command": "npm test",
|
||||
"name": "Run npm test",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"${relativeFile}"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
},
|
||||
{
|
||||
"name": "test.ts",
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"args": [
|
||||
"test/test.ts"
|
||||
],
|
||||
"runtimeArgs": ["-r", "@gitzone/tsrun"],
|
||||
"cwd": "${workspaceRoot}",
|
||||
"protocol": "inspector",
|
||||
"internalConsoleOptions": "openOnSessionStart"
|
||||
"type": "node-terminal"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
@@ -15,7 +15,7 @@
|
||||
"properties": {
|
||||
"projectType": {
|
||||
"type": "string",
|
||||
"enum": ["website", "element", "service", "npm"]
|
||||
"enum": ["website", "element", "service", "npm", "wcc"]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
95
changelog.md
Normal file
95
changelog.md
Normal file
@@ -0,0 +1,95 @@
|
||||
# Changelog
|
||||
|
||||
## 2026-03-26 - 5.1.0 - feat(projectinfo)
|
||||
migrate project info loading to async factories and update build configuration
|
||||
|
||||
- replace synchronous npm metadata loading with async factory methods in ProjectInfo and ProjectinfoNpm
|
||||
- switch filesystem access from @push.rocks/smartfile to @push.rocks/smartfs and update helper/tests for async usage
|
||||
- refresh build tooling and project metadata configuration, including .smartconfig.json and tsbuild script updates
|
||||
|
||||
## 2024-05-29 - 5.0.2 - maintenance
|
||||
Repository metadata and configuration updates across 5.0.2.
|
||||
|
||||
- Updated project description
|
||||
- Updated TypeScript configuration
|
||||
- Updated npmextra.json githost settings
|
||||
|
||||
## 2023-08-08 - 5.0.1 - core
|
||||
Small core maintenance release with repository organization updates.
|
||||
|
||||
- Fixed a core update
|
||||
- Switched to the new organization scheme
|
||||
|
||||
## 2022-04-18 - 5.0.0 - core
|
||||
Major release introducing an ESM migration.
|
||||
|
||||
- BREAKING CHANGE: switched the package to ESM
|
||||
- Included a core update alongside the release
|
||||
|
||||
## 2020-06-01 - 4.0.3-4.0.5 - core
|
||||
Grouped maintenance releases with repeated core update work.
|
||||
|
||||
- 4.0.3 and 4.0.4 delivered routine core fixes
|
||||
- 4.0.5 introduced a breaking change by switching core packaging behavior toward ESM compatibility
|
||||
|
||||
## 2018-09-02 - 4.0.0-4.0.2 - package
|
||||
Infrastructure and package metadata updates across the 4.0.x line.
|
||||
|
||||
- 4.0.0 updated CI configuration
|
||||
- 4.0.1 fixed the private parameter in package.json
|
||||
- 4.0.2 delivered another core update
|
||||
|
||||
## 2018-09-02 - 3.0.4-3.0.5 - scope
|
||||
Dependency maintenance followed by a breaking scope adjustment.
|
||||
|
||||
- 3.0.4 updated dependencies
|
||||
- 3.0.5 introduced a BREAKING CHANGE by changing scope
|
||||
|
||||
## 2017-09-22 - 3.0.1-3.0.3 - maintenance
|
||||
Routine maintenance releases focused on dependencies, CI, and documentation.
|
||||
|
||||
- 3.0.1 updated dependencies and README
|
||||
- 3.0.2 updated dependencies
|
||||
- 3.0.3 updated CI
|
||||
|
||||
## 2016-11-26 - 3.0.0 - documentation
|
||||
Documentation-only release.
|
||||
|
||||
- Updated README
|
||||
|
||||
## 2016-11-26 - 2.0.0 - core
|
||||
Feature release introducing the main project information class.
|
||||
|
||||
- Added the ProjectInfo main class
|
||||
|
||||
## 2016-10-27 - 1.0.3-1.0.4 - maintenance
|
||||
Project standards, tooling, and documentation improvements.
|
||||
|
||||
- 1.0.3 updated smartfile, CI base image, and added README
|
||||
- 1.0.4 updated the project to meet newer standards
|
||||
|
||||
## 2016-06-08 - 1.0.1-1.0.2 - refactor
|
||||
Dependency and structure updates across early 1.x releases.
|
||||
|
||||
- 1.0.1 updated dependencies and restructured code
|
||||
- 1.0.2 updated dependencies, project structure, and typings configuration
|
||||
|
||||
## 2016-02-23 - 1.0.0 - core
|
||||
Initial stable release with token handling improvements.
|
||||
|
||||
- Added token handling correctly
|
||||
- Included a small lint fix
|
||||
|
||||
## 2016-02-21 - 0.0.3-0.0.5 - core
|
||||
Early project setup and metadata expansion.
|
||||
|
||||
- 0.0.3 updated project structure
|
||||
- 0.0.4 added .license support to the npm class
|
||||
- 0.0.5 added repository information and git metadata
|
||||
|
||||
## 2016-02-20 - 0.0.0-0.0.2 - bootstrap
|
||||
Initial bootstrap releases establishing the project foundation.
|
||||
|
||||
- Added Travis CI setup
|
||||
- Added a second npm version
|
||||
- Added the getName function
|
||||
@@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Push.Rocks
|
||||
Copyright (c) 2016 Task Venture Capital GmbH
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
},
|
||||
"gitzone": {
|
||||
"projectType": "npm",
|
||||
"module": {
|
||||
"githost": "gitlab.com",
|
||||
"gitscope": "pushrocks",
|
||||
"gitrepo": "projectinfo",
|
||||
"shortDescription": "gather information about projects. supports npm, git etc.",
|
||||
"npmPackagename": "@pushrocks/projectinfo",
|
||||
"license": "MIT"
|
||||
}
|
||||
}
|
||||
}
|
||||
4705
package-lock.json
generated
4705
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
45
package.json
45
package.json
@@ -1,45 +1,45 @@
|
||||
{
|
||||
"name": "@pushrocks/projectinfo",
|
||||
"version": "4.0.5",
|
||||
"name": "@push.rocks/projectinfo",
|
||||
"version": "5.1.0",
|
||||
"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",
|
||||
"scripts": {
|
||||
"test": "(tstest test/)",
|
||||
"build": "(tsbuild --web)"
|
||||
"build": "(tsbuild tsfolders)",
|
||||
"buildDocs": "tsdoc"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://gitlab.com/pushrocks/projectinfo.git"
|
||||
"url": "https://code.foss.global/push.rocks/projectinfo.git"
|
||||
},
|
||||
"keywords": [
|
||||
"project",
|
||||
"project-info",
|
||||
"npm",
|
||||
"git",
|
||||
"info",
|
||||
"package"
|
||||
"typescript",
|
||||
"package-info",
|
||||
"repository"
|
||||
],
|
||||
"author": "Lossless GmbH",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/pushrocks/projectinfo/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/projectinfo#readme",
|
||||
"homepage": "https://code.foss.global/push.rocks/projectinfo",
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.1.24",
|
||||
"@gitzone/tsrun": "^1.2.12",
|
||||
"@gitzone/tstest": "^1.0.33",
|
||||
"@pushrocks/tapbundle": "^3.2.1",
|
||||
"@types/node": "^14.0.6",
|
||||
"tslint": "^6.1.2",
|
||||
"tslint-config-prettier": "^1.18.0"
|
||||
"@git.zone/tsbuild": "^4.4.0",
|
||||
"@git.zone/tsrun": "^2.0.2",
|
||||
"@git.zone/tstest": "^3.6.0",
|
||||
"@types/node": "^25.5.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@pushrocks/smartfile": "^7.0.12",
|
||||
"@pushrocks/smartpath": "^4.0.3",
|
||||
"@pushrocks/smartpromise": "^3.0.6",
|
||||
"@pushrocks/smartstring": "^3.0.18"
|
||||
"@push.rocks/smartfs": "^1.5.0",
|
||||
"@push.rocks/smartpath": "^6.0.0",
|
||||
"@push.rocks/smartpromise": "^4.2.3",
|
||||
"@push.rocks/smartstring": "^4.1.0"
|
||||
},
|
||||
"files": [
|
||||
"ts/**/*",
|
||||
@@ -50,7 +50,10 @@
|
||||
"dist_ts_web/**/*",
|
||||
"assets/**/*",
|
||||
"cli.js",
|
||||
"npmextra.json",
|
||||
".smartconfig.json",
|
||||
"readme.md"
|
||||
],
|
||||
"browserslist": [
|
||||
"last 1 chrome versions"
|
||||
]
|
||||
}
|
||||
|
||||
8014
pnpm-lock.yaml
generated
Normal file
8014
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
1
readme.hints.md
Normal file
1
readme.hints.md
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
185
readme.md
185
readme.md
@@ -1,51 +1,158 @@
|
||||
# @pushrocks/projectinfo
|
||||
gather information about projects. supports npm, git etc.
|
||||
# @push.rocks/projectinfo
|
||||
|
||||
## Availabililty and Links
|
||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/projectinfo)
|
||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/projectinfo)
|
||||
* [github.com (source mirror)](https://github.com/pushrocks/projectinfo)
|
||||
* [docs (typedoc)](https://pushrocks.gitlab.io/projectinfo/)
|
||||
A tool for gathering project information, supporting npm, git, and more.
|
||||
|
||||
## Status for master
|
||||
## Issue Reporting and Security
|
||||
|
||||
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)
|
||||
Platform support | [](https://lossless.cloud) [](https://lossless.cloud)
|
||||
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
||||
|
||||
## Usage
|
||||
## Install 📦
|
||||
|
||||
Use TypeScript for best in class instellisense.
|
||||
Install via npm:
|
||||
|
||||
```javascript
|
||||
import { ProjectInfo } from 'projectinfo';
|
||||
|
||||
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
|
||||
|
||||
// for more info check out the module in your IDE with TypeScript intellisense enabled
|
||||
```bash
|
||||
npm install @push.rocks/projectinfo
|
||||
```
|
||||
|
||||
## Contribution
|
||||
Or with pnpm:
|
||||
|
||||
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). :)
|
||||
```bash
|
||||
pnpm install @push.rocks/projectinfo
|
||||
```
|
||||
|
||||
For further information read the linked docs at the top of this readme.
|
||||
This module is ESM-only and requires Node.js 18+.
|
||||
|
||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
||||
## Usage 🚀
|
||||
|
||||
[](https://maintainedby.lossless.com)
|
||||
`@push.rocks/projectinfo` provides an async API for extracting npm and git metadata from any project directory. It uses `@push.rocks/smartfs` under the hood for filesystem operations.
|
||||
|
||||
All classes use async factory methods — no synchronous constructors.
|
||||
|
||||
### Quick Start
|
||||
|
||||
```typescript
|
||||
import { ProjectInfo, ProjectinfoNpm, getNpmNameForDir } from '@push.rocks/projectinfo';
|
||||
```
|
||||
|
||||
### Get Full Project Info
|
||||
|
||||
The `ProjectInfo` class is the main entry point. It gathers both npm and git info from a given directory:
|
||||
|
||||
```typescript
|
||||
import { ProjectInfo } from '@push.rocks/projectinfo';
|
||||
|
||||
const info = await ProjectInfo.create('./my-project');
|
||||
|
||||
// npm info
|
||||
console.log(info.npm.name); // e.g. "@push.rocks/projectinfo"
|
||||
console.log(info.npm.version); // e.g. "5.0.2"
|
||||
console.log(info.npm.license); // e.g. "MIT"
|
||||
console.log(info.npm.isNpm); // true if package.json exists
|
||||
|
||||
// git info (parsed from directory path)
|
||||
console.log(info.git.gitrepo); // e.g. "projectinfo"
|
||||
console.log(info.git.gituser); // e.g. "push.rocks"
|
||||
|
||||
// project type
|
||||
console.log(info.type); // "npm" if package.json found, otherwise "git"
|
||||
```
|
||||
|
||||
### NPM Info Only
|
||||
|
||||
Use `ProjectinfoNpm` directly when you only need package.json data:
|
||||
|
||||
```typescript
|
||||
import { ProjectinfoNpm } from '@push.rocks/projectinfo';
|
||||
|
||||
const npm = await ProjectinfoNpm.create('/path/to/project');
|
||||
|
||||
if (npm.isNpm) {
|
||||
console.log(npm.name); // package name
|
||||
console.log(npm.version); // package version
|
||||
console.log(npm.license); // license field
|
||||
console.log(npm.packageJson); // full parsed package.json object
|
||||
}
|
||||
```
|
||||
|
||||
#### With Git Access Token
|
||||
|
||||
If your `package.json` has a `repository` field, `ProjectinfoNpm` will parse it into a `GitRepo` object. You can provide an access token for authenticated URLs:
|
||||
|
||||
```typescript
|
||||
const npm = await ProjectinfoNpm.create('/path/to/project', {
|
||||
gitAccessToken: 'ghp_your_token_here',
|
||||
});
|
||||
|
||||
if (npm.git) {
|
||||
console.log(npm.git.httpsUrl); // e.g. "https://ghp_your_token_here@github.com/user/repo.git"
|
||||
}
|
||||
```
|
||||
|
||||
### Git Info Only
|
||||
|
||||
Use `ProjectinfoGit` for path-based git metadata extraction:
|
||||
|
||||
```typescript
|
||||
import { ProjectinfoGit } from '@push.rocks/projectinfo';
|
||||
|
||||
// Parses the directory path to extract git user and repo
|
||||
const git = new ProjectinfoGit('/home/user/repos/myorg/myrepo');
|
||||
|
||||
console.log(git.gituser); // "myorg"
|
||||
console.log(git.gitrepo); // "myrepo"
|
||||
```
|
||||
|
||||
You can also parse a remote URL:
|
||||
|
||||
```typescript
|
||||
git.getGitInfoFromRemote('git+https://github.com/someuser/somerepo.git');
|
||||
```
|
||||
|
||||
### Quick Helper: Get Package Name
|
||||
|
||||
A convenience function to quickly get the npm package name from a directory:
|
||||
|
||||
```typescript
|
||||
import { getNpmNameForDir } from '@push.rocks/projectinfo';
|
||||
|
||||
const name = await getNpmNameForDir('./my-project');
|
||||
console.log(name); // e.g. "@push.rocks/projectinfo"
|
||||
```
|
||||
|
||||
Returns `undefined` if no valid `package.json` is found.
|
||||
|
||||
### API Reference
|
||||
|
||||
| Class / Function | Description |
|
||||
|---|---|
|
||||
| `ProjectInfo.create(cwd)` | Async factory — gathers both npm + git info |
|
||||
| `ProjectinfoNpm.create(cwd, opts?)` | Async factory — parses `package.json` |
|
||||
| `ProjectinfoGit(cwd)` | Sync constructor — extracts git info from path |
|
||||
| `getNpmNameForDir(cwd)` | Async helper — returns the npm package name |
|
||||
|
||||
### Types
|
||||
|
||||
```typescript
|
||||
type TProjectType = 'git' | 'npm';
|
||||
```
|
||||
|
||||
## License and Legal Information
|
||||
|
||||
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./license) file.
|
||||
|
||||
**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 or third parties, 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 or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
||||
|
||||
### Company Information
|
||||
|
||||
Task Venture Capital GmbH
|
||||
Registered at District Court Bremen HRB 35230 HB, Germany
|
||||
|
||||
For any legal inquiries or 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.
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"name": "testpackage",
|
||||
"version": "1.0.0",
|
||||
"description": "some test",
|
||||
"type": "module",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/someuser/somerepo.git"
|
||||
|
||||
32
test/test.ts
32
test/test.ts
@@ -1,31 +1,37 @@
|
||||
import { tap, expect } from '@pushrocks/tapbundle';
|
||||
import projectinfo = require('../ts/index');
|
||||
import { tap, expect } from '@git.zone/tstest/tapbundle';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
import * as projectinfo from '../ts/index.js';
|
||||
|
||||
let path = require('path');
|
||||
let testBasePath = path.resolve(__dirname);
|
||||
import * as path from 'path';
|
||||
let testBasePath = path.resolve(smartpath.get.dirnameFromImportMetaUrl(import.meta.url));
|
||||
|
||||
let myNpm: projectinfo.ProjectinfoNpm;
|
||||
|
||||
tap.test('should create ProjectinfoNpm instance', async () => {
|
||||
myNpm = await projectinfo.ProjectinfoNpm.create(testBasePath, { gitAccessToken: 'sometoken' });
|
||||
});
|
||||
|
||||
let myNpm = new projectinfo.ProjectinfoNpm(testBasePath, { gitAccessToken: 'sometoken' });
|
||||
tap.test('should have .packageJson', async () => {
|
||||
expect(myNpm.packageJson).have.property('version', '1.0.0');
|
||||
expect(myNpm.packageJson).have.property('name', 'testpackage');
|
||||
expect(myNpm.packageJson).property('version').toEqual('1.0.0');
|
||||
expect(myNpm.packageJson).property('name').toEqual('testpackage');
|
||||
});
|
||||
|
||||
tap.test('should have .version', async () => {
|
||||
expect(myNpm).have.property('version', '1.0.0');
|
||||
expect(myNpm).property('version').toEqual('1.0.0');
|
||||
});
|
||||
|
||||
tap.test('should have .name', async () => {
|
||||
expect(myNpm).have.property('name', 'testpackage');
|
||||
expect(myNpm).property('name').toEqual('testpackage');
|
||||
});
|
||||
|
||||
tap.test('should have .license', async () => {
|
||||
expect(myNpm).have.property('license', 'MIT');
|
||||
expect(myNpm).property('license').toEqual('MIT');
|
||||
});
|
||||
tap.test('should have .git', async () => {
|
||||
expect(myNpm.git.httpsUrl).equal('https://sometoken@github.com/someuser/somerepo.git');
|
||||
expect(myNpm.git!.httpsUrl).toEqual('https://sometoken@github.com/someuser/somerepo.git');
|
||||
});
|
||||
tap.test('should return a name', async () => {
|
||||
expect(projectinfo.getNpmNameForDir(testBasePath)).equal('testpackage');
|
||||
expect(await projectinfo.getNpmNameForDir(testBasePath)).toEqual('testpackage');
|
||||
});
|
||||
|
||||
tap.start();
|
||||
export default tap.start();
|
||||
|
||||
8
ts/00_commitinfo_data.ts
Normal file
8
ts/00_commitinfo_data.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* autocreated commitinfo by @push.rocks/commitinfo
|
||||
*/
|
||||
export const commitinfo = {
|
||||
name: '@push.rocks/projectinfo',
|
||||
version: '5.1.0',
|
||||
description: 'A tool for gathering project information, supporting npm, git, and more.'
|
||||
}
|
||||
14
ts/index.ts
14
ts/index.ts
@@ -1,20 +1,20 @@
|
||||
import plugins = require('./projectinfo.plugins');
|
||||
import * as plugins from './projectinfo.plugins.js';
|
||||
|
||||
// direct access to classes
|
||||
export * from './projectinfo.classes.git';
|
||||
export * from './projectinfo.classes.npm';
|
||||
export * from './projectinfo.classes.projectinfo';
|
||||
export * from './projectinfo.classes.git.js';
|
||||
export * from './projectinfo.classes.npm.js';
|
||||
export * from './projectinfo.classes.projectinfo.js';
|
||||
|
||||
// npm
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm';
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm.js';
|
||||
|
||||
// quick functions
|
||||
|
||||
/**
|
||||
* gets the name from package.json in a specified directory
|
||||
*/
|
||||
export let getNpmNameForDir = function(cwdArg) {
|
||||
let localNpm = new ProjectinfoNpm(cwdArg);
|
||||
export let getNpmNameForDir = async function (cwdArg: string) {
|
||||
let localNpm = await ProjectinfoNpm.create(cwdArg);
|
||||
if (localNpm.status === 'ok') {
|
||||
return localNpm.name;
|
||||
}
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import * as plugins from './projectinfo.plugins';
|
||||
import * as plugins from './projectinfo.plugins.js';
|
||||
|
||||
export class ProjectinfoGit {
|
||||
isGit: boolean;
|
||||
githost: string;
|
||||
gituser: string;
|
||||
gitrepo: string;
|
||||
isGit: boolean = false;
|
||||
githost: string = '';
|
||||
gituser: string = '';
|
||||
gitrepo: string = '';
|
||||
cwd: string;
|
||||
constructor(cwdArg: string) {
|
||||
this.cwd = cwdArg;
|
||||
|
||||
@@ -1,31 +1,38 @@
|
||||
import plugins = require('./projectinfo.plugins');
|
||||
import * as plugins from './projectinfo.plugins.js';
|
||||
|
||||
export class ProjectinfoNpm {
|
||||
isNpm: boolean = false;
|
||||
packageJson: any;
|
||||
name: string;
|
||||
version: string;
|
||||
status: string;
|
||||
license: string;
|
||||
git: plugins.smartstring.GitRepo;
|
||||
packageJson: any = null;
|
||||
name: string = '';
|
||||
version: string = '';
|
||||
status: string = '';
|
||||
license: string = '';
|
||||
git: plugins.smartstring.GitRepo | null = null;
|
||||
|
||||
constructor(cwdArg: string, optionsArg: { gitAccessToken?: string } = {}) {
|
||||
let resolvedCwd = plugins.path.resolve(cwdArg);
|
||||
if (plugins.smartfile.fs.fileExists(plugins.path.join(resolvedCwd, 'package.json'))) {
|
||||
this.isNpm = true;
|
||||
this.packageJson = plugins.smartfile.fs.toObjectSync(
|
||||
plugins.path.join(resolvedCwd, 'package.json'),
|
||||
'json'
|
||||
);
|
||||
this.name = this.packageJson.name;
|
||||
this.version = this.packageJson.version;
|
||||
this.status = 'ok';
|
||||
this.license = this.packageJson.license;
|
||||
if (this.packageJson.repository) {
|
||||
this.git = new plugins.smartstring.GitRepo(
|
||||
this.packageJson.repository.url,
|
||||
private constructor() {}
|
||||
|
||||
static async create(cwdArg: string, optionsArg: { gitAccessToken?: string } = {}): Promise<ProjectinfoNpm> {
|
||||
const instance = new ProjectinfoNpm();
|
||||
const resolvedCwd = plugins.path.resolve(cwdArg);
|
||||
const smartFsInstance = new plugins.smartfs.SmartFs(new plugins.smartfs.SmartFsProviderNode());
|
||||
const packageJsonPath = plugins.path.join(resolvedCwd, 'package.json');
|
||||
|
||||
const fileExists = await smartFsInstance.file(packageJsonPath).exists();
|
||||
if (fileExists) {
|
||||
instance.isNpm = true;
|
||||
const content = await smartFsInstance.file(packageJsonPath).encoding('utf8').read();
|
||||
instance.packageJson = JSON.parse(content as string);
|
||||
instance.name = instance.packageJson.name;
|
||||
instance.version = instance.packageJson.version;
|
||||
instance.status = 'ok';
|
||||
instance.license = instance.packageJson.license;
|
||||
if (instance.packageJson.repository) {
|
||||
instance.git = new plugins.smartstring.GitRepo(
|
||||
instance.packageJson.repository.url,
|
||||
optionsArg.gitAccessToken
|
||||
);
|
||||
}
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
import * as plugins from './projectinfo.plugins';
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm';
|
||||
import { ProjectinfoGit } from './projectinfo.classes.git';
|
||||
import * as plugins from './projectinfo.plugins.js';
|
||||
import { ProjectinfoNpm } from './projectinfo.classes.npm.js';
|
||||
import { ProjectinfoGit } from './projectinfo.classes.git.js';
|
||||
export type TProjectType = 'git' | 'npm';
|
||||
|
||||
/**
|
||||
* class projectinfo automatically examines a given directory and exposes relevant info about it
|
||||
*/
|
||||
export class ProjectInfo {
|
||||
type: TProjectType;
|
||||
type: TProjectType = 'git';
|
||||
npm: ProjectinfoNpm;
|
||||
git: ProjectinfoGit;
|
||||
/**
|
||||
* constructor of class ProjectInfo
|
||||
*/
|
||||
constructor(cwdArg: string) {
|
||||
this.npm = new ProjectinfoNpm(cwdArg);
|
||||
this.git = new ProjectinfoGit(cwdArg);
|
||||
|
||||
private constructor(npm: ProjectinfoNpm, git: ProjectinfoGit) {
|
||||
this.npm = npm;
|
||||
this.git = git;
|
||||
if (npm.isNpm) {
|
||||
this.type = 'npm';
|
||||
}
|
||||
}
|
||||
|
||||
static async create(cwdArg: string): Promise<ProjectInfo> {
|
||||
const npm = await ProjectinfoNpm.create(cwdArg);
|
||||
const git = new ProjectinfoGit(cwdArg);
|
||||
return new ProjectInfo(npm, git);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import * as path from 'path';
|
||||
import * as smartpromise from '@pushrocks/smartpromise';
|
||||
import * as smartfile from '@pushrocks/smartfile';
|
||||
import * as smartstring from '@pushrocks/smartstring';
|
||||
import * as smartpath from '@pushrocks/smartpath';
|
||||
import * as smartpromise from '@push.rocks/smartpromise';
|
||||
import * as smartfs from '@push.rocks/smartfs';
|
||||
import * as smartstring from '@push.rocks/smartstring';
|
||||
import * as smartpath from '@push.rocks/smartpath';
|
||||
|
||||
export { path, smartpromise, smartfile, smartstring, smartpath };
|
||||
export { path, smartpromise, smartfs, smartstring, smartpath };
|
||||
|
||||
15
tsconfig.json
Normal file
15
tsconfig.json
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"experimentalDecorators": true,
|
||||
"useDefineForClassFields": false,
|
||||
"target": "ES2022",
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext",
|
||||
"esModuleInterop": true,
|
||||
"verbatimModuleSyntax": true,
|
||||
"types": ["node"]
|
||||
},
|
||||
"exclude": [
|
||||
"dist_*/**/*.d.ts"
|
||||
]
|
||||
}
|
||||
17
tslint.json
17
tslint.json
@@ -1,17 +0,0 @@
|
||||
{
|
||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||
"rules": {
|
||||
"semicolon": [true, "always"],
|
||||
"no-console": false,
|
||||
"ordered-imports": false,
|
||||
"object-literal-sort-keys": false,
|
||||
"member-ordering": {
|
||||
"options":{
|
||||
"order": [
|
||||
"static-method"
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"defaultSeverity": "warning"
|
||||
}
|
||||
Reference in New Issue
Block a user