This commit is contained in:
2025-08-23 11:29:22 +00:00
parent 92cbc4e543
commit 234aab74d6
16 changed files with 10068 additions and 2037 deletions

View File

@@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: code.foss.global/host.today/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{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 @ship.zone/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: code.foss.global/host.today/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@/${{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 @ship.zone/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 @ship.zone/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 @ship.zone/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 @ship.zone/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

18
.gitignore vendored
View File

@@ -3,17 +3,21 @@
# artifacts
coverage/
public/
pages/
# installs
node_modules/
# caches and builds
# caches
.yarn/
.cache/
dist/
dist_web/
dist_serve/
dist_ts_web/
.rpt2_cache
# custom
# builds
dist/
dist_*/
# AI
.claude/
.serena/
#------# custom

View File

@@ -1,125 +0,0 @@
# gitzone standard
image: 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:
- docker
- notpriv
snyk:
stage: security
script:
- npmci npm prepare
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# test stage
# ====================
testLTS:
stage: test
script:
- npmci npm prepare
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci npm prepare
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- notpriv
release:
stage: release
script:
- npmci node install stable
- npmci npm publish
only:
- tags
tags:
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags:
- docker
- priv
trigger:
stage: metadata
script:
- npmci trigger
only:
- tags
tags:
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npm install -g typedoc typescript
- npmci npm prepare
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true

1
.npmrc Normal file
View File

@@ -0,0 +1 @@
registry=https://registry.npmjs.org/

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"]
}
}
}
}
}
}
]
}

View File

@@ -1,5 +1,6 @@
{
"gitzone": {
"projectType": "npm",
"module": {
"githost": "code.foss.global",
"gitscope": "push.rocks",
@@ -26,4 +27,4 @@
"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"
}
}
}

1864
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -8,25 +8,24 @@
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(tstest test/)",
"test": "(tstest test/ --verbose --logfile --timeout 60)",
"build": "(tsbuild)",
"format": "(gitzone format)"
"format": "(gitzone format)",
"buildDocs": "tsdoc"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tstest": "^1.0.19",
"@pushrocks/smartspawn": "^2.0.4",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^11.13.0",
"tslint": "^5.11.0",
"tslint-config-prettier": "^1.15.0"
"@git.zone/tsbuild": "^2.0.22",
"@git.zone/tsrun": "^1.3.3",
"@git.zone/tstest": "^2.3.5",
"@push.rocks/smartpromise": "^4.0.2",
"@push.rocks/smartspawn": "^3.0.2",
"@types/node": "^22.13.8"
},
"dependencies": {
"@pushrocks/smartdelay": "^2.0.3",
"@pushrocks/smartpromise": "^3.0.2",
"@pushrocks/smartrx": "^2.0.3",
"@push.rocks/smartdelay": "^3.0.1",
"@push.rocks/smartrx": "^3.0.10",
"@types/node-ipc": "^9.1.1",
"node-ipc": "^9.1.1"
"node-ipc": "^12.0.0"
},
"keywords": [
"IPC",
@@ -36,9 +35,29 @@
"client-server",
"message passing"
],
"homepage": "https://code.foss.global/push.rocks/smartipc",
"homepage": "https://code.foss.global/push.rocks/smartipc#readme",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smartipc.git"
},
"packageManager": "pnpm@10.14.0+sha512.ad27a79641b49c3e481a16a805baa71817a04bbe06a38d17e60e2eaee83f6a146c6a688125f5792e48dd5ba30e7da52a5cda4c3992b9ccf333f9ce223af84748",
"bugs": {
"url": "https://code.foss.global/push.rocks/smartipc/issues"
},
"type": "module",
"files": [
"ts/**/*",
"ts_web/**/*",
"dist/**/*",
"dist_*/**/*",
"dist_ts/**/*",
"dist_ts_web/**/*",
"assets/**/*",
"cli.js",
"npmextra.json",
"readme.md"
],
"pnpm": {
"overrides": {}
}
}
}

