58 Commits

Author SHA1 Message Date
0dbcfca79b v5.1.0 2026-03-26 08:35:13 +00:00
4a20f31b99 feat(projectinfo): migrate project info loading to async factories and update build configuration 2026-03-26 08:35:13 +00:00
9e79ea4e70 update description 2024-05-29 14:11:27 +02:00
ecc5dee2ee update tsconfig 2024-04-14 17:15:51 +02:00
5ac7470e24 update npmextra.json: githost 2024-04-01 21:33:28 +02:00
3f9e0f2907 update npmextra.json: githost 2024-04-01 19:57:31 +02:00
c3bc4630bd update npmextra.json: githost 2024-03-30 21:46:28 +01:00
3d346b0515 5.0.2 2023-08-08 18:06:23 +02:00
6d12041154 fix(core): update 2023-08-08 18:06:23 +02:00
db6b2aa8c1 switch to new org scheme 2023-07-11 00:06:23 +02:00
fd4bd1919e switch to new org scheme 2023-07-10 02:41:49 +02:00
8c4404ff68 5.0.1 2022-04-18 22:17:11 +02:00
f2e91b8e1b fix(core): update 2022-04-18 22:17:10 +02:00
31bcc5f8c2 5.0.0 2022-04-18 22:16:46 +02:00
216eabe035 BREAKING CHANGE(core): switch to ESM 2022-04-18 22:16:46 +02:00
bc79a9ae42 4.0.5 2020-06-01 22:57:09 +00:00
b82b6de5f5 fix(core): update 2020-06-01 22:57:08 +00:00
b27c069177 4.0.4 2020-06-01 22:45:54 +00:00
b25be551f6 fix(core): update 2020-06-01 22:45:54 +00:00
47da0afd4b 4.0.3 2020-06-01 22:45:46 +00:00
f9296f1f26 fix(core): update 2020-06-01 22:45:45 +00:00
d013fbad50 4.0.2 2018-09-02 14:24:45 +02:00
d5f72a76d9 fix(package.json): fix private param 2018-09-02 14:24:45 +02:00
d26a8b02db 4.0.1 2018-09-02 14:21:05 +02:00
9b3db5daca fix(ci): update 2018-09-02 14:21:05 +02:00
75d94111a9 4.0.0 2018-09-02 14:12:36 +02:00
4f425dfc93 BREAKING CHANGE(scope): change scope 2018-09-02 14:12:36 +02:00
0f2af7219e 3.0.5 2018-09-02 14:08:15 +02:00
9abe15f871 fix(dependencies): update 2018-09-02 14:08:15 +02:00
27aa9f7166 3.0.4 2017-09-22 23:53:26 +02:00
0a1063e6c8 update ci 2017-09-22 23:52:28 +02:00
f606dd6e6d 3.0.3 2017-09-22 23:46:46 +02:00
5c608dd675 update dependencies 2017-09-22 23:46:43 +02:00
b4f8093230 3.0.2 2017-02-27 22:46:15 +01:00
aa903ec93e update deps and readme 2017-02-27 22:46:12 +01:00
187721a511 3.0.1 2016-11-27 00:09:09 +01:00
c457cbff6a update README 2016-11-27 00:09:04 +01:00
6fbc179fcb 3.0.0 2016-11-26 23:18:46 +01:00
c17db19b9f added ProjectInfo main class 2016-11-26 23:18:33 +01:00
481ab58d02 2.0.0 2016-11-26 14:46:01 +01:00
9030619046 update to meet newest standards 2016-11-26 14:45:56 +01:00
fcd559090a 1.0.4 2016-10-27 19:44:02 +02:00
f946d5b1d8 update smartfile 2016-10-27 19:43:54 +02:00
4fee4ec822 update gitlab ci base image 2016-06-09 23:48:27 +02:00
94a431ef33 add README 2016-06-09 23:46:28 +02:00
142cc52f95 1.0.3 2016-06-09 03:13:46 +02:00
040120d034 update dependencies and structure 2016-06-09 03:13:40 +02:00
0618e46cd8 update typings to typings-global 2016-06-09 01:56:05 +02:00
c255f08ea6 1.0.2 2016-06-09 01:38:45 +02:00
a7035a56fc update dependencies and restructure code 2016-06-09 01:38:22 +02:00
bb926b7319 1.0.1 2016-02-23 09:38:20 +01:00
9edcf5140d small lint fix 2016-02-23 09:38:17 +01:00
e43322defd now adding token correctly 2016-02-23 09:36:40 +01:00
ed0c947a2e 1.0.0 2016-02-23 08:48:52 +01:00
3c9dd787b3 now has .git 2016-02-23 08:48:41 +01:00
e4ef9bf97a add repo information 2016-02-23 00:58:33 +01:00
d394588fff 0.0.5 2016-02-21 17:17:36 +01:00
a5baae60c9 add .license to npm class 2016-02-21 17:17:31 +01:00
29 changed files with 8769 additions and 200 deletions

