zapier-platform-cli 15.19.0 → 16.1.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.
Files changed (74) hide show
  1. package/oclif.manifest.json +2316 -1
  2. package/package.json +39 -32
  3. package/src/bin/run +4 -4
  4. package/src/bin/run.cmd +0 -3
  5. package/src/constants.js +2 -2
  6. package/src/generators/index.js +11 -11
  7. package/src/generators/templates/dynamic-dropdown/README.md +1 -1
  8. package/src/generators/templates/dynamic-dropdown/triggers/people.js +2 -2
  9. package/src/generators/templates/dynamic-dropdown/triggers/species.js +2 -2
  10. package/src/index.js +1 -1
  11. package/src/oclif/ZapierBaseCommand.js +52 -45
  12. package/src/oclif/buildFlags.js +14 -16
  13. package/src/oclif/commands/analytics.js +6 -6
  14. package/src/oclif/commands/build.js +6 -6
  15. package/src/oclif/commands/cache/clear.js +13 -13
  16. package/src/oclif/commands/canary/create.js +27 -20
  17. package/src/oclif/commands/canary/delete.js +26 -16
  18. package/src/oclif/commands/canary/list.js +5 -7
  19. package/src/oclif/commands/convert.js +16 -16
  20. package/src/oclif/commands/delete/version.js +6 -6
  21. package/src/oclif/commands/deprecate.js +10 -11
  22. package/src/oclif/commands/describe.js +5 -5
  23. package/src/oclif/commands/env/get.js +5 -5
  24. package/src/oclif/commands/env/set.js +11 -12
  25. package/src/oclif/commands/env/unset.js +9 -10
  26. package/src/oclif/commands/history.js +1 -0
  27. package/src/oclif/commands/init.js +12 -13
  28. package/src/oclif/commands/invoke.js +67 -69
  29. package/src/oclif/commands/jobs.js +1 -1
  30. package/src/oclif/commands/link.js +2 -2
  31. package/src/oclif/commands/login.js +15 -15
  32. package/src/oclif/commands/logout.js +1 -1
  33. package/src/oclif/commands/logs.js +9 -9
  34. package/src/oclif/commands/migrate.js +19 -22
  35. package/src/oclif/commands/promote.js +25 -27
  36. package/src/oclif/commands/push.js +2 -2
  37. package/src/oclif/commands/register.js +31 -32
  38. package/src/oclif/commands/scaffold.js +15 -17
  39. package/src/oclif/commands/team/add.js +12 -15
  40. package/src/oclif/commands/team/get.js +2 -2
  41. package/src/oclif/commands/team/remove.js +6 -6
  42. package/src/oclif/commands/test.js +8 -8
  43. package/src/oclif/commands/upload.js +1 -1
  44. package/src/oclif/commands/users/add.js +9 -11
  45. package/src/oclif/commands/users/get.js +7 -7
  46. package/src/oclif/commands/users/links.js +4 -4
  47. package/src/oclif/commands/users/remove.js +8 -9
  48. package/src/oclif/commands/validate.js +29 -21
  49. package/src/oclif/commands/versions.js +26 -1
  50. package/src/oclif/hooks/checkValidNodeVersion.js +1 -1
  51. package/src/oclif/hooks/deprecated.js +1 -1
  52. package/src/oclif/hooks/getAppRegistrationFieldChoices.js +4 -4
  53. package/src/oclif/hooks/renderMarkdownHelp.js +6 -7
  54. package/src/oclif/hooks/versionInfo.js +2 -2
  55. package/src/utils/analytics.js +20 -7
  56. package/src/utils/api.js +27 -30
  57. package/src/utils/ast.js +15 -15
  58. package/src/utils/auth-files-codegen.js +102 -99
  59. package/src/utils/build.js +27 -28
  60. package/src/utils/changelog.js +1 -1
  61. package/src/utils/check-missing-app-info.js +2 -2
  62. package/src/utils/convert.js +26 -20
  63. package/src/utils/credentials.js +1 -1
  64. package/src/utils/display.js +31 -8
  65. package/src/utils/files.js +3 -3
  66. package/src/utils/ignore.js +2 -2
  67. package/src/utils/local.js +1 -1
  68. package/src/utils/metadata.js +1 -1
  69. package/src/utils/misc.js +21 -22
  70. package/src/utils/promisify.js +1 -1
  71. package/src/utils/scaffold.js +12 -12
  72. package/src/utils/team.js +3 -3
  73. package/src/utils/xdg.js +3 -3
  74. package/src/version-store.js +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zapier-platform-cli",