9764
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,9 @@
# @push.rocks/smartipc
node inter process communication
## Install
To install @push.rocks/smartipc, use the following command with npm:
```bash
@@ -29,7 +31,7 @@ To set up an IPC server, create an instance of `SmartIpc` with the type set to `
```typescript
const serverIpc = new SmartIpc({
type: 'server',
ipcSpace: 'myUniqueIpcSpace'
ipcSpace: 'myUniqueIpcSpace',
});
```
@@ -42,7 +44,7 @@ serverIpc.registerHandler({
keyword: 'greeting',
handlerFunc: (dataArg: string) => {
console.log(`Received greeting: ${dataArg}`);
}
},
});
```
@@ -62,7 +64,7 @@ Setting up a client is similar to setting up a server. Create a `SmartIpc` insta
```typescript
const clientIpc = new SmartIpc({
type: 'client',
ipcSpace: 'myUniqueIpcSpace'
ipcSpace: 'myUniqueIpcSpace',
});
```
@@ -118,7 +120,7 @@ serverIpc.registerHandler({
handlerFunc: (dataArg: string) => {
const dataObject = JSON.parse(dataArg);
console.log(dataObject.key); // Outputs: value
}
},
});
```
@@ -140,13 +142,13 @@ Always include error handling in production applications to manage unexpected sc
### Conclusion
Integrating `@push.rocks/smartipc` into your Node.js applications streamlines the process of setting up IPC for inter-process communication. Through the examples provided, you've seen how to configure both servers and clients, register message handlers, send messages, and incorporate error handling. With `smartipc`, you can facilitate robust communication channels between different parts of your application, enhancing modularity and process isolation.
Integrating `@push.rocks/smartipc` into your Node.js applications streamlines the process of setting up IPC for inter-process communication. Through the examples provided, you've seen how to configure both servers and clients, register message handlers, send messages, and incorporate error handling. With `smartipc`, you can facilitate robust communication channels between different parts of your application, enhancing modularity and process isolation.
For further information and advanced configuration options, refer to the `@push.rocks/smartipc` documentation.
## 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.
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.

View File

@@ -1,8 +1,8 @@
import { expect, tap } from '@pushrocks/tapbundle';
import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as smartipc from '../ts/index';
import * as smartspawn from '@pushrocks/smartspawn';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartspawn from '@push.rocks/smartspawn';
import * as smartpromise from '@push.rocks/smartpromise';
let serverIpc: smartipc.SmartIpc;
let clientIpc: smartipc.SmartIpc;
@@ -10,27 +10,27 @@ let clientIpc: smartipc.SmartIpc;
tap.test('should instantiate a valid instance', async () => {
serverIpc = new smartipc.SmartIpc({
ipcSpace: 'testSmartIpc',
type: 'server'
type: 'server',
});
serverIpc.registerHandler({
keyword: 'hi',
handlerFunc: data => {
handlerFunc: (data) => {
console.log(data);
}
},
});
await serverIpc.start();
});
tap.test('should create a client', async tools => {
tap.test('should create a client', async (tools) => {
clientIpc = new smartipc.SmartIpc({
ipcSpace: 'testSmartIpc',
type: 'client'
type: 'client',
});
await clientIpc.start();
clientIpc.sendMessage('hi', { awesome: 'yes' });
});
tap.test('should terminate the smartipc process', async tools => {
tap.test('should terminate the smartipc process', async (tools) => {
await clientIpc.stop();
await serverIpc.stop();
tools.delayFor(2000).then(() => {

View File

@@ -1,4 +1,4 @@
import * as plugins from './smartipc.plugins';
import * as plugins from './smartipc.plugins.js';
import { EventEmitter } from 'events';
export interface ISmartIpcConstructorOptions {
@@ -49,11 +49,13 @@ export class SmartIpc {
await done.promise;
break;
default:
throw new Error('type of ipc is not valid. Must be "server" or "client"');
throw new Error(
'type of ipc is not valid. Must be "server" or "client"',
);
}
for (const handler of this.handlers) {
ipcEventEmitter.on(handler.keyword, dataArg => {
ipcEventEmitter.on(handler.keyword, (dataArg) => {
handler.handlerFunc(dataArg);
});
}

View File

@@ -1,7 +1,7 @@
// pushrocks scope
import * as smartdelay from '@pushrocks/smartdelay';
import * as smartpromise from '@pushrocks/smartpromise';
import * as smartrx from '@pushrocks/smartrx';
import * as smartdelay from '@push.rocks/smartdelay';
import * as smartpromise from '@push.rocks/smartpromise';
import * as smartrx from '@push.rocks/smartrx';
export { smartdelay, smartpromise, smartrx };

View File

@@ -6,9 +6,9 @@
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
"verbatimModuleSyntax": true,
"baseUrl": ".",
"paths": {}
},
"exclude": [
"dist_*/**/*.d.ts"
]
"exclude": ["dist_*/**/*.d.ts"]
}