View 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

View 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

25
.gitignore vendored
View File

@@ -1,7 +1,20 @@
.idea/
coverage/
node_modules
.nogit/
ts/**/*.js
ts/**/*.js.map
ts/typings/
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches
.yarn/
.cache/
.rpt2_cache
# builds
dist/
dist_*/
# custom

34
.smartconfig.json Normal file
View 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": []
}
}

View File

@@ -1,12 +0,0 @@
language: node_js
node_js:
- 'v4.2.6'
- 'stable'
deploy:
provider: npm
email: npm@lossless.digital
api_key:
secure: G2ZQYeDEokGCWQcXeT9SJ4aUF0uZ41B1kM9WD7hZKMGM5hzbGSTXjd/bLWf2HfujvN9FWQYVv0y5OpbRck4xTuEDBPmC5AqXCfrtNj77n151VLO0cF4+Ya1l8OQWvw13hX+cux8UfxRVHUAxUt7CoW3q6FBO/vt1Mvo9u9ucxKdB4QHXmPdq8TwuFusPJYC+l2LdWiaSCEz2LpnyrDf6OjLl2Bt+8rID3Ikbi+5yXWv/n7bfiXyIlpJX/i4Efh/mqsSWp+ziVWaSdKdpYMFPxqyOfqQ/kjbzLCwdR72cD3+UoJPdGQ46Vq3ncZRq3KighWkYRzN76EOTI/quzfcAoz5CekETPh419lPuqs2w8wEeE2oP0yCCSH1SG1ljH8ASrADWsoHzWyVa8c/ovzWMOc3hgLey6xgbYVar0sC94bjjqJh8Y5qOak4idOpI/SXf0UT1TkirZTGfdSgRzg/E1Zqj262sxLeIv0yHsbnzgwUduj6PjfLztgLVAGO13csxksUSiKxT8Mbbqozv1sdz/0SgoZTMYfZSO5kYdBCqguJkJdEj1Dr4tM/0ca+mugHibavQxPJiWqnfNqxdlmywpzPHPHe5G2wzba2W62l3yPHF4rJBJuUi35ddWWOkAN1g9D2NHlByWfqF+WYRuTv1DPlw7ZpmgEVPPUlBPhC5YO8=
on:
tags: true
repo: pushrocks/projectinfo

11
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,11 @@
{
"version": "0.2.0",
"configurations": [
{
"command": "npm test",
"name": "Run npm test",
"request": "launch",
"type": "node-terminal"
}
]
}

26
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,26 @@
{
"json.schemas": [
{
"fileMatch": ["/npmextra.json"],
"schema": {
"type": "object",
"properties": {
"npmci": {
"type": "object",
"description": "settings for npmci"
},
"gitzone": {
"type": "object",
"description": "settings for gitzone",
"properties": {
"projectType": {
"type": "string",
"enum": ["website", "element", "service", "npm", "wcc"]
}
}
}
}
}
}
]
}

95
changelog.md Normal file
View 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

16
dist/index.js vendored
View File