3
- "version": "15.19.0",
3
+ "version": "16.1.0",
4
4
  "description": "The CLI for managing integrations in Zapier Developer Platform.",
5
5
  "repository": "zapier/zapier-platform",
6
6
  "homepage": "https://platform.zapier.com/",
@@ -19,12 +19,12 @@
19
19
  "/oclif.manifest.json"
20
20
  ],
21
21
  "engines": {
22
- "node": ">=16"
22
+ "node": ">=18.18"
23
23
  },
24
24
  "scripts": {
25
25
  "docs": "ZAPIER_BASE_ENDPOINT='' node scripts/docs.js",
26
26
  "preversion": "git pull && yarn validate",
27
- "prepack": "oclif-dev manifest",
27
+ "prepack": "oclif manifest",
28
28
  "postpack": "rm -f oclif.manifest.json",
29
29
  "precommit": "yarn docs && git add docs",
30
30
  "version": "yarn docs && git add docs/*",
@@ -40,20 +40,20 @@
40
40
  "validate": "yarn test && yarn smoke-test && yarn lint"
41
41
  },
42
42
  "dependencies": {
43
- "@oclif/command": "1.8.27",
44
- "@oclif/config": "1.18.10",
45
- "@oclif/plugin-autocomplete": "0.3.0",
46
- "@oclif/plugin-help": "3.2.20",
47
- "@oclif/plugin-not-found": "1.2.4",
48
- "adm-zip": "0.5.10",
49
- "archiver": "5.3.1",
50
- "browserify": "17.0.0",
43
+ "@oclif/core": "4.0.34",
44
+ "@oclif/plugin-autocomplete": "3.2.11",
45
+ "@oclif/plugin-help": "6.2.18",
46
+ "@oclif/plugin-not-found": "3.2.29",
47
+ "@oclif/plugin-version": "2.2.16",
48
+ "adm-zip": "0.5.16",
49
+ "archiver": "7.0.1",
50
+ "browserify": "17.0.1",
51
51
  "chrono-node": "2.7.7",
52
- "cli-table3": "0.6.3",
52
+ "cli-table3": "0.6.5",
53
53
  "colors": "1.4.0",
54
- "debug": "4.3.4",
55
- "dotenv": "16.4.5",
56
- "fs-extra": "11.1.1",
54
+ "debug": "4.3.7",
55
+ "dotenv": "16.4.6",
56
+ "fs-extra": "11.2.0",
57
57
  "gulp-filter": "7.0.0",
58
58
  "gulp-prettier": "4.0.0",
59
59
  "ignore": "5.2.4",
@@ -62,34 +62,33 @@
62
62
  "klaw": "4.1.0",
63
63
  "lodash": "4.17.21",
64
64
  "luxon": "3.5.0",
65
- "marked": "4.2.12",
66
- "marked-terminal": "5.2.0",
65
+ "marked": "14.1.4",
66
+ "marked-terminal": "7.2.1",
67
67
  "minimatch": "9.0.3",
68
- "node-fetch": "2.6.7",
68
+ "node-fetch": "2.7.0",
69
69
  "open": "10.1.0",
70
70
  "ora": "5.4.0",
71
71
  "parse-gitignore": "0.5.1",
72
- "prettier": "2.8.8",
73
- "read": "2.1.0",
74
- "semver": "7.5.2",
72
+ "prettier": "3.4.1",
73
+ "read": "4.0.0",
74
+ "semver": "7.6.3",
75
75
  "string-length": "4.0.2",
76
76
  "through2": "4.0.2",
77
- "tmp": "0.2.1",
78
- "traverse": "0.6.7",
77
+ "tmp": "0.2.3",
78
+ "traverse": "0.6.10",
79
79
  "update-notifier": "5.1.0",
80
- "yeoman-environment": "3.3.0",
80
+ "yeoman-environment": "3.19.3",
81
81
  "yeoman-generator": "5.9.0"
82
82
  },
