netlify-cli 16.0.3 → 16.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.
package/npm-shrinkwrap.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "netlify-cli",
|
|
3
|
-
"version": "16.0
|
|
3
|
+
"version": "16.1.0",
|
|
4
4
|
"lockfileVersion": 2,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "netlify-cli",
|
|
9
|
-
"version": "16.0
|
|
9
|
+
"version": "16.1.0",
|
|
10
10
|
"hasInstallScript": true,
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"dependencies": {
|
package/package.json
CHANGED
|
@@ -574,7 +574,7 @@ export default class BaseCommand extends Command {
|
|
|
574
574
|
// configuration file and the API
|
|
575
575
|
// ==================================================
|
|
576
576
|
const cachedConfig = await actionCommand.getConfig({
|
|
577
|
-
cwd: this.jsWorkspaceRoot || this.workingDir,
|
|
577
|
+
cwd: flags.cwd ? this.workingDir : this.jsWorkspaceRoot || this.workingDir,
|
|
578
578
|
repositoryRoot: rootDir,
|
|
579
579
|
packagePath: this.workspacePackage,
|
|
580
580
|
// The config flag needs to be resolved from the actual process working directory
|
package/src/utils/proxy.mjs
CHANGED
|
@@ -75,19 +75,35 @@ const formatEdgeFunctionError = (errorBuffer, acceptsHtml) => {
|
|
|
75
75
|
})
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
78
|
+
/**
|
|
79
|
+
* @param {string} url
|
|
80
|
+
*/
|
|
81
|
+
function isInternal(url) {
|
|
79
82
|
return url.startsWith('/.netlify/')
|
|
80
83
|
}
|
|
81
|
-
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* @param {boolean|number|undefined} functionsPort
|
|
87
|
+
* @param {string} url
|
|
88
|
+
*/
|
|
89
|
+
function isFunction(functionsPort, url) {
|
|
82
90
|
return functionsPort && url.match(/^\/.netlify\/(functions|builders)\/.+/)
|
|
83
91
|
}
|
|
84
92
|
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
/**
|
|
94
|
+
* @param {Record<string, string>} addonsUrls
|
|
95
|
+
* @param {http.IncomingMessage} req
|
|
96
|
+
*/
|
|
97
|
+
function getAddonUrl(addonsUrls, req) {
|
|
98
|
+
const matches = req.url?.match(/^\/.netlify\/([^/]+)(\/.*)/)
|
|
87
99
|
const addonUrl = matches && addonsUrls[matches[1]]
|
|
88
100
|
return addonUrl ? `${addonUrl}${matches[2]}` : null
|
|
89
101
|
}
|
|
90
102
|
|
|
103
|
+
/**
|
|
104
|
+
* @param {string} pathname
|
|
105
|
+
* @param {string} publicFolder
|
|
106
|
+
*/
|
|
91
107
|
const getStatic = async function (pathname, publicFolder) {
|
|
92
108
|
const alternatives = [pathname, ...alternativePathsFor(pathname)].map((filePath) =>
|
|
93
109
|
path.resolve(publicFolder, filePath.slice(1)),
|
package/src/utils/run-build.mjs
CHANGED
|
@@ -80,7 +80,7 @@ export const runNetlifyBuild = async ({ command, env = {}, options, settings, ti
|
|
|
80
80
|
const devCommand = async (settingsOverrides = {}) => {
|
|
81
81
|
let cwd = command.workingDir
|
|
82
82
|
|
|
83
|
-
if (command.project.workspace?.packages.length) {
|
|
83
|
+
if (!options.cwd && command.project.workspace?.packages.length) {
|
|
84
84
|
cwd = join(command.project.jsWorkspaceRoot, settings.baseDirectory || '')
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -13,14 +13,18 @@ import isValidEventName from './validation.mjs'
|
|
|
13
13
|
|
|
14
14
|
const dirPath = dirname(fileURLToPath(import.meta.url))
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
/**
|
|
17
|
+
* @param {'track' | 'identify'} type
|
|
18
|
+
* @param {object} payload
|
|
19
|
+
*/
|
|
20
|
+
function send(type, payload) {
|
|
17
21
|
const requestFile = join(dirPath, 'request.mjs')
|
|
18
22
|
const options = JSON.stringify({
|
|
19
23
|
data: payload,
|
|
20
24
|
type,
|
|
21
25
|
})
|
|
22
26
|
|
|
23
|
-
const args = [process.execPath, [requestFile, options]]
|
|
27
|
+
const args = /** @type {const} */ ([process.execPath, [requestFile, options]])
|
|
24
28
|
if (process.env.NETLIFY_TEST_TELEMETRY_WAIT === 'true') {
|
|
25
29
|
return execa(...args, {
|
|
26
30
|
stdio: 'inherit',
|
|
@@ -46,7 +50,12 @@ const eventConfig = {
|
|
|
46
50
|
],
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
/**
|
|
54
|
+
* Tracks a custom event with the provided payload
|
|
55
|
+
* @param {string} eventName
|
|
56
|
+
* @param {{status?: string, duration?: number, [key: string]: unknown}} [payload]
|
|
57
|
+
*/
|
|
58
|
+
export async function track(eventName, payload = {}) {
|
|
50
59
|
if (isCI) {
|
|
51
60
|
return
|
|
52
61
|
}
|
|
@@ -83,7 +92,14 @@ export const track = async function (eventName, payload = {}) {
|
|
|
83
92
|
return send('track', defaultData)
|
|
84
93
|
}
|
|
85
94
|
|
|
86
|
-
|
|
95
|
+
/**
|
|
96
|
+
* @param {object} payload
|
|
97
|
+
* @param {string} payload.name
|
|
98
|
+
* @param {string} payload.email
|
|
99
|
+
* @param {string} payload.userId
|
|
100
|
+
* @returns
|
|
101
|
+
*/
|
|
102
|
+
export async function identify(payload) {
|
|
87
103
|
if (isCI) {
|
|
88
104
|
return
|
|
89
105
|
}
|
package/src/utils/validation.mjs
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
import { BANG, chalk } from './command-helpers.mjs'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @param {string} exampleCommand
|
|
6
|
+
* @returns {(value:string, previous: unknown) => unknown}
|
|
7
|
+
*/
|
|
4
8
|
export const getGeoCountryArgParser = (exampleCommand) => (arg) => {
|
|
5
9
|
// Validate that the arg passed is two letters only for country
|
|
6
10
|
// See https://en.wikipedia.org/wiki/List_of_ISO_3166_country_codes
|