netlify-cli 8.1.3 → 8.1.4

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 (191) hide show
  1. package/README.md +12 -13
  2. package/bin/run +38 -2
  3. package/npm-shrinkwrap.json +1052 -7693
  4. package/package.json +12 -36
  5. package/scripts/postinstall.js +13 -0
  6. package/src/commands/addons/addons-auth.js +50 -0
  7. package/src/commands/addons/addons-config.js +180 -0
  8. package/src/commands/addons/addons-create.js +131 -0
  9. package/src/commands/addons/addons-delete.js +60 -0
  10. package/src/commands/addons/addons-list.js +62 -0
  11. package/src/commands/addons/addons.js +44 -0
  12. package/src/commands/addons/index.js +3 -24
  13. package/src/commands/api/api.js +75 -0
  14. package/src/commands/api/index.js +5 -0
  15. package/src/commands/base-command.js +502 -0
  16. package/src/commands/build/build.js +58 -0
  17. package/src/commands/build/index.js +3 -61
  18. package/src/commands/completion/completion.js +56 -0
  19. package/src/commands/completion/index.js +5 -0
  20. package/src/commands/{deploy.js → deploy/deploy.js} +295 -275
  21. package/src/commands/deploy/index.js +5 -0
  22. package/src/commands/dev/dev-exec.js +35 -0
  23. package/src/commands/dev/dev-trace.js +47 -0
  24. package/src/commands/dev/dev.js +340 -0
  25. package/src/commands/dev/index.js +3 -335
  26. package/src/commands/env/env-get.js +51 -0
  27. package/src/commands/env/env-import.js +93 -0
  28. package/src/commands/env/env-list.js +63 -0
  29. package/src/commands/env/env-set.js +67 -0
  30. package/src/commands/env/env-unset.js +66 -0
  31. package/src/commands/env/env.js +42 -0
  32. package/src/commands/env/index.js +3 -23
  33. package/src/commands/functions/functions-build.js +59 -0
  34. package/src/commands/functions/{create.js → functions-create.js} +130 -94
  35. package/src/commands/functions/functions-invoke.js +273 -0
  36. package/src/commands/functions/functions-list.js +106 -0
  37. package/src/commands/functions/functions-serve.js +63 -0
  38. package/src/commands/functions/functions.js +47 -0
  39. package/src/commands/functions/index.js +3 -45
  40. package/src/commands/index.js +7 -0
  41. package/src/commands/init/index.js +6 -0
  42. package/src/commands/{init.js → init/init.js} +79 -68
  43. package/src/commands/link/index.js +6 -0
  44. package/src/{utils/link/link-by-prompt.js → commands/link/link.js} +141 -14
  45. package/src/commands/lm/index.js +3 -19
  46. package/src/commands/lm/lm-info.js +42 -0
  47. package/src/commands/lm/lm-install.js +33 -0
  48. package/src/commands/lm/lm-setup.js +106 -0
  49. package/src/commands/lm/lm-uninstall.js +25 -0
  50. package/src/commands/lm/lm.js +34 -0
  51. package/src/commands/login/index.js +6 -0
  52. package/src/commands/login/login.js +55 -0
  53. package/src/commands/logout/index.js +5 -0
  54. package/src/commands/logout/logout.js +43 -0
  55. package/src/commands/main.js +206 -0
  56. package/src/commands/open/index.js +3 -39
  57. package/src/commands/open/open-admin.js +60 -0
  58. package/src/commands/open/open-site.js +53 -0
  59. package/src/commands/open/open.js +40 -0
  60. package/src/commands/sites/index.js +5 -20
  61. package/src/commands/sites/sites-create.js +187 -0
  62. package/src/commands/sites/sites-delete.js +104 -0
  63. package/src/commands/sites/sites-list.js +90 -0
  64. package/src/commands/sites/sites.js +32 -0
  65. package/src/commands/status/index.js +3 -118
  66. package/src/commands/status/status-hooks.js +69 -0
  67. package/src/commands/status/status.js +124 -0
  68. package/src/commands/switch/index.js +5 -0
  69. package/src/commands/switch/switch.js +50 -0
  70. package/src/commands/unlink/index.js +5 -0
  71. package/src/commands/unlink/unlink.js +48 -0
  72. package/src/commands/watch/index.js +5 -0
  73. package/src/commands/watch/watch.js +131 -0
  74. package/src/functions-templates/javascript/stripe-charge/package-lock.json +6 -6
  75. package/src/functions-templates/javascript/stripe-subscription/package-lock.json +6 -6
  76. package/src/lib/build.js +21 -7
  77. package/src/lib/completion/constants.js +6 -0
  78. package/src/lib/completion/generate-autocompletion.js +36 -0
  79. package/src/lib/completion/index.js +5 -0
  80. package/src/lib/completion/script.js +72 -0
  81. package/src/lib/exec-fetcher.js +5 -3
  82. package/src/lib/fs.js +54 -36
  83. package/src/lib/functions/background.js +1 -1
  84. package/src/lib/functions/form-submissions-handler.js +2 -1
  85. package/src/lib/functions/local-proxy.js +2 -1
  86. package/src/lib/functions/netlify-function.js +4 -1
  87. package/src/lib/functions/registry.js +4 -6
  88. package/src/lib/functions/runtimes/go/index.js +2 -1
  89. package/src/lib/functions/runtimes/js/builders/netlify-lambda.js +6 -4
  90. package/src/lib/functions/runtimes/js/builders/zisi.js +3 -3
  91. package/src/lib/functions/runtimes/rust/index.js +4 -3
  92. package/src/lib/functions/server.js +2 -3
  93. package/src/lib/functions/synchronous.js +2 -1
  94. package/src/lib/functions/utils.js +2 -3
  95. package/src/lib/functions/watcher.js +1 -0
  96. package/src/lib/http-agent.js +5 -5
  97. package/src/lib/log.js +2 -1
  98. package/src/lib/settings.js +16 -1
  99. package/src/lib/spinner.js +22 -0
  100. package/src/utils/addons/diffs/index.js +1 -0
  101. package/src/utils/addons/diffs/options.js +3 -1
  102. package/src/utils/addons/prepare.js +13 -6
  103. package/src/utils/addons/prompts.js +2 -1
  104. package/src/utils/addons/render.js +3 -1
  105. package/src/utils/command-helpers.js +136 -42
  106. package/src/utils/create-stream-promise.js +5 -5
  107. package/src/utils/deferred.js +1 -0
  108. package/src/utils/deploy/deploy-site.js +1 -1
  109. package/src/utils/deploy/index.js +4 -0
  110. package/src/utils/detect-server-settings.js +10 -12
  111. package/src/utils/dev.js +18 -10
  112. package/src/utils/dot-env.js +4 -2
  113. package/src/utils/{edge-handlers.js → functions/edge-handlers.js} +8 -7
  114. package/src/utils/functions/functions.js +36 -0
  115. package/src/utils/{get-functions.js → functions/get-functions.js} +2 -1
  116. package/src/utils/functions/index.js +8 -26
  117. package/src/utils/get-global-config.js +3 -2
  118. package/src/utils/get-repo-data.js +8 -1
  119. package/src/utils/gh-auth.js +1 -0
  120. package/src/utils/gitignore.js +7 -5
  121. package/src/utils/headers.js +1 -2
  122. package/src/utils/index.js +42 -0
  123. package/src/utils/init/config-github.js +12 -5
  124. package/src/utils/init/config-manual.js +9 -2
  125. package/src/utils/init/config.js +13 -7
  126. package/src/utils/init/frameworks.js +1 -0
  127. package/src/utils/init/node-version.js +4 -2
  128. package/src/utils/init/utils.js +10 -6
  129. package/src/utils/live-tunnel.js +3 -4
  130. package/src/utils/lm/install.js +10 -15
  131. package/src/utils/lm/requirements.js +3 -1
  132. package/src/utils/lm/steps.js +1 -1
  133. package/src/utils/lm/ui.js +7 -3
  134. package/src/utils/open-browser.js +8 -2
  135. package/src/utils/parse-raw-flags.js +4 -4
  136. package/src/utils/proxy.js +6 -5
  137. package/src/utils/read-repo-url.js +1 -0
  138. package/src/utils/redirects.js +2 -2
  139. package/src/utils/rules-proxy.js +2 -1
  140. package/src/utils/state-config.js +1 -1
  141. package/src/utils/telemetry/index.js +2 -113
  142. package/src/utils/telemetry/request.js +3 -1
  143. package/src/utils/telemetry/telemetry.js +117 -0
  144. package/src/utils/telemetry/validation.js +13 -12
  145. package/src/utils/traffic-mesh.js +3 -3
  146. package/oclif.manifest.json +0 -1
  147. package/src/commands/addons/auth.js +0 -42
  148. package/src/commands/addons/config.js +0 -177
  149. package/src/commands/addons/create.js +0 -127
  150. package/src/commands/addons/delete.js +0 -69
  151. package/src/commands/addons/list.js +0 -54
  152. package/src/commands/api.js +0 -84
  153. package/src/commands/dev/exec.js +0 -32
  154. package/src/commands/dev/trace.js +0 -61
  155. package/src/commands/env/get.js +0 -44
  156. package/src/commands/env/import.js +0 -90
  157. package/src/commands/env/list.js +0 -49
  158. package/src/commands/env/set.js +0 -64
  159. package/src/commands/env/unset.js +0 -58
  160. package/src/commands/functions/build.js +0 -60
  161. package/src/commands/functions/invoke.js +0 -277
  162. package/src/commands/functions/list.js +0 -102
  163. package/src/commands/functions/serve.js +0 -70
  164. package/src/commands/link.js +0 -133
  165. package/src/commands/lm/info.js +0 -36
  166. package/src/commands/lm/install.js +0 -30
  167. package/src/commands/lm/setup.js +0 -107
  168. package/src/commands/lm/uninstall.js +0 -17
  169. package/src/commands/login.js +0 -54
  170. package/src/commands/logout.js +0 -37
  171. package/src/commands/open/admin.js +0 -51
  172. package/src/commands/open/site.js +0 -43
  173. package/src/commands/sites/create.js +0 -191
  174. package/src/commands/sites/delete.js +0 -116
  175. package/src/commands/sites/list.js +0 -84
  176. package/src/commands/status/hooks.js +0 -60
  177. package/src/commands/switch.js +0 -44
  178. package/src/commands/unlink.js +0 -38
  179. package/src/commands/watch.js +0 -115
  180. package/src/hooks/init.js +0 -46
  181. package/src/index.js +0 -25
  182. package/src/lib/help.js +0 -26
  183. package/src/utils/chalk.js +0 -16
  184. package/src/utils/check-command-inputs.js +0 -21
  185. package/src/utils/command.js +0 -261
  186. package/src/utils/detect-functions-builder.js +0 -25
  187. package/src/utils/difference.js +0 -4
  188. package/src/utils/header.js +0 -18
  189. package/src/utils/logo.js +0 -11
  190. package/src/utils/show-help.js +0 -5
  191. package/src/utils/telemetry/tracked-command.js +0 -51