83
83
  "devDependencies": {
84
- "@oclif/dev-cli": "^1.26.10",
85
- "@oclif/test": "^1.2.9",
84
+ "@oclif/test": "^4.0.9",
86
85
  "@types/jscodeshift": "^0.12.0",
87
86
  "@types/mocha": "^10.0.9",
88
87
  "chai": "^4.3.7",
89
88
  "decompress": "4.2.1",
90
89
  "mock-fs": "^5.2.0",
91
90
  "nock": "^13.3.1",
92
- "stdout-stderr": "0.1.13",
91
+ "oclif": "^4.15.30",
93
92
  "typescript": "^5.6.3",
94
93
  "yamljs": "0.3.0"
95
94
  },
@@ -98,20 +97,28 @@
98
97
  },
99
98
  "oclif": {
100
99
  "commands": "src/oclif/commands",
100
+ "additionalHelpFlags": [
101
+ "-h"
102
+ ],
103
+ "additionalVersionFlags": [
104
+ "-v"
105
+ ],
101
106
  "bin": "zapier",
107
+ "dirname": "zapier",
102
108
  "plugins": [
109
+ "@oclif/plugin-autocomplete",
103
110
  "@oclif/plugin-help",
104
111
  "@oclif/plugin-not-found",
105
- "@oclif/plugin-autocomplete"
112
+ "@oclif/plugin-version"
106
113
  ],
107
114
  "hooks": {
108
115
  "init": [
109
- "./src/oclif/hooks/versionInfo",
110
- "./src/oclif/hooks/deprecated",
111
- "./src/oclif/hooks/updateNotifier",
112
116
  "./src/oclif/hooks/checkValidNodeVersion",
117
+ "./src/oclif/hooks/deprecated",
118
+ "./src/oclif/hooks/getAppRegistrationFieldChoices",
113
119
  "./src/oclif/hooks/renderMarkdownHelp",
114
- "./src/oclif/hooks/getAppRegistrationFieldChoices"
120
+ "./src/oclif/hooks/updateNotifier",
121
+ "./src/oclif/hooks/versionInfo"
115
122
  ]
116
123
  },
117
124
  "topics": {
package/src/bin/run CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- require('@oclif/command')
4
- .run() // this looks through the directory to find all the commands
5
- .then(require('@oclif/command/flush'))
6
- .catch(require('@oclif/errors/handle'));
3
+ (async () => {
4
+ const oclif = await import('@oclif/core');
5
+ await oclif.execute({ development: false, dir: __dirname });
6
+ })();
package/src/bin/run.cmd CHANGED
@@ -1,6 +1,3 @@
1
- REM this is created by the oclif generator and is similar to a file that npm creates on install
2
- REM see https://stackoverflow.com/a/28415646/1825390
3
-
4
1
  @echo off
5
2
 
6
3
  node "%~dp0\run" %*
package/src/constants.js CHANGED
@@ -26,7 +26,7 @@ const BLOCKLISTED_PATHS = [
26
26
  ];
27
27
  const NODE_VERSION = versionStore[versionStore.length - 1].nodeVersion;
28
28
  const LAMBDA_VERSION = `v${NODE_VERSION}`;
29
- const NODE_VERSION_CLI_REQUIRES = '>=16'; // should be the oldest non-ETL version
29
+ const NODE_VERSION_CLI_REQUIRES = '>=18'; // should be the oldest non-ETL version
30
30
  const AUTH_KEY = 'deployKey';
31
31
  const ANALYTICS_KEY = 'analyticsMode';
32
32
  const ANALYTICS_MODES = {
@@ -42,7 +42,7 @@ const PACKAGE_VERSION = packageJson.version;
42
42
  const UPDATE_NOTIFICATION_INTERVAL = 1000 * 60 * 60 * 24 * 7; // one week
43
43
 
44
44
  const CHECK_REF_DOC_LINK =
45
- 'https://platform.zapier.com/docs/integration-checks-reference';
45
+ 'https://docs.zapier.com/platform/publish/integration-checks-reference#integration-check-reference';
46
46
 
47
47
  const ISSUES_URL =
48
48
  'https://github.com/zapier/zapier-platform/issues/new/choose';
@@ -13,14 +13,14 @@ const writeGenericReadme = (gen) => {
13
13
  gen.fs.copyTpl(
14
14
  gen.templatePath('README.template.md'),
15
15
  gen.destinationPath('README.md'),
16
- { name: gen.options.packageName }
16
+ { name: gen.options.packageName },
17
17
  );
18
18
  };
19
19
 
20
20
  const appendReadme = (gen) => {
21
21
  const content = gen.fs.read(
22
22
  gen.templatePath(gen.options.template, 'README.md'),
23
- { defaults: '' }
23
+ { defaults: '' },
24
24
  );
25
25
  if (content) {
26
26
  gen.fs.append(gen.destinationPath('README.md'), '\n' + content);
@@ -51,8 +51,8 @@ const writeGenericPackageJson = (gen, packageJsonExtension) => {
51
51
  },
52
52
  private: true,
53
53
  },
54
- packageJsonExtension
55
- )
54
+ packageJsonExtension,
55
+ ),
56
56
  );
57
57
  };