@@ -1,16 +0,0 @@
var projectinfo = {};
//classes
var ProjectinfoNPM = require("./projectinfo.npm");
projectinfo.npm = function (cwdArg) {
return new ProjectinfoNPM(cwdArg);
};
//quick functions
projectinfo.getName = function (cwdArg) {
var localNpm = projectinfo.npm(cwdArg);
if (localNpm.status === "ok") {
return localNpm.name;
}
};
module.exports = projectinfo;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImluZGV4LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUVBLElBQUksV0FBVyxHQUFPLEVBQUUsQ0FBQztBQUV6QixTQUFTO0FBQ1QsSUFBTyxjQUFjLFdBQVcsbUJBQW1CLENBQUMsQ0FBQztBQUNyRCxXQUFXLENBQUMsR0FBRyxHQUFHLFVBQVMsTUFBTTtJQUM3QixNQUFNLENBQUMsSUFBSSxjQUFjLENBQUMsTUFBTSxDQUFDLENBQUM7QUFDdEMsQ0FBQyxDQUFDO0FBRUYsaUJBQWlCO0FBQ2pCLFdBQVcsQ0FBQyxPQUFPLEdBQUcsVUFBUyxNQUFNO0lBQ2pDLElBQUksUUFBUSxHQUFHLFdBQVcsQ0FBQyxHQUFHLENBQUMsTUFBTSxDQUFDLENBQUM7SUFDdkMsRUFBRSxDQUFDLENBQUMsUUFBUSxDQUFDLE1BQU0sS0FBSyxJQUFJLENBQUMsQ0FBQSxDQUFDO1FBQzFCLE1BQU0sQ0FBQyxRQUFRLENBQUMsSUFBSSxDQUFDO0lBQ3pCLENBQUM7QUFDTCxDQUFDLENBQUM7QUFZRixpQkFBUyxXQUFXLENBQUMiLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG5pbXBvcnQgcGx1Z2lucyA9IHJlcXVpcmUoXCIuL3Byb2plY3RpbmZvLnBsdWdpbnNcIik7XG52YXIgcHJvamVjdGluZm86YW55ID0ge307XG5cbi8vY2xhc3Nlc1xuaW1wb3J0IFByb2plY3RpbmZvTlBNID0gcmVxdWlyZShcIi4vcHJvamVjdGluZm8ubnBtXCIpO1xucHJvamVjdGluZm8ubnBtID0gZnVuY3Rpb24oY3dkQXJnKXtcbiAgICByZXR1cm4gbmV3IFByb2plY3RpbmZvTlBNKGN3ZEFyZyk7XG59O1xuXG4vL3F1aWNrIGZ1bmN0aW9uc1xucHJvamVjdGluZm8uZ2V0TmFtZSA9IGZ1bmN0aW9uKGN3ZEFyZyl7XG4gICAgdmFyIGxvY2FsTnBtID0gcHJvamVjdGluZm8ubnBtKGN3ZEFyZyk7XG4gICAgaWYgKGxvY2FsTnBtLnN0YXR1cyA9PT0gXCJva1wiKXtcbiAgICAgICAgcmV0dXJuIGxvY2FsTnBtLm5hbWU7XG4gICAgfVxufTtcblxuLyogVE9ET1xucHJvamVjdGluZm8uZ2l0ID0gZnVuY3Rpb24oKXtcblxufTtcblxucHJvamVjdGluZm8ubW9qbyA9IGZ1bmN0aW9uKCl7XG5cbn07XG4qL1xuXG5leHBvcnQgPSBwcm9qZWN0aW5mbzsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=

View File

@@ -1,14 +0,0 @@
/// <reference path="./typings/main.d.ts" />
var plugins = require("./projectinfo.plugins");
var ProjectinfoNPM = (function () {
function ProjectinfoNPM(cwdArg) {
this.packageJson = plugins.smartfile.readFileToObject(plugins.path.join(plugins.path.resolve(cwdArg), "package.json"));
this.name = this.packageJson.name;
this.version = this.packageJson.version;
this.status = "ok";
}
return ProjectinfoNPM;
})();
module.exports = ProjectinfoNPM;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByb2plY3RpbmZvLm5wbS50cyJdLCJuYW1l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pzdHJpbmc7XG4gICAgc3RhdHVzOnN0cmluZztcblxuICAgIGNvbnN0cnVjdG9yKGN3ZEFyZzpzdHJpbmcpe1xuICAgICAgICB0aGlzLnBhY2thZ2VKc29uID0gcGx1Z2lucy5zbWFydGZpbGUucmVhZEZpbGVUb09iamVjdChcbiAgICAgICAgICAgIHBsdWdpbnMucGF0aC5qb2luKFxuICAgICAgICAgICAgICAgIHBsdWdpbnMucGF0aC5yZXNvbHZlKGN3ZEFyZyksXG4gICAgICAgICAgICAgICAgXCJwYWNrYWdlLmpzb25cIlxuICAgICAgICAgICAgKVxuICAgICAgICApO1xuICAgICAgICB0aGlzLm5hbWUgPSB0aGlzLnBhY2thZ2VKc29uLm5hbWU7XG4gICAgICAgIHRoaXMudmVyc2lvbiA9IHRoaXMucGFja2FnZUpzb24udmVyc2lvbjtcbiAgICAgICAgdGhpcy5zdGF0dXMgPSBcIm9rXCI7XG4gICAgfVxufVxuXG5leHBvcnQgPSBQcm9qZWN0aW5mb05QTTsiXSwic291cmNlUm9vdCI6Ii9zb3VyY2UvIn0=

