Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
a09ac09
chore: refactor entry point
metcoder95 Oct 28, 2022
e1bc19e
types: add initial types
metcoder95 Oct 28, 2022
c87d287
types: extend typings
metcoder95 Oct 28, 2022
a7b9cd7
types: adjust typings
metcoder95 Oct 30, 2022
afff7de
chore: add support for multiple imports
metcoder95 Oct 30, 2022
a66a2c4
tests: apply styling
metcoder95 Oct 30, 2022
383bc5e
fix: adjust bad check
metcoder95 Oct 30, 2022
396f087
chore: remove lock-file
metcoder95 Oct 30, 2022
3f06b0c
chore: replace joi with ajv
metcoder95 Nov 4, 2022
8d66308
refactor: adjustements for ajv implementation
metcoder95 Nov 4, 2022
9276801
chore: do not show help if no flag/resource are set
metcoder95 Nov 4, 2022
8468427
chore: refactor entrypoint
metcoder95 Nov 4, 2022
0d48a21
chore: replace joi defaults with ajv
metcoder95 Nov 4, 2022
a74c7c3
refactor: package adjustements
metcoder95 Nov 4, 2022
26c9dcf
feat: refactor HTTP support
metcoder95 Nov 11, 2022
dc915f2
refactor: move validation to its own file
metcoder95 Nov 21, 2022
03fe965
chore: add new dependencies
metcoder95 Nov 21, 2022
56c8811
chore: refactor index
metcoder95 Nov 23, 2022
d3aa7f4
refactor: adjust http implementation + test
metcoder95 Nov 23, 2022
266dc49
refactor: adjust validation of hooks
metcoder95 Nov 23, 2022
43b8b5f
fix: remove leftover
metcoder95 Nov 23, 2022
5d5ede1
feat: add dynamic logs to CLI
metcoder95 Nov 23, 2022
1ae7e80
feat: support plain TCP
metcoder95 Nov 24, 2022
84f7094
refactor: smaller improvements
metcoder95 Nov 24, 2022
1bab56f
docs: add examples
metcoder95 Nov 24, 2022
713e75d
feat: support for Socket enabled
metcoder95 Nov 25, 2022
11aa672
refactor: smaller changes
metcoder95 Nov 25, 2022
56b3fe2
feat: add support for files
metcoder95 Nov 27, 2022
2e66ee8
fix: handle non-formatted resources ahead of creating the check resource
metcoder95 Nov 27, 2022
ac0f5c2
tests: refactor some test
metcoder95 Nov 27, 2022
69bc7e7
fix: handle flags correctly
metcoder95 Nov 27, 2022
953e6c4
fix: handle non existent ports
metcoder95 Nov 27, 2022
3401cb6
chore: drop support for Node 14
metcoder95 Nov 30, 2022
18be88f
test: adjust domain for testing
metcoder95 Nov 30, 2022
8c2b8e7
chore: rename jobs
metcoder95 Nov 30, 2022
f17d666
refactor: reuse socket for subsquent retries on TCP
metcoder95 Nov 30, 2022
2d156ba
test: fix bad write into socket
metcoder95 Nov 30, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions .editorconfig

This file was deleted.

4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: CI
on: [push, pull_request]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: [14.x, 16.x, 18.x]
node: [16.x, 18.x, 19.x]
name: Node ${{ matrix.node }}
steps:
- uses: actions/checkout@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- 'v*.*.*-rc**'

jobs:
build:
release:
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
build:
release:
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down
81 changes: 0 additions & 81 deletions bin/wait-on

This file was deleted.

2 changes: 1 addition & 1 deletion exampleConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ module.exports = {
},
// optional default resources if not specified in command args
resources: ['http://foo/bar', 'http://cat/dog']
};
}
9 changes: 9 additions & 0 deletions examples/http.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { WaitOn } = require('..')

WaitOn({
resources: ['http://localhost:3000'],
timeout: 10000,
events: {
onResourceResponse: console.log
}
}).then(res => console.log('done:', res), console.error)
9 changes: 9 additions & 0 deletions examples/socket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { WaitOn } = require('..')

WaitOn({
resources: ['socket:/path/to/socket.sock'],
timeout: 10000,
events: {
onResourceResponse: console.log
}
}).then(res => console.log('done:', res), console.error)
9 changes: 9 additions & 0 deletions examples/tcp.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { WaitOn } = require('..')

WaitOn({
resources: ['tcp://localhost:3000'],
timeout: 10000,
events: {
onResourceResponse: console.log
}
}).then(res => console.log('done:', res), console.error)
File renamed without changes.
60 changes: 60 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/// <reference types="node" />
import { AgentOptions as HTTPAgentOptions } from "node:http";
import { AgentOptions as HTTPSAgentOptions } from "node:https";

declare function WaitOn(
options: WaitOnOptions,
cb?: WaitOnCallback
): Promise<void> | void;

type WaitOnCallback = (err?: Error) => unknown;

type WaitOnProxyConfig = {
host?: string;
protocol?: string;
auth?: WaitOnOptions["auth"];
};

type WaitOnResourcesType =
| `file:${string}`
| `http-get:${string}`
| `https-get:${string}`
| `http:${string}`
| `https:${string}`
| `tcp:${string}`
| `socket:${string}`;

type WaitOnValidateStatusCallback = (status: number) => boolean;

type WaitOnOptions = {
resources: WaitOnResourcesType[];
delay?: number;
interval?: number;
log?: boolean;
reverse?: boolean;
simultaneous?: number;
timeout?: number;
tcpTimeout?: number;
verbose?: boolean;
window?: number;
passphrase?: string;
proxy?: boolean | WaitOnProxyConfig;
auth?: {
user: string;
pass: string;
};
headers?: Record<string, string | number>;
validateStatus?: WaitOnValidateStatusCallback;
strictSSL?: boolean;
} & HTTPAgentOptions &
HTTPSAgentOptions;

export default WaitOn;
export {
WaitOnOptions,
WaitOnProxyConfig,
WaitOnResourcesType,
WaitOnValidateStatusCallback,
WaitOnCallback,
WaitOn,
};
Loading