netlify-cli 11.2.0 → 11.3.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,16 +1,16 @@
1
1
  {
2
2
  "name": "netlify-cli",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
4
4
  "lockfileVersion": 2,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "netlify-cli",
9
- "version": "11.2.0",
9
+ "version": "11.3.0",
10
10
  "hasInstallScript": true,
11
11
  "license": "MIT",
12
12
  "dependencies": {
13
- "@netlify/build": "^27.15.4",
13
+ "@netlify/build": "^27.15.5",
14
14
  "@netlify/config": "^18.2.1",
15
15
  "@netlify/edge-bundler": "^1.13.0",
16
16
  "@netlify/framework-info": "^9.2.0",
@@ -81,7 +81,7 @@
81
81
  "multiparty": "^4.2.1",
82
82
  "netlify": "^12.0.1",
83
83
  "netlify-headers-parser": "^6.0.2",
84
- "netlify-onegraph-internal": "0.8.7",
84
+ "netlify-onegraph-internal": "0.10.0",
85
85
  "netlify-redirect-parser": "^13.0.5",
86
86
  "netlify-redirector": "^0.2.1",
87
87
  "node-fetch": "^2.6.0",
@@ -1189,9 +1189,9 @@
1189
1189
  "integrity": "sha512-4wMPu9iN3/HL97QblBsBay3E1etIciR84izI3U+4iALY+JHCrI+a2jO0qbAZ/nxKoegypYEaiiqWXylm+/zfrw=="
1190
1190
  },
1191
1191
  "node_modules/@netlify/build": {
1192
- "version": "27.15.4",
1193
- "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.15.4.tgz",
1194
- "integrity": "sha512-4fNEB3V4DF1HQEQrRfFFRWWRNNlkZEdcyWXz1ekzAwQ6rJYmhUxHV5tJg98AhHTrovXBmlWK1gLF3qLaGGoMFA==",
1192
+ "version": "27.15.5",
1193
+ "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.15.5.tgz",
1194
+ "integrity": "sha512-DfzpiNztkB+7e0eM3B8QrXGP1Fc0ky/9ow5Mwg3+R7VeFKknVFAF8PKddQucR1vS0CW1lL1/jjcrv1M5zudVmQ==",
1195
1195
  "dependencies": {
1196
1196
  "@bugsnag/js": "^7.0.0",
1197
1197
  "@netlify/cache-utils": "^4.0.0",
@@ -15963,9 +15963,9 @@
15963
15963
  }
15964
15964
  },
15965
15965
  "node_modules/netlify-onegraph-internal": {
15966
- "version": "0.8.7",
15967
- "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.8.7.tgz",
15968
- "integrity": "sha512-FDHQes/GP7UjlzAwJ+qwKfhESBo9NQDN9Ed6U+9a5CW5o2j8Lr23P9Ac1MKp7jDP5h0uAq73r9P86J9Kl1yzLQ==",
15966
+ "version": "0.10.0",
15967
+ "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.10.0.tgz",
15968
+ "integrity": "sha512-Gf6cE1W+q35niIz54xpSLneShpRxlleYL3ZD3D1tjGazuv19q8XBVAAynaAQFzbOk/RPTnu3+Vi/5L7DGACOIg==",
15969
15969
  "dependencies": {
15970
15970
  "graphql": "16.5.0",
15971
15971
  "node-fetch": "^2.6.0",
@@ -23374,9 +23374,9 @@
23374
23374
  "integrity": "sha512-4wMPu9iN3/HL97QblBsBay3E1etIciR84izI3U+4iALY+JHCrI+a2jO0qbAZ/nxKoegypYEaiiqWXylm+/zfrw=="
23375
23375
  },
23376
23376
  "@netlify/build": {
23377
- "version": "27.15.4",
23378
- "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.15.4.tgz",
23379
- "integrity": "sha512-4fNEB3V4DF1HQEQrRfFFRWWRNNlkZEdcyWXz1ekzAwQ6rJYmhUxHV5tJg98AhHTrovXBmlWK1gLF3qLaGGoMFA==",
23377
+ "version": "27.15.5",
23378
+ "resolved": "https://registry.npmjs.org/@netlify/build/-/build-27.15.5.tgz",
23379
+ "integrity": "sha512-DfzpiNztkB+7e0eM3B8QrXGP1Fc0ky/9ow5Mwg3+R7VeFKknVFAF8PKddQucR1vS0CW1lL1/jjcrv1M5zudVmQ==",
23380
23380
  "requires": {
23381
23381
  "@bugsnag/js": "^7.0.0",
23382
23382
  "@netlify/cache-utils": "^4.0.0",
@@ -34193,9 +34193,9 @@
34193
34193
  }
34194
34194
  },
34195
34195
  "netlify-onegraph-internal": {
34196
- "version": "0.8.7",
34197
- "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.8.7.tgz",
34198
- "integrity": "sha512-FDHQes/GP7UjlzAwJ+qwKfhESBo9NQDN9Ed6U+9a5CW5o2j8Lr23P9Ac1MKp7jDP5h0uAq73r9P86J9Kl1yzLQ==",
34196
+ "version": "0.10.0",
34197
+ "resolved": "https://registry.npmjs.org/netlify-onegraph-internal/-/netlify-onegraph-internal-0.10.0.tgz",
34198
+ "integrity": "sha512-Gf6cE1W+q35niIz54xpSLneShpRxlleYL3ZD3D1tjGazuv19q8XBVAAynaAQFzbOk/RPTnu3+Vi/5L7DGACOIg==",
34199
34199
  "requires": {
34200
34200
  "graphql": "16.5.0",
34201
34201
  "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": "11.2.0",
4
+ "version": "11.3.0",
5
5
  "author": "Netlify Inc.",
6
6
  "contributors": [
7
7
  "@whitep4nth3r (https://twitter.com/whitep4nth3r)",
@@ -222,7 +222,7 @@
222
222
  "prettier": "--ignore-path .gitignore --loglevel=warn \"{src,tools,scripts,site,tests,.github}/**/*.{mjs,cjs,js,md,yml,json,html}\" \"*.{mjs,cjs,js,yml,json,html}\" \".*.{mjs,cjs,js,yml,json,html}\" \"!CHANGELOG.md\" \"!npm-shrinkwrap.json\" \"!**/*/package-lock.json\" \"!.github/**/*.md\""
223
223
  },
224
224
  "dependencies": {
225
- "@netlify/build": "^27.15.4",
225
+ "@netlify/build": "^27.15.5",
226
226
  "@netlify/config": "^18.2.1",
227
227
  "@netlify/edge-bundler": "^1.13.0",
228
228
  "@netlify/framework-info": "^9.2.0",
@@ -293,7 +293,7 @@
293
293
  "multiparty": "^4.2.1",
294
294
  "netlify": "^12.0.1",
295
295
  "netlify-headers-parser": "^6.0.2",
296
- "netlify-onegraph-internal": "0.8.7",
296
+ "netlify-onegraph-internal": "0.10.0",
297
297
  "netlify-redirect-parser": "^13.0.5",
298
298
  "netlify-redirector": "^0.2.1",
299
299
  "node-fetch": "^2.6.0",
@@ -434,6 +434,7 @@ const dev = async (options, command) => {
434
434
  }
435
435
 
436
436
  let { env } = cachedConfig
437
+
437
438
  if (!options.offline && siteInfo.use_envelope) {
438
439
  env = await getEnvelopeEnv({ api, context: options.context, env, siteInfo })
439
440
  }
@@ -33,17 +33,18 @@ const graphHandler = async (args, options, command) => {
33
33
  error(`Error parsing schema: ${buildSchemaError}`)
34
34
  }
35
35
 
36
- const userOperationName = args.operationName
36
+ const userOperationNames = args.operationNames
37
37
  const userCodegenId = options.codegen
38
38
 
39
39
  const handlerOptions = options.data ? JSON.parse(options.data) : {}
40
40
 
41
- let operationName = userOperationName
42
- if (!operationName) {
43
- operationName = await autocompleteOperationNames({ netlifyGraphConfig })
41
+ let operationNames = userOperationNames
42
+ if (!operationNames || operationNames.length === 0) {
43
+ const operationName = await autocompleteOperationNames({ netlifyGraphConfig })
44
+ operationNames = [operationName]
44
45
  }
45
46
 
46
- if (!operationName) {
47
+ if (!operationNames || operationNames.length === 0) {
47
48
  error(`No operation name provided`)
48
49
  }
49
50
 
@@ -66,14 +67,17 @@ const graphHandler = async (args, options, command) => {
66
67
  }
67
68
 
68
69
  if (schema) {
69
- generateHandlerByOperationName({
70
- generate: codeGenerator.generateHandler,
71
- logger: log,
72
- netlifyGraphConfig,
73
- schema,
74
- operationName,
75
- handlerOptions,
76
- })
70
+ /* eslint-disable fp/no-loops */
71
+ for (const operationName of operationNames) {
72
+ await generateHandlerByOperationName({
73
+ generate: codeGenerator.generateHandler,
74
+ logger: log,
75
+ netlifyGraphConfig,
76
+ schema,
77
+ operationName,
78
+ handlerOptions,
79
+ })
80
+ }
77
81
  } else {
78
82
  error(`Failed to parse Netlify GraphQL schema`)
79
83
  }
@@ -87,14 +91,14 @@ const graphHandler = async (args, options, command) => {
87
91
  const createGraphHandlerCommand = (program) =>
88
92
  program
89
93
  .command('graph:handler')
90
- .argument('[name]', 'Operation name')
94
+ .argument('[name...]', 'Operation name(s)')
91
95
  .option('-c, --codegen <id>', 'The id of the specific code generator to use')
92
96
  .option("-d, --data '<json>'", 'Optional data to pass along to the code generator')
93
97
  .description(
94
98
  'Generate a handler for a Graph operation given its name. See `graph:operations` for a list of operations.',
95
99
  )
96
- .action(async (operationName, options, command) => {
97
- await graphHandler({ operationName }, options, command)
100
+ .action(async (operationNames, options, command) => {
101
+ await graphHandler({ operationNames }, options, command)
98
102
  })
99
103
 
100
104
  module.exports = { createGraphHandlerCommand }
@@ -318,7 +318,7 @@ const refetchAndGenerateFromOneGraph = async (input) => {
318
318
  return
319
319
  }
320
320
 
321
- generateFunctionsFile({
321
+ await generateFunctionsFile({
322
322
  config,
323
323
  logger,
324
324
  netlifyGraphConfig,
@@ -619,7 +619,7 @@ ${JSON.stringify(payload, null, 2)}`)
619
619
  return
620
620
  }
621
621
 
622
- const files = generateHandlerByOperationId({
622
+ const files = await generateHandlerByOperationId({
623
623
  netlifyGraphConfig,
624
624
  schema,
625
625
  operationId: payload.operationId,
@@ -550,9 +550,9 @@ const readGraphQLSchemaFile = (netlifyGraphConfig) => {
550
550
  * @param {string} input.operationsDoc The document containing the operation with operationId and any fragment dependency to use when generating the handler
551
551
  * @param {object} input.handlerOptions The options to use when generating the handler
552
552
  * @param {(message: string) => void=} input.logger A function that if provided will be used to log messages
553
- * @returns {{exportedFiles: CodegenHelpers.ExportedFile[]; operation: GraphQL.OperationDefinitionNode;} | undefined} The generated files
553
+ * @returns {Promise<{exportedFiles: CodegenHelpers.ExportedFile[]; operation: GraphQL.OperationDefinitionNode;} | undefined>} The generated files
554
554
  */
555
- const generateHandlerSourceByOperationId = ({
555
+ const generateHandlerSourceByOperationId = async ({
556
556
  generate,
557
557
  handlerOptions,
558
558
  netlifyGraphConfig,
@@ -571,7 +571,7 @@ const generateHandlerSourceByOperationId = ({
571
571
  operationsDoc,
572
572
  }
573
573
 
574
- const result = NetlifyGraph.generateCustomHandlerSource(generateHandlerPayload)
574
+ const result = await NetlifyGraph.generateCustomHandlerSource(generateHandlerPayload)
575
575
 
576
576
  return result
577
577
  }
@@ -585,15 +585,15 @@ const generateHandlerSourceByOperationId = ({
585
585
  * @param {string} input.operationId The operationId to use when generating the handler
586
586
  * @param {object} input.handlerOptions The options to use when generating the handler
587
587
  * @param {(message: string) => void=} input.logger A function that if provided will be used to log messages
588
- * @returns {Array<{filePath: string, name:string, prettierSuccess: boolean}> | undefined} An array of the generated handler filepaths
588
+ * @returns {Promise<Array<{filePath: string, name:string, prettierSuccess: boolean}> | undefined>} An array of the generated handler filepaths
589
589
  */
590
- const generateHandlerByOperationId = ({ generate, handlerOptions, netlifyGraphConfig, operationId, schema }) => {
590
+ const generateHandlerByOperationId = async ({ generate, handlerOptions, netlifyGraphConfig, operationId, schema }) => {
591
591
  let currentOperationsDoc = readGraphQLOperationsSourceFile(netlifyGraphConfig)
592
592
  if (currentOperationsDoc.trim().length === 0) {
593
593
  currentOperationsDoc = NetlifyGraph.defaultExampleOperationsDoc
594
594
  }
595
595
 
596
- const result = generateHandlerSourceByOperationId({
596
+ const result = await generateHandlerSourceByOperationId({
597
597
  generate,
598
598
  handlerOptions,
599
599
  netlifyGraphConfig,
@@ -669,9 +669,9 @@ const generateHandlerByOperationId = ({ generate, handlerOptions, netlifyGraphCo
669
669
  * @param {string} input.operationName The name of the operation to use when generating the handler
670
670
  * @param {object} input.handlerOptions The options to use when generating the handler
671
671
  * @param {(message: string) => void} input.logger A function that if provided will be used to log messages
672
- * @returns
672
+ * @returns {Promise<void>}
673
673
  */
674
- const generateHandlerByOperationName = ({
674
+ const generateHandlerByOperationName = async ({
675
675
  generate,
676
676
  handlerOptions,
677
677
  logger,
@@ -702,7 +702,7 @@ const generateHandlerByOperationName = ({
702
702
  return
703
703
  }
704
704
 
705
- generateHandlerByOperationId({
705
+ await generateHandlerByOperationId({
706
706
  logger,
707
707
  generate,
708
708
  netlifyGraphConfig,