Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 287db41

Browse filesBrowse files
committed
Merge branch 'main' of github.com:remy/nodemon
2 parents 9ecd9db + cd27c0b commit 287db41
Copy full SHA for 287db41

File tree

Expand file treeCollapse file tree

6 files changed

+140
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

6 files changed

+140
-2
lines changed
Open diff view settings
Collapse file

‎.github/workflows/node.js.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/node.js.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515

1616
strategy:
1717
matrix:
18-
node-version: [10.x, 12.x, 18.x]
18+
node-version: [18.x]
1919
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
2020

2121
steps:
Collapse file

‎.github/workflows/release.yml‎

Copy file name to clipboardExpand all lines: .github/workflows/release.yml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
uses: actions/setup-node@v4
2020
with:
2121
cache: npm
22-
node-version: 16
22+
node-version: 18
2323
- name: Install dependencies
2424
run: npm ci
2525
- name: Release
Collapse file

‎index.d.ts‎

Copy file name to clipboard
+126Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
type NodemonEventHandler =
2+
| 'start'
3+
| 'crash'
4+
| 'exit'
5+
| 'quit'
6+
| 'restart'
7+
| 'config:update'
8+
| 'log'
9+
| 'readable'
10+
| 'stdout'
11+
| 'stderr';
12+
13+
type NodemonEventListener = {
14+
on(event: 'start' | 'crash' | 'readable', listener: () => void): Nodemon;
15+
on(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon;
16+
on(event: 'stdout' | 'stderr', listener: (e: string) => void): Nodemon;
17+
on(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon;
18+
on(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon;
19+
on(event: 'exit', listener: (e?: NodemonEventExit) => void): Nodemon;
20+
on(
21+
event: 'config:update',
22+
listener: (e?: NodemonEventConfig) => void
23+
): Nodemon;
24+
};
25+
26+
type Nodemon = {
27+
(options?: NodemonSettings): Nodemon;
28+
on(event: 'start' | 'crash', listener: () => void): Nodemon;
29+
on(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon;
30+
on(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon;
31+
on(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon;
32+
on(event: 'exit', listener: (e?: NodemonEventExit) => void): Nodemon;
33+
on(
34+
event: 'config:update',
35+
listener: (e?: NodemonEventConfig) => void
36+
): Nodemon;
37+
38+
// this is repeated because VS Code doesn't autocomplete otherwise
39+
addEventListener(event: 'start' | 'crash', listener: () => void): Nodemon;
40+
addEventListener(
41+
event: 'log',
42+
listener: (e: NodemonEventLog) => void
43+
): Nodemon;
44+
addEventListener(
45+
event: 'restart',
46+
listener: (e?: NodemonEventRestart) => void
47+
): Nodemon;
48+
addEventListener(
49+
event: 'quit',
50+
listener: (e?: NodemonEventQuit) => void
51+
): Nodemon;
52+
addEventListener(
53+
event: 'exit',
54+
listener: (e?: NodemonEventExit) => void
55+
): Nodemon;
56+
addEventListener(
57+
event: 'config:update',
58+
listener: (e?: NodemonEventConfig) => void
59+
): Nodemon;
60+
61+
once(event: 'start' | 'crash', listener: () => void): Nodemon;
62+
once(event: 'log', listener: (e: NodemonEventLog) => void): Nodemon;
63+
once(event: 'restart', listener: (e?: NodemonEventRestart) => void): Nodemon;
64+
once(event: 'quit', listener: (e?: NodemonEventQuit) => void): Nodemon;
65+
once(event: 'exit', listener: (e?: NodemonEventExit) => void): Nodemon;
66+
once(
67+
event: 'config:update',
68+
listener: (e?: NodemonEventConfig) => void
69+
): Nodemon;
70+
71+
removeAllListeners(event: NodemonEventHandler): Nodemon;
72+
emit(type: NodemonEventHandler, event?: any): Nodemon;
73+
reset(callback: Function): Nodemon;
74+
restart(): Nodemon;
75+
config: NodemonSettings;
76+
};
77+
78+
type NodemonEventLog = {
79+
/**
80+
detail*: what you get with nodemon --verbose.
81+
status: subprocess starting, restarting.
82+
fail: is the subprocess crashing.
83+
error: is a nodemon system error.
84+
*/
85+
type: 'detail' | 'log' | 'status' | 'error' | 'fail';
86+
/** the plain text message */
87+
message: String;
88+
/** contains the terminal escape codes to add colour, plus the "[nodemon]" prefix */
89+
colour: String;
90+
};
91+
92+
interface NodemonEventRestart {
93+
matched?: {
94+
result: string[];
95+
total: number;
96+
};
97+
}
98+
99+
type NodemonEventQuit = 143 | 130;
100+
type NodemonEventExit = number;
101+
102+
// TODO: Define the type of NodemonEventConfig
103+
type NodemonEventConfig = any;
104+
105+
interface NodemonSettings {
106+
/* restartable defaults to "rs" as a string the user enters */
107+
restartable?: false | String;
108+
colours?: Boolean;
109+
execMap?: { [key: string]: string };
110+
ignoreRoot?: string[];
111+
watch?: string[];
112+
stdin?: boolean;
113+
runOnChangeOnly?: boolean;
114+
verbose?: boolean;
115+
signal?: string;
116+
stdout?: boolean;
117+
watchOptions?: WatchOptions;
118+
}
119+
120+
interface WatchOptions {
121+
ignorePermissionErrors: boolean;
122+
ignored: string;
123+
persistent: boolean;
124+
usePolling: boolean;
125+
interval: number;
126+
}
Collapse file

‎jsconfig.json‎

Copy file name to clipboard
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"compilerOptions": {
3+
"typeRoots": ["./index.d.ts", "./node_modules/@types"],
4+
"checkJs": true
5+
},
6+
"exclude": ["node_modules"]
7+
}
Collapse file

‎lib/nodemon.js‎

Copy file name to clipboardExpand all lines: lib/nodemon.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ var eventHandlers = {};
1616
// stable module API
1717
config.required = utils.isRequired;
1818

19+
/**
20+
* @param {NodemonSettings} settings
21+
* @returns {Nodemon}
22+
*/
1923
function nodemon(settings) {
2024
bus.emit('boot');
2125
nodemon.reset();
Collapse file

‎package.json‎

Copy file name to clipboardExpand all lines: package.json
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
"terminal"
2828
],
2929
"license": "MIT",
30+
"types": "./index.d.ts",
3031
"main": "./lib/nodemon",
3132
"scripts": {
3233
"commitmsg": "commitlint -e",

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.