swaggerhub-cli 0.14.0 → 0.16.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 (76) hide show
  1. package/README.md +152 -41
  2. package/bin/run +5 -4
  3. package/oclif.manifest.json +841 -670
  4. package/package.json +21 -16
  5. package/skills/swaggerhub-cli/SKILL.md +43 -0
  6. package/src/check-node-version.js +3 -2
  7. package/src/commands/api/clone.js +8 -7
  8. package/src/commands/api/comment/list.js +91 -0
  9. package/src/commands/api/create.js +8 -8
  10. package/src/commands/api/delete.js +6 -6
  11. package/src/commands/api/fork.js +75 -0
  12. package/src/commands/api/get.js +7 -7
  13. package/src/commands/api/publish.js +6 -6
  14. package/src/commands/api/rename.js +8 -10
  15. package/src/commands/api/setdefault.js +5 -5
  16. package/src/commands/api/unpublish.js +5 -5
  17. package/src/commands/api/update.js +8 -8
  18. package/src/commands/api/validate/download-rules.js +6 -6
  19. package/src/commands/api/validate/index.js +8 -8
  20. package/src/commands/api/validate/local.js +8 -8
  21. package/src/commands/configure.js +6 -6
  22. package/src/commands/domain/clone.js +8 -7
  23. package/src/commands/domain/create.js +8 -8
  24. package/src/commands/domain/delete.js +6 -6
  25. package/src/commands/domain/fork.js +75 -0
  26. package/src/commands/domain/get.js +7 -7
  27. package/src/commands/domain/publish.js +5 -5
  28. package/src/commands/domain/rename.js +9 -8
  29. package/src/commands/domain/setdefault.js +5 -5
  30. package/src/commands/domain/unpublish.js +5 -5
  31. package/src/commands/domain/update.js +8 -8
  32. package/src/commands/integration/create.js +5 -5
  33. package/src/commands/integration/delete.js +5 -5
  34. package/src/commands/integration/execute.js +5 -5
  35. package/src/commands/integration/get.js +7 -7
  36. package/src/commands/integration/list.js +6 -6
  37. package/src/commands/integration/update.js +5 -5
  38. package/src/commands/project/api/add.js +5 -7
  39. package/src/commands/project/api/remove.js +7 -10
  40. package/src/commands/project/create.js +5 -9
  41. package/src/commands/project/delete.js +5 -5
  42. package/src/commands/project/domain/add.js +5 -7
  43. package/src/commands/project/domain/remove.js +7 -10
  44. package/src/commands/project/get.js +7 -7
  45. package/src/commands/project/list.js +5 -5
  46. package/src/commands/project/member/list.js +6 -6
  47. package/src/commands/spectral/download.js +8 -8
  48. package/src/commands/spectral/upload.js +10 -10
  49. package/src/config/index.js +27 -5
  50. package/src/format-readme.js +3 -2
  51. package/src/help.js +2 -2
  52. package/src/hooks/setup-config.js +11 -6
  53. package/src/index.js +2 -2
  54. package/src/requests/api.js +3 -3
  55. package/src/requests/domain.js +3 -3
  56. package/src/requests/project.js +2 -2
  57. package/src/requests/spec.js +5 -5
  58. package/src/requests/spectral.js +3 -3
  59. package/src/requests/standardization.js +4 -4
  60. package/src/support/command/base-command.js +10 -11
  61. package/src/support/command/base-validate-command.js +3 -3
  62. package/src/support/command/handle-response.js +7 -5
  63. package/src/support/command/parse-input.js +8 -6
  64. package/src/support/command/update-command.js +5 -5
  65. package/src/support/http/default-headers.js +1 -1
  66. package/src/support/http/header-templates.js +2 -2
  67. package/src/support/http/index.js +7 -7
  68. package/src/support/http/proxy-agent.js +4 -4
  69. package/src/support/inquirer/index.js +4 -4
  70. package/src/support/inquirer/prompt-templates.js +2 -2
  71. package/src/support/isOnPrem.js +4 -4
  72. package/src/template-strings/errors.js +2 -2
  73. package/src/template-strings/index.js +3 -3
  74. package/src/template-strings/info.js +6 -2
  75. package/src/utils/definitions.js +8 -6
  76. package/src/utils/general.js +3 -3
