Skip to content

Commit

Permalink
Automatic update to new version.
Browse files Browse the repository at this point in the history
  • Loading branch information
torben committed Mar 22, 2022
1 parent dd81b1c commit 67d09a0
Show file tree
Hide file tree
Showing 11 changed files with 255 additions and 105 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
container: node:latest
steps:
- uses: actions/checkout@v2

# Runs a set of commands using the runners shell

#- name: Install yarn
# run: npm install --global yarn

- name: Install packages marked as dependencies
run: yarn

- name: Build package contents
run: yarn build
22 changes: 22 additions & 0 deletions .github/workflows/check:types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Check types
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
check-types:
runs-on: ubuntu-latest
container: node:latest
steps:
- uses: actions/checkout@v2

# Runs a set of commands using the runners shell

- name: Install packages marked as dependencies
run: yarn

- name: Check-types
run: yarn check:types
22 changes: 22 additions & 0 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Lint
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
lint:
runs-on: ubuntu-latest
container: node:latest
steps:
- uses: actions/checkout@v2

# Runs a set of commands using the runners shell

- name: Install packages marked as dependencies
run: yarn

- name: Run lint
run: yarn lint
22 changes: 22 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Test
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
container: node:latest
steps:
- uses: actions/checkout@v2

# Runs a set of commands using the runners shell

- name: Install packages marked as dependencies
run: yarn

- name: Run tests
run: yarn test
28 changes: 28 additions & 0 deletions .github/workflows/test:coverage:report.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test coverage and report
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
test-coverage-report:
runs-on: ubuntu-latest
container: node:latest
steps:
- uses: actions/checkout@v2

# Runs a set of commands using the runners shell

- name: Install packages marked as dependencies
run: yarn

- name: Run tests
run: yarn test:coverage:report

- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: .coverage/lcov.info
12 changes: 8 additions & 4 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export class ApplicationServer implements PluginHandler {
services, 'applicationServer'
))
return await new Promise<Service>((
resolve:(_value:Service) => void, reject:(_reason:Error) => void
resolve:(value:Service) => void, reject:(_reason:Error) => void
):void => {
const parameters:Array<any> = []
const parameters:Array<unknown> = []
if (configuration.applicationServer.hostName)
parameters.push(configuration.applicationServer.hostName)
parameters.push(():void => {
Expand All @@ -79,9 +79,11 @@ export class ApplicationServer implements PluginHandler {

try {
services.applicationServer.instance.listen(
configuration.applicationServer.port, ...parameters
configuration.applicationServer.port,
...parameters as [() => void]
)
} catch (error) {
// eslint-disable-next-line prefer-promise-reject-errors
reject(error as Error)
}
})
Expand Down Expand Up @@ -178,7 +180,9 @@ export class ApplicationServer implements PluginHandler {
* @returns Given object of services.
*/
static async shouldExit(services:Services):Promise<Services> {
return new Promise((resolve:Function):void => {
return new Promise<Services>((
resolve:(services:Services) => void
):void => {
services.applicationServer.instance.close(():void => {
delete (services as {
applicationServer?:Services['applicationServer']
Expand Down
33 changes: 24 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
"version": "1.0.290",
"license": "CC-BY-3.0",
"description": "A generic extendable application and file server for webNode.",
"homepage": "https://torben.website/application-server-web-node-plugin",
"documentationWebsite": {
"name": "application-server-web-node-plugin",
"trackingCode": "UA-40192634-24"
},
"keywords": [
"web",
"backend",
"application",
"server"
],
"homepage": "https://torben.website/application-server-web-node-plugin",
"bugs": {
"email": "info@torben.website",
"url": "https://github.com/thaibault/application-server-web-node-plugin/issues"
},
"license": "CC-BY-3.0",
"author": {
"name": "Torben Sickert",
"email": "info@torben.website",
"url": "https://torben.website"
},
"files": [
"index.d.ts",
"index.js",
Expand All @@ -31,14 +37,18 @@
"document": "weboptimizer document",
"lint": "weboptimizer lint",
"prepare": "yarn build",
"report:coverage": "nyc report --reporter=text-lcov | coveralls",
"serve": "yarn build && yarn start",
"start": "web-node '{plugin: {hotReloading: true}}'",
"test": "weboptimizer test",
"test:coverage": "weboptimizer test:coverage",
"test:coverage:report": "weboptimizer test:coverage:report",
"update": "yarn version --patch && yarn publish",
"update:documentation": "documentationWebsite --log-level info",
"watch": "weboptimizer build --watch"
},
"dependencies": {
"@types/webpack": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz"
},
"devDependencies": {
"@babel/eslint-parser": "*",
"@types/jest": "*",
Expand All @@ -65,11 +75,19 @@
"optional": true
}
},
"engines": {
"node": ">=17",
"npm": ">=7"
},
"resolutions": {
"@types/webpack": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz",
"colors": "1.4.0"
},
"sideEffects": false,
"documentationWebsite": {
"name": "application-server-web-node-plugin",
"trackingCode": "UA-40192634-24"
},
"webNode": {
"applicationServer": {
"authentication": {
Expand Down Expand Up @@ -97,8 +115,5 @@
"boilerplate": "node",
"payload": "node"
}
},
"dependencies": {
"@types/webpack": "https://registry.yarnpkg.com/@favware/skip-dependency/-/skip-dependency-1.1.1.tgz"
}
}
32 changes: 18 additions & 14 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
<!-- #!/usr/bin/env markdown
<!-- !/usr/bin/env markdown
-*- coding: utf-8 -*-
region header
Copyright Torben Sickert (info["~at~"]torben.website) 16.12.2012
License
This library written by Torben Sickert stand under a creative commons
naming 3.0 unported license.
See https://creativecommons.org/licenses/by/3.0/deed.de
-------
This library written by Torben Sickert stand under a creative commons naming
3.0 unported license. See https://creativecommons.org/licenses/by/3.0/deed.de
endregion -->

Project status
--------------

[![npm version](https://badge.fury.io/js/application-server-web-node-plugin.svg)](https://www.npmjs.com/package/application-server-web-node-plugin)
[![downloads](https://img.shields.io/npm/dy/application-server-web-node-plugin.svg)](https://www.npmjs.com/package/application-server-web-node-plugin)
[![build status](https://travis-ci.org/thaibault/application-server-web-node-plugin.svg?branch=master)](https://travis-ci.org/thaibault/application-server-web-node-plugin)
[![npm](https://img.shields.io/npm/v/application-server-web-node-plugin?color=%23d55e5d&label=npm%20package%20version&logoColor=%23d55e5d)](https://www.npmjs.com/package/application-server-web-node-plugin)
[![npm downloads](https://img.shields.io/npm/dy/application-server-web-node-plugin.svg)](https://www.npmjs.com/package/application-server-web-node-plugin)

[![<LABEL>](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/build.yaml/badge.svg)](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/build.yaml)
[![<LABEL>](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/test.yaml/badge.svg)](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/test.yaml)
[![<LABEL>](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/test:coverage:report.yaml/badge.svg)](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/test:coverage:report.yaml)
[![<LABEL>](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/check:types.yaml/badge.svg)](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/check:types.yaml)
[![<LABEL>](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/lint.yaml/badge.svg)](https://github.com/thaibault/application-server-web-node-plugin/actions/workflows/lint.yaml)

[![code coverage](https://coveralls.io/repos/github/thaibault/application-server-web-node-plugin/badge.svg)](https://coveralls.io/github/thaibault/application-server-web-node-plugin)

<!-- Too unstable yet
[![dependencies](https://img.shields.io/david/thaibault/application-server-web-node-plugin.svg)](https://david-dm.org/thaibault/application-server-web-node-plugin)
[![development dependencies](https://img.shields.io/david/dev/thaibault/application-server-web-node-plugin.svg)](https://david-dm.org/thaibault/application-server-web-node-plugin?type=dev)
[![peer dependencies](https://img.shields.io/david/peer/thaibault/application-server-web-node-plugin.svg)](https://david-dm.org/thaibault/application-server-web-node-plugin?type=peer)
[![documentationd website](https://img.shields.io/website-up-down-green-red/https/torben.website/application-server-web-node-plugin.svg?label=documentation-website)](https://torben.website/application-server-web-node-plugin)
-->
[![documentation website](https://img.shields.io/website-up-down-green-red/https/torben.website/application-server-web-node-plugin.svg?label=documentation-website)](https://torben.website/application-server-web-node-plugin)

Use case
--------

Node application server as web-node plugin.

<!-- region vim modline
vim: set tabstop=4 shiftwidth=4 expandtab:
vim: foldmethod=marker foldmarker=region,endregion:
endregion -->
4 changes: 2 additions & 2 deletions test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ describe('application-server', ():void => {
{applicationServer: {
instance: {
listen: (
port:number, host:string, started:Function
port:number, host:string, started:() => void
):void => started()
} as unknown as HTTPServer,
sockets: [],
Expand All @@ -62,7 +62,7 @@ describe('application-server', ():void => {
test('shouldExit', async ():Promise<void> => {
let testValue = false
const services:Services = {applicationServer: {
instance: {close: (callback:Function|undefined):HTTPServer => {
instance: {close: (callback:(() => void)|undefined):HTTPServer => {
testValue = true
if (callback)
callback()
Expand Down
7 changes: 4 additions & 3 deletions type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
endregion
*/
// region imports
import {Mapping} from 'clientnode/type'
import {
Http2SecureServer as HTTPSecureServer,
Http2Server as HttpServer,
Expand All @@ -34,7 +35,7 @@ import {
} from 'web-node/type'
// endregion
// region exports
export type Configuration<PluginConfigurationType = {}> =
export type Configuration<PluginConfigurationType = Mapping<unknown>> =
BaseConfiguration<{
applicationServer:{
authentication:{
Expand All @@ -61,7 +62,7 @@ export interface Service extends BaseService {
name:'applicationServer'
promise:Promise<HTTPServer>
}
export type Services<PluginServiceType = {}> =
export type Services<PluginServiceType = Mapping<unknown>> =
BaseServices<{
applicationServer:{
instance:HTTPServer
Expand All @@ -70,7 +71,7 @@ export type Services<PluginServiceType = {}> =
}
}> &
PluginServiceType
export type ServicePromises<PluginServicePromiseType = {}> =
export type ServicePromises<PluginServicePromiseType = Mapping<unknown>> =
BaseServicePromises<{applicationServer:Promise<HTTPServer>}> &
PluginServicePromiseType

Expand Down
Loading

0 comments on commit 67d09a0

Please sign in to comment.