Skip to content

Commit

Permalink
chore(gatsby-cli,gatsby-source-wordpress): bump clipboardy (#38775) (#…
Browse files Browse the repository at this point in the history
…38776)

* Upgrade clipboardy from ^2.3.0 to ^3.0.0 to reduce vulns from 227 to 225

* use latest

* use await import for clipboardy as it's esm-only package now

---------

Co-authored-by: k <id>
Co-authored-by: Michal Piechowiak <[email protected]>
(cherry picked from commit ee158d9)

Co-authored-by: Israel Montoya <[email protected]>
  • Loading branch information
gatsbybot and izzythecubemaster authored Dec 22, 2023
1 parent 2c0622c commit 4b892c5
Show file tree
Hide file tree
Showing 8 changed files with 95 additions and 20 deletions.
5 changes: 4 additions & 1 deletion packages/gatsby-cli/.babelrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"presets": [
[
"babel-preset-gatsby-package"
"babel-preset-gatsby-package",
{
"keepDynamicImports": ["./src/create-cli.ts"]
}
]
]
}
2 changes: 1 addition & 1 deletion packages/gatsby-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"better-opn": "^2.1.1",
"boxen": "^5.1.2",
"chalk": "^4.1.2",
"clipboardy": "^2.3.0",
"clipboardy": "^4.0.0",
"common-tags": "^1.8.2",
"convert-hrtime": "^3.0.0",
"create-gatsby": "^3.13.0",
Expand Down
6 changes: 4 additions & 2 deletions packages/gatsby-cli/src/create-cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import resolveCwd from "resolve-cwd"
import yargs from "yargs"
import envinfo from "envinfo"
import { sync as existsSync } from "fs-exists-cached"
import clipboardy from "clipboardy"
import {
trackCli,
setDefaultTags,
Expand Down Expand Up @@ -357,7 +356,10 @@ function buildLocalCommands(cli: yargs.Argv, isLocalSite: boolean): void {
console.log(envinfoOutput)

if (copyToClipboard) {
clipboardy.writeSync(envinfoOutput)
// clipboardy is ESM-only package
import(`clipboardy`).then(({ default: clipboardy }) => {
clipboardy.writeSync(envinfoOutput)
})
}
})
} catch (err) {
Expand Down
12 changes: 11 additions & 1 deletion packages/gatsby-source-wordpress/.babelrc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
module.exports = {
presets: [[`babel-preset-gatsby-package`]],
presets: [
[
`babel-preset-gatsby-package`,
{
"keepDynamicImports": [
"./src/utils/fetch-graphql.ts",
"./src/steps/ingest-remote-schema/build-queries-from-introspection/generate-queries-from-ingestable-types.js"
]
}
]
],
plugins: [
[
`@babel/plugin-proposal-private-methods`,
Expand Down
2 changes: 1 addition & 1 deletion packages/gatsby-source-wordpress/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"cache-manager-fs-hash": "^0.0.9",
"chalk": "^4.1.2",
"cheerio": "^1.0.0-rc.10",
"clipboardy": "^2.3.0",
"clipboardy": "^4.0.0",
"diff": "^5.1.0",
"dumper.js": "^1.3.1",
"execall": "^2.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import {
generateReusableFragments,
} from "./build-query-on-field-name"

import clipboardy from "clipboardy"

import { getStore } from "~/store"
import { getTypeSettingsByType } from "~/steps/create-schema-customization/helpers"
import prettier from "prettier"
Expand Down Expand Up @@ -317,6 +315,8 @@ const generateNodeQueriesFromIngestibleFields = async () => {
`Query debug mode. Writing node list query for the ${nodesType.name} node type to the system clipboard and exiting\n\n`
)
)
// clipboardy is ESM-only package
const { default: clipboardy } = await import(`clipboardy`)
await clipboardy.write(
prettier.format(nodeListQueries[0], { parser: `graphql` })
)
Expand Down
5 changes: 4 additions & 1 deletion packages/gatsby-source-wordpress/src/utils/fetch-graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { IPluginOptions } from "~/models/gatsby-api"
import { GatsbyReporter } from "./gatsby-types"
import prettier from "prettier"
import clipboardy from "clipboardy"
import axios, { AxiosRequestConfig, AxiosResponse } from "axios"
import rateLimit, { RateLimitedAxiosInstance } from "axios-rate-limit"
import { bold } from "chalk"
Expand Down Expand Up @@ -70,6 +69,8 @@ const handleErrorOptions = async ({

if (pluginOptions.debug.graphql.copyQueryOnError) {
try {
// clipboardy is ESM-only package
const { default: clipboardy } = await import(`clipboardy`)
await clipboardy.write(query)
} catch (e) {
// do nothing
Expand Down Expand Up @@ -529,6 +530,8 @@ ${slackChannelSupportMessage}`

if (copyHtmlResponseOnError) {
try {
// clipboardy is ESM-only package
const { default: clipboardy } = await import(`clipboardy`)
if (`writeSync` in clipboardy) {
clipboardy.writeSync(response.data)
}
Expand Down
79 changes: 68 additions & 11 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6106,10 +6106,6 @@ aproba@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/aproba/-/aproba-2.0.0.tgz#52520b8ae5b569215b354efc0caa3fe1e45a8adc"

arch@^2.1.1:
version "2.1.1"
resolved "https://registry.yarnpkg.com/arch/-/arch-2.1.1.tgz#8f5c2731aa35a30929221bb0640eed65175ec84e"

are-we-there-yet@~1.1.2:
version "1.1.5"
resolved "https://registry.yarnpkg.com/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz#4b35c2944f062a8bfcda66410760350fe9ddfc21"
Expand Down Expand Up @@ -7848,14 +7844,14 @@ [email protected]:
dependencies:
typanion "^3.8.0"

clipboardy@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-2.3.0.tgz#3c2903650c68e46a91b388985bc2774287dba290"
integrity sha512-mKhiIL2DrQIsuXMgBgnfEHOZOryC7kY7YO//TN6c63wlEm3NG5tz+YgY5rVi29KCmq/QQjKYvM7a19+MDOTHOQ==
clipboardy@^4.0.0:
version "4.0.0"
resolved "https://registry.yarnpkg.com/clipboardy/-/clipboardy-4.0.0.tgz#e73ced93a76d19dd379ebf1f297565426dffdca1"
integrity sha512-5mOlNS0mhX0707P2I0aZ2V/cmHUEO/fL7VFLqszkhUsxt7RwnmrInf/eEQKlf5GzvYeHIjT+Ov1HRfNmymlG0w==
dependencies:
arch "^2.1.1"
execa "^1.0.0"
is-wsl "^2.1.1"
execa "^8.0.1"
is-wsl "^3.1.0"
is64bit "^2.0.0"

cliui@^5.0.0:
version "5.0.0"
Expand Down Expand Up @@ -11098,6 +11094,21 @@ execa@^6.0.0:
signal-exit "^3.0.7"
strip-final-newline "^3.0.0"

execa@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/execa/-/execa-8.0.1.tgz#51f6a5943b580f963c3ca9c6321796db8cc39b8c"
integrity sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==
dependencies:
cross-spawn "^7.0.3"
get-stream "^8.0.1"
human-signals "^5.0.0"
is-stream "^3.0.0"
merge-stream "^2.0.0"
npm-run-path "^5.1.0"
onetime "^6.0.0"
signal-exit "^4.1.0"
strip-final-newline "^3.0.0"

execall@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/execall/-/execall-2.0.0.tgz#16a06b5fe5099df7d00be5d9c06eecded1663b45"
Expand Down Expand Up @@ -12153,6 +12164,11 @@ get-stream@^6.0.0, get-stream@^6.0.1:
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-6.0.1.tgz#a262d8eef67aced57c2852ad6167526a43cbf7b7"
integrity sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==

get-stream@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-8.0.1.tgz#def9dfd71742cd7754a7761ed43749a27d02eca2"
integrity sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==

get-symbol-description@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/get-symbol-description/-/get-symbol-description-1.0.0.tgz#7fdb81c900101fbd564dd5f1a30af5aadc1e58d6"
Expand Down Expand Up @@ -13358,6 +13374,11 @@ human-signals@^3.0.1:
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-3.0.1.tgz#c740920859dafa50e5a3222da9d3bf4bb0e5eef5"
integrity sha512-rQLskxnM/5OCldHo+wNXbpVgDn5A17CUoKX+7Sokwaknlq7CdSnphy0W39GU8dw59XiCXmFXDg4fRuckQRKewQ==

human-signals@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/human-signals/-/human-signals-5.0.0.tgz#42665a284f9ae0dade3ba41ebc37eb4b852f3a28"
integrity sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==

humanize-ms@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/humanize-ms/-/humanize-ms-1.2.1.tgz#c46e3159a293f6b896da29316d8b6fe8bb79bbed"
Expand Down Expand Up @@ -13942,6 +13963,11 @@ is-docker@^2.0.0, is-docker@^2.1.1, is-docker@^2.2.1:
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-2.2.1.tgz#33eeabe23cfe86f14bde4408a02c0cfb853acdaa"
integrity sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==

is-docker@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/is-docker/-/is-docker-3.0.0.tgz#90093aa3106277d8a77a5910dbae71747e15a200"
integrity sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==

is-extendable@^0.1.0, is-extendable@^0.1.1:
version "0.1.1"
resolved "https://registry.yarnpkg.com/is-extendable/-/is-extendable-0.1.1.tgz#62b110e289a471418e3ec36a617d472e301dfc89"
Expand Down Expand Up @@ -14020,6 +14046,13 @@ is-hexadecimal@^2.0.0:
resolved "https://registry.yarnpkg.com/is-hexadecimal/-/is-hexadecimal-2.0.1.tgz#86b5bf668fca307498d319dfc03289d781a90027"
integrity sha512-DgZQp241c8oO6cA1SbTEWiXeoxV42vlcJxgH+B3hi1AiqqKruZR3ZGF8In3fj4+/y/7rHvlOZLZtgJ/4ttYGZg==

is-inside-container@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/is-inside-container/-/is-inside-container-1.0.0.tgz#e81fba699662eb31dbdaf26766a61d4814717ea4"
integrity sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==
dependencies:
is-docker "^3.0.0"

is-installed-globally@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/is-installed-globally/-/is-installed-globally-0.1.0.tgz#0dfd98f5a9111716dd535dda6492f67bf3d25a80"
Expand Down Expand Up @@ -14418,6 +14451,20 @@ is-wsl@^2.1.1, is-wsl@^2.2.0:
dependencies:
is-docker "^2.0.0"

is-wsl@^3.1.0:
version "3.1.0"
resolved "https://registry.yarnpkg.com/is-wsl/-/is-wsl-3.1.0.tgz#e1c657e39c10090afcbedec61720f6b924c3cbd2"
integrity sha512-UcVfVfaK4Sc4m7X3dUSoHoozQGBEFeDC+zVo06t98xe8CzHSZZBekNXH+tu0NalHolcJ/QAGqS46Hef7QXBIMw==
dependencies:
is-inside-container "^1.0.0"

is64bit@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/is64bit/-/is64bit-2.0.0.tgz#198c627cbcb198bbec402251f88e5e1a51236c07"
integrity sha512-jv+8jaWCl0g2lSBkNSVXdzfBA0npK1HGC2KtWM9FumFRoGS94g3NbCCLVnCYHLjp4GrW2KZeeSTMo5ddtznmGw==
dependencies:
system-architecture "^0.1.0"

[email protected]:
version "0.0.1"
resolved "https://registry.yarnpkg.com/isarray/-/isarray-0.0.1.tgz#8a18acfca9a8f4177e09abfc6038939b05d1eedf"
Expand Down Expand Up @@ -22146,6 +22193,11 @@ signal-exit@^4.0.1:
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.0.1.tgz#96a61033896120ec9335d96851d902cc98f0ba2a"
integrity sha512-uUWsN4aOxJAS8KOuf3QMyFtgm1pkb6I+KRZbRF/ghdf5T7sM+B1lLLzPDxswUjkmHyxQAVzEgG35E3NzDM9GVw==

signal-exit@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04"
integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==

signedsource@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/signedsource/-/signedsource-1.0.0.tgz#1ddace4981798f93bd833973803d80d52e93ad6a"
Expand Down Expand Up @@ -23329,6 +23381,11 @@ sync-request@^3.0.1:
http-response-object "^1.0.1"
then-request "^2.0.1"

system-architecture@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/system-architecture/-/system-architecture-0.1.0.tgz#71012b3ac141427d97c67c56bc7921af6bff122d"
integrity sha512-ulAk51I9UVUyJgxlv9M6lFot2WP3e7t8Kz9+IS6D4rVba1tR9kON+Ey69f+1R4Q8cd45Lod6a4IcJIxnzGc/zA==

table@^6.0.9:
version "6.7.1"
resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2"
Expand Down

0 comments on commit 4b892c5

Please sign in to comment.