@@ -1,11 +1,11 @@
1
- const { Args } = require('@oclif/core')
2
- const { saveSpectralRuleset } = require('../../requests/spectral')
3
- const { getSpectralIdentifierArg, splitPathParams } = require('../../support/command/parse-input')
4
- const BaseCommand = require('../../support/command/base-command')
5
- const { PassThrough } = require('stream')
6
- const { pipeAsync } = require('../../utils/general')
7
- const archiver = require('archiver')
8
- const { getResponseContent } = require('../../support/command/handle-response')
1
+ import { Args } from '@oclif/core'
2
+ import { saveSpectralRuleset } from '../../requests/spectral.js'
3
+ import { getSpectralIdentifierArg, splitPathParams } from '../../support/command/parse-input.js'
4
+ import BaseCommand from '../../support/command/base-command.js'
5
+ import { PassThrough } from 'stream'
6
+ import { pipeAsync } from '../../utils/general.js'
7
+ import { ZipArchive } from 'archiver'
8
+ import { getResponseContent } from '../../support/command/handle-response.js'
9
9
 
10
10
  class UploadSpectralRulesetCommand extends BaseCommand {
11
11
  async run() {
@@ -17,7 +17,7 @@ class UploadSpectralRulesetCommand extends BaseCommand {
17
17
  }
18
18
 
19
19
  async zipTheDirectory(directoryPath) {
20
- const archive = archiver('zip', { zlib: { level: 9 } })
20
+ const archive = new ZipArchive({ zlib: { level: 9 } })
21
21
  const passthrough = new PassThrough()
22
22
 
23
23
  archive.directory(directoryPath, false)
@@ -56,4 +56,4 @@ UploadSpectralRulesetCommand.flags = {
56
56
  ...BaseCommand.flags
57
57
  }
58
58
 
59
- module.exports = UploadSpectralRulesetCommand
59
+ export default UploadSpectralRulesetCommand
@@ -1,5 +1,5 @@
1
- const fse = require('fs-extra') // We're not using {readSyncJSON, ...} expansion, since we want to mock it.
2
- const { mergeDeep, pick } = require('../utils/general')
1
+ import fs from 'node:fs'
2
+ import { mergeDeep, pick } from '../utils/general.js'
3
3
 
4
4
  const swaggerhubUrlRegex = new RegExp(/^https?:\/\/api\..*swaggerhub\.com$/)
5
5
  const environmentalKeys = ['SWAGGERHUB_URL', 'SWAGGERHUB_API_KEY']
@@ -9,14 +9,26 @@ const checkEnvOverrides = config => ({
9
9
  ...pick(process.env, environmentalKeys)
10
10
  })
11
11
 
12
+ const stripTrailingSlashes = config => (
13
+ typeof config.SWAGGERHUB_URL === 'string'
14
+ ? { ...config, SWAGGERHUB_URL: config.SWAGGERHUB_URL.replace(/\/+$/, '') }
15
+ : config
16
+ )
17
+
18
+ // A mutable object keeps file access stubbable in tests (ES module namespaces are frozen).
19
+ const fileIO = {
20
+ readJSON: filePath => JSON.parse(fs.readFileSync(filePath, 'utf8')),
21
+ writeJSON: (filePath, data) => fs.writeFileSync(filePath, `${JSON.stringify(data)}\n`)
22
+ }
23
+
12
24
  const getConfig = () => {
13
25
  const { configFilePath } = global
14
- return checkEnvOverrides(fse.readJSONSync(configFilePath))
26
+ return stripTrailingSlashes(checkEnvOverrides(fileIO.readJSON(configFilePath)))
15
27
  }
16
28
 
17
29
  const setConfig = update => {
18
30
  const { configFilePath } = global
19
- return fse.writeJSONSync(configFilePath, mergeDeep(fse.readJSONSync(configFilePath), update))
31
+ return fileIO.writeJSON(configFilePath, mergeDeep(fileIO.readJSON(configFilePath), update))
20
32
  }
21
33
 
22
34
  const isURLValid = () => {
@@ -27,8 +39,18 @@ const isURLValid = () => {
27
39
  url.hostname === 'localhost'
28
40
  }
29
41
 
30
- module.exports = {
42
+ // A mutable default export keeps these functions stubbable (ES module namespaces are frozen).
43
+ const config = {
44
+ fileIO,
31
45
  setConfig,
32
46
  getConfig,
33
47
  isURLValid
34
48
  }
49
+
50
+ export default config
51
+ export {
52
+ fileIO,
53
+ setConfig,
54
+ getConfig,
55
+ isURLValid
56
+ }
@@ -1,4 +1,5 @@
1
- const fs = require('fs')
1
+ import fs from 'fs'
2
+ import { fileURLToPath } from 'url'
2
3
 
3
4
  const removeArgsFromHeaders = line => {
4
5
  const words = line.split(' ')
@@ -33,6 +34,6 @@ const main = () => {
33
34
  }
34
35
  }
35
36
 
36
- if (require.main === module) {
37
+ if (process.argv[1] === fileURLToPath(import.meta.url)) {
37
38
  main()
38
39
  }
package/src/help.js CHANGED
@@ -1,6 +1,6 @@
1
- const { Help } = require('@oclif/core')
1
+ import { Help } from '@oclif/core'
2
2
 
3
- module.exports = class CustomHelp extends Help {
3
+ export default class CustomHelp extends Help {
4
4
 
5
5
  constructor(config, opts) {
6
6
  super(config, opts)
@@ -1,9 +1,14 @@
1
- const path = require('path')
2
- const { existsSync, outputJsonSync } = require('fs-extra')
3
- const { configDefaults } = require('../../package.json').oclif
4
- const { pipe } = require('../utils/general')
1
+ import path from 'path'
2
+ import fs, { existsSync } from 'node:fs'
3
+ import packageJson from '../../package.json' with { type: 'json' }
4
+ import { pipe } from '../utils/general.js'
5
5
 
6
- const createConfigFile = (filePath, config) => outputJsonSync(filePath, config, { mode: 0o600 })
6
+ const { configDefaults } = packageJson.oclif
7
+
8
+ const createConfigFile = (filePath, config) => {
9
+ fs.mkdirSync(path.dirname(filePath), { recursive: true })
10
+ fs.writeFileSync(filePath, `${JSON.stringify(config)}\n`, { mode: 0o600 })
11
+ }
7
12
 
8
13
  const createConfigPath = ({ configDir }) => path.join(configDir, 'config.json')
9
14
 
@@ -20,4 +25,4 @@ const SetupConfig = async ({ config: defaults }) => (
20
25
  pipe(setAsGlobalUserAgent, createConfigPath, setAsGlobalPath, initConfig)(defaults)
21
26
  )
22
27
 
23
- module.exports = SetupConfig
28
+ export default SetupConfig
package/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
- const { run } = require('@oclif/core')
2
- module.exports = { run }
1
+ import { run } from '@oclif/core'
2
+ export { run }
@@ -1,4 +1,4 @@
1
- const { getSpec, putSpec, postSpec, deleteSpec } = require('./spec')
1
+ import { getSpec, putSpec, postSpec, deleteSpec } from './spec.js'
2
2
 
3
3
  const getApi = (pathParams, queryParams, accept = 'json') =>
4
4
  getSpec('apis', pathParams, queryParams, accept)
@@ -12,9 +12,9 @@ const putApi = ({ pathParams, body }) =>
12
12
  const postApi = ({ pathParams, queryParams, body }) =>
13
13
  postSpec('apis', pathParams, queryParams, body)
14
14
 
15
- module.exports = {
15
+ export {
16
16
  getApi,
17
17
  deleteApi,
18
18
  putApi,
19
19
  postApi
20
- }
20
+ }
@@ -1,4 +1,4 @@
1
- const { getSpec, postSpec, deleteSpec } = require('./spec')
1
+ import { getSpec, postSpec, deleteSpec } from './spec.js'
2
2
 
3
3
  const getDomain = (pathParams, queryParams, accept = 'json') =>
4
4
  getSpec('domains', pathParams, queryParams, accept)
@@ -9,8 +9,8 @@ const deleteDomain = (pathParams, queryParams) =>
9
9
  const postDomain = ({ pathParams, queryParams, body }) =>
10
10
  postSpec('domains', pathParams, queryParams, body)
11
11
 
12
- module.exports = {
12
+ export {
13
13
  getDomain,
14
14
  deleteDomain,
15
15
  postDomain
16
- }
16
+ }
@@ -1,4 +1,4 @@
1
- const { getSpec, postSpec, deleteSpec, putSpec } = require('./spec')
1
+ import { getSpec, postSpec, deleteSpec, putSpec } from './spec.js'
2
2
 
3
3
  const getProject = (pathParams, queryParams, accept = 'json') =>
4
4
  getSpec('projects', pathParams, queryParams, accept)
@@ -12,7 +12,7 @@ const putProject = ({ pathParams, body }) =>
12
12
  const deleteProject = pathParams =>
13
13
  deleteSpec('projects', pathParams)
14
14
 
15
- module.exports = {
15
+ export {
16
16
  getProject,
17
17
  postProject,
18
18
  putProject,
@@ -1,6 +1,6 @@
1
- const config = require('../config')
2
- const http = require('../support/http')
3
- const { hasJsonStructure } = require('../utils/general')
1
+ import config from '../config/index.js'
2
+ import http from '../support/http/index.js'
3
+ import { hasJsonStructure } from '../utils/general.js'
4
4
 
5
5
  const getSpec = (specType, pathParams, queryParams, accept) => {
6
6
  const { SWAGGERHUB_URL, SWAGGERHUB_API_KEY } = config.getConfig()
@@ -49,9 +49,9 @@ const postSpec = (specType, pathParams, queryParams, body) => {
49
49
  })
50
50
  }
51
51
 
52
- module.exports = {
52
+ export {
53
53
  getSpec,
54
54
  deleteSpec,
55
55
  putSpec,
56
56
  postSpec
57
- }
57
+ }
@@ -1,5 +1,5 @@
1
- const config = require('../config')
2
- const http = require('../support/http')
1
+ import config from '../config/index.js'
2
+ import http from '../support/http/index.js'
3
3
 
4
4
  const saveSpectralRuleset = (pathParams, body) => {
5
5
  const { SWAGGERHUB_URL, SWAGGERHUB_API_KEY } = config.getConfig()
@@ -24,7 +24,7 @@ const getSpectralRuleset = pathParams => {
24
24
  })
25
25
  }
26
26
 
27
- module.exports = {
27
+ export {
28
28
  saveSpectralRuleset,
29
29
  getSpectralRuleset
30
30
  }
@@ -1,6 +1,6 @@
1
- const config = require('../config')
2
- const http = require('../support/http')
3
- const { hasJsonStructure } = require('../utils/general')
1
+ import config from '../config/index.js'
2
+ import http from '../support/http/index.js'
3
+ import { hasJsonStructure } from '../utils/general.js'
4
4
 
5
5
  const postStandardization = (pathParams, body) => {
6
6
  const { SWAGGERHUB_URL, SWAGGERHUB_API_KEY } = config.getConfig()
@@ -27,7 +27,7 @@ const getStandardization = (pathParams, queryParams) => {
27
27
  })
28
28
  }
29
29
 
30
- module.exports = {
30
+ export {
31
31
  postStandardization,
32
32
  getStandardization
33
33
  }
@@ -1,17 +1,16 @@
1
- const { Command, Flags } = require('@oclif/core')
2
- const { capitalise, pipeAsync } = require('../../utils/general')
3
- const { infoMsg, errorMsg } = require('../../template-strings')
4
- const { getApi } = require('../../requests/api')
5
- const { getDomain } = require('../../requests/domain')
6
- const { getResponseContent } = require('./handle-response')
7
-
8
- const config = require('../../config')
9
- const {
1
+ import { Command, Flags } from '@oclif/core'
2
+ import { capitalise, pipeAsync } from '../../utils/general.js'
3
+ import { infoMsg, errorMsg } from '../../template-strings/index.js'
4
+ import { getApi } from '../../requests/api.js'
5
+ import { getDomain } from '../../requests/domain.js'
6
+ import {
7
+ getResponseContent,
10
8
  parseResponse,
11
9
  checkForErrors,
12
10
  handleErrors,
13
11
  filterResponseMessaging
14
- } = require('./handle-response')
12
+ } from './handle-response.js'
13
+ import config from '../../config/index.js'
15
14
 
16
15
  const versionResponse = content => JSON.parse(content).version
17
16
 
@@ -88,4 +87,4 @@ BaseCommand.flags = {
88
87
  help: Flags.help({ char: 'h' })
89
88
  }
90
89
 
91
- module.exports = BaseCommand
90
+ export default BaseCommand
@@ -1,5 +1,5 @@
1
- const { Flags, ux } = require('@oclif/core')
2
- const BaseCommand = require('../../support/command/base-command')
1
+ import { Flags, ux } from '@oclif/core'
2
+ import BaseCommand from '../../support/command/base-command.js'
3
3
 
4
4
  class BaseValidateCommand extends BaseCommand {
5
5
 
@@ -37,4 +37,4 @@ BaseValidateCommand.flags = {
37
37
  }),
38
38
  ...BaseCommand.flags
39
39
  }
40
- module.exports = BaseValidateCommand
40
+ export default BaseValidateCommand
@@ -1,6 +1,8 @@
1
- const { CLIError } = require('@oclif/core').Errors
2
- const { hasJsonStructure, isError } = require('../../utils/general')
3
- const { errorMsg } = require('../../template-strings')
1
+ import { Errors } from '@oclif/core'
2
+ import { hasJsonStructure, isError } from '../../utils/general.js'
3
+ import { errorMsg } from '../../template-strings/index.js'
4
+
5
+ const { CLIError } = Errors
4
6
 
5
7
  const parseResponse = response => new Promise(resolve => {
6
8
 
@@ -60,10 +62,10 @@ const handleErrors = error => {
60
62
  throw new CLIError(cliError)
61
63
  }
62
64
 
63
- module.exports = {
65
+ export {
64
66
  parseResponse,
65
67
  checkForErrors,
66
68
  getResponseContent,
67
69
  handleErrors,
68
70
  filterResponseMessaging
69
- }
71
+ }
@@ -1,7 +1,9 @@
1
- const { existsSync, readFileSync } = require('fs-extra')
2
- const { hasJsonStructure } = require('../../utils/general')
3
- const { CLIError } = require('@oclif/core').Errors
4
- const { errorMsg } = require('../../template-strings')
1
+ import { existsSync, readFileSync } from 'node:fs'
2
+ import { hasJsonStructure } from '../../utils/general.js'
3
+ import { Errors } from '@oclif/core'
4
+ import { errorMsg } from '../../template-strings/index.js'
5
+
6
+ const { CLIError } = Errors
5
7
 
6
8
  const noVersionRegex = new RegExp(/^\/?[\w\-.]+\/[\w\-.]+$/)
7
9
  const apiNameRegex = new RegExp(/^[\w\-.]+$/)
@@ -88,7 +90,7 @@ const reqType = ({ json }) => json ? 'json' : 'yaml'
88
90
 
89
91
  const resolvedParam = ({ resolved }) => resolved ? { resolved: true } : null
90
92
 
91
- module.exports = {
93
+ export {
92
94
  getApiIdentifierArg,
93
95
  apiNameRegex,
94
96
  noVersionRegex,
@@ -102,4 +104,4 @@ module.exports = {
102
104
  reqType,
103
105
  resolvedParam,
104
106
  isValidIdentifier
105
- }
107
+ }
@@ -1,7 +1,7 @@
1
- const BaseCommand = require('./base-command')
2
- const { putSpec } = require('../../requests/spec')
3
- const { handleErrors } = require('./handle-response')
4
- const inquirer = require('inquirer')
1
+ import BaseCommand from './base-command.js'
2
+ import { putSpec } from '../../requests/spec.js'
3
+ import { handleErrors } from './handle-response.js'
4
+ import inquirer from 'inquirer'
5
5
 
6
6
  class UpdateCommand extends BaseCommand {
7
7
 
@@ -84,4 +84,4 @@ class UpdateCommand extends BaseCommand {
84
84
  }
85
85
  }
86
86
 
87
- module.exports = UpdateCommand
87
+ export default UpdateCommand
@@ -1,3 +1,3 @@
1
- module.exports = () => ({
1
+ export default () => ({
2
2
  'User-Agent': global.shUserAgent
3
3
  })
@@ -1,4 +1,4 @@
1
- const { wrapTemplates } = require('../../utils/general')
1
+ import { wrapTemplates } from '../../utils/general.js'
2
2
 
3
3
  const accept = {
4
4
  'Accept': 'application/{{accept}}'
@@ -12,7 +12,7 @@ const contentType = {
12
12
  'Content-Type': 'application/{{contentType}}'
13
13
  }
14
14
 
15
- module.exports = wrapTemplates({
15
+ export default wrapTemplates({
16
16
  accept,
17
17
  auth,
18
18
  contentType
@@ -1,10 +1,10 @@
1
- const fetch = require('node-fetch')
2
- const qs = require('querystring')
3
- const headerTemplates = require('./header-templates')
4
- const defaultHeaders = require('./default-headers')
5
- const { agentFor } = require('./proxy-agent')
1
+ import fetch from 'node-fetch'
2
+ import qs from 'querystring'
3
+ import headerTemplates from './header-templates.js'
4
+ import defaultHeaders from './default-headers.js'
5
+ import { agentFor } from './proxy-agent.js'
6
6
 
7
- const { pipe, pick, omit } = require('../../utils/general')
7
+ import { pipe, pick, omit } from '../../utils/general.js'
8
8
 
9
9
  const buildHeaders = options => Object.keys(options)
10
10
  .reduce((obj, key) => ({
@@ -37,6 +37,6 @@ const parseHeaders = options => {
37
37
 
38
38
  const request = ({ url, ...options }) => fetch(url, { agent: agentFor, ...options })
39
39
 
40
- module.exports = options => (
40
+ export default options => (
41
41
  pipe(parseQuery, parseUrl, parseHeaders, request)(options)
42
42
  )
@@ -1,6 +1,6 @@
1
- const { getProxyForUrl } = require('proxy-from-env')
2
- const { HttpsProxyAgent } = require('https-proxy-agent')
3
- const { HttpProxyAgent } = require('http-proxy-agent')
1
+ import { getProxyForUrl } from 'proxy-from-env'
2
+ import { HttpsProxyAgent } from 'https-proxy-agent'
3
+ import { HttpProxyAgent } from 'http-proxy-agent'
4
4
 
5
5
  const normalizeProxy = proxy => {
6
6
  try {
@@ -22,4 +22,4 @@ const agentFor = parsedUrl => {
22
22
  new HttpProxyAgent(proxyUrl)
23
23
  }
24
24
 
25
- module.exports = { agentFor }
25
+ export { agentFor }
@@ -1,9 +1,9 @@
1
- const promptTemplates = require('./prompt-templates')
1
+ import promptTemplates from './prompt-templates.js'
2
2
 
3
- const getPrompts = prompts => (
4
- (options = {}) => prompts.map(p => promptTemplates[p](options))
3
+ const getPrompts = (prompts, templates = promptTemplates) => (
4
+ (options = {}) => prompts.map(p => templates[p](options))
5
5
  )
6
6
 
7
- module.exports = {
7
+ export {
8
8
  getPrompts
9
9
  }
@@ -1,4 +1,4 @@
1
- const { wrapTemplates } = require('../../utils/general')
1
+ import { wrapTemplates } from '../../utils/general.js'
2
2
 
3
3
  const swaggerHubUrl = {
4
4
  name: 'SWAGGERHUB_URL',
@@ -12,7 +12,7 @@ const apiKey = {
12
12
  default: '{{SWAGGERHUB_API_KEY}}'
13
13
  }
14
14
 
15
- module.exports = wrapTemplates({
15
+ export default wrapTemplates({
16
16
  swaggerHubUrl,
17
17
  apiKey
18
18
  })
@@ -1,10 +1,10 @@
1
- const config = require('../config')
1
+ import { getConfig } from '../config/index.js'
2
2
 
3
3
  const isOnPrem = () => {
4
- const { SWAGGERHUB_URL } = config.getConfig()
4
+ const { SWAGGERHUB_URL } = getConfig()
5
5
  return !SWAGGERHUB_URL.endsWith('swaggerhub.com')
6
6
  }
7
7
 
8
- module.exports = {
8
+ export {
9
9
  isOnPrem
10
- }
10
+ }
@@ -1,4 +1,4 @@
1
- const { wrapTemplates } = require('../utils/general')
1
+ import { wrapTemplates } from '../utils/general.js'
2
2
 
3
3
  const errorMsg = {
4
4
  ApiCreate: 'API version \'{{owner}}/{{name}}/{{version}}\' already exists in Swagger',
@@ -28,6 +28,6 @@ const errorMsg = {
28
28
  unknown: 'Unknown error',
29
29
  }
30
30
 
31
- module.exports = wrapTemplates({
31
+ export default wrapTemplates({
32
32
  ...errorMsg
33
33
  })
@@ -1,7 +1,7 @@
1
- const errorMsg = require('./errors')
2
- const infoMsg = require('./info')
1
+ import errorMsg from './errors.js'
2
+ import infoMsg from './info.js'
3
3
 
4
- module.exports = {
4
+ export {
5
5
  errorMsg,
6
6
  infoMsg
7
7
  }
@@ -1,4 +1,4 @@
1
- const { wrapTemplates } = require('../utils/general')
1
+ import { wrapTemplates } from '../utils/general.js'
2
2
 
3
3
  const infoMsg = {
4
4
  ApiCreate: 'Created API \'{{owner}}/{{name}}\'',
@@ -9,8 +9,12 @@ const infoMsg = {
9
9
 
10
10
  ApiClone: 'Cloned API \'{{apiPath}}\' as version {{newVersion}}',
11
11
 
12
+ ApiFork: 'Forked API \'{{apiPath}}\' as \'{{forkPath}}\'',
13
+
12
14
  DomainClone: 'Cloned domain \'{{domainPath}}\' as version {{newVersion}}',
13
15
 
16
+ DomainFork: 'Forked domain \'{{domainPath}}\' as \'{{forkPath}}\'',
17
+
14
18
  DomainRename: 'Renamed domain \'{{domainPath}}\' to \'{{newName}}\'',
15
19
 
16
20
  DomainCreate: 'Created domain \'{{owner}}/{{name}}\'',
@@ -69,6 +73,6 @@ const infoMsg = {
69
73
 
70
74
  }
71
75
 
72
- module.exports = wrapTemplates({
76
+ export default wrapTemplates({
73
77
  ...infoMsg
74
78
  })
@@ -1,8 +1,10 @@
1
- const { CLIError } = require('@oclif/core').Errors
2
- const { hasJsonStructure } = require('./general')
3
- const yaml = require('js-yaml')
4
- const { existsSync, readFileSync } = require('fs-extra')
5
- const { errorMsg } = require('../template-strings')
1
+ import { Errors } from '@oclif/core'
2
+ import { hasJsonStructure } from './general.js'
3
+ import * as yaml from 'js-yaml'
4
+ import { existsSync, readFileSync } from 'node:fs'
5
+ import { errorMsg } from '../template-strings/index.js'
6
+
7
+ const { CLIError } = Errors
6
8
 
7
9
  const specVersionToSpecification = specVersion => {
8
10
  if (/2.0$/.test(specVersion))
@@ -44,7 +46,7 @@ const parseDefinition = filename => {
44
46
  }
45
47
  }
46
48
 
47
- module.exports = {
49
+ export {
48
50
  getSpecification,
49
51
  getVersion,
50
52
  parseDefinition,
@@ -1,5 +1,5 @@
1
- const deepExtend = require('deep-extend')
2
- const jsonTemplate = require('json-templates')
1
+ import deepExtend from 'deep-extend'
2
+ import jsonTemplate from 'json-templates'
3
3
 
4
4
  const pick = (object, keys) => {
5
5
  const newObject = {}
@@ -64,7 +64,7 @@ const prettyPrintJSON = str => {
64
64
  return JSON.stringify(result, null, 2)
65
65
  }
66
66
 
67
- module.exports = {
67
+ export {
68
68
  hasJsonStructure,
69
69
  prettyPrintJSON,
70
70
  isError,