@tryghost/server 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +9 -15
  2. package/lib/server.js +16 -19
  3. package/package.json +15 -15
package/README.md CHANGED
@@ -6,8 +6,7 @@
6
6
 
7
7
  or
8
8
 
9
- `yarn add @tryghost/server`
10
-
9
+ `pnpm add @tryghost/server`
11
10
 
12
11
  ## Purpose
13
12
 
@@ -15,29 +14,24 @@ HTTP server lifecycle helpers for starting/stopping servers and handling listen
15
14
 
16
15
  ## Usage
17
16
 
18
-
19
17
  ## Develop
20
18
 
21
- This is a mono repository, managed with [lerna](https://lernajs.io/).
19
+ This is a mono repository, managed with [Nx](https://nx.dev).
22
20
 
23
21
  Follow the instructions for the top-level repo.
24
- 1. `git clone` this repo & `cd` into it as usual
25
- 2. Run `yarn` to install top-level dependencies.
26
22
 
23
+ 1. `git clone` this repo & `cd` into it as usual
24
+ 2. Run `pnpm install` to install top-level dependencies.
27
25
 
28
26
  ## Run
29
27
 
30
- - `yarn dev`
31
-
28
+ - `pnpm dev`
32
29
 
33
30
  ## Test
34
31
 
35
- - `yarn lint` run just eslint
36
- - `yarn test` run lint and tests
37
-
38
-
39
-
32
+ - `pnpm lint` runs oxlint
33
+ - `pnpm test` runs lint and tests
40
34
 
41
- # Copyright & License
35
+ # Copyright & License
42
36
 
43
- Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
37
+ Copyright (c) 2013-2026 Ghost Foundation - Released under the [MIT license](LICENSE).
package/lib/server.js CHANGED
@@ -39,8 +39,8 @@ const start = function start(app, port) {
39
39
  const stop = function stop(done) {
40
40
  try {
41
41
  server.close(done);
42
- } catch (e) {
43
- /*jshint unused:false*/
42
+ } catch {
43
+ // ignore
44
44
  }
45
45
  };
46
46
 
@@ -82,22 +82,21 @@ function onError(error) {
82
82
  throw error;
83
83
  }
84
84
 
85
- const bind = typeof normalizedPort === 'string'
86
- ? `Pipe ${normalizedPort}`
87
- : `Port ${normalizedPort}`;
85
+ const bind =
86
+ typeof normalizedPort === 'string' ? `Pipe ${normalizedPort}` : `Port ${normalizedPort}`;
88
87
 
89
88
  // handle specific listen errors with friendly messages
90
89
  switch (error.code) {
91
- case 'EACCES':
92
- logging.error(`${bind} requires elevated privileges`);
93
- process.exit(1);
94
- break;
95
- case 'EADDRINUSE':
96
- logging.error(`${bind} is already in use`);
97
- process.exit(1);
98
- break;
99
- default:
100
- throw error;
90
+ case 'EACCES':
91
+ logging.error(`${bind} requires elevated privileges`);
92
+ process.exit(1);
93
+ break;
94
+ case 'EADDRINUSE':
95
+ logging.error(`${bind} is already in use`);
96
+ process.exit(1);
97
+ break;
98
+ default:
99
+ throw error;
101
100
  }
102
101
  }
103
102
 
@@ -106,12 +105,10 @@ function onError(error) {
106
105
  */
107
106
  function onListening() {
108
107
  const addr = server.address();
109
- const bind = typeof addr === 'string'
110
- ? 'pipe ' + addr
111
- : 'port ' + addr.port;
108
+ const bind = typeof addr === 'string' ? 'pipe ' + addr : 'port ' + addr.port;
112
109
  debug('Server ready');
113
110
  logging.info(`Listening on ${bind} \n`);
114
111
  }
115
112
 
116
113
  module.exports.start = start;
117
- module.exports.stop = stop;
114
+ module.exports.stop = stop;
package/package.json CHANGED
@@ -1,32 +1,32 @@
1
1
  {
2
2
  "name": "@tryghost/server",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
+ "license": "MIT",
5
+ "author": "Ghost Foundation",
4
6
  "repository": {
5
7
  "type": "git",
6
8
  "url": "git+https://github.com/TryGhost/framework.git",
7
9
  "directory": "packages/server"
8
10
  },
9
- "author": "Ghost Foundation",
10
- "license": "MIT",
11
- "main": "index.js",
12
- "scripts": {
13
- "dev": "echo \"Implement me!\"",
14
- "test": "NODE_ENV=testing vitest run --coverage --config ../../vitest.config.ts",
15
- "lint": "eslint . --ext .js --cache",
16
- "posttest": "yarn lint"
17
- },
18
11
  "files": [
19
12
  "index.js",
20
13
  "lib"
21
14
  ],
15
+ "main": "index.js",
22
16
  "publishConfig": {
23
17
  "access": "public"
24
18
  },
19
+ "dependencies": {
20
+ "@tryghost/debug": "2.1.0",
21
+ "@tryghost/logging": "4.1.0"
22
+ },
25
23
  "devDependencies": {
26
- "sinon": "21.0.2"
24
+ "sinon": "21.1.2"
27
25
  },
28
- "dependencies": {
29
- "@tryghost/debug": "^2.0.2",
30
- "@tryghost/logging": "^4.0.2"
26
+ "scripts": {
27
+ "dev": "echo \"Implement me!\"",
28
+ "test": "NODE_ENV=testing vitest run --coverage --config ../../vitest.config.ts",
29
+ "lint": "oxlint -c ../../.oxlintrc.json .",
30
+ "posttest": "pnpm run lint"
31
31
  }
32
- }
32
+ }