View File

@@ -1,9 +0,0 @@
/// <reference path="./typings/main.d.ts" />
var plugins = {
path: require("path"),
Q: require("q"),
smartfile: require("smartfile")
};
module.exports = plugins;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInByb2plY3RpbmZvLnBsdWdpbnMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsNENBQTRDO0FBQzVDLElBQUksT0FBTyxHQUFHO0lBQ1YsSUFBSSxFQUFFLE9BQU8sQ0FBQyxNQUFNLENBQUM7SUFDckIsQ0FBQyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUM7SUFDZixTQUFTLEVBQUUsT0FBTyxDQUFDLFdBQVcsQ0FBQztDQUNsQyxDQUFDO0FBRUYsaUJBQVMsT0FBTyxDQUFDIiwiZmlsZSI6InByb2plY3RpbmZvLnBsdWdpbnMuanMiLCJzb3VyY2VzQ29udGVudCI6WyIvLy8gPHJlZmVyZW5jZSBwYXRoPVwiLi90eXBpbmdzL21haW4uZC50c1wiIC8+XG52YXIgcGx1Z2lucyA9IHtcbiAgICBwYXRoOiByZXF1aXJlKFwicGF0aFwiKSxcbiAgICBROiByZXF1aXJlKFwicVwiKSxcbiAgICBzbWFydGZpbGU6IHJlcXVpcmUoXCJzbWFydGZpbGVcIilcbn07XG5cbmV4cG9ydCA9IHBsdWdpbnM7Il0sInNvdXJjZVJvb3QiOiIvc291cmNlLyJ9

View File

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

View File

@@ -1,34 +1,59 @@
{
"name": "projectinfo",
"version": "0.0.4",
"description": "gather information about projects. supports npm, git etc.",
"main": "dist/index.js",
"name": "@push.rocks/projectinfo",
"version": "5.1.0",
"private": false,
"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": "(npmts)"
"test": "(tstest test/)",
"build": "(tsbuild tsfolders)",
"buildDocs": "tsdoc"
},
"repository": {
"type": "git",
"url": "git+https://github.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://github.com/pushrocks/projectinfo/issues"
"url": "https://gitlab.com/pushrocks/projectinfo/issues"
},
"homepage": "https://github.com/pushrocks/projectinfo#readme",
"homepage": "https://code.foss.global/push.rocks/projectinfo",
"devDependencies": {
"npmts": "^3.1.2",
"should": "^8.2.2"
"@git.zone/tsbuild": "^4.4.0",
"@git.zone/tsrun": "^2.0.2",
"@git.zone/tstest": "^3.6.0",
"@types/node": "^25.5.0"
},
"dependencies": {
"q": "^1.4.1",
"smartfile": "0.0.11"
}
"@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/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
".smartconfig.json",
"readme.md"
],
"browserslist": [
"last 1 chrome versions"
]
}

8014
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
readme.hints.md Normal file
View File

@@ -0,0 +1 @@

158
readme.md Normal file
View File

