@budibase/cli 1.3.19-alpha.0 → 1.3.19-alpha.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@budibase/cli",
3
- "version": "1.3.19-alpha.0",
3
+ "version": "1.3.19-alpha.1",
4
4
  "description": "Budibase CLI, for developers, self hosting and migrations.",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -26,9 +26,9 @@
26
26
  "outputPath": "build"
27
27
  },
28
28
  "dependencies": {
29
- "@budibase/backend-core": "1.3.19-alpha.0",
30
- "@budibase/string-templates": "1.3.19-alpha.0",
31
- "@budibase/types": "1.3.19-alpha.0",
29
+ "@budibase/backend-core": "1.3.19-alpha.1",
30
+ "@budibase/string-templates": "1.3.19-alpha.1",
31
+ "@budibase/types": "1.3.19-alpha.1",
32
32
  "axios": "0.21.2",
33
33
  "chalk": "4.1.0",
34
34
  "cli-progress": "3.11.2",
@@ -52,5 +52,5 @@
52
52
  "eslint": "^7.20.0",
53
53
  "renamer": "^4.0.0"
54
54
  },
55
- "gitHead": "04749bf93a17516f8f71d44b49995b2d50b080bb"
55
+ "gitHead": "9eb4995976ec00b40ba52df7d0bc357e8df6edce"
56
56
  }
package/src/constants.js CHANGED
@@ -1,3 +1,5 @@
1
+ const { Event } = require("@budibase/types")
2
+
1
3
  exports.CommandWords = {
2
4
  BACKUPS: "backups",
3
5
  HOSTING: "hosting",
@@ -15,6 +17,7 @@ exports.AnalyticsEvents = {
15
17
  OptOut: "analytics:opt:out",
16
18
  OptIn: "analytics:opt:in",
17
19
  SelfHostInit: "hosting:init",
20
+ PluginInit: Event.PLUGIN_INIT,
18
21
  }
19
22
 
20
23
  exports.POSTHOG_TOKEN = "phc_yGOn4i7jWKaCTapdGR6lfA4AvmuEQ2ijn5zAVSFYPlS"
package/src/events.js ADDED
@@ -0,0 +1,11 @@
1
+ const AnalyticsClient = require("./analytics/Client")
2
+
3
+ const client = new AnalyticsClient()
4
+
5
+ exports.captureEvent = (event, properties) => {
6
+ client.capture({
7
+ distinctId: "cli",
8
+ event,
9
+ properties,
10
+ })
11
+ }
@@ -13,7 +13,7 @@ const fs = require("fs")
13
13
  const compose = require("docker-compose")
14
14
  const makeEnv = require("./makeEnv")
15
15
  const axios = require("axios")
16
- const AnalyticsClient = require("../analytics/Client")
16
+ const { captureEvent } = require("../events")
17
17
 
18
18
  const BUDIBASE_SERVICES = ["app-service", "worker-service", "proxy-service"]
19
19
  const ERROR_FILE = "docker-error.log"
@@ -22,8 +22,6 @@ const FILE_URLS = [
22
22
  ]
23
23
  const DO_USER_DATA_URL = "http://169.254.169.254/metadata/v1/user-data"
24
24
 
25
- const client = new AnalyticsClient()
26
-
27
25
  async function downloadFiles() {
28
26
  const promises = []
29
27
  for (let url of FILE_URLS) {
@@ -72,12 +70,8 @@ async function init(type) {
72
70
  return
73
71
  }
74
72
  }
75
- client.capture({
76
- distinctId: "cli",
77
- event: AnalyticsEvents.SelfHostInit,
78
- properties: {
79
- type,
80
- },
73
+ captureEvent(AnalyticsEvents.SelfHostInit, {
74
+ type,
81
75
  })
82
76
  await downloadFiles()
83
77
  const config = isQuick ? makeEnv.QUICK_CONFIG : {}
@@ -1,5 +1,5 @@
1
1
  const Command = require("../structures/Command")
2
- const { CommandWords } = require("../constants")
2
+ const { CommandWords, AnalyticsEvents } = require("../constants")
3
3
  const { getSkeleton, fleshOutSkeleton } = require("./skeleton")
4
4
  const questions = require("../questions")
5
5
  const fs = require("fs")
@@ -8,6 +8,7 @@ const { validate } = require("@budibase/backend-core/plugins")
8
8
  const { runPkgCommand } = require("../exec")
9
9
  const { join } = require("path")
10
10
  const { success, error, info, moveDirectory } = require("../utils")
11
+ const { captureEvent } = require("../events")
11
12
 
12
13
  function checkInPlugin() {
13
14
  if (!fs.existsSync("package.json")) {
@@ -58,7 +59,7 @@ async function init(opts) {
58
59
  )
59
60
  return
60
61
  }
61
- const desc = await questions.string(
62
+ const description = await questions.string(
62
63
  "Description",
63
64
  `An amazing Budibase ${type}!`
64
65
  )
@@ -67,7 +68,7 @@ async function init(opts) {
67
68
  // get the skeleton
68
69
  console.log(info("Retrieving project..."))
69
70
  await getSkeleton(type, name)
70
- await fleshOutSkeleton(type, name, desc, version)
71
+ await fleshOutSkeleton(type, name, description, version)
71
72
  console.log(info("Installing dependencies..."))
72
73
  await runPkgCommand("install", join(process.cwd(), name))
73
74
  // if no parent directory desired move to cwd
@@ -77,6 +78,12 @@ async function init(opts) {
77
78
  } else {
78
79
  console.log(info(`Plugin created in directory "${name}"`))
79
80
  }
81
+ captureEvent(AnalyticsEvents.PluginInit, {
82
+ type,
83
+ name,
84
+ description,
85
+ version,
86
+ })
80
87
  }
81
88
 
82
89
  async function verify() {