Compare commits
14 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6bce80efb0 | |||
| 631b346b0a | |||
| 536588f61f | |||
| cbfc7e7b94 | |||
| 659ff9d6a0 | |||
| 7f5d0ad68a | |||
| b1e03f8657 | |||
| 57bcd8e30b | |||
| 08144be520 | |||
| 083a909ec4 | |||
| 5414142deb | |||
| 9649b3e4a8 | |||
| ac28f05a23 | |||
| 0f9b261f3e |
-140
@@ -1,140 +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
|
|
||||||
|
|
||||||
before_script:
|
|
||||||
- npm install -g @shipzone/npmci
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# security stage
|
|
||||||
# ====================
|
|
||||||
mirror:
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci git mirror
|
|
||||||
only:
|
|
||||||
- tags
|
|
||||||
tags:
|
|
||||||
- lossless
|
|
||||||
- docker
|
|
||||||
- notpriv
|
|
||||||
|
|
||||||
auditProductionDependencies:
|
|
||||||
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
|
||||||
stage: security
|
|
||||||
script:
|
|
||||||
- npmci npm prepare
|
|
||||||
- npmci command npm install --production --ignore-scripts
|
|
||||||
- npmci command npm config set registry https://registry.npmjs.org
|
|
||||||
- npmci command npm audit --audit-level=high --only=prod --production
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
auditDevDependencies:
|
|
||||||
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 --only=dev
|
|
||||||
tags:
|
|
||||||
- docker
|
|
||||||
allow_failure: true
|
|
||||||
|
|
||||||
# ====================
|
|
||||||
# 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:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
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:
|
|
||||||
- docker
|
|
||||||
|
|
||||||
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 @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
|
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
{
|
||||||
|
"@git.zone/cli": {
|
||||||
|
"projectType": "npm",
|
||||||
|
"module": {
|
||||||
|
"githost": "code.foss.global",
|
||||||
|
"gitscope": "push.rocks",
|
||||||
|
"gitrepo": "commitinfo",
|
||||||
|
"shortDescription": "commit metadata generator",
|
||||||
|
"description": "A tool to bake commit information into code for tracking and version control.",
|
||||||
|
"npmPackagename": "@push.rocks/commitinfo",
|
||||||
|
"license": "MIT",
|
||||||
|
"projectDomain": "push.rocks",
|
||||||
|
"keywords": [
|
||||||
|
"version control",
|
||||||
|
"commit information",
|
||||||
|
"typescript",
|
||||||
|
"node.js",
|
||||||
|
"software development",
|
||||||
|
"project management",
|
||||||
|
"code maintenance",
|
||||||
|
"continuous integration",
|
||||||
|
"continuous deployment"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"registries": [
|
||||||
|
"https://verdaccio.lossless.digital",
|
||||||
|
"https://registry.npmjs.org"
|
||||||
|
],
|
||||||
|
"accessLevel": "public"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"@ship.zone/szci": {
|
||||||
|
"npmGlobalTools": [],
|
||||||
|
"npmRegistryUrl": "registry.npmjs.org"
|
||||||
|
},
|
||||||
|
"@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,29 @@
|
|||||||
|
# Changelog
|
||||||
|
|
||||||
|
## 2026-05-01 - 1.0.13 - fix(commitinfo)
|
||||||
|
update project metadata and make commit info generation compatible with current tooling
|
||||||
|
|
||||||
|
- lazily initialize project info before computing the next version to support the updated @push.rocks/projectinfo API
|
||||||
|
- replace smartfile directory and file operations with native fs APIs
|
||||||
|
- add a node-based test that verifies writing the next patch version into generated commit info data
|
||||||
|
- refresh package exports, build/test scripts, TypeScript config, and dependency versions
|
||||||
|
|
||||||
|
## 2026-03-01 - 1.0.12 - maintenance
|
||||||
|
Repository maintenance changes.
|
||||||
|
|
||||||
|
- Removed the legacy GitLab CI configuration file.
|
||||||
|
- Version 1.0.12 release tagging contained no additional user-facing changes beyond prior fixes.
|
||||||
|
|
||||||
|
## 2024-06-23 - 1.0.11 - core
|
||||||
|
Core update release with supporting project maintenance.
|
||||||
|
|
||||||
|
- Applied a core fix/update.
|
||||||
|
- Refreshed project metadata and configuration, including description and TypeScript settings.
|
||||||
|
- Updated npm host metadata.
|
||||||
|
- Included earlier repository organization migration changes.
|
||||||
|
|
||||||
|
## 2022-04-28 - 1.0.2–1.0.10 - core
|
||||||
|
Series of patch releases containing repeated core updates.
|
||||||
|
|
||||||
|
- Versions 1.0.2 through 1.0.10 primarily shipped the same `fix(core): update` change.
|
||||||
|
- Individual version bump commits in this range contained no additional relevant details.
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
Copyright (c) 2022 Lossless GmbH (hello@lossless.com)
|
Copyright (c) 2026 Task Venture Capital GmbH <hello@task.vc>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|||||||
+30
-8
@@ -1,18 +1,40 @@
|
|||||||
{
|
{
|
||||||
"gitzone": {
|
"@git.zone/cli": {
|
||||||
"projectType": "npm",
|
"projectType": "npm",
|
||||||
"module": {
|
"module": {
|
||||||
"githost": "gitlab.com",
|
"githost": "code.foss.global",
|
||||||
"gitscope": "pushrocks",
|
"gitscope": "push.rocks",
|
||||||
"gitrepo": "commitinfo",
|
"gitrepo": "commitinfo",
|
||||||
"description": "bake commitinfos into code",
|
"shortDescription": "commit metadata generator",
|
||||||
"npmPackagename": "@pushrocks/commitinfo",
|
"description": "A tool to bake commit information into code for tracking and version control.",
|
||||||
|
"npmPackagename": "@push.rocks/commitinfo",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"projectDomain": "push.rocks"
|
"projectDomain": "push.rocks",
|
||||||
|
"keywords": [
|
||||||
|
"version control",
|
||||||
|
"commit information",
|
||||||
|
"typescript",
|
||||||
|
"node.js",
|
||||||
|
"software development",
|
||||||
|
"project management",
|
||||||
|
"code maintenance",
|
||||||
|
"continuous integration",
|
||||||
|
"continuous deployment"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"release": {
|
||||||
|
"registries": [
|
||||||
|
"https://verdaccio.lossless.digital",
|
||||||
|
"https://registry.npmjs.org"
|
||||||
|
],
|
||||||
|
"accessLevel": "public"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"npmci": {
|
"@ship.zone/szci": {
|
||||||
"npmGlobalTools": [],
|
"npmGlobalTools": [],
|
||||||
"npmAccessLevel": "public"
|
"npmRegistryUrl": "registry.npmjs.org"
|
||||||
|
},
|
||||||
|
"@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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Generated
+478
-478
File diff suppressed because it is too large
Load Diff
+33
-14
@@ -1,23 +1,25 @@
|
|||||||
{
|
{
|
||||||
"name": "@pushrocks/commitinfo",
|
"name": "@push.rocks/commitinfo",
|
||||||
"version": "1.0.10",
|
"version": "1.0.13",
|
||||||
"private": false,
|
"private": false,
|
||||||
"description": "bake commitinfos into code",
|
"description": "A tool to bake commit information into code for tracking and version control.",
|
||||||
|
"exports": {
|
||||||
|
".": "./dist_ts/index.js"
|
||||||
|
},
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"author": "Lossless GmbH",
|
"author": "Task Venture Capital GmbH <hello@task.vc>",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/ --web)",
|
"test": "tstest test/",
|
||||||
"build": "(tsbuild --web --allowimplicitany)"
|
"build": "tsbuild --web"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.25",
|
"@git.zone/tsbuild": "^4.4.0",
|
||||||
"@gitzone/tsbundle": "^1.0.78",
|
"@git.zone/tsrun": "^2.0.3",
|
||||||
"@gitzone/tstest": "^1.0.44",
|
"@git.zone/tstest": "^3.6.3",
|
||||||
"@pushrocks/tapbundle": "^5.0.3",
|
"@types/node": "^25.6.0"
|
||||||
"@types/node": "^17.0.29"
|
|
||||||
},
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 1 chrome versions"
|
"last 1 chrome versions"
|
||||||
@@ -31,12 +33,29 @@
|
|||||||
"dist_ts_web/**/*",
|
"dist_ts_web/**/*",
|
||||||
"assets/**/*",
|
"assets/**/*",
|
||||||
"cli.js",
|
"cli.js",
|
||||||
|
".smartconfig.json",
|
||||||
|
"license",
|
||||||
"npmextra.json",
|
"npmextra.json",
|
||||||
"readme.md"
|
"readme.md"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/projectinfo": "^5.0.1",
|
"@push.rocks/projectinfo": "^5.1.0",
|
||||||
"@pushrocks/smartfile": "^9.0.6",
|
"@push.rocks/smartversion": "^3.1.0"
|
||||||
"@pushrocks/smartversion": "^3.0.2"
|
},
|
||||||
|
"keywords": [
|
||||||
|
"version control",
|
||||||
|
"commit information",
|
||||||
|
"typescript",
|
||||||
|
"node.js",
|
||||||
|
"software development",
|
||||||
|
"project management",
|
||||||
|
"code maintenance",
|
||||||
|
"continuous integration",
|
||||||
|
"continuous deployment"
|
||||||
|
],
|
||||||
|
"homepage": "https://code.foss.global/push.rocks/commitinfo",
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://code.foss.global/push.rocks/commitinfo.git"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Generated
+8025
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -1,39 +1,77 @@
|
|||||||
# @pushrocks/commitinfo
|
# @push.rocks/commitinfo
|
||||||
bake commitinfos into code
|
bake commitinfos into code
|
||||||
|
|
||||||
## Availabililty and Links
|
## Install
|
||||||
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/commitinfo)
|
To start using `@push.rocks/commitinfo`, you need to first install it via npm. To do this, run the following command in your terminal:
|
||||||
* [gitlab.com (source)](https://gitlab.com/pushrocks/commitinfo)
|
|
||||||
* [github.com (source mirror)](https://github.com/pushrocks/commitinfo)
|
|
||||||
* [docs (typedoc)](https://pushrocks.gitlab.io/commitinfo/)
|
|
||||||
|
|
||||||
## Status for master
|
```sh
|
||||||
|
npm install @push.rocks/commitinfo --save
|
||||||
|
```
|
||||||
|
|
||||||
Status Category | Status Badge
|
This command will add `@push.rocks/commitinfo` to your project's dependencies in your `package.json` file.
|
||||||
-- | --
|
|
||||||
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)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
The `@push.rocks/commitinfo` module is designed to help you incorporate commit information directly into your TypeScript codebase. Below are detailed steps and examples to utilize the module effectively.
|
||||||
|
|
||||||
Use TypeScript for best info class intellisense
|
### Basic Setup
|
||||||
|
First, ensure that your project is set up to use TypeScript and ESM syntax. Then, you can proceed to import and use `@push.rocks/commitinfo` in your project.
|
||||||
|
|
||||||
## Contribution
|
```typescript
|
||||||
|
import { CommitInfo } from '@push.rocks/commitinfo';
|
||||||
|
|
||||||
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). :)
|
// Specify your project directory and the planned version type of your next commit
|
||||||
|
const commitInfo = new CommitInfo('./path/to/your/project', 'patch');
|
||||||
|
|
||||||
For further information read the linked docs at the top of this readme.
|
// Now you can use commitInfo to access or modify commit-related information
|
||||||
|
```
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
### Writing Commit Info into Your Project
|
||||||
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
|
One of the primary uses of `@push.rocks/commitinfo` is to bake commit information into your project dynamically. This is especially useful for including version information, project description, etc., within your build artifacts.
|
||||||
|
|
||||||
[](https://maintainedby.lossless.com)
|
```typescript
|
||||||
|
// Assuming you've initialized `commitInfo` as shown previously
|
||||||
|
|
||||||
|
// Write commit info into potential directories like 'ts' or 'ts_web'
|
||||||
|
await commitInfo.writeIntoPotentialDirs(['ts', 'ts_web']);
|
||||||
|
```
|
||||||
|
|
||||||
|
This method will check for the existence of specified directories (e.g., 'ts' and 'ts_web') in your project and create a `00_commitinfo_data.ts` file with commit-related information in each present directory.
|
||||||
|
|
||||||
|
### Using Commit Info in Your Project
|
||||||
|
After running the `writeIntoPotentialDirs` function, `00_commitinfo_data.ts` will be generated in the specified directories. You can then import this file anywhere in your project to access the baked commit information.
|
||||||
|
|
||||||
|
```typescript
|
||||||
|
import { commitinfo } from './ts/00_commitinfo_data';
|
||||||
|
|
||||||
|
console.log(commitinfo.name); // Outputs: @push.rocks/commitinfo
|
||||||
|
console.log(commitinfo.version); // Outputs the version that was baked into the code
|
||||||
|
console.log(commitinfo.description); // Outputs: bake commitinfos into code
|
||||||
|
```
|
||||||
|
|
||||||
|
### Real-World Scenario: Automating Version Updates
|
||||||
|
A practical use case for `@push.rocks/commitinfo` is to automate the updating of version information across your project upon each new release. By integrating `commitInfo.writeIntoPotentialDirs()` into your CI/CD pipeline, you can ensure that each build artifact always contains the latest commit information, making it easier to trace back artifacts to specific versions and commits.
|
||||||
|
|
||||||
|
### Extending Usage
|
||||||
|
The above examples provide a basic understanding of how to use `@push.rocks/commitinfo`. However, feel free to explore more advanced scenarios that fit your project's needs, such as customizing the generated `00_commitinfo_data.ts` file or creating a dedicated workflow for handling version bumps and commit information updates.
|
||||||
|
|
||||||
|
### Conclusion
|
||||||
|
`@push.rocks/commitinfo` offers a streamlined and efficient way to incorporate dynamic commit information into your TypeScript projects. By following the examples and scenarios outlined above, you can enhance your project’s maintainability and traceability, ensuring that each piece of code can be unequivocally linked to specific commits and version updates.
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
import * as fs from 'fs';
|
||||||
|
import * as path from 'path';
|
||||||
|
|
||||||
|
import { tap } from '@git.zone/tstest/tapbundle';
|
||||||
|
import * as commitinfo from '../ts/index.js';
|
||||||
|
|
||||||
|
tap.test('first test', async () => {
|
||||||
|
const testDir = path.join(process.cwd(), '.nogit', 'commitinfo-test');
|
||||||
|
fs.rmSync(testDir, { recursive: true, force: true });
|
||||||
|
fs.mkdirSync(path.join(testDir, 'ts'), { recursive: true });
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(testDir, 'package.json'),
|
||||||
|
JSON.stringify(
|
||||||
|
{
|
||||||
|
name: '@push.rocks/commitinfo-test',
|
||||||
|
version: '1.0.0',
|
||||||
|
description: 'test package',
|
||||||
|
},
|
||||||
|
null,
|
||||||
|
2
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const testCommitinfo = new commitinfo.CommitInfo(testDir, 'patch');
|
||||||
|
await testCommitinfo.writeIntoPotentialDirs();
|
||||||
|
const commitInfoFile = fs.readFileSync(path.join(testDir, 'ts', '00_commitinfo_data.ts'), 'utf8');
|
||||||
|
if (!commitInfoFile.includes("version: '1.0.1'")) {
|
||||||
|
throw new Error('Expected commitinfo to write the next patch version.');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
export default tap.start();
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
|
|
||||||
import * as commitinfo from '../ts/index.js';
|
|
||||||
|
|
||||||
tap.test('first test', async () => {
|
|
||||||
const testCommitinfo = new commitinfo.CommitInfo(process.cwd(), 'patch');
|
|
||||||
await testCommitinfo.writeIntoPotentialDirs();
|
|
||||||
});
|
|
||||||
|
|
||||||
tap.start();
|
|
||||||
@@ -1,11 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const name: string = '@pushrocks/commitinfo';
|
|
||||||
export const version: string = '1.0.10';
|
|
||||||
export const description: string = 'bake commitinfos into code'
|
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '@pushrocks/commitinfo',
|
name: '@push.rocks/commitinfo',
|
||||||
version: '1.0.10',
|
version: '1.0.13',
|
||||||
description: 'bake commitinfos into code'
|
description: 'A tool to bake commit information into code for tracking and version control.'
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,34 +4,49 @@ export class CommitInfo {
|
|||||||
// Instance
|
// Instance
|
||||||
public projectDir: string;
|
public projectDir: string;
|
||||||
public plannedCommitVersionTypeArg: 'patch' | 'minor' | 'major';
|
public plannedCommitVersionTypeArg: 'patch' | 'minor' | 'major';
|
||||||
public projectinfoNpmRef: plugins.projectinfo.ProjectinfoNpm;
|
public projectinfoNpmRef: plugins.projectinfo.ProjectinfoNpm | undefined;
|
||||||
public smartVersionRef: plugins.smartversion.SmartVersion;
|
public smartVersionRef: plugins.smartversion.SmartVersion | undefined;
|
||||||
|
private projectinfoNpmPromise: Promise<plugins.projectinfo.ProjectinfoNpm>;
|
||||||
|
|
||||||
constructor(projectDirArg: string, plannedCommitVersionTypeArg: 'patch' | 'minor' | 'major') {
|
constructor(projectDirArg: string, plannedCommitVersionTypeArg: 'patch' | 'minor' | 'major') {
|
||||||
this.projectDir = projectDirArg;
|
this.projectDir = projectDirArg;
|
||||||
this.plannedCommitVersionTypeArg = plannedCommitVersionTypeArg;
|
this.plannedCommitVersionTypeArg = plannedCommitVersionTypeArg;
|
||||||
this.projectinfoNpmRef = new plugins.projectinfo.ProjectinfoNpm(projectDirArg);
|
this.projectinfoNpmPromise = plugins.projectinfo.ProjectinfoNpm.create(projectDirArg);
|
||||||
this.smartVersionRef = new plugins.smartversion.SmartVersion(this.projectinfoNpmRef.version);
|
}
|
||||||
|
|
||||||
|
private async getProjectinfoNpmRef(): Promise<plugins.projectinfo.ProjectinfoNpm> {
|
||||||
|
if (!this.projectinfoNpmRef) {
|
||||||
|
this.projectinfoNpmRef = await this.projectinfoNpmPromise;
|
||||||
|
}
|
||||||
|
return this.projectinfoNpmRef;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async getNextPlannedVersion() {
|
||||||
|
const projectinfoNpmRef = await this.getProjectinfoNpmRef();
|
||||||
|
this.smartVersionRef = new plugins.smartversion.SmartVersion(projectinfoNpmRef.version);
|
||||||
|
return this.smartVersionRef.getNewVersion(this.plannedCommitVersionTypeArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async writeIntoPotentialDirs(potentialDirs: string[] = ['ts', 'ts_web']) {
|
public async writeIntoPotentialDirs(potentialDirs: string[] = ['ts', 'ts_web']) {
|
||||||
const expectedDefinitiveVersion = this.smartVersionRef.getNewVersion(
|
const projectinfoNpmRef = await this.getProjectinfoNpmRef();
|
||||||
this.plannedCommitVersionTypeArg
|
const expectedDefinitiveVersion = await this.getNextPlannedVersion();
|
||||||
);
|
|
||||||
for (const dir of potentialDirs) {
|
for (const dir of potentialDirs) {
|
||||||
const dirExists = plugins.smartfile.fs.isDirectory(plugins.path.join(this.projectDir, dir));
|
const dirPath = plugins.path.join(this.projectDir, dir);
|
||||||
|
const dirExists = plugins.fs.existsSync(dirPath) && plugins.fs.statSync(dirPath).isDirectory();
|
||||||
if (dirExists) {
|
if (dirExists) {
|
||||||
const writePath = plugins.path.join(this.projectDir, dir, '00_commitinfo_data.ts');
|
const writePath = plugins.path.join(this.projectDir, dir, '00_commitinfo_data.ts');
|
||||||
await plugins.smartfile.memory.toFs(
|
await plugins.fs.promises.writeFile(
|
||||||
|
writePath,
|
||||||
`/**
|
`/**
|
||||||
* autocreated commitinfo by @pushrocks/commitinfo
|
* autocreated commitinfo by @push.rocks/commitinfo
|
||||||
*/
|
*/
|
||||||
export const commitinfo = {
|
export const commitinfo = {
|
||||||
name: '${this.projectinfoNpmRef.name}',
|
name: '${projectinfoNpmRef.name}',
|
||||||
version: '${expectedDefinitiveVersion.versionString}',
|
version: '${expectedDefinitiveVersion.versionString}',
|
||||||
description: '${this.projectinfoNpmRef.packageJson.description}'
|
description: '${projectinfoNpmRef.packageJson.description}'
|
||||||
}
|
}
|
||||||
`,
|
`,
|
||||||
writePath
|
'utf8'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,17 +1,17 @@
|
|||||||
// node native
|
// node native
|
||||||
|
import * as fs from 'fs';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
|
fs,
|
||||||
path
|
path
|
||||||
}
|
}
|
||||||
|
|
||||||
// pushrocks scope
|
// pushrocks scope
|
||||||
import * as projectinfo from '@pushrocks/projectinfo';
|
import * as projectinfo from '@push.rocks/projectinfo';
|
||||||
import * as smartfile from '@pushrocks/smartfile';
|
import * as smartversion from '@push.rocks/smartversion';
|
||||||
import * as smartversion from '@pushrocks/smartversion';
|
|
||||||
|
|
||||||
export {
|
export {
|
||||||
projectinfo,
|
projectinfo,
|
||||||
smartfile,
|
|
||||||
smartversion
|
smartversion
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1,2 @@
|
|||||||
export * from './commitinfo.classes.commitinfo.js';
|
export * from './commitinfo.classes.commitinfo.js';
|
||||||
|
export { commitinfo } from './00_commitinfo_data.js';
|
||||||
|
|||||||
+10
-3
@@ -3,7 +3,14 @@
|
|||||||
"experimentalDecorators": true,
|
"experimentalDecorators": true,
|
||||||
"useDefineForClassFields": false,
|
"useDefineForClassFields": false,
|
||||||
"target": "ES2022",
|
"target": "ES2022",
|
||||||
"module": "ES2022",
|
"module": "NodeNext",
|
||||||
"moduleResolution": "nodenext"
|
"moduleResolution": "NodeNext",
|
||||||
}
|
"noImplicitAny": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"verbatimModuleSyntax": true,
|
||||||
|
"types": ["node"]
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"dist_*/**/*.d.ts"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user