From cee2e916de22ca61c0581866a4d0896ac2bef010 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Tue, 30 Nov 2021 17:04:31 +0000 Subject: [PATCH 1/2] fix(deps): update dependency netlify to v10 --- npm-shrinkwrap.json | 69 +++++++++++++++++++++++++++++++++++++++------ package.json | 2 +- 2 files changed, 62 insertions(+), 9 deletions(-) diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index b2ba7837bc8..0d84c7b9eeb 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -22,7 +22,7 @@ "@oclif/config": "^1.15.1", "@oclif/errors": "^1.3.4", "@oclif/parser": "^3.8.4", - "@oclif/plugin-help": "^3.2.8", + "@oclif/plugin-help": "^3.0.0", "@oclif/plugin-not-found": "^1.1.4", "@oclif/plugin-plugins": "^1.9.3", "@octokit/rest": "^18.0.0", @@ -83,7 +83,7 @@ "minimist": "^1.2.5", "mock-require": "^3.0.3", "multiparty": "^4.2.1", - "netlify": "^9.0.0", + "netlify": "^10.0.0", "netlify-headers-parser": "^5.0.0", "netlify-redirect-parser": "^12.0.0", "netlify-redirector": "^0.2.1", @@ -3059,6 +3059,23 @@ "node": ">=8" } }, + "node_modules/@netlify/config/node_modules/netlify": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/netlify/-/netlify-9.0.0.tgz", + "integrity": "sha512-3QQpmCFSdCgsUEBLULwNxVojjFgYgooKhHtJ9OgjizzwJsNDYnBdAWKQ3lcpPX2etQ0quWJg5Uv8md02LuezZw==", + "dependencies": { + "@netlify/open-api": "^2.6.0", + "lodash.camelcase": "^4.3.0", + "micro-api-client": "^3.3.0", + "node-fetch": "^2.6.1", + "omit.js": "^2.0.2", + "p-wait-for": "^3.2.0", + "qs": "^6.9.6" + }, + "engines": { + "node": "^12.20.0 || ^14.14.0 || >=16.0.0" + } + }, "node_modules/@netlify/config/node_modules/p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -3073,6 +3090,20 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/@netlify/config/node_modules/qs": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/@netlify/config/node_modules/wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -15207,9 +15238,9 @@ "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==" }, "node_modules/netlify": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/netlify/-/netlify-9.0.0.tgz", - "integrity": "sha512-3QQpmCFSdCgsUEBLULwNxVojjFgYgooKhHtJ9OgjizzwJsNDYnBdAWKQ3lcpPX2etQ0quWJg5Uv8md02LuezZw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/netlify/-/netlify-10.0.0.tgz", + "integrity": "sha512-8oLcxWZPbzJy9naA2oH86NyaIFmDuRyQONjPAD4hn6JmnZPq+s6Ukh//qjWXNXE/9H8l8J/vDzY4ehHxYfP32w==", "dependencies": { "@netlify/open-api": "^2.6.0", "lodash.camelcase": "^4.3.0", @@ -24200,6 +24231,20 @@ } } }, + "netlify": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/netlify/-/netlify-9.0.0.tgz", + "integrity": "sha512-3QQpmCFSdCgsUEBLULwNxVojjFgYgooKhHtJ9OgjizzwJsNDYnBdAWKQ3lcpPX2etQ0quWJg5Uv8md02LuezZw==", + "requires": { + "@netlify/open-api": "^2.6.0", + "lodash.camelcase": "^4.3.0", + "micro-api-client": "^3.3.0", + "node-fetch": "^2.6.1", + "omit.js": "^2.0.2", + "p-wait-for": "^3.2.0", + "qs": "^6.9.6" + } + }, "p-limit": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", @@ -24208,6 +24253,14 @@ "p-try": "^2.0.0" } }, + "qs": { + "version": "6.10.1", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.10.1.tgz", + "integrity": "sha512-M528Hph6wsSVOBiYUnGf+K/7w0hNshs/duGsNXPUCLH5XAqjEtiPGwNONLV0tBH8NoGb0mvD5JubnUTrujKDTg==", + "requires": { + "side-channel": "^1.0.4" + } + }, "wrap-ansi": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", @@ -33406,9 +33459,9 @@ "integrity": "sha512-AO81vsIO1k1sM4Zrd6Hu7regmJN1NSiAja10gc4bX3F0wd+9rQmcuHQaHVQCYIEC8iFXnE+mavh23GOt7wBgug==" }, "netlify": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/netlify/-/netlify-9.0.0.tgz", - "integrity": "sha512-3QQpmCFSdCgsUEBLULwNxVojjFgYgooKhHtJ9OgjizzwJsNDYnBdAWKQ3lcpPX2etQ0quWJg5Uv8md02LuezZw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/netlify/-/netlify-10.0.0.tgz", + "integrity": "sha512-8oLcxWZPbzJy9naA2oH86NyaIFmDuRyQONjPAD4hn6JmnZPq+s6Ukh//qjWXNXE/9H8l8J/vDzY4ehHxYfP32w==", "requires": { "@netlify/open-api": "^2.6.0", "lodash.camelcase": "^4.3.0", diff --git a/package.json b/package.json index 736f5ea9de5..91e6f39d4f0 100644 --- a/package.json +++ b/package.json @@ -152,7 +152,7 @@ "minimist": "^1.2.5", "mock-require": "^3.0.3", "multiparty": "^4.2.1", - "netlify": "^9.0.0", + "netlify": "^10.0.0", "netlify-headers-parser": "^5.0.0", "netlify-redirect-parser": "^12.0.0", "netlify-redirector": "^0.2.1", From 0202fada731f50c99aab328012e7c1e8d0a4cca0 Mon Sep 17 00:00:00 2001 From: ehmicky Date: Tue, 30 Nov 2021 21:46:39 +0100 Subject: [PATCH 2/2] fix: new js-client major release --- .eslintrc.js | 3 +++ src/commands/api.js | 5 ++++- src/utils/command.js | 7 +++++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 147824607a7..4d405bb11d0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -25,6 +25,9 @@ module.exports = { 'fp/no-this': 0, 'import/max-dependencies': 0, 'node/no-sync': 0, + // TODO: remove once bug in eslint-plugin-node is fixed: + // https://github.com/mysticatea/eslint-plugin-node/issues/250 + 'node/no-unsupported-features/es-syntax': [2, { ignores: ['modules', 'dynamicImport'] }], 'sort-destructure-keys/sort-destructure-keys': 2, 'unicorn/consistent-destructuring': 0, // TODO: harmonize with filename snake_case in other Netlify Dev projects diff --git a/src/commands/api.js b/src/commands/api.js index 139feb5360f..83cff6344e3 100644 --- a/src/commands/api.js +++ b/src/commands/api.js @@ -1,7 +1,9 @@ const oclif = require('@oclif/command') const AsciiTable = require('ascii-table') const chalk = require('chalk') -const { methods } = require('netlify') + +// TODO: use static `import` after migrating this repository to pure ES modules +const jsClient = import('netlify') const { isEmptyCommand } = require('../utils/check-command-inputs') const Command = require('../utils/command') @@ -17,6 +19,7 @@ class APICommand extends Command { if (isEmptyCommand(flags, args) || flags.list) { const table = new AsciiTable(`Netlify API Methods`) table.setHeading('API Method', 'Docs Link') + const { methods } = await jsClient methods.forEach((method) => { const { operationId } = method table.addRow(operationId, `https://open-api.netlify.com/#operation/${operationId}`) diff --git a/src/utils/command.js b/src/utils/command.js index 5f59d49591e..f242d968f72 100644 --- a/src/utils/command.js +++ b/src/utils/command.js @@ -5,7 +5,9 @@ const resolveConfig = require('@netlify/config') const { flags: flagsLib } = require('@oclif/command') const oclifParser = require('@oclif/parser') const merge = require('lodash/merge') -const API = require('netlify') + +// TODO: use static `import` after migrating this repository to pure ES modules +const jsClient = import('netlify') const { getAgent } = require('../lib/http-agent') @@ -57,9 +59,10 @@ class BaseCommand extends TrackedCommand { const apiOpts = { ...apiUrlOpts, agent } const globalConfig = await getGlobalConfig() + const { NetlifyAPI } = await jsClient this.netlify = { // api methods - api: new API(token || '', apiOpts), + api: new NetlifyAPI(token || '', apiOpts), repositoryRoot, // current site context site: {