netlify-cli 10.11.2 → 10.12.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.
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "10.11.2",
3
+ "version": "10.12.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "10.11.2",
9
+ "version": "10.12.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
@@ -81,7 +81,7 @@
81
81
  "multiparty": "^4.2.1",
82
82
  "netlify": "^12.0.0",
83
83
  "netlify-headers-parser": "^6.0.2",
84
- "netlify-onegraph-internal": "0.3.6",
84
+ "netlify-onegraph-internal": "0.3.8",
85
85
  "netlify-redirect-parser": "^13.0.5",
86
86
  "netlify-redirector": "^0.2.1",
87
87
  "node-fetch": "^2.6.0",
@@ -6217,9 +6217,9 @@
6217
6217
  }
6218
6218
  },
6219
6219
  "node_modules/c8": {
6220
- "version": "7.11.3",
6221
- "resolved": "https://registry.npmjs.org/c8/-/c8-7.11.3.tgz",
6222
- "integrity": "sha512-6YBmsaNmqRm9OS3ZbIiL2EZgi1+Xc4O24jL3vMYGE6idixYuGdy76rIfIdltSKDj9DpLNrcXSonUTR1miBD0wA==",
6220
+ "version": "7.12.0",
6221
+ "resolved": "https://registry.npmjs.org/c8/-/c8-7.12.0.tgz",
6222
+ "integrity": "sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==",
6223
6223
  "dev": true,
6224
6224
  "dependencies": {
6225
6225
  "@bcoe/v8-coverage": "^0.2.3",
@@ -16038,9 +16038,9 @@
16038
16038
  }
16039
16039
  },
