From 38781061dc6dd6497147a37daf3c1bac2b7f83b3 Mon Sep 17 00:00:00 2001 From: Chang-Hung Liang Date: Fri, 2 Feb 2024 21:31:39 +0800 Subject: [PATCH] PDE-4682 chore(cli): fix text alignment in `zapier validate` (#743) * add @clif/core and upgrade @oclif/plugin-help * another spot that uses stdtermwidth * remove renderList options * Fix text alignment in `zapier validate` * change stdtermwidth in renderMarkdownHelp --- example-apps/custom-auth/authentication.js | 10 +++++++++- packages/cli/src/oclif/ZapierBaseCommand.js | 5 +++-- packages/cli/src/oclif/hooks/renderMarkdownHelp.js | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/example-apps/custom-auth/authentication.js b/example-apps/custom-auth/authentication.js index 8f271680f..2a8bb5520 100644 --- a/example-apps/custom-auth/authentication.js +++ b/example-apps/custom-auth/authentication.js @@ -47,7 +47,15 @@ module.exports = { // Define any input app's auth requires here. The user will be prompted to enter // this info when they connect their account. - fields: [{ key: 'apiKey', label: 'API Key', required: true, helpText: 'Find the API Key in your [app settings page](https://yourapp.com/settings)' }], + fields: [ + { + key: 'apiKey', + label: 'API Key', + required: true, + helpText: + 'Find the API Key in your [app settings page](https://yourapp.com/settings)', + }, + ], // The test method allows Zapier to verify that the credentials a user provides // are valid. We'll execute this method whenever a user connects their account for diff --git a/packages/cli/src/oclif/ZapierBaseCommand.js b/packages/cli/src/oclif/ZapierBaseCommand.js index fab3a954a..86dd0794b 100644 --- a/packages/cli/src/oclif/ZapierBaseCommand.js +++ b/packages/cli/src/oclif/ZapierBaseCommand.js @@ -1,5 +1,6 @@ const { Command } = require('@oclif/command'); -const { renderList } = require('@oclif/core/lib/cli-ux/list'); +const { stdtermwidth } = require('@oclif/help/lib/screen'); +const { renderList } = require('@oclif/help/lib/list'); const colors = require('colors/safe'); const { startSpinner, endSpinner, formatStyles } = require('../utils/display'); @@ -149,7 +150,7 @@ class ZapierBaseCommand extends Command { * @param {string[][]} items */ logList(items) { - this.log(renderList(items)); + this.log(renderList(items, { spacer: '\n', maxWidth: stdtermwidth })); } /** diff --git a/packages/cli/src/oclif/hooks/renderMarkdownHelp.js b/packages/cli/src/oclif/hooks/renderMarkdownHelp.js index f05d02494..4ddba94bb 100644 --- a/packages/cli/src/oclif/hooks/renderMarkdownHelp.js +++ b/packages/cli/src/oclif/hooks/renderMarkdownHelp.js @@ -1,7 +1,7 @@ const chalk = require('chalk'); const { marked } = require('marked'); const TerminalRenderer = require('marked-terminal'); -const { stdtermwidth } = require('@oclif/core/lib/screen'); +const { stdtermwidth } = require('@oclif/help/lib/screen'); marked.setOptions({ renderer: new TerminalRenderer({