58
58
 
@@ -76,8 +76,8 @@ const writeTypeScriptPackageJson = (gen, packageJsonExtension) => {
76
76
  },
77
77
  private: true,
78
78
  },
79
- packageJsonExtension
80
- )
79
+ packageJsonExtension,
80
+ ),
81
81
  );
82
82
  };
83
83
 
@@ -85,7 +85,7 @@ const writeGenericIndex = (gen, hasAuth) => {
85
85
  gen.fs.copyTpl(
86
86
  gen.templatePath('index.template.js'),
87
87
  gen.destinationPath('index.js'),
88
- { corePackageName: PLATFORM_PACKAGE, hasAuth }
88
+ { corePackageName: PLATFORM_PACKAGE, hasAuth },
89
89
  );
90
90
  };
91
91
 
@@ -108,14 +108,14 @@ const writeGenericAuthTest = (gen) => {
108
108
  const authType = authTypes[gen.options.template];
109
109
  gen.fs.copyTpl(
110
110
  gen.templatePath(`authTests/${authType || 'generic'}.test.js`),
111
- gen.destinationPath('test/authentication.test.js')
111
+ gen.destinationPath('test/authentication.test.js'),
112
112
  );
113
113
  };
114
114
 
115
115
  const writeGenericTest = (gen) => {
116
116
  gen.fs.copyTpl(
117
117
  gen.templatePath('authTests/generic.test.js'),
118
- gen.destinationPath('test/example.test.js')
118
+ gen.destinationPath('test/example.test.js'),
119
119
  );
120
120
  };
121
121
 
@@ -158,7 +158,7 @@ const writeForStandaloneTemplate = (gen) => {
158
158
 
159
159
  gen.fs.copy(
160
160
  gen.templatePath(gen.options.template, '**', '*.{js,json,ts}'),
161
- gen.destinationPath()
161
+ gen.destinationPath(),
162
162
  );
163
163
  };
164
164
 
@@ -187,7 +187,7 @@ const writeForStandaloneTypeScriptTemplate = (gen) => {
187
187
 
188
188
  gen.fs.copy(
189
189
  gen.templatePath(gen.options.template, '**', '*.{js,json,ts}'),
190
- gen.destinationPath()
190
+ gen.destinationPath(),
191
191
  );
192
192
  };
193
193
 
@@ -1,5 +1,5 @@
1
1
  # The "dynamic-dropdown" Template
2
2
 
