diff --git a/bin/versionPlugin.js b/bin/versionPlugin.js index fe1de91..cdb8816 100644 --- a/bin/versionPlugin.js +++ b/bin/versionPlugin.js @@ -6,10 +6,10 @@ * Ported over from FaustJS * @link https://github.com/wpengine/faustjs/blob/canary/scripts/versionPlugin.js */ -const fs = require("fs/promises"); -const path = require("node:path"); +const fs = require( 'fs/promises' ); +const path = require( 'node:path' ); -const readFile = (filename) => fs.readFile(filename, { encoding: "utf8" }); +const readFile = ( filename ) => fs.readFile( filename, { encoding: 'utf8' } ); const writeFile = fs.writeFile; /** @@ -17,56 +17,60 @@ const writeFile = fs.writeFile; * including version bumps and readme.txt changelog updates. */ async function versionPlugin() { - const pluginPath = path.join(__dirname, "../"); - const pluginFile = path.join(pluginPath, "wpgraphql-ide.php"); - const readmeTxt = path.join(pluginPath, "readme.txt"); - const changelog = path.join(pluginPath, "CHANGELOG.md"); - - const version = await getNewVersion(pluginPath); - - if (version) { - await bumpPluginHeader(pluginFile, version); - await bumpStableTag(readmeTxt, version); - await bumpVersionConstant(pluginFile, version); - await generateReadmeChangelog(readmeTxt, changelog); - } + const pluginPath = path.join( __dirname, '../' ); + const pluginFile = path.join( pluginPath, 'wpgraphql-ide.php' ); + const readmeTxt = path.join( pluginPath, 'readme.txt' ); + const changelog = path.join( pluginPath, 'CHANGELOG.md' ); + + const version = await getNewVersion( pluginPath ); + + if ( version ) { + await bumpPluginHeader( pluginFile, version ); + await bumpStableTag( readmeTxt, version ); + await bumpVersionConstant( pluginFile, version ); + await generateReadmeChangelog( readmeTxt, changelog ); + } } /** * Updates the version number found in the header comment of a given * WordPress plugin's main PHP file. * - * @param {String} pluginFile Full path to a file containing a WordPress + * @param {string} pluginFile Full path to a file containing a WordPress * plugin header comment. - * @param {String} version The new version number. + * @param {string} version The new version number. */ -async function bumpPluginHeader(pluginFile, version) { - return bumpVersion(pluginFile, /^\s*\*\s*Version:\s*([0-9.]+)$/gm, version); +async function bumpPluginHeader( pluginFile, version ) { + return bumpVersion( + pluginFile, + /^\s*\*\s*Version:\s*([0-9.]+)$/gm, + version + ); } /** * Updates the stable tag found in a given WordPress plugin's readme.txt file. * - * @param {String} readmeTxt Full path to a file containing a WordPress - * readme.txt file. - * @param {String} version The new version number. + * @param {string} readmeTxt Full path to a file containing a WordPress + * readme.txt file. + * @param {string} version The new version number. */ -async function bumpStableTag(readmeTxt, version) { - return bumpVersion(readmeTxt, /^Stable tag:\s*([0-9.]+)$/gm, version); +async function bumpStableTag( readmeTxt, version ) { + return bumpVersion( readmeTxt, /^Stable tag:\s*([0-9.]+)$/gm, version ); } /** * Updates the version constant found in the WPGraphQLContentBlocks.php file. * - * @param {String} pluginFile Full path to a file containing PHP constants. - * @param {String} version The new version number. + * @param {string} pluginFile Full path to a file containing PHP constants. + * @param {string} version The new version number. */ -async function bumpVersionConstant(pluginFile, version) { - return bumpVersion( - pluginFile, - /^\s*define\(\s*'WPGRAPHQL_IDE_VERSION',\s*'([0-9.]+)'\s*\);/, - version - ); +async function bumpVersionConstant( pluginFile, version ) { + return bumpVersion( + pluginFile, + /^\s*define\(\s*'WPGRAPHQL_IDE_VERSION',\s*'([0-9.]+)'\s*\);/, + version + ); } /** @@ -81,107 +85,110 @@ async function bumpVersionConstant(pluginFile, version) { * number portion of the line. For example, in the line " * Version: 1.0.0" * capturing group 1 of the regex must resolve to "1.0.0". * - * @param {String} file Full path to the file to update. + * @param {string} file Full path to the file to update. * @param {RegExp} regex A valid regular expression as noted above. - * @param {String} version The new version number. + * @param {string} version The new version number. */ -async function bumpVersion(file, regex, version) { - try { - let data = await readFile(file); - const matches = regex.exec(data); +async function bumpVersion( file, regex, version ) { + try { + let data = await readFile( file ); + const matches = regex.exec( data ); - if (!matches) { - throw new Error(`Version string does not exist in ${file}`); - } + if ( ! matches ) { + throw new Error( `Version string does not exist in ${ file }` ); + } - // Replace the version number in the captured line. - let versionString = matches[0].replace(matches[1], version); + // Replace the version number in the captured line. + const versionString = matches[ 0 ].replace( matches[ 1 ], version ); - // Replace the captured line with the new version string. - data = data.replace(matches[0], versionString); + // Replace the captured line with the new version string. + data = data.replace( matches[ 0 ], versionString ); - return writeFile(file, data); - } catch (e) { - console.warn(e); - } + return writeFile( file, data ); + } catch ( e ) { + console.warn( e ); + } } /** * Get the current version number from a plugin's package.json file. * - * @param {String} pluginPath Full path to the directory containing the plugin's + * @param {string} pluginPath Full path to the directory containing the plugin's * package.json file. - * @returns The version number string found in the plugin's package.json. + * @return The version number string found in the plugin's package.json. */ -async function getNewVersion(pluginPath) { - const packageJsonFile = path.join(pluginPath, "package.json"); +async function getNewVersion( pluginPath ) { + const packageJsonFile = path.join( pluginPath, 'package.json' ); - try { - let packageJson = await readFile(packageJsonFile); + try { + const packageJson = await readFile( packageJsonFile ); - return JSON.parse(packageJson)?.version; - } catch (e) { - if (e instanceof SyntaxError) { - e.message = `${e.message} in ${packageJsonFile}.\n`; - } + return JSON.parse( packageJson )?.version; + } catch ( e ) { + if ( e instanceof SyntaxError ) { + e.message = `${ e.message } in ${ packageJsonFile }.\n`; + } - console.warn(e); - } + console.warn( e ); + } } /** * Updates the plugin's readme.txt changelog with the latest 3 releases * found in the plugin's CHANGELOG.md file. * - * @param {String} readmeTxtFile Full path to the plugin's readme.txt file. - * @param {String} changelog Full path to the plugin's CHANGELOG.md file. + * @param {string} readmeTxtFile Full path to the plugin's readme.txt file. + * @param {string} changelog Full path to the plugin's CHANGELOG.md file. */ -async function generateReadmeChangelog(readmeTxtFile, changelog) { - let output = ""; - - try { - let readmeTxt = await readFile(readmeTxtFile); - let changelogContent = await readFile(changelog); - - // Remove the "# Changelog" header if it exists in CHANGELOG.md - changelogContent = changelogContent.replace("# Changelog", ""); - - // Split the contents by new line - const changelogLines = changelogContent.split(/\r?\n/); - const processedLines = []; - let versionCount = 0; - - // Process all lines in current version - changelogLines.every((line) => { - // Version numbers in CHANGELOG.md are h2 - if (line.startsWith("## ")) { - if (versionCount == 3) { - return false; // Stop processing after 3 versions - } - // Format version number for WordPress - line = line.replace("## ", "= ") + " ="; - versionCount++; - } - - processedLines.push(line); - - return true; // Continue processing - }); - - changelogContent = processedLines.join("\n"); - - const changelogStart = readmeTxt.indexOf("== Changelog =="); - const readmeTxtBeforeChangelog = readmeTxt.substring(0, changelogStart + "== Changelog ==".length); - - // Combine the original part of readme.txt up to the changelog section with the new changelog content - output = readmeTxtBeforeChangelog + changelogContent; - output += - "\n[View the full changelog](https://github.com/wp-graphql/wpgraphql-ide/blob/main/CHANGELOG.md)"; - - return writeFile(readmeTxtFile, output); - } catch (e) { - console.warn(e); - } +async function generateReadmeChangelog( readmeTxtFile, changelog ) { + let output = ''; + + try { + const readmeTxt = await readFile( readmeTxtFile ); + let changelogContent = await readFile( changelog ); + + // Remove the "# Changelog" header if it exists in CHANGELOG.md + changelogContent = changelogContent.replace( '# Changelog', '' ); + + // Split the contents by new line + const changelogLines = changelogContent.split( /\r?\n/ ); + const processedLines = []; + let versionCount = 0; + + // Process all lines in current version + changelogLines.every( ( line ) => { + // Version numbers in CHANGELOG.md are h2 + if ( line.startsWith( '## ' ) ) { + if ( versionCount == 3 ) { + return false; // Stop processing after 3 versions + } + // Format version number for WordPress + line = line.replace( '## ', '= ' ) + ' ='; + versionCount++; + } + + processedLines.push( line ); + + return true; // Continue processing + } ); + + changelogContent = processedLines.join( '\n' ); + + const changelogStart = readmeTxt.indexOf( '== Changelog ==' ); + const readmeTxtBeforeChangelog = readmeTxt.substring( + 0, + changelogStart + '== Changelog =='.length + ); + + // Combine the original part of readme.txt up to the changelog section with the new changelog content + output = readmeTxtBeforeChangelog + changelogContent; + output += + '\n[View the full changelog](https://github.com/wp-graphql/wpgraphql-ide/blob/main/CHANGELOG.md)'; + + return writeFile( readmeTxtFile, output ); + } catch ( e ) { + console.warn( e ); + } } versionPlugin(); diff --git a/package-lock.json b/package-lock.json index c32d6e5..2a4a6c8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,7 @@ "dependencies": { "@changesets/cli": "^2.27.1", "@graphiql/plugin-explorer": "^1.0.3", + "@graphiql/react": "^0.22.1", "@wordpress/components": "^27.0.0", "@wordpress/data": "^9.22.0", "@wordpress/element": "^5.23.0", @@ -2916,9 +2917,9 @@ "peer": true }, "node_modules/@codemirror/view": { - "version": "6.26.0", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.26.0.tgz", - "integrity": "sha512-nSSmzONpqsNzshPOxiKhK203R6BvABepugAe34QfQDbNDslyjkqBuKgrK5ZBvqNXpfxz5iLrlGTmEfhbQyH46A==", + "version": "6.26.3", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.26.3.tgz", + "integrity": "sha512-gmqxkPALZjkgSxIeeweY/wGQXBfwTUaLs8h7OKtSwfbj9Ct3L11lD+u1sS7XHppxFQoMDiMDp07P9f3I2jWOHw==", "peer": true, "dependencies": { "@codemirror/state": "^6.4.0", @@ -3309,9 +3310,9 @@ } }, "node_modules/@graphiql/react": { - "version": "0.20.3", - "resolved": "https://registry.npmjs.org/@graphiql/react/-/react-0.20.3.tgz", - "integrity": "sha512-LHEiWQPABflTyRJZBZB50WSlrWER4RtlWg9XV1+D4yZQ3+6GbLM7X1zYf4D/TQ6AJB/vLZQHEnbhS0LuKcNqfA==", + "version": "0.22.1", + "resolved": "https://registry.npmjs.org/@graphiql/react/-/react-0.22.1.tgz", + "integrity": "sha512-PBClhO2juCvVvmE5qD4PHivJLkhp0dqIX1zgId8Z83UCKpxO2M+bEspRL9aOQQaE4F4xqExCUk5B2AL+wc+agg==", "dependencies": { "@graphiql/toolkit": "^0.9.1", "@headlessui/react": "^1.7.15", @@ -3322,11 +3323,11 @@ "@types/codemirror": "^5.60.8", "clsx": "^1.2.1", "codemirror": "^5.65.3", - "codemirror-graphql": "^2.0.10", + "codemirror-graphql": "^2.0.11", "copy-to-clipboard": "^3.2.0", "framer-motion": "^6.5.1", "graphql-language-service": "^5.2.0", - "markdown-it": "^12.2.0", + "markdown-it": "^14.1.0", "set-value": "^4.1.0" }, "peerDependencies": { @@ -3350,6 +3351,11 @@ "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", "optional": true }, + "node_modules/@graphiql/react/node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==" + }, "node_modules/@graphiql/react/node_modules/clsx": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", @@ -3378,6 +3384,40 @@ "react-dom": ">=16.8 || ^17.0.0 || ^18.0.0" } }, + "node_modules/@graphiql/react/node_modules/linkify-it": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz", + "integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==", + "dependencies": { + "uc.micro": "^2.0.0" + } + }, + "node_modules/@graphiql/react/node_modules/markdown-it": { + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-14.1.0.tgz", + "integrity": "sha512-a54IwgWPaeBCAAsv13YgmALOF1elABB08FxO9i+r4VFk5Vl4pKokRPeX8u5TCgSsPi6ec1otfLjdOpVcgbpshg==", + "dependencies": { + "argparse": "^2.0.1", + "entities": "^4.4.0", + "linkify-it": "^5.0.0", + "mdurl": "^2.0.0", + "punycode.js": "^2.3.1", + "uc.micro": "^2.1.0" + }, + "bin": { + "markdown-it": "bin/markdown-it.mjs" + } + }, + "node_modules/@graphiql/react/node_modules/mdurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-2.0.0.tgz", + "integrity": "sha512-Lf+9+2r+Tdp5wXDXC4PcIBjTDtq4UKjCPMQhKIuzpJNW0b96kVqSwW0bT7FhRSfmAiFYgP+SCRvdrDozfh0U5w==" + }, + "node_modules/@graphiql/react/node_modules/uc.micro": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.1.0.tgz", + "integrity": "sha512-ARDJmphmdvUk6Glw7y9DQ2bFkKBHwQHLi2lsaH6PPmz/Ka9sFOBsBluozhDltWmnv9u/cF6Rt87znRTPV+yp/A==" + }, "node_modules/@graphiql/toolkit": { "version": "0.9.1", "resolved": "https://registry.npmjs.org/@graphiql/toolkit/-/toolkit-0.9.1.tgz", @@ -9932,9 +9972,9 @@ "integrity": "sha512-br21LjYmSlVL0vFCPWPfhzUCT34FM/pAdK7rRIZwa0rrtrIdotvP4Oh4GUHsu2E3IrQMCfRkL/fN3ytMNxVQvg==" }, "node_modules/codemirror-graphql": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/codemirror-graphql/-/codemirror-graphql-2.0.10.tgz", - "integrity": "sha512-rC9NxibCsSzWtCQjHLfwKCkyYdGv2BT/BCgyDoKPrc/e7aGiyLyeT0fB60d+0imwlvhX3lIHncl6JMz2YxQ/jg==", + "version": "2.0.11", + "resolved": "https://registry.npmjs.org/codemirror-graphql/-/codemirror-graphql-2.0.11.tgz", + "integrity": "sha512-j1QDDXKVkpin2VsyS0ke2nAhKal6/N1UJtgnBGrPe3gj9ZSP6/K8Xytft94k0xW6giIU/JhZjvW0GwwERNzbFA==", "dependencies": { "@types/codemirror": "^0.0.90", "graphql-language-service": "5.2.0" @@ -11721,7 +11761,6 @@ "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", "integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==", - "dev": true, "engines": { "node": ">=0.12" }, @@ -14208,6 +14247,76 @@ "react-dom": "^16.8.0 || ^17 || ^18" } }, + "node_modules/graphiql/node_modules/@emotion/is-prop-valid": { + "version": "0.8.8", + "resolved": "https://registry.npmjs.org/@emotion/is-prop-valid/-/is-prop-valid-0.8.8.tgz", + "integrity": "sha512-u5WtneEAr5IDG2Wv65yhunPSMLIpuKsbuOktRojfrEiEvRyC85LgPMZI63cr7NUqT8ZIGdSVg8ZKGxIug4lXcA==", + "optional": true, + "dependencies": { + "@emotion/memoize": "0.7.4" + } + }, + "node_modules/graphiql/node_modules/@emotion/memoize": { + "version": "0.7.4", + "resolved": "https://registry.npmjs.org/@emotion/memoize/-/memoize-0.7.4.tgz", + "integrity": "sha512-Ja/Vfqe3HpuzRsG1oBtWTHk2PGZ7GR+2Vz5iYGelAw8dx32K0y7PjVuxK6z1nMpZOqAFsRUPCkK1YjJ56qJlgw==", + "optional": true + }, + "node_modules/graphiql/node_modules/@graphiql/react": { + "version": "0.20.4", + "resolved": "https://registry.npmjs.org/@graphiql/react/-/react-0.20.4.tgz", + "integrity": "sha512-LDgIlHa65pSngk8G2O0hvohNz4B41VUa7Yg6iPwifa1XreXxHIXjhV6FC1qi5oSjdCIRp4T8dkZnHA6iI5eElg==", + "dependencies": { + "@graphiql/toolkit": "^0.9.1", + "@headlessui/react": "^1.7.15", + "@radix-ui/react-dialog": "^1.0.4", + "@radix-ui/react-dropdown-menu": "^2.0.5", + "@radix-ui/react-tooltip": "^1.0.6", + "@radix-ui/react-visually-hidden": "^1.0.3", + "@types/codemirror": "^5.60.8", + "clsx": "^1.2.1", + "codemirror": "^5.65.3", + "codemirror-graphql": "^2.0.11", + "copy-to-clipboard": "^3.2.0", + "framer-motion": "^6.5.1", + "graphql-language-service": "^5.2.0", + "markdown-it": "^12.2.0", + "set-value": "^4.1.0" + }, + "peerDependencies": { + "graphql": "^15.5.0 || ^16.0.0", + "react": "^16.8.0 || ^17 || ^18", + "react-dom": "^16.8.0 || ^17 || ^18" + } + }, + "node_modules/graphiql/node_modules/clsx": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/clsx/-/clsx-1.2.1.tgz", + "integrity": "sha512-EcR6r5a8bj6pu3ycsa/E/cKVGuTgZJZdsyUYHOksG/UHIiKfjxzRxYJpyVBwYaQeOvghal9fcc4PidlgzugAQg==", + "engines": { + "node": ">=6" + } + }, + "node_modules/graphiql/node_modules/framer-motion": { + "version": "6.5.1", + "resolved": "https://registry.npmjs.org/framer-motion/-/framer-motion-6.5.1.tgz", + "integrity": "sha512-o1BGqqposwi7cgDrtg0dNONhkmPsUFDaLcKXigzuTFC5x58mE8iyTazxSudFzmT6MEyJKfjjU8ItoMe3W+3fiw==", + "dependencies": { + "@motionone/dom": "10.12.0", + "framesync": "6.0.1", + "hey-listen": "^1.0.8", + "popmotion": "11.0.3", + "style-value-types": "5.0.0", + "tslib": "^2.1.0" + }, + "optionalDependencies": { + "@emotion/is-prop-valid": "^0.8.2" + }, + "peerDependencies": { + "react": ">=16.8 || ^17.0.0 || ^18.0.0", + "react-dom": ">=16.8 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/graphql": { "version": "16.8.1", "resolved": "https://registry.npmjs.org/graphql/-/graphql-16.8.1.tgz", @@ -21499,6 +21608,14 @@ "node": ">=6" } }, + "node_modules/punycode.js": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/punycode.js/-/punycode.js-2.3.1.tgz", + "integrity": "sha512-uxFIHU0YlHYhDQtV4R9J6a52SLx28BCjT+4ieh7IGbgwVJWO+km431c4yRlREUAsAmt/uMjQUyQHNEPf0M39CA==", + "engines": { + "node": ">=6" + } + }, "node_modules/puppeteer-core": { "version": "13.7.0", "resolved": "https://registry.npmjs.org/puppeteer-core/-/puppeteer-core-13.7.0.tgz", diff --git a/package.json b/package.json index 8231570..68acdbc 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "dependencies": { "@changesets/cli": "^2.27.1", "@graphiql/plugin-explorer": "^1.0.3", + "@graphiql/react": "^0.22.1", "@wordpress/components": "^27.0.0", "@wordpress/data": "^9.22.0", "@wordpress/element": "^5.23.0", diff --git a/plugins/third-party-plugin/src/components/CopyQueryButton/index.js b/plugins/third-party-plugin/src/components/CopyQueryButton/index.js index f043fd2..aae58da 100644 --- a/plugins/third-party-plugin/src/components/CopyQueryButton/index.js +++ b/plugins/third-party-plugin/src/components/CopyQueryButton/index.js @@ -1,3 +1,3 @@ import { CopyQueryButton } from './CopyQueryButton'; -export default CopyQueryButton; \ No newline at end of file +export default CopyQueryButton; diff --git a/plugins/third-party-plugin/src/components/MergeFragmentsButton/MergeFragmentsButton.jsx b/plugins/third-party-plugin/src/components/MergeFragmentsButton/MergeFragmentsButton.jsx index 8385903..0c21d5c 100644 --- a/plugins/third-party-plugin/src/components/MergeFragmentsButton/MergeFragmentsButton.jsx +++ b/plugins/third-party-plugin/src/components/MergeFragmentsButton/MergeFragmentsButton.jsx @@ -1,7 +1,7 @@ import React from 'react'; import { useMergeQuery, MergeIcon } from '@graphiql/react'; -export const MergeFragmentsButton = ({ ToolbarButton }) => { +export const MergeFragmentsButton = ( { ToolbarButton } ) => { const merge = useMergeQuery(); return ( diff --git a/plugins/third-party-plugin/src/components/PrettifyButton/PrettifyButton.jsx b/plugins/third-party-plugin/src/components/PrettifyButton/PrettifyButton.jsx index df66081..25c4f17 100644 --- a/plugins/third-party-plugin/src/components/PrettifyButton/PrettifyButton.jsx +++ b/plugins/third-party-plugin/src/components/PrettifyButton/PrettifyButton.jsx @@ -1,17 +1,16 @@ import React from 'react'; -import { - PrettifyIcon, -} from '@graphiql/react'; +import { PrettifyIcon } from '@graphiql/react'; import { useDispatch, useSelect } from '@wordpress/data'; - -export const PrettifyButton = ({ ToolbarButton }) => { +export const PrettifyButton = ( { ToolbarButton } ) => { // const prettify = usePrettifyEditors(); const { GraphQL } = window.WPGraphQLIDE; const { print, parse } = GraphQL; - const query = useSelect( ( select ) => select( 'wpgraphql-ide/app' ).getQuery() ); + const query = useSelect( ( select ) => + select( 'wpgraphql-ide/app' ).getQuery() + ); const { prettifyQuery } = useDispatch( 'wpgraphql-ide/app' ); return ( diff --git a/plugins/third-party-plugin/src/components/ShareDocumentButton/ShareDocumentButton.jsx b/plugins/third-party-plugin/src/components/ShareDocumentButton/ShareDocumentButton.jsx index 70eb111..448ae01 100644 --- a/plugins/third-party-plugin/src/components/ShareDocumentButton/ShareDocumentButton.jsx +++ b/plugins/third-party-plugin/src/components/ShareDocumentButton/ShareDocumentButton.jsx @@ -13,10 +13,11 @@ import { useCopyToClipboard } from '../../../../../src/hooks/useCopyToClipboard' * `useCopyToClipboard` hook to copy this URL to the clipboard and provide user feedback * via WordPress admin notices. * - * @param {Object} props Component properties. + * @param {Object} props Component properties. + * @param props.ToolbarButton * @return {React.Element} A ToolbarButton element for the share document functionality. */ -export const ShareDocumentButton = ({ ToolbarButton }) => { +export const ShareDocumentButton = ( { ToolbarButton } ) => { const { queryEditor } = useEditorContext(); const [ copyToClipboard ] = useCopyToClipboard(); const { dedicatedIdeBaseUrl } = window.WPGRAPHQL_IDE_DATA; @@ -49,5 +50,3 @@ export const ShareDocumentButton = ({ ToolbarButton }) => { ); }; - - diff --git a/plugins/third-party-plugin/src/components/ToggleAuthenticationButton/ToggleAuthenticationButton.jsx b/plugins/third-party-plugin/src/components/ToggleAuthenticationButton/ToggleAuthenticationButton.jsx index 45fcd6a..bdc1ff3 100644 --- a/plugins/third-party-plugin/src/components/ToggleAuthenticationButton/ToggleAuthenticationButton.jsx +++ b/plugins/third-party-plugin/src/components/ToggleAuthenticationButton/ToggleAuthenticationButton.jsx @@ -10,9 +10,12 @@ import styles from './ToggleAuthenticationButton.module.css'; * @param {Object} props Component props. * @param {boolean} props.isAuthenticated Indicates if the current state is authenticated. * @param {Function} props.toggleAuthentication Function to toggle the authentication state. + * @param props.ToolbarButton */ export const ToggleAuthenticationButton = ( { ToolbarButton } ) => { - const isAuthenticated = useSelect( ( select ) =>select( 'wpgraphql-ide/app' ).isAuthenticated()); + const isAuthenticated = useSelect( ( select ) => + select( 'wpgraphql-ide/app' ).isAuthenticated() + ); const { toggleAuthentication } = useDispatch( 'wpgraphql-ide/app' ); const avatarUrl = window.WPGRAPHQL_IDE_DATA?.context?.avatarUrl; const title = isAuthenticated diff --git a/plugins/third-party-plugin/src/index.js b/plugins/third-party-plugin/src/index.js index 727f649..5366c04 100644 --- a/plugins/third-party-plugin/src/index.js +++ b/plugins/third-party-plugin/src/index.js @@ -1,16 +1,13 @@ /* global WPGRAPHQL_IDE_DATA */ -import { select, dispatch, useSelect, useDispatch } from "@wordpress/data"; +import { select, dispatch, useSelect, useDispatch } from '@wordpress/data'; import { MergeIcon } from '@graphiql/react'; -import styles from "./components/ToggleAuthenticationButton/ToggleAuthenticationButton.module.css"; -import clsx from "clsx"; -import { PrettifyIcon } from "@graphiql/react"; +import styles from './components/ToggleAuthenticationButton/ToggleAuthenticationButton.module.css'; +import clsx from 'clsx'; +import { PrettifyIcon } from '@graphiql/react'; import React from 'react'; -import { useCopyToClipboard } from "../../../src/hooks/useCopyToClipboard"; -import LZString from "lz-string"; +import { useCopyToClipboard } from '../../../src/hooks/useCopyToClipboard'; +import LZString from 'lz-string'; import { Icon, external } from '@wordpress/icons'; import { CopyIcon } from '@graphiql/react'; - -window.addEventListener( 'WPGraphQLIDEReady', () => { - -} ); +window.addEventListener( 'WPGraphQLIDEReady', () => {} ); diff --git a/src/access-functions.js b/src/access-functions.js index 88f7dd9..b513e6b 100644 --- a/src/access-functions.js +++ b/src/access-functions.js @@ -33,6 +33,3 @@ export function registerDocumentEditorToolbarButton( ); } } - - - diff --git a/src/components/ActivityBar.jsx b/src/components/ActivityBar.jsx index 729d874..698690d 100644 --- a/src/components/ActivityBar.jsx +++ b/src/components/ActivityBar.jsx @@ -1,16 +1,25 @@ import React from 'react'; -import {ActivityBarUtilities} from "./ActivityBarUtilities"; -import {ActivityBarPlugins} from "./ActivityBarPlugins"; +import { ActivityBarUtilities } from './ActivityBarUtilities'; +import { ActivityBarPlugins } from './ActivityBarPlugins'; -export const ActivityBar = ({ pluginContext, handlePluginClick, schemaContext, handleRefetchSchema, handleShowDialog }) => { +export const ActivityBar = ( { + pluginContext, + handlePluginClick, + schemaContext, + handleRefetchSchema, + handleShowDialog, +} ) => { return (