Skip to content

Commit deef2e4

Browse files
committed
chore: update jsdocs
1 parent 945e676 commit deef2e4

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/helpers/getAngularJson.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,14 @@ const { join } = require('node:path')
22

33
const { existsSync, readJsonSync } = require('fs-extra')
44

5-
// Get contents of project's angular.json file
5+
/**
6+
* Get contents of project's angular.json file
7+
* @param {Object} obj
8+
* @param {string} obj.siteRoot Root directory of an app
9+
* @param {(msg: string) => never} obj.failPlugin Function to fail the plugin
10+
*
11+
* @returns {any}
12+
*/
613
const getAngularJson = function ({ failPlugin, siteRoot }) {
714
if (!existsSync(join(siteRoot, 'angular.json'))) {
815
return failPlugin(`No angular.json found at project root`)

src/helpers/serverModuleHelpers.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,16 @@ const getUsedEngine = function (serverModuleContents) {
4949
}
5050

5151
/**
52-
* TODO: document what's happening here and update types
53-
* @param {string} angularJson
52+
* For Angular@19+ we inspect user's server.ts and if it uses express, we swap it out with our own.
53+
* We also check wether CommonEngine or AppEngine is used to provide correct replacement preserving
54+
* engine of user's choice (CommonEngine is stable, but lacks support for some features, AppEngine is
55+
* Developer Preview, but has more features and is easier to integrate with - ultimately choice is up to user
56+
* as AppEngine might have breaking changes outside of major version bumps)
57+
* @param {Object} obj
58+
* @param {string} obj.angularVersion Angular version
59+
* @param {string} obj.siteRoot Root directory of an app
60+
* @param {(msg: string) => never} obj.failPlugin Function to fail the plugin
61+
*
5462
* @returns {'AppEngine' | 'CommonEngine' | undefined}
5563
*/
5664
const fixServerTs = async function ({ angularVersion, siteRoot, failPlugin }) {
@@ -78,10 +86,6 @@ const fixServerTs = async function ({ angularVersion, siteRoot, failPlugin }) {
7886
const usedEngine = getUsedEngine(serverModuleContents) ?? 'CommonEngine'
7987

8088
// if server module uses express - it means we can't use it and instead we need to provide our own
81-
// alternatively we could just compare content (or hash of it) to "known" content of server.ts file
82-
// that users get when they scaffold new project and only swap if it's known content and fail with
83-
// actionable message so users know how to adjust their server.ts file to work on Netlify
84-
// with engine they opted to use
8589
needSwapping = serverModuleContents.includes('express')
8690

8791
if (needSwapping) {

0 commit comments

Comments
 (0)