3
- This example integration uses the [Star Wars API](https://swapi.dev/) to provide a dynamic listing of choices for an `inputField` in a trigger.
3
+ This example integration uses the [Star Wars API](https://swapi.info/) to provide a dynamic listing of choices for an `inputField` in a trigger.
4
4
 
5
5
  ![](https://cdn.zappy.app/d985065c5098089795d9b60c77791e12.png)
@@ -5,8 +5,8 @@ const perform = async (z, bundle) => {
5
5
  // Ideally, we should poll through all the pages of results, but in this
6
6
  // example we're going to omit that part. Thus, this trigger only "see" the
7
7
  // people in their first page of results.
8
- const response = await z.request({ url: 'https://swapi.dev/api/people/' });
9
- let peopleArray = response.data.results;
8
+ const response = await z.request({ url: 'https://swapi.info/api/people/' });
9
+ let peopleArray = response.data;
10
10
 
11
11
  if (bundle.inputData.species_id) {
12
12
  // The Zap's setup has requested a specific species of person. Since the
@@ -3,7 +3,7 @@ const { extractID } = require('../utils');
3
3
  // Fetches a list of records from the endpoint
4
4
  const perform = async (z, bundle) => {
5
5
  const request = {
6
- url: 'https://swapi.dev/api/species/',
6
+ url: 'https://swapi.info/api/species/',
7
7
  params: {},
8
8
  };
9
9
 
@@ -13,7 +13,7 @@ const perform = async (z, bundle) => {
13
13
  }
14
14
 
15
15
  const response = await z.request(request);
16
- const speciesArray = response.data.results;
16
+ const speciesArray = response.data;
17
17
  return speciesArray.map((species) => {
18
18
  species.id = extractID(species.url);
19
19
  return species;
package/src/index.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // for now, requiring this file has no real effect
2
2
 
3
- module.exports = require('@oclif/command');
3
+ module.exports = require('@oclif/core');
@@ -1,6 +1,4 @@
1
- const { Command } = require('@oclif/command');
2
- const { stdtermwidth } = require('@oclif/help/lib/screen');
3
- const { renderList } = require('@oclif/help/lib/list');
1
+ const { Command } = require('@oclif/core');
4
2
  const colors = require('colors/safe');
5
3
 
6
4
  const { startSpinner, endSpinner, formatStyles } = require('../utils/display');
@@ -14,9 +12,9 @@ const inquirer = require('inquirer');
14
12
  const DATA_FORMATS = ['json', 'raw'];
15
13
 
16
14
  class ZapierBaseCommand extends Command {
17
- run() {
15
+ async run() {
18
16
  this._initPromptModules();
19
- this._parseFlags();
17
+ await this._parseCommand();
20
18
 
21
19
  if (this.flags.debug) {
22
20
  this.debug.enabled = true; // enables this.debug on the command
@@ -47,7 +45,7 @@ class ZapierBaseCommand extends Command {
47
45
 
48
46
  if (!this.flags.debug && !this.flags.invokedFromAnotherCommand) {
49
47
  errTextLines.push(
50
- colors.gray('re-run this command with `--debug` for more info')
48
+ colors.gray('re-run this command with `--debug` for more info'),
51
49
  );
52
50
  }
53
51
 
@@ -67,11 +65,12 @@ class ZapierBaseCommand extends Command {
67
65
  });
68
66
  }
69
67
 
70
- _parseFlags() {
71
- const { flags, args } = this.parse(this._staticClassReference);
68
+ async _parseCommand() {
69
+ const { flags, args, argv } = await this.parse(this._staticClassReference);
72
70
 
73
71
  this.flags = flags;
74
72
  this.args = args;
73
+ this.argv = argv;
75
74
  }
76
75
 
77
76
  perform() {
@@ -93,7 +92,7 @@ class ZapierBaseCommand extends Command {
93
92
  throwForInvalidVersion(version) {
94
93
  if (!version.match(/^\d+\.\d+\.\d+$/g)) {
95
94
  throw new Error(
96
- `${version} is an invalid version str. Try something like \`1.2.3\``
95
+ `${version} is an invalid version str. Try something like \`1.2.3\``,
97
96
  );
98
97
  }
99
98
  }
@@ -137,6 +136,9 @@ class ZapierBaseCommand extends Command {
137
136
  headers = [],
138
137
  emptyMessage = '',
139
138
  formatOverride = '',
139
+ hasBorder = true,
140
+ showHeaders = true,
141
+ style = undefined,
140
142
  } = {}) {
141
143
  const formatter = formatOverride
142
144
  ? formatStyles[formatOverride]
@@ -149,18 +151,10 @@ class ZapierBaseCommand extends Command {
149
151
  this.log(colors.gray(emptyMessage));
150
152
  } else {
151
153
  // data comes out of the formatter ready to be printed (and it's always in the type to match the format) so we don't need to do anything special with it
152
- console.log(formatter(rows, headers));
154
+ console.log(formatter(rows, headers, showHeaders, hasBorder, style));
153
155
  }
154
156
  }
155
157
 
156
- /**
157
- * Print text in a list style.
158
- * @param {string[][]} items
159
- */
160
- logList(items) {
161
- this.log(renderList(items, { spacer: '\n', maxWidth: stdtermwidth }));
162
- }
163
-
164
158
  /**
165
159
  *
166
160
  * @param {Object} opts options object (as expected for this.prompt())
@@ -270,44 +264,53 @@ class ZapierBaseCommand extends Command {
270
264
  return arg.required ? argName : `[${argName}]`;
271
265
  };
272
266
 
273
- return [
274
- 'zapier',
275
- name,
276
- ...(this.args || []).filter((a) => !a.hidden).map((a) => formatArg(a)),
277
- ].join(' ');
267
+ const argv = Object.entries(this.args ?? {}).map(([argName, argValue]) => ({
268
+ name: argName,
269
+ ...argValue,
270
+ }));
271
+ const visibleArgv = argv.filter((arg) => !arg.hidden);
272
+
273
+ return ['zapier', name, ...visibleArgv.map(formatArg)].join(' ');
278
274
  }
279
275
 
280
276
  // this is fine for now but we'll want to hack into https://github.com/oclif/plugin-help/blob/master/src/command.ts at some point
281
277
  // the presentation is wrapped into the formatting, so it's a little tough to pull out
282
278
  static markdownHelp(name) {
283
- const formattedArgs = () =>
284
- this.args.map((arg) =>
285
- arg.hidden
279
+ const getFormattedArgs = () =>
280
+ Object.keys(this.args ?? {}).map((argName) => {
281
+ const arg = this.args[argName];
282
+ return arg.hidden
286
283
  ? null
287
- : `* ${arg.required ? '(required) ' : ''}\`${arg.name}\` | ${
284
+ : `* ${arg.required ? '(required) ' : ''}\`${argName}\` | ${
288
285
  arg.description
289
- }`
290
- );
291
- const formattedFlags = () =>
286
+ }`;
287
+ });
288
+ const getFormattedFlags = () =>
292
289
  Object.entries(this.flags)
293
- .map(([longName, flag]) =>
294
- flag.hidden
290
+ .map(([flagName, flagValue]) =>
291
+ flagValue.hidden
295
292
  ? null
296
- : `* ${flag.required ? '(required) ' : ''}\`${
297
- flag.char ? `-${flag.char}, ` : ''
298
- }--${longName}\` |${
299
- flag.description ? ` ${flag.description}` : ''
293
+ : `* ${flagValue.required ? '(required) ' : ''}\`${
294
+ flagValue.char ? `-${flagValue.char}, ` : ''
295
+ }--${flagName}\` |${
296
+ flagValue.description ? ` ${flagValue.description}` : ''
300
297
  } ${
301
- flag.options ? `One of \`[${flag.options.join(' | ')}]\`.` : ''
302
- }${flag.default ? ` Defaults to \`${flag.default}\`.` : ''}
303
- `.trim()
298
+ flagValue.options
299
+ ? `One of \`[${flagValue.options.join(' | ')}]\`.`
300
+ : ''
301
+ }${
302
+ flagValue.default
303
+ ? ` Defaults to \`${flagValue.default}\`.`
304
+ : ''
305
+ }
306
+ `.trim(),
304
307
  )
305
308
  .filter(Boolean);
306
309
 
307
310
  const descriptionParts = this.description.split('\n\n').filter(Boolean);
308
311
  const blurb = descriptionParts[0];
309
312
  const lengthyDescription = colors.stripColors(
310
- descriptionParts.length > 1 ? descriptionParts.slice(1).join('\n\n') : ''
313
+ descriptionParts.length > 1 ? descriptionParts.slice(1).join('\n\n') : '',
311
314
  );
312
315
 
313
316
  return [
@@ -317,16 +320,20 @@ class ZapierBaseCommand extends Command {
317
320
  '',
318
321
  `**Usage**: \`${this.zUsage(name)}\``,
319
322
  ...(lengthyDescription ? ['', lengthyDescription] : []),
320
- ...(this.args ? ['', '**Arguments**', ...formattedArgs()] : []),
321
- ...(this.flags ? ['', '**Flags**', ...formattedFlags()] : []),
322
- ...(this.examples
323
+ ...(Object.keys(this.args ?? {}).length
324
+ ? ['', '**Arguments**', ...getFormattedArgs()]
325
+ : []),
326
+ ...(Object.keys(this.flags ?? {}).length
327
+ ? ['', '**Flags**', ...getFormattedFlags()]
328
+ : []),
329
+ ...((this.examples ?? []).length
323
330
  ? [
324
331
  '',
325
332
  '**Examples**',
326
333
  this.examples.map((e) => `* \`${e}\``).join('\n'),
327
334
  ]
328
335
  : []),
329
- ...(this.aliases.length
336
+ ...((this.aliases ?? []).length
330
337
  ? ['', '**Aliases**', this.aliases.map((e) => `* \`${e}\``).join('\n')]
331
338
  : []),
332
339
  ]
@@ -339,7 +346,7 @@ class ZapierBaseCommand extends Command {
339
346
  if (!this.args) {
340
347
  throw new Error('unable to record analytics until args are parsed');
341
348
  }
342
- return recordAnalytics(this.id, true, Object.keys(this.args), this.flags);
349
+ return recordAnalytics(this.id, true, this.args, this.flags);
343
350
  }
344
351
  }
345
352
 
@@ -1,25 +1,24 @@
1
- const { flags } = require('@oclif/command');
1
+ const { Flags } = require('@oclif/core');
2
2
  const { pickBy } = require('lodash');
3
3
 
4
4
  const { formatStyles } = require('../utils/display');
5
5
 
6
6
  const baseFlags = {
7
- format: flags.string({
7
+ debug: Flags.boolean({
8
+ char: 'd',
9
+ description: 'Show extra debugging output.',
10
+ // pull from env?
11
+ }),
12
+ format: Flags.string({
8
13
  char: 'f',
9
14
  options: Object.keys(formatStyles),
10
15
  default: 'table',
11
16
  description:
12
17
  'Change the way structured data is presented. If "json" or "raw", you can pipe the output of the command into other tools, such as jq.',
13
18
  }),
14
- debug: flags.boolean({
15
- char: 'd',
16
- description: 'Show extra debugging output.',
17
- // pull from env?
18
- }),
19
-
20
19
  // Indicates we're calling a command from another command so we know when not
21
20
  // to print duplicate messages.
22
- invokedFromAnotherCommand: flags.boolean({
21
+ invokedFromAnotherCommand: Flags.boolean({
23
22
  hidden: true,
24
23
  }),
25
24
  };
@@ -32,14 +31,13 @@ const defaultOpts = {
32
31
  };
33
32
 
34
33
  /**
35
- * pass in flag objects, plus whether or not to include debug and format
34
+ * pass in flag objects, plus whether or not to include debug, format, and
35
+ * invokedFormatAnotherCommand.
36
36
  */
37
37
  const buildFlags = ({ commandFlags = {}, opts = {} } = {}) => {
38
- const selectedBaseFlags = Object.assign({}, defaultOpts, opts);
39
- return Object.assign(
40
- {},
41
- commandFlags,
42
- pickBy(baseFlags, (v, k) => selectedBaseFlags[k])
43
- );
38
+ const options = { ...defaultOpts, ...opts };
39
+ const pickedFlags = pickBy(baseFlags, (_v, k) => options[k]);
40
+ return { ...commandFlags, ...pickedFlags };
44
41
  };
42
+
45
43
  module.exports = { buildFlags };
@@ -1,5 +1,5 @@
1
1
  const BaseCommand = require('../ZapierBaseCommand');
2
- const { flags } = require('@oclif/command');
2
+ const { Flags } = require('@oclif/core');
3
3
  const { buildFlags } = require('../buildFlags');
4
4
  const {
5
5
  currentAnalyticsMode,
@@ -13,8 +13,8 @@ class AnalyticsCommand extends BaseCommand {
13
13
  const currentMode = await currentAnalyticsMode();
14
14
  this.log(
15
15
  `The current analytics mode is ${colors.cyan(
16
- currentMode
17
- )}. Analytics may be skipped anyway if you've got DISABLE_ZAPIER_ANALYTICS set to a truthy value.`
16
+ currentMode,
17
+ )}. Analytics may be skipped anyway if you've got DISABLE_ZAPIER_ANALYTICS set to a truthy value.`,
18
18
  );
19
19
 
20
20
  if (this.flags.mode) {
@@ -23,8 +23,8 @@ class AnalyticsCommand extends BaseCommand {
23
23
  } else {
24
24
  this.log(
25
25
  `You can see what data is sent by running \`${colors.yellow(
26
- 'DEBUG=zapier:analytics zapier someCommand'
27
- )}\`.\n\nYou can change your analytics preferences by re-running this command with the \`--mode\` flag.\n\nThe data collected is as generic as we can make it while still getting useful input. No specific information about your filesystem is collected. Your Zapier user id is collected so that we can better debug issues. We will never use this data for any advertising puposes.`
26
+ 'DEBUG=zapier:analytics zapier someCommand',
27
+ )}\`.\n\nYou can change your analytics preferences by re-running this command with the \`--mode\` flag.\n\nThe data collected is as generic as we can make it while still getting useful input. No specific information about your filesystem is collected. Your Zapier user id is collected so that we can better debug issues. We will never use this data for any advertising puposes.`,
28
28
  );
29
29
  }
30
30
  }
@@ -32,7 +32,7 @@ class AnalyticsCommand extends BaseCommand {
32
32
 
33
33
  AnalyticsCommand.flags = buildFlags({
34
34
  commandFlags: {
35
- mode: flags.string({
35
+ mode: Flags.string({
36
36
  char: 'm',
37
37
  options: Object.keys(modes),
38
38
  description:
@@ -1,6 +1,6 @@
1
1
  const BaseCommand = require('../ZapierBaseCommand');
2
+ const { Flags } = require('@oclif/core');
2
3
  const { buildFlags } = require('../buildFlags');
3
- const { flags } = require('@oclif/command');
4
4
  const {
5
5
  BUILD_PATH,
6
6
  SOURCE_PATH,
@@ -17,26 +17,26 @@ class BuildCommand extends BaseCommand {
17
17
  skipNpmInstall: this.flags['skip-npm-install'],
18
18
  disableDependencyDetection: this.flags['disable-dependency-detection'],
19
19
  skipValidation: this.flags['skip-validation'],
20
- }
20
+ },
21
21
  );
22
22
 
23
23
  this.log(
24
- `\nBuild complete! Created ${BUILD_PATH} and ${SOURCE_PATH}. Try the \`zapier upload\` command now.`
24
+ `\nBuild complete! Created ${BUILD_PATH} and ${SOURCE_PATH}. Try the \`zapier upload\` command now.`,
25
25
  );
26
26
  }
27
27
  }
28
28
 
29
29
  BuildCommand.flags = buildFlags({
30
30
  commandFlags: {
31
- 'disable-dependency-detection': flags.boolean({
31
+ 'disable-dependency-detection': Flags.boolean({
32
32
  description: `Disable "smart" file inclusion. By default, Zapier only includes files that are required by \`index.js\`. If you (or your dependencies) require files dynamically (such as with \`require(someVar)\`), then you may see "Cannot find module" errors. Disabling this may make your \`build.zip\` too large. If that's the case, try using the \`includeInBuild\` option in your \`${CURRENT_APP_FILE}\`. See the docs about \`includeInBuild\` for more info.`,
33
33
  }),
34
- 'skip-npm-install': flags.boolean({
34
+ 'skip-npm-install': Flags.boolean({
35
35
  description:
36
36
  'Skips installing a fresh copy of npm dependencies on build. Helpful for using `yarn` or local copies of dependencies.',
37
37
  hidden: true,
38
38
  }),
39
- 'skip-validation': flags.boolean({
39
+ 'skip-validation': Flags.boolean({
40
40
  description:
41
41
  "Skips local pre-push validation checks, and remote validation check of the CLI app's schema and AppVersion integrity.",
42
42
  hidden: true,