@@ -0,0 +1,158 @@
# @push.rocks/projectinfo
A tool for gathering project information, supporting npm, git, and more.
## Issue Reporting and Security
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.
## Install 📦
Install via npm:
```bash
npm install @push.rocks/projectinfo
```
Or with pnpm:
```bash
pnpm install @push.rocks/projectinfo
```
This module is ESM-only and requires Node.js 18+.
## Usage 🚀
`@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.

View File

@@ -2,6 +2,11 @@
"name": "testpackage",
"version": "1.0.0",
"description": "some test",
"type": "module",
"repository": {
"type": "git",
"url": "git+https://github.com/someuser/somerepo.git"
},
"main": "test.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"

View File

@@ -1,32 +0,0 @@
/// <reference path="../ts/typings/main.d.ts" />
var projectinfo = require("../dist/index.js");
var should = require("should");
var path = require("path");
var testBasePath = path.resolve(__dirname);
describe("projectinfo", function () {
describe(".npm() return", function () {
var myNpm = projectinfo.npm(testBasePath);
it("should have .packageJson", function () {
myNpm.packageJson
.should.have.property("version", "1.0.0");
myNpm.packageJson
.should.have.property("name", "testpackage");
});
it("should have .version", function () {
myNpm
.should.have.property("name", "testpackage");
});
it("should have .name", function () {
myNpm
.should.have.property("name", "testpackage");
});
});
describe(".getName()", function () {
it("should return a name", function () {
projectinfo.getName(testBasePath)
.should.equal("testpackage");
});
});
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsZ0RBQWdEO0FBQ2hELElBQUksV0FBVyxHQUFHLE9BQU8sQ0FBQyxrQkFBa0Is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lvbigpe1xuICAgICAgICAgICAgbXlOcG1cbiAgICAgICAgICAgICAgICAuc2hvdWxkLmhhdmUucHJvcGVydHkoXCJuYW1lXCIsXCJ0ZXN0cGFja2FnZVwiKVxuICAgICAgICB9KTtcblxuICAgICAgICBpdChcInNob3VsZCBoYXZlIC5uYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIG15TnBtXG4gICAgICAgICAgICAgICAgLnNob3VsZC5oYXZlLnByb3BlcnR5KFwibmFtZVwiLFwidGVzdHBhY2thZ2VcIik7XG4gICAgICAgIH0pO1xuXG4gICAgfSk7XG5cbiAgICBkZXNjcmliZShcIi5nZXROYW1lKClcIixmdW5jdGlvbigpe1xuICAgICAgICBpdChcInNob3VsZCByZXR1cm4gYSBuYW1lXCIsZnVuY3Rpb24oKXtcbiAgICAgICAgICAgIHByb2plY3RpbmZvLmdldE5hbWUodGVzdEJhc2VQYXRoKVxuICAgICAgICAgICAgICAgIC5zaG91bGQuZXF1YWwoXCJ0ZXN0cGFja2FnZVwiKTtcbiAgICAgICAgfSk7XG4gICAgfSlcbn0pOyJdLCJzb3VyY2VSb290IjoiL3NvdXJjZS8ifQ==

View File

@@ -1 +0,0 @@
{"version":3,"file":"test.js","sourceRoot":"","sources":["test.ts"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,IAAI,WAAW,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAC9C,IAAI,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAC/B,IAAI,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,IAAI,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AAE3C,QAAQ,CAAC,aAAa,EAAC;IACnB,QAAQ,CAAC,eAAe,EAAC;QACrB,IAAI,KAAK,GAAG,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC1C,EAAE,CAAC,0BAA0B,EAAC;YAC1B,KAAK,CAAC,WAAW;iBACb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAC,OAAO,CAAC,CAAC;YAC5C,KAAK,CAAC,WAAW;iBACb,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,aAAa,CAAC,CAAC;QACnD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,sBAAsB,EAAC;YACtB,KAAK;iBACA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,aAAa,CAAC,CAAA;QACnD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,mBAAmB,EAAC;YACnB,KAAK;iBACA,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAC,aAAa,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,YAAY,EAAC;QAClB,EAAE,CAAC,sBAAsB,EAAC;YACtB,WAAW,CAAC,OAAO,CAAC,YAAY,CAAC;iBAC5B,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAA;AACN,CAAC,CAAC,CAAC"}

View File

@@ -1,35 +1,37 @@
/// <reference path="../ts/typings/main.d.ts" />
var projectinfo = require("../dist/index.js");
var should = require("should");
var path = require("path");
var testBasePath = path.resolve(__dirname);
import { tap, expect } from '@git.zone/tstest/tapbundle';
import * as smartpath from '@push.rocks/smartpath';
import * as projectinfo from '../ts/index.js';
describe("projectinfo",function(){
describe(".npm() return",function(){
var myNpm = projectinfo.npm(testBasePath);
it("should have .packageJson",function(){
myNpm.packageJson
.should.have.property("version","1.0.0");
myNpm.packageJson
.should.have.property("name","testpackage");
});
import * as path from 'path';
let testBasePath = path.resolve(smartpath.get.dirnameFromImportMetaUrl(import.meta.url));
it("should have .version",function(){
myNpm
.should.have.property("name","testpackage")
});
let myNpm: projectinfo.ProjectinfoNpm;
it("should have .name",function(){
myNpm
.should.have.property("name","testpackage");
});
tap.test('should create ProjectinfoNpm instance', async () => {
myNpm = await projectinfo.ProjectinfoNpm.create(testBasePath, { gitAccessToken: 'sometoken' });
});
});
tap.test('should have .packageJson', async () => {
expect(myNpm.packageJson).property('version').toEqual('1.0.0');
expect(myNpm.packageJson).property('name').toEqual('testpackage');
});
describe(".getName()",function(){
it("should return a name",function(){
projectinfo.getName(testBasePath)
.should.equal("testpackage");
});
})
});
tap.test('should have .version', async () => {
expect(myNpm).property('version').toEqual('1.0.0');
});
tap.test('should have .name', async () => {
expect(myNpm).property('name').toEqual('testpackage');
});
tap.test('should have .license', async () => {
expect(myNpm).property('license').toEqual('MIT');
});
tap.test('should have .git', async () => {
expect(myNpm.git!.httpsUrl).toEqual('https://sometoken@github.com/someuser/somerepo.git');
});
tap.test('should return a name', async () => {
expect(await projectinfo.getNpmNameForDir(testBasePath)).toEqual('testpackage');
});
export default tap.start();

8
ts/00_commitinfo_data.ts Normal file
View 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.'
}

View File

@@ -1,29 +1,21 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./projectinfo.plugins");
var projectinfo:any = {};
import * as plugins from './projectinfo.plugins.js';
//classes
import ProjectinfoNPM = require("./projectinfo.npm");
projectinfo.npm = function(cwdArg){
return new ProjectinfoNPM(cwdArg);
// direct access to classes
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.js';
// quick functions
/**
* gets the name from package.json in a specified directory
*/
export let getNpmNameForDir = async function (cwdArg: string) {
let localNpm = await ProjectinfoNpm.create(cwdArg);
if (localNpm.status === 'ok') {
return localNpm.name;
}
};
//quick functions
projectinfo.getName = function(cwdArg){
var localNpm = projectinfo.npm(cwdArg);
if (localNpm.status === "ok"){
return localNpm.name;
}
};
/* TODO
projectinfo.git = function(){
};
projectinfo.mojo = function(){
};
*/
export = projectinfo;

View File

@@ -0,0 +1,29 @@
import * as plugins from './projectinfo.plugins.js';
export class ProjectinfoGit {
isGit: boolean = false;
githost: string = '';
gituser: string = '';
gitrepo: string = '';
cwd: string;
constructor(cwdArg: string) {
this.cwd = cwdArg;
this.getGitInfoFromPath();
}
/**
* get git info from path
*/
getGitInfoFromPath() {
let localSmartpath = new plugins.smartpath.Smartpath(this.cwd);
this.gitrepo = localSmartpath.pathLevelsBackwards[0];
this.gituser = localSmartpath.pathLevelsBackwards[1];
}
/**
* get git info from remote url
*/
getGitInfoFromRemote(remoteUrlArg: string) {
let gitRepoParsed = new plugins.smartstring.GitRepo(remoteUrlArg);
}
}

View File

@@ -0,0 +1,38 @@
import * as plugins from './projectinfo.plugins.js';
export class ProjectinfoNpm {
isNpm: boolean = false;
packageJson: any = null;
name: string = '';
version: string = '';
status: string = '';
license: string = '';
git: plugins.smartstring.GitRepo | null = null;
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;
}
}

View File

@@ -0,0 +1,27 @@
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 = 'git';
npm: ProjectinfoNpm;
git: ProjectinfoGit;
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);
}
}

View File

@@ -1,22 +0,0 @@
/// <reference path="./typings/main.d.ts" />
import plugins = require("./projectinfo.plugins");
class ProjectinfoNPM {
packageJson;
name:string;
version:string;
status:string;
constructor(cwdArg:string){
this.packageJson = plugins.smartfile.readFileToObject(
plugins.path.join(
plugins.path.resolve(cwdArg),
"package.json"
)
);
this.name = this.packageJson.name;
this.version = this.packageJson.version;
this.status = "ok";
}
}
export = ProjectinfoNPM;

View File

@@ -1,8 +1,7 @@
/// <reference path="./typings/main.d.ts" />
var plugins = {
path: require("path"),
Q: require("q"),
smartfile: require("smartfile")
};
import * as path from 'path';
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 = plugins;
export { path, smartpromise, smartfs, smartstring, smartpath };

View File

@@ -1,7 +0,0 @@
{
"ambientDependencies": {
"node": "github:DefinitelyTyped/DefinitelyTyped/node/node.d.ts",
"mocha": "github:Bartvds/tsd-deftools/typings/DefinitelyTyped/mocha/mocha.d.ts",
"colors": "github:DefinitelyTyped/DefinitelyTyped/colors/colors.d.ts"
}
}

15
tsconfig.json Normal file
View 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"
]
}