15 Commits

Author SHA1 Message Date
jkunz d61a1cf7f6 v1.0.9 2026-05-01 21:44:49 +00:00
jkunz 1477ceda5d fix(package): modernize package configuration and stabilize ping typings and tests 2026-05-01 21:44:49 +00:00
jkunz 2632bf2082 chore: remove .gitlab-ci.yml 2026-03-01 18:57:18 +00:00
philkunz 9803cf6b90 update description 2024-05-29 14:15:26 +02:00
philkunz 83cd9507ac update tsconfig 2024-04-14 18:08:27 +02:00
philkunz 0837945b81 update npmextra.json: githost 2024-04-01 21:37:21 +02:00
philkunz 68c064f260 update npmextra.json: githost 2024-04-01 19:59:17 +02:00
philkunz bd95de9152 update npmextra.json: githost 2024-03-30 21:48:17 +01:00
philkunz 6864bed88d switch to new org scheme 2023-07-10 10:17:26 +02:00
philkunz 0bdddc32d1 1.0.8 2023-04-19 17:21:17 +02:00
philkunz 40651a5660 fix(core): update 2023-04-19 17:21:16 +02:00
philkunz 5f1b4a784e 1.0.7 2022-10-21 14:24:36 +02:00
philkunz 2da9122c68 fix(core): update 2022-10-21 14:24:36 +02:00
philkunz 5d80323baa 1.0.6 2022-10-21 12:06:25 +02:00
philkunz 72fccebf14 fix(core): update 2022-10-21 12:06:24 +02:00
17 changed files with 7315 additions and 17571 deletions
-128
View File
@@ -1,128 +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:
- pnpm install -g pnpm
- pnpm install -g @shipzone/npmci
- npmci npm prepare
# ====================
# security stage
# ====================
# ====================
# security stage
# ====================
auditProductionDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --prod
tags:
- lossless
- docker
allow_failure: true
auditDevDependencies:
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
stage: security
script:
- npmci command npm config set registry https://registry.npmjs.org
- npmci command pnpm audit --audit-level=high --dev
tags:
- lossless
- docker
allow_failure: true
# ====================
# test stage
# ====================
testStable:
stage: test
script:
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
testBuild:
stage: test
script:
- 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 stable
- npmci npm install
- npmci command npm run buildDocs
tags:
- lossless
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true
+37
View File
@@ -0,0 +1,37 @@
{
"@ship.zone/szci": {
"npmGlobalTools": [],
"npmRegistryUrl": "registry.npmjs.org"
},
"@git.zone/cli": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartping",
"shortDescription": "Node.js ping utility",
"description": "A utility for performing ping operations in Node.js environments.",
"npmPackagename": "@push.rocks/smartping",
"license": "MIT",
"keywords": [
"ping",
"network",
"connectivity",
"Node.js",
"utility",
"async",
"promise"
]
},
"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"
}
}
+34
View File
@@ -0,0 +1,34 @@
# Changelog
## 2026-05-01 - 1.0.9 - fix(package)
modernize package configuration and stabilize ping typings and tests
- add package exports and include project metadata files in published package
- update build and test tooling to current @git.zone packages and newer ping dependency
- replace external host-based tests with localhost node tests for more reliable execution
- derive ping response type from the ping library and simplify pingAlive error handling
## 2026-03-01 - 1.0.8 - maintenance
Project maintenance and repository metadata updates across the 1.0.8 line.
- Removed the `.gitlab-ci.yml` configuration
- Updated package metadata and repository hosting configuration
- Refreshed TypeScript configuration and project description
- Consolidates trivial maintenance changes from 2023-07-10 through 2026-03-01
## 2023-04-19 - 1.0.8 - core
Core update release.
- Applied a core update
## 2022-10-21 - 1.0.7 - core
Patch release continuing a series of core fixes.
- Applied a core update
- Summarizes repeated trivial patch releases across 1.0.4 to 1.0.7
## 2018-11-18 - 1.0.1 - core
Initial recorded core patch release.
- Applied a core update
- Includes the initial version tagging activity through 1.0.2
+1 -1
View File
@@ -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
+29 -9
View File
@@ -1,18 +1,38 @@
{ {
"gitzone": { "@ship.zone/szci": {
"npmGlobalTools": [],
"npmRegistryUrl": "registry.npmjs.org"
},
"@git.zone/cli": {
"projectType": "npm", "projectType": "npm",
"module": { "module": {
"githost": "gitlab.com", "githost": "code.foss.global",
"gitscope": "pushrocks", "gitscope": "push.rocks",
"gitrepo": "smartping", "gitrepo": "smartping",
"description": "a ping utility", "shortDescription": "Node.js ping utility",
"npmPackagename": "@pushrocks/smartping", "description": "A utility for performing ping operations in Node.js environments.",
"npmPackagename": "@push.rocks/smartping",
"license": "MIT", "license": "MIT",
"projectDomain": "push.rocks" "projectDomain": "push.rocks",
"keywords": [
"ping",
"network",
"connectivity",
"Node.js",
"utility",
"async",
"promise"
]
},
"release": {
"registries": [
"https://verdaccio.lossless.digital",
"https://registry.npmjs.org"
],
"accessLevel": "public"
} }
}, },
"npmci": { "@git.zone/tsdoc": {
"npmGlobalTools": [], "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"
"npmAccessLevel": "public"
} }
} }
-13432
View File
File diff suppressed because it is too large Load Diff
+31 -17
View File
@@ -1,30 +1,28 @@
{ {
"name": "@pushrocks/smartping", "name": "@push.rocks/smartping",
"version": "1.0.5", "version": "1.0.9",
"private": false, "private": false,
"description": "a ping utility", "description": "A utility for performing ping operations in Node.js environments.",
"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",
"buildDocs": "(tsdoc)" "buildDocs": "tsdoc"
}, },
"dependencies": { "dependencies": {
"@types/ping": "^0.4.1", "ping": "^1.0.0"
"ping": "^0.4.2"
}, },
"devDependencies": { "devDependencies": {
"@gitzone/tsbuild": "^2.1.25", "@git.zone/tsbuild": "^4.4.0",
"@gitzone/tsbundle": "^2.0.5", "@git.zone/tstest": "^3.6.3",
"@gitzone/tsdoc": "^1.1.10", "@types/node": "^25.6.0"
"@gitzone/tsrun": "^1.2.38",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^18.11.2"
}, },
"browserslist": [ "browserslist": [
"last 1 chrome versions" "last 1 chrome versions"
@@ -38,7 +36,23 @@
"dist_ts_web/**/*", "dist_ts_web/**/*",
"assets/**/*", "assets/**/*",
"cli.js", "cli.js",
".smartconfig.json",
"license",
"npmextra.json", "npmextra.json",
"readme.md" "readme.md"
] ],
"keywords": [
"ping",
"network",
"connectivity",
"Node.js",
"utility",
"async",
"promise"
],
"homepage": "https://code.foss.global/push.rocks/smartping",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smartping.git"
}
} }
+7001 -3895
View File
File diff suppressed because it is too large Load Diff
+1
View File
@@ -0,0 +1 @@
+111 -27
View File
@@ -1,39 +1,123 @@
# @pushrocks/smartping # @push.rocks/smartping
a ping utility a ping utility
## Availabililty and Links ## Install
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartping)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartping)
* [github.com (source mirror)](https://github.com/pushrocks/smartping)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartping/)
## Status for master To install `@push.rocks/smartping`, run the following command in your project directory:
Status Category | Status Badge ```bash
-- | -- npm install @push.rocks/smartping --save
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartping/badges/master/pipeline.svg)](https://lossless.cloud) ```
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartping/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartping)](https://lossless.cloud) This command adds `@push.rocks/smartping` to your project's dependencies and ensures you can begin utilizing it to manage your network ping needs efficiently.
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartping)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartping)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartping)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartping)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
## Usage ## Usage
Use TypeScript for best in class intellisense `@push.rocks/smartping` leverages TypeScript and ESM syntax for a seamless development experience, offering straightforward methods to conduct ping operations within your applications.
## Contribution Before diving into the usage scenarios, ensure that you import the module in your TypeScript files using:
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). :) ```typescript
import { Smartping } from '@push.rocks/smartping';
```
For further information read the linked docs at the top of this readme. ### Basic Ping
> MIT licensed | **&copy;** [Lossless GmbH](https://lossless.gmbh) To perform a basic ping operation to check the reachability of a host, you can do the following:
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com) ```typescript
import { Smartping } from '@push.rocks/smartping';
const pingInstance = new Smartping();
async function basicPing() {
const pingResponse = await pingInstance.ping('google.com');
console.log(pingResponse);
}
basicPing();
```
This will output the ping response from `google.com`, including whether the host is alive, the time it took for the response, and other detailed information.
### Ping with Timeout
Sometimes, you may want to specify a timeout for the ping operation to avoid long waiting times if the host is not reachable. You can easily do this as follows:
```typescript
import { Smartping } from '@push.rocks/smartping';
const pingInstance = new Smartping();
async function pingWithTimeout() {
const pingResponse = await pingInstance.ping('google.com', 1000); // Timeout set to 1000 milliseconds
console.log(pingResponse);
}
pingWithTimeout();
```
### Checking if Host is Alive
If you're only interested in whether a host is alive without the need for detailed ping information, you can use the `pingAlive` method:
```typescript
import { Smartping } from '@push.rocks/smartping';
const pingInstance = new Smartping();
async function checkHostAlive() {
const isAlive = await pingInstance.pingAlive('google.com');
console.log(`Is Google alive? ${isAlive}`);
}
checkHostAlive();
```
This method is particularly useful for quickly verifying the availability of a server or an API endpoint.
### Advanced Usage Scenarios
`@push.rocks/smartping` can be integrated into health-check mechanisms, automated network diagnostics, server monitoring tools, or any application requiring network communication verification. Its straightforward API and promise-based architecture allow it to be seamlessly incorporated into asynchronous flow control, enhancing both the development experience and performance.
### Error Handling
While using `@push.rocks/smartping`, you might encounter errors, particularly when dealing with unreachable hosts or network issues. It is recommended to implement proper error handling to manage such scenarios gracefully:
```typescript
async function safePingWithTimeout() {
try {
const pingResponse = await pingInstance.ping('google.com', 500);
console.log(pingResponse);
} catch (error) {
console.error('Ping operation failed:', error);
}
}
safePingWithTimeout();
```
### Wrapping Up
Whether integrating into existing applications for network diagnostics or constructing a new solution requiring ping capabilities, `@push.rocks/smartping` provides an efficient and easy-to-use interface to accomplish these tasks with minimal code. Its design and implementation cater to modern development practices, promoting clean and maintainable code.
For more complex scenarios or contributions, please consult the documentation and source code available on GitHub and NPM. Contributions are always welcome to enhance the module's capabilities and address the evolving needs of developers and applications alike.
## 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.
+20
View File
@@ -0,0 +1,20 @@
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as smartping from '../ts/index.js';
let testPing: smartping.Smartping;
tap.test('should create an instance of Smartping', async () => {
testPing = new smartping.Smartping();
expect(testPing).toBeInstanceOf(smartping.Smartping);
});
tap.test('should deliver a ping result', async () => {
const result = await testPing.ping('127.0.0.1', 1);
expect(result.alive).toBeTrue();
});
tap.test('should detect alive', async () => {
expect(await testPing.pingAlive('127.0.0.1', 1)).toBeTrue();
});
export default tap.start();
-15
View File
@@ -1,15 +0,0 @@
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartping from '../ts/index.js';
let testPing: smartping.Smartping;
tap.test('should create an instance of Smartping', async () => {
testPing = new smartping.Smartping();
expect(testPing).toBeInstanceOf(smartping.Smartping);
});
tap.test('should detect alive', async () => {
await expectAsync(testPing.pingAlive('lossless.com', 1000)).toBeTrue();
})
tap.start();
+4 -4
View File
@@ -1,8 +1,8 @@
/** /**
* autocreated commitinfo by @pushrocks/commitinfo * autocreated commitinfo by @push.rocks/commitinfo
*/ */
export const commitinfo = { export const commitinfo = {
name: '@pushrocks/smartping', name: '@push.rocks/smartping',
version: '1.0.5', version: '1.0.9',
description: 'a ping utility' description: 'A utility for performing ping operations in Node.js environments.'
} }
-2
View File
@@ -1,3 +1 @@
import * as plugins from './smartping.plugins.js';
export * from './smartping.classes.smartping.js'; export * from './smartping.classes.smartping.js';
+8 -9
View File
@@ -1,21 +1,20 @@
import * as plugins from './smartping.plugins.js'; import * as plugins from './smartping.plugins.js';
export type TPingResponse = Awaited<ReturnType<typeof plugins.ping.promise.probe>>;
export class Smartping { export class Smartping {
public async ping(hostArg: string, timeoutArg: number = 500): Promise<plugins.ping.PingResponse> { public async ping(hostArg: string, timeoutArg: number = 500): Promise<TPingResponse> {
const result = await plugins.ping.promise.probe(hostArg, { const result = await plugins.ping.promise.probe(hostArg, {
timeout: timeoutArg timeout: timeoutArg
}) });
return result; return result;
} }
public async pingAlive(hostArg: string, timeoutArg: number = 500): Promise<boolean> { public async pingAlive(hostArg: string, timeoutArg: number = 500): Promise<boolean> {
const result = await plugins.ping.promise.probe(hostArg, { try {
timeout: timeoutArg const result = await this.ping(hostArg, timeoutArg);
}).catch(); return result.alive;
//console.log(result); } catch {
if (result.alive) {
return true;
} else {
return false; return false;
} }
} }
+1 -1
View File
@@ -2,4 +2,4 @@ import ping from 'ping';
export { export {
ping ping
} };
+10 -4
View File
@@ -3,8 +3,14 @@
"experimentalDecorators": true, "experimentalDecorators": true,
"useDefineForClassFields": false, "useDefineForClassFields": false,
"target": "ES2022", "target": "ES2022",
"module": "ES2022", "module": "NodeNext",
"moduleResolution": "nodenext", "moduleResolution": "NodeNext",
"esModuleInterop": true "noImplicitAny": true,
} "esModuleInterop": true,
"verbatimModuleSyntax": true,
"types": ["node"]
},
"exclude": [
"dist_*/**/*.d.ts"
]
} }