flowershow 0.0.10 → 0.0.11

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # flowershow
2
2
 
3
+ ## 0.0.11
4
+
5
+ ### Patch Changes
6
+
7
+ - Basic anonymous telemetry (OS, Flowershow version and command being run).
8
+
3
9
  ## 0.0.10
4
10
 
5
11
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "flowershow",
3
- "version": "0.0.10",
3
+ "version": "0.0.11",
4
4
  "description": "Publish your digital garden",
5
5
  "bin": {
6
6
  "flowershow": "src/bin/cli.js"
@@ -29,7 +29,8 @@
29
29
  "degit": "^2.8.4",
30
30
  "execa": "^6.1.0",
31
31
  "inquirer": "^9.1.1",
32
- "ora": "^6.1.2"
32
+ "ora": "^6.1.2",
33
+ "universal-analytics": "^0.5.3"
33
34
  },
34
35
  "type": "module",
35
36
  "engines": {
package/src/bin/cli.js CHANGED
@@ -1,20 +1,48 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire } from "node:module";
3
3
  const require = createRequire(import.meta.url);
4
- import { warn } from "../lib/utils/index.js";
4
+ import { warn, exit, sendEvent } from "../lib/utils/index.js";
5
+ import { Command } from "commander";
5
6
 
6
- import os from "os";
7
+ // TODO check current vs required node version (package.json engines)
8
+ // const requiredNodeVersion = require("../package.json").engines.node;
7
9
 
8
- if (os.platform() === "win32") {
10
+ const { version: cli } = require("../../package.json");
11
+ const { version: node, platform, argv } = process;
12
+
13
+ if (platform === "win32") {
9
14
  warn(
10
15
  "This may not work as expected. You're trying to run Flowreshow CLI on Windows, which is not thoroughly tested. Please submit an issue if you encounter any problems: https://github.com/flowershow/flowershow/issues"
11
16
  );
12
17
  }
13
18
 
14
- // TODO check current vs required node version (package.json engines)
15
- // const requiredNodeVersion = require("../package.json").engines.node;
19
+ const [, , cmd, ...args] = argv;
20
+ sendEvent({
21
+ event: "cli-usage",
22
+ action: cmd,
23
+ meta: {
24
+ args,
25
+ cli,
26
+ node,
27
+ platform,
28
+ },
29
+ });
16
30
 
17
- import { Command } from "commander";
31
+ process.on("uncaughtException", () => {
32
+ sendEvent({
33
+ event: "cli-error",
34
+ action: cmd,
35
+ meta: {
36
+ args,
37
+ cli,
38
+ node,
39
+ platform,
40
+ },
41
+ });
42
+ exit(1);
43
+ });
44
+
45
+ // CLI commands
18
46
 
19
47
  const program = new Command();
20
48
 
@@ -180,7 +180,9 @@ export default class Installer {
180
180
  const emitter = degit(templateRepo);
181
181
  await emitter.clone(flowershowDir);
182
182
  } catch {
183
- error(`Failed to create Flowershow template in ${flowershowDir}.`);
183
+ error(
184
+ `Failed to clone Flowershow template into ${flowershowDir}. This may be a problem with Flowershow. Please let us know about it by submitting an issue: https://github.com/flowershow/flowershow/issues.`
185
+ );
184
186
  exit(1);
185
187
  }
186
188
 
@@ -1,6 +1,7 @@
1
1
  export { error, info, log, success, warn } from "./logger.js";
2
2
  export { exit } from "./exit.js";
3
3
  export { isSubdir } from "./isSubdir.js";
4
+ export { sendEvent } from "./sendEvent.js";
4
5
  export {
5
6
  logWithSpinner,
6
7
  stopSpinner,
@@ -0,0 +1,7 @@
1
+ import ua from "universal-analytics";
2
+
3
+ const visitor = ua("UA-235099461-1");
4
+
5
+ export function sendEvent({ event, action, meta }) {
6
+ visitor.event(event, action, JSON.stringify(meta)).send();
7
+ }