@@ -1,84 +0,0 @@
1
- const { flags: flagsLib } = require('@oclif/command')
2
- const chalk = require('chalk')
3
- const { cli } = require('cli-ux')
4
-
5
- const { listSites } = require('../../lib/api')
6
- const Command = require('../../utils/command')
7
- const { log, logJson } = require('../../utils/command-helpers')
8
-
9
- class SitesListCommand extends Command {
10
- async run() {
11
- const { flags } = this.parse(SitesListCommand)
12
-
13
- const { api } = this.netlify
14
- if (!flags.json) {
15
- cli.action.start('Loading your sites')
16
- }
17
- await this.authenticate()
18
-
19
- const sites = await listSites({ api, options: { filter: 'all' } })
20
- if (!flags.json) {
21
- cli.action.stop()
22
- }
23
-
24
- if (sites && sites.length !== 0) {
25
- const logSites = sites.map((site) => {
26
- const siteInfo = {
27
- id: site.id,
28
- name: site.name,
29
- ssl_url: site.ssl_url,
30
- account_name: site.account_name,
31
- }
32
-
33
- if (site.build_settings && site.build_settings.repo_url) {
34
- siteInfo.repo_url = site.build_settings.repo_url
35
- }
36
-
37
- return siteInfo
38
- })
39
-
40
- // Json response for piping commands
41
- if (flags.json) {
42
- const redactedSites = sites.map((site) => {
43
- if (site && site.build_settings) {
44
- delete site.build_settings.env
45
- }
46
- return site
47
- })
48
- logJson(redactedSites)
49
- return false
50
- }
51
-
52
- log(`
53
- ────────────────────────────┐
54
- Current Netlify Sites │
55
- ────────────────────────────┘
56
-
57
- Count: ${logSites.length}
58
- `)
59
-
60
- logSites.forEach((logSite) => {
61
- log(`${chalk.greenBright(logSite.name)} - ${logSite.id}`)
62
- log(` ${chalk.whiteBright.bold('url:')} ${chalk.yellowBright(logSite.ssl_url)}`)
63
- if (logSite.repo_url) {
64
- log(` ${chalk.whiteBright.bold('repo:')} ${chalk.white(logSite.repo_url)}`)
65
- }
66
- if (logSite.account_name) {
67
- log(` ${chalk.whiteBright.bold('account:')} ${chalk.white(logSite.account_name)}`)
68
- }
69
- log(`─────────────────────────────────────────────────`)
70
- })
71
- }
72
- }
73
- }
74
-
75
- SitesListCommand.description = `List all sites you have access to`
76
-
77
- SitesListCommand.flags = {
78
- json: flagsLib.boolean({
79
- description: 'Output site data as JSON',
80
- }),
81
- ...SitesListCommand.flags,
82
- }
83
-
84
- module.exports = SitesListCommand
@@ -1,60 +0,0 @@
1
- const { get } = require('dot-prop')
2
- const prettyjson = require('prettyjson')
3
-
4
- const Command = require('../../utils/command')
5
- const { error, log, warn } = require('../../utils/command-helpers')
6
-
7
- class StatusHooksCommand extends Command {
8
- async run() {
9
- const { api, site } = this.netlify
10
-
11
- await this.authenticate()
12
-
13
- const siteId = site.id
14
- if (!siteId) {
15
- warn('Did you run `netlify link` yet?')
16
- error(`You don't appear to be in a folder that is linked to a site`)
17
- }
18
-
19
- let siteData
20
- try {
21
- siteData = await api.getSite({ siteId })
22
- } catch (error_) {
23
- // unauthorized
24
- if (error_.status === 401) {
25
- warn(`Log in with a different account or re-link to a site you have permission for`)
26
- error(`Not authorized to view the currently linked site (${siteId})`)
27
- }
28
- // missing
29
- if (error_.status === 404) {
30
- error(`The site this folder is linked to can't be found`)
31
- }
32
- error(error_)
33
- }
34
-
35
- const ntlHooks = await api.listHooksBySiteId({ siteId: siteData.id })
36
- const data = {
37
- site: siteData.name,
38
- hooks: {},
39
- }
40
- ntlHooks.forEach((hook) => {
41
- data.hooks[hook.id] = {
42
- type: hook.type,
43
- event: hook.event,
44
- id: hook.id,
45
- disabled: hook.disabled,
46
- }
47
- if (get(siteData, 'build_settings.repo_url')) {
48
- data.hooks[hook.id].repo_url = get(siteData, 'build_settings.repo_url')
49
- }
50
- })
51
- log(`─────────────────┐
52
- Site Hook Status │
53
- ─────────────────┘`)
54
- log(prettyjson.render(data))
55
- }
56
- }
57
-
58
- StatusHooksCommand.description = `Print hook information of the linked site`
59
-
60
- module.exports = StatusHooksCommand
@@ -1,44 +0,0 @@
1
- const chalk = require('chalk')
2
- const inquirer = require('inquirer')
3
-
4
- const Command = require('../utils/command')
5
- const { exit, log } = require('../utils/command-helpers')
6
-
7
- const LoginCommand = require('./login')
8
-
9
- class SwitchCommand extends Command {
10
- async run() {
11
- const LOGIN_NEW = 'I would like to login to a new account'
12
- const availableUsersChoices = Object.values(this.netlify.globalConfig.get('users')).reduce(
13
- (prev, current) =>
14
- Object.assign(prev, { [current.id]: current.name ? `${current.name} (${current.email})` : current.email }),
15
- {},
16
- )
17
-
18
- const { accountSwitchChoice } = await inquirer.prompt([
19
- {
20
- type: 'list',
21
- name: 'accountSwitchChoice',
22
- message: 'Please select the account you want to use:',
23
- choices: [...Object.entries(availableUsersChoices).map(([, val]) => val), LOGIN_NEW],
24
- },
25
- ])
26
-
27
- if (accountSwitchChoice === LOGIN_NEW) {
28
- await LoginCommand.run(['--new'])
29
- } else {
30
- const selectedAccount = Object.entries(availableUsersChoices).find(
31
- ([, availableUsersChoice]) => availableUsersChoice === accountSwitchChoice,
32
- )
33
- this.netlify.globalConfig.set('userId', selectedAccount[0])
34
- log('')
35
- log(`You're now using ${chalk.bold(selectedAccount[1])}.`)
36
- }
37
-
38
- return exit()
39
- }
40
- }
41
-
42
- SwitchCommand.description = `Switch your active Netlify account`
43
-
44
- module.exports = SwitchCommand
@@ -1,38 +0,0 @@
1
- const Command = require('../utils/command')
2
- const { exit, log } = require('../utils/command-helpers')
3
- const { track } = require('../utils/telemetry')
4
-
5
- class UnlinkCommand extends Command {
6
- async run() {
7
- const { site, state } = this.netlify
8
- const siteId = site.id
9
-
10
- if (!siteId) {
11
- log(`Folder is not linked to a Netlify site. Run 'netlify link' to link it`)
12
- return exit()
13
- }
14
-
15
- let siteData = {}
16
- try {
17
- siteData = await this.netlify.api.getSite({ siteId })
18
- } catch (error) {
19
- // ignore errors if we can't get the site
20
- }
21
-
22
- state.delete('siteId')
23
-
24
- await track('sites_unlinked', {
25
- siteId: siteData.id || siteId,
26
- })
27
-
28
- if (site) {
29
- log(`Unlinked ${site.configPath} from ${siteData ? siteData.name : siteId}`)
30
- } else {
31
- log('Unlinked site')
32
- }
33
- }
34
- }
35
-
36
- UnlinkCommand.description = `Unlink a local folder from a Netlify site`
37
-
38
- module.exports = UnlinkCommand
@@ -1,115 +0,0 @@
1
- const { CLIError } = require('@oclif/errors')
2
- const chalk = require('chalk')
3
- const cli = require('cli-ux').default
4
- const pWaitFor = require('p-wait-for')
5
- const prettyjson = require('prettyjson')
6
-
7
- const Command = require('../utils/command')
8
- const { exit, log } = require('../utils/command-helpers')
9
-
10
- const InitCommand = require('./init')
11
-
12
- // 1 second
13
- const INIT_WAIT = 1e3
14
-
15
- class SitesWatchCommand extends Command {
16
- async run() {
17
- await this.authenticate()
18
- const client = this.netlify.api
19
- let siteId = this.netlify.site.id
20
-
21
- if (!siteId) {
22
- const siteData = await InitCommand.run([])
23
- siteId = siteData.id
24
- }
25
-
26
- // wait for 1 sec for everything to kickoff
27
- console.time('Deploy time')
28
- await cli.wait(INIT_WAIT)
29
-
30
- // Get latest commit and look for that
31
- // git rev-parse HEAD
32
-
33
- // if no sha, its a manual "triggered deploy"
34
- //
35
- // {
36
- // "id": "5b4e23db82d3f1780abd74f3",
37
- // "deploy_id": "5b4e23db82d3f1780abd74f2",
38
- // "sha": "pull/1/head",
39
- // "log": [],
40
- // "done": false,
41
- // "error": null,
42
- // "created_at": "2018-07-17T17:14:03.423Z"
43
- // }
44
- //
45
- cli.action.start('Waiting for active site deploys to complete')
46
- try {
47
- // Fetch all builds!
48
- // const builds = await client.listSiteBuilds({siteId})
49
- //
50
- // // Filter down to any that are not done
51
- // const buildsToWatch = builds.filter((build) => {
52
- // return !build.done
53
- // })
54
-
55
- const noActiveBuilds = await waitForBuildFinish(client, siteId)
56
-
57
- const siteData = await client.getSite({ siteId })
58
-
59
- const message = chalk.cyanBright.bold.underline(noActiveBuilds ? 'Last build' : 'Deploy complete')
60
- log()
61
- log(message)
62
- log(
63
- prettyjson.render({
64
- URL: siteData.ssl_url || siteData.url,
65
- Admin: siteData.admin_url,
66
- }),
67
- )
68
- console.timeEnd('Deploy time')
69
- } catch (error) {
70
- throw new CLIError(error)
71
- }
72
-
73
- exit()
74
- }
75
- }
76
-
77
- SitesWatchCommand.description = `Watch for site deploy to finish`
78
-
79
- SitesWatchCommand.examples = [`netlify watch`, `git push && netlify watch`]
80
-
81
- // 1 second
82
- const BUILD_FINISH_INTERVAL = 1e3
83
- // 20 minutes
84
- const BUILD_FINISH_TIMEOUT = 12e5
85
-
86
- const waitForBuildFinish = async function (api, siteId) {
87
- let firstPass = true
88
-
89
- const waitForBuildToFinish = async function () {
90
- const builds = await api.listSiteBuilds({ siteId })
91
- // build.error
92
- const currentBuilds = builds.filter((build) => !build.done)
93
-
94
- // if build.error
95
- // @TODO implement build error messages into this
96
-
97
- if (!currentBuilds || currentBuilds.length === 0) {
98
- cli.action.stop()
99
- return true
100
- }
101
- firstPass = false
102
- return false
103
- }
104
-
105
- await pWaitFor(waitForBuildToFinish, {
106
- interval: BUILD_FINISH_INTERVAL,
107
- timeout: BUILD_FINISH_TIMEOUT,
108
- message: 'Timeout while waiting for deploy to finish',
109
- })
110
-
111
- // return only when build done or timeout happens
112
- return firstPass
113
- }
114
-
115
- module.exports = SitesWatchCommand
package/src/hooks/init.js DELETED
@@ -1,46 +0,0 @@
1
- const process = require('process')
2
-
3
- const getGlobalConfig = require('../utils/get-global-config')
4
- const header = require('../utils/header')
5
- const { track } = require('../utils/telemetry')
6
-
7
- module.exports = async function initHooks(context) {
8
- const globalConfig = await getGlobalConfig()
9
- // Enable/disable telemetry Global flags. TODO refactor where these fire
10
- if (context.id === '--telemetry-disable') {
11
- globalConfig.set('telemetryDisabled', true)
12
- console.log('Netlify telemetry has been disabled')
13
- console.log('You can renable it anytime with the --telemetry-enable flag')
14
- process.exit()
15
- }
16
- if (context.id === '--telemetry-enable') {
17
- globalConfig.set('telemetryDisabled', false)
18
- console.log('Netlify telemetry has been enabled')
19
- console.log('You can disable it anytime with the --telemetry-disable flag')
20
- await track('user_telemetryEnabled')
21
- process.exit()
22
- }
23
-
24
- if (
25
- process.argv.length > 3 &&
26
- ['-v', '--version', 'version'].includes(process.argv[2]) &&
27
- process.argv[3] === '--verbose'
28
- ) {
29
- console.log(`────────────────────┐
30
- Environment Info │
31
- ────────────────────┘`)
32
-
33
- // performance optimization - load envinfo on demand
34
- // eslint-disable-next-line node/global-require
35
- const envinfo = require('envinfo')
36
- const data = await envinfo.run({
37
- System: ['OS', 'CPU'],
38
- Binaries: ['Node', 'Yarn', 'npm'],
39
- Browsers: ['Chrome', 'Edge', 'Firefox', 'Safari'],
40
- npmGlobalPackages: ['netlify-cli'],
41
- })
42
- console.log(data)
43
- }
44
-
45
- header(context)
46
- }
package/src/index.js DELETED
@@ -1,25 +0,0 @@
1
- const process = require('process')
2
-
3
- const updateNotifier = require('update-notifier')
4
-
5
- const pkg = require('../package.json')
6
-
7
- // 12 hours
8
- const UPDATE_CHECK_INTERVAL = 432e5
9
-
10
- // performance optimization to disable built in oclif TypeScript support
11
- // see https://github.com/oclif/config/blob/1066a42a61a71b9a0708a2beff498d2cbbb9a3fd/src/ts-node.ts#L51
12
- // oclif registers ts-node which can be quite slow
13
- process.env.OCLIF_TS_NODE = '0'
14
-
15
- try {
16
- updateNotifier({
17
- pkg,
18
- updateCheckInterval: UPDATE_CHECK_INTERVAL,
19
- }).notify()
20
- } catch (error) {
21
- console.log('Error checking for updates:')
22
- console.log(error)
23
- }
24
-
25
- module.exports = require('@oclif/command')
package/src/lib/help.js DELETED
@@ -1,26 +0,0 @@
1
- const Help = require('@oclif/plugin-help').default
2
-
3
- const isBetaPlugin = (id) => id === 'completion'
4
-
5
- const isHelpCommand = (id) => id === 'help'
6
-
7
- const formatDescription = (description, id) => {
8
- if (isBetaPlugin(id)) {
9
- return `(Beta) ${description}`
10
- }
11
-
12
- if (isHelpCommand(id)) {
13
- return 'Display help. To display help for a specific command run `netlify help [command]`'
14
- }
15
-
16
- return description
17
- }
18
-
19
- module.exports = class CustomHelp extends Help {
20
- constructor(config, opts = {}) {
21
- config.commands.forEach((command) => {
22
- command.description = formatDescription(command.description, command.id)
23
- })
24
- super(config, opts)
25
- }
26
- }
@@ -1,16 +0,0 @@
1
- const chalk = require('chalk')
2
-
3
- /**
4
- * Chalk instance for CLI
5
- * @param {boolean} noColors - disable chalk colors
6
- * @return {object} - default or custom chalk instance
7
- */
8
- const safeChalk = function (noColors) {
9
- if (noColors) {
10
- const colorlessChalk = new chalk.Instance({ level: 0 })
11
- return colorlessChalk
12
- }
13
- return chalk
14
- }
15
-
16
- module.exports = safeChalk
@@ -1,21 +0,0 @@
1
- // Checks for args or flags supplied to command
2
- const isEmptyCommand = function (flags, args) {
3
- if (!hasFlags(flags) && !hasArgs(args)) {
4
- return true
5
- }
6
- return false
7
- }
8
-
9
- const hasFlags = function (flags) {
10
- return Object.keys(flags).length
11
- }
12
-
13
- const hasArgs = function (args) {
14
- return Object.keys(args).length
15
- }
16
-
17
- module.exports = {
18
- hasFlags,
19
- hasArgs,
20
- isEmptyCommand,
21
- }