16040
16040
  "node_modules/netlify-onegraph-internal": {
16041
- "version": "0.3.6",
16042
- "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.6.tgz",
16043
- "integrity": "sha512-nNqCWT2jzPmqw/3/sKf1RFicL2JEFjmxXTpnIzJKt5U+bnS633cOy5pImNnfBGTd50NTNvdZ0GXMhQ7AwH16Qg==",
16041
+ "version": "0.3.8",
16042
+ "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.8.tgz",
16043
+ "integrity": "sha512-ElgiJwQpXwXjHjC0Lhq2woZoJ/l62b1xUIDeg6tC3UF/pQFNIaD0aaIwphoiPfkkkbo5DVLogg9AASt2E0oONQ==",
16044
16044
  "dependencies": {
16045
16045
  "graphql": "16.0.0",
16046
16046
  "node-fetch": "^2.6.0",
@@ -27214,9 +27214,9 @@
27214
27214
  "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg=="
27215
27215
  },
27216
27216
  "c8": {
27217
- "version": "7.11.3",
27218
- "resolved": "https://registry.npmjs.org/c8/-/c8-7.11.3.tgz",
27219
- "integrity": "sha512-6YBmsaNmqRm9OS3ZbIiL2EZgi1+Xc4O24jL3vMYGE6idixYuGdy76rIfIdltSKDj9DpLNrcXSonUTR1miBD0wA==",
27217
+ "version": "7.12.0",
27218
+ "resolved": "https://registry.npmjs.org/c8/-/c8-7.12.0.tgz",
27219
+ "integrity": "sha512-CtgQrHOkyxr5koX1wEUmN/5cfDa2ckbHRA4Gy5LAL0zaCFtVWJS5++n+w4/sr2GWGerBxgTjpKeDclk/Qk6W/A==",
27220
27220
  "dev": true,
27221
27221
  "requires": {
27222
27222
  "@bcoe/v8-coverage": "^0.2.3",
@@ -34703,9 +34703,9 @@
34703
34703
  }
34704
34704
  },
34705
34705
  "netlify-onegraph-internal": {
34706
- "version": "0.3.6",
34707
- "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.6.tgz",
34708
- "integrity": "sha512-nNqCWT2jzPmqw/3/sKf1RFicL2JEFjmxXTpnIzJKt5U+bnS633cOy5pImNnfBGTd50NTNvdZ0GXMhQ7AwH16Qg==",
34706
+ "version": "0.3.8",
34707
+ "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.3.8.tgz",
34708
+ "integrity": "sha512-ElgiJwQpXwXjHjC0Lhq2woZoJ/l62b1xUIDeg6tC3UF/pQFNIaD0aaIwphoiPfkkkbo5DVLogg9AASt2E0oONQ==",
34709
34709
  "requires": {
34710
34710
  "graphql": "16.0.0",
34711
34711
  "node-fetch": "^2.6.0",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
3
  "description": "Netlify command line tool",
4
- "version": "10.11.2",
4
+ "version": "10.12.0",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "Abraham Schilling <AbrahamSchilling@gmail.com> (https://gitlab.com/n4bb12)",
@@ -290,7 +290,7 @@
290
290
  "multiparty": "^4.2.1",
291
291
  "netlify": "^12.0.0",
292
292
  "netlify-headers-parser": "^6.0.2",
293
- "netlify-onegraph-internal": "0.3.6",
293
+ "netlify-onegraph-internal": "0.3.8",
294
294
  "netlify-redirect-parser": "^13.0.5",
295
295
  "netlify-redirector": "^0.2.1",
296
296
  "node-fetch": "^2.6.0",
@@ -598,6 +598,7 @@ const createDevCommand = (program) => {
598
598
 
599
599
  return program
600
600
  .command('dev')
601
+ .alias('develop')
601
602
  .description(
602
603
  `Local dev server\nThe dev command will run a local dev server with Netlify's proxy and redirect rules`,
603
604
  )
@@ -7,6 +7,10 @@ const { runRecipe } = require('../../commands/recipes')
7
7
  const STATE_PROMPT_PROPERTY = 'promptVSCodeSettings'
8
8
 
9
9
  const promptEditorHelper = async ({ NETLIFYDEVLOG, chalk, config, log, repositoryRoot, state }) => {
10
+ // This prevents tests from hanging when running them inside the VS Code
11
+ // terminal, as otherwise we'll show the prompt and wait for a response.
12
+ if (env.NODE_ENV === 'test') return
13
+
10
14
  const isVSCode = env.TERM_PROGRAM === 'vscode'
11
15
  const hasShownPrompt = Boolean(state.get(STATE_PROMPT_PROPERTY))
12
16
  const hasEdgeFunctions = Boolean(config.edge_functions && config.edge_functions.length !== 0)
@@ -61,7 +61,8 @@ InternalConsole.registerConsole(internalConsole)
61
61
  * @returns
62
62
  */
63
63
  const monitorCLISessionEvents = (input) => {
64
- const { appId, netlifyGraphConfig, netlifyToken, onClose, onError, onEvents, sessionId, site, state } = input
64
+ const { appId, netlifyGraphConfig, netlifyToken, onClose, onError, onEvents, site, state } = input
65
+ const currentSessionId = input.sessionId
65
66
 
66
67
  const frequency = 5000
67
68
  // 30 minutes
@@ -71,11 +72,15 @@ const monitorCLISessionEvents = (input) => {
71
72
 
72
73
  const markActiveHelper = async () => {
73
74
  const graphJwt = await OneGraphClient.getGraphJwtForSite({ siteId: appId, nfToken: netlifyToken })
74
- const fullSession = await OneGraphClient.fetchCliSession({ jwt: graphJwt.jwt, appId, sessionId })
75
+ const fullSession = await OneGraphClient.fetchCliSession({ jwt: graphJwt.jwt, appId, sessionId: currentSessionId })
75
76
  // @ts-ignore
76
77
  const heartbeatIntervalms = fullSession.session.cliHeartbeatIntervalMs || defaultHeartbeatFrequency
77
78
  nextMarkActiveHeartbeat = heartbeatIntervalms
78
- const markCLISessionActiveResult = await executeMarkCliSessionActiveHeartbeat(graphJwt.jwt, site.id, sessionId)
79
+ const markCLISessionActiveResult = await executeMarkCliSessionActiveHeartbeat(
80
+ graphJwt.jwt,
81
+ site.id,
82
+ currentSessionId,
83
+ )
79
84
  if (markCLISessionActiveResult.errors && markCLISessionActiveResult.errors.length !== 0) {
80
85
  warn(`Failed to mark CLI session active: ${markCLISessionActiveResult.errors.join(', ')}`)
81
86
  }
@@ -84,10 +89,10 @@ const monitorCLISessionEvents = (input) => {
84
89
 
85
90
  setTimeout(markActiveHelper, nextMarkActiveHeartbeat)
86
91
 
87
- const enabledServiceWatcher = async (jwt, siteId) => {
92
+ const enabledServiceWatcher = async (jwt, { appId: siteId, sessionId }) => {
88
93
  const enabledServices = state.get('oneGraphEnabledServices') || ['onegraph']
89
94
 
90
- const enabledServicesInfo = await OneGraphClient.fetchEnabledServices(jwt, siteId)
95
+ const enabledServicesInfo = await OneGraphClient.fetchEnabledServicesForSession(jwt, siteId, sessionId)
91
96
  if (!enabledServicesInfo) {
92
97
  warn('Unable to fetch enabled services for site for code generation')
93
98
  return
@@ -102,7 +107,7 @@ const monitorCLISessionEvents = (input) => {
102
107
  'Reloading',
103
108
  )} Netlify Graph schema..., ${enabledServicesCompareKey} => ${newEnabledServicesCompareKey}`,
104
109
  )
105
- await refetchAndGenerateFromOneGraph({ netlifyGraphConfig, state, jwt, siteId })
110
+ await refetchAndGenerateFromOneGraph({ netlifyGraphConfig, state, jwt, siteId, sessionId })
106
111
  log(`${chalk.green('Reloaded')} Netlify Graph schema and regenerated functions`)
107
112
  }
108
113
  }
@@ -120,7 +125,7 @@ const monitorCLISessionEvents = (input) => {
120
125
  }
121
126
 
122
127
  const graphJwt = await OneGraphClient.getGraphJwtForSite({ siteId: appId, nfToken: netlifyToken })
123
- const next = await OneGraphClient.fetchCliSessionEvents({ appId, jwt: graphJwt.jwt, sessionId })
128
+ const next = await OneGraphClient.fetchCliSessionEvents({ appId, jwt: graphJwt.jwt, sessionId: currentSessionId })
124
129
 
125
130
  if (next && next.errors) {
126
131
  next.errors.forEach((fetchEventError) => {
@@ -137,11 +142,16 @@ const monitorCLISessionEvents = (input) => {
137
142
  } catch (eventHandlerError) {
138
143
  warn(`Error handling event: ${eventHandlerError}`)
139
144
  } finally {
140
- await OneGraphClient.ackCLISessionEvents({ appId, jwt: graphJwt.jwt, sessionId, eventIds: ackIds })
145
+ await OneGraphClient.ackCLISessionEvents({
146
+ appId,
147
+ jwt: graphJwt.jwt,
148
+ sessionId: currentSessionId,
149
+ eventIds: ackIds,
150
+ })
141
151
  }
142
152
  }
143
153
 
144
- await enabledServiceWatcher(graphJwt.jwt, appId)
154
+ await enabledServiceWatcher(graphJwt.jwt, { appId, sessionId: currentSessionId })
145
155
 
146
156
  handle = setTimeout(helper, frequency)
147
157
  }
@@ -178,6 +188,7 @@ const monitorOperationFile = async ({ netlifyGraphConfig, onAdd, onChange, onUnl
178
188
  * @param {object} input
179
189
  * @param {string} input.siteId The id of the site to query against
180
190
  * @param {string} input.jwt The Graph JWT
191
+ * @param {string} input.sessionId The session ID for the current session
181
192
  * @param {NetlifyGraph.NetlifyGraphConfig} input.netlifyGraphConfig A standalone config object that contains all the information necessary for Netlify Graph to process events
182
193
  * @param {StateConfig} input.state A function to call to set/get the current state of the local Netlify project
183
194
  * @param {(message: string) => void=} input.logger A function that if provided will be used to log messages
@@ -188,7 +199,7 @@ const refetchAndGenerateFromOneGraph = async (input) => {
188
199
 
189
200
  await OneGraphClient.ensureAppForSite(jwt, siteId)
190
201
 
191
- const enabledServicesInfo = await OneGraphClient.fetchEnabledServices(jwt, siteId)
202
+ const enabledServicesInfo = await OneGraphClient.fetchEnabledServicesForSession(jwt, siteId, input.sessionId)
192
203
  if (!enabledServicesInfo) {
193
204
  warn('Unable to fetch enabled services for site for code generation')
194
205
  return