dashcam 0.2.1 → 0.3.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/README.md +106 -72
- package/index.js +6 -8
- package/lib.js +10 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,76 +1,142 @@
|
|
|
1
|
-
<img src="https://user-images.githubusercontent.com/318295/204898620-922afee0-5415-46a9-a84f-ae6237001bf0.png" height="50" alt="
|
|
1
|
+
<img src="https://user-images.githubusercontent.com/318295/204898620-922afee0-5415-46a9-a84f-ae6237001bf0.png" height="50" alt="Dashcam"/>
|
|
2
2
|
|
|
3
|
-
#
|
|
3
|
+
# Dashcam API
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
Add Dashcam to your app or workflow. This package allows you to control the Dashcam desktop application from the via CLI SDK.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
> Why double-back when you can capture it the first time? Playback and share exactly what happened with Dashcam's desktop replay buffer.
|
|
8
8
|
|
|
9
|
-
You can easily embed desktop replays within git commits, pull requests, bug reports, jira tickets, and even within log files.
|
|
9
|
+
You can easily embed desktop replays within git commits, pull requests, bug reports, jira tickets, and even within log files. Desktop replays are a great way to share context behind problems and document the application state within logs, tickets and more.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
Requires that you [install Dashcam Desktop](https://dashcam.io). Dashcam Desktop runs in the background giving you access to a buffer of video.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
<p>Capture bugs with replayable. - Watch Video</p>
|
|
15
|
-
<img style="max-width:300px;" src="https://cdn.loom.com/sessions/thumbnails/ea9c2831013a4b5eb996bd47f8178f4e-with-play.gif">
|
|
16
|
-
</a>
|
|
13
|
+
## Table of contents
|
|
17
14
|
|
|
18
|
-
|
|
15
|
+
- [Dashcam API](#dashcam-api)
|
|
16
|
+
- [Install Dashcam Desktop](#install-dashcam-desktop)
|
|
17
|
+
- [Examples](#examples)
|
|
18
|
+
- [Web](#web)
|
|
19
|
+
- [Setup](#setup)
|
|
20
|
+
- [HTML Anchor Tag](#html-anchor-tag)
|
|
21
|
+
- [JS Error Handler](#js-error-handler)
|
|
22
|
+
- [NodeJS SDK](#nodejs-sdk)
|
|
23
|
+
- [Setup](#setup)
|
|
24
|
+
- [Create a Replay](#create-a-replay)
|
|
25
|
+
- [Error Handler](#error-handler)
|
|
26
|
+
- [CLI](#cli)
|
|
27
|
+
- [Setup](#setup)
|
|
28
|
+
- [Create a Replay](#create-a-replay)
|
|
29
|
+
- [Return a rich markdown link](#return-a-rich-markdown-link)
|
|
30
|
+
- [Set a replay title](#set-a-replay-title)
|
|
31
|
+
- [Attach the last 20 CLI commands to the replay](#attach-the-last-20-cli-commands-to-the-replay)
|
|
32
|
+
- [Attach a logfile to the replay](#attach-a-logfile-to-the-replay)
|
|
33
|
+
- [GitHub CLI](#github-cli)
|
|
34
|
+
- [Create a github issue with a replay in the description](#create-a-github-issue-with-a-replay-in-the-description)
|
|
35
|
+
- [Create a github pull request with a replay in the description](#create-a-github-pull-request-with-a-replay-in-the-description)
|
|
36
|
+
- [Append a 30 second replay to a commit](#append-a-30-second-replay-to-a-commit)
|
|
37
|
+
- [Advanced Usage](#advanced-usage)
|
|
38
|
+
- [Ideas](#ideas)
|
|
39
|
+
|
|
40
|
+
# Examples
|
|
41
|
+
|
|
42
|
+
Also see [the examples folder](https://github.com/replayableio/cli/tree/main/examples).
|
|
43
|
+
|
|
44
|
+
## Web
|
|
45
|
+
|
|
46
|
+
### Setup
|
|
19
47
|
|
|
20
|
-
|
|
48
|
+
Nothing! The app exposes the protocol to the system natively via `dashcam://`.
|
|
21
49
|
|
|
22
|
-
|
|
50
|
+
### HTML Anchor Tag
|
|
23
51
|
|
|
24
|
-
|
|
52
|
+
```html
|
|
53
|
+
<a href="dashcam://replay/create" target="_blank">Create a Replay</a>
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### JS Error Handler
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
window.onerror = function myErrorHandler() {
|
|
60
|
+
window.open("dashcam://replay/create", "_blank");
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
setTimeout(() => {
|
|
64
|
+
throw new Error("Throw makes it go boom!");
|
|
65
|
+
}, 3000);
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## NodeJS SDK
|
|
69
|
+
|
|
70
|
+
### Setup
|
|
25
71
|
|
|
26
72
|
```sh
|
|
27
|
-
npm install
|
|
73
|
+
npm install dashcam
|
|
28
74
|
```
|
|
29
75
|
|
|
30
|
-
|
|
76
|
+
### Create a Replay
|
|
31
77
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
- [Examples](#examples)
|
|
35
|
-
- [CLI](#cli)
|
|
36
|
-
- [GitHub CLI](#github-cli)
|
|
37
|
-
- [NodeJS SDK](#nodejs-sdk)
|
|
38
|
-
- [Javascript Integration](#javascript-integration)
|
|
39
|
-
- [Advanced Usage](#advanced-usage)
|
|
78
|
+
```js
|
|
79
|
+
const dashcam = require("dashcam");
|
|
40
80
|
|
|
41
|
-
|
|
81
|
+
let replay = await dashcam.createReplay({
|
|
82
|
+
title: "My New Replay",
|
|
83
|
+
description: `This **renders markdown** or plaintext in monospace font.`,
|
|
84
|
+
});
|
|
85
|
+
```
|
|
42
86
|
|
|
43
|
-
|
|
87
|
+
### Error Handler
|
|
88
|
+
|
|
89
|
+
```js
|
|
90
|
+
const dashcam = require("dashcam");
|
|
91
|
+
|
|
92
|
+
process.on("uncaughtException", async (err) => {
|
|
93
|
+
let replay = await dashcam.createReplay({
|
|
94
|
+
title: "uncaughtException",
|
|
95
|
+
description: err,
|
|
96
|
+
});
|
|
97
|
+
console.log("Dashcam", replay);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
setTimeout(() => {
|
|
101
|
+
throw new Error("Throw makes it go boom!");
|
|
102
|
+
}, 3000);
|
|
103
|
+
```
|
|
44
104
|
|
|
45
105
|
## CLI
|
|
46
106
|
|
|
107
|
+
### Setup
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
npm install dashcam -g
|
|
111
|
+
```
|
|
112
|
+
|
|
47
113
|
### Create a Replay
|
|
48
114
|
|
|
49
115
|
```sh
|
|
50
|
-
$
|
|
51
|
-
https://
|
|
116
|
+
$ dashcam
|
|
117
|
+
https://dashcam.io/replay/123?share=xyz
|
|
52
118
|
```
|
|
53
119
|
|
|
54
120
|
### Return a rich markdown link
|
|
55
121
|
|
|
56
122
|
```sh
|
|
57
|
-
$
|
|
123
|
+
$ dashcam --md
|
|
58
124
|
|
|
59
|
-
[](https://replayable.io/replay/123?share=xyz)
|
|
60
126
|
|
|
61
|
-
Watch [
|
|
127
|
+
Watch [Dashcam - New Replay](https://dashcam.io/replay/123?share=xyz) on Dashcam
|
|
62
128
|
```
|
|
63
129
|
|
|
64
130
|
### Set a replay title
|
|
65
131
|
|
|
66
132
|
```sh
|
|
67
|
-
$
|
|
133
|
+
$ dashcam -t "My New Title"
|
|
68
134
|
```
|
|
69
135
|
|
|
70
136
|
### Attach the last 20 CLI commands to the replay
|
|
71
137
|
|
|
72
138
|
```sh
|
|
73
|
-
$ history -20 |
|
|
139
|
+
$ history -20 | dashcam
|
|
74
140
|
```
|
|
75
141
|
|
|
76
142
|
### Attach a logfile to the replay
|
|
@@ -78,7 +144,7 @@ $ history -20 | replayable
|
|
|
78
144
|
This will attach the mac system log to the replay.
|
|
79
145
|
|
|
80
146
|
```sh
|
|
81
|
-
$ cat /var/log/system.log |
|
|
147
|
+
$ cat /var/log/system.log | dashcam
|
|
82
148
|
```
|
|
83
149
|
|
|
84
150
|
## GitHub CLI
|
|
@@ -88,69 +154,37 @@ The following examples depend on having the [GitHub CLI](https://cli.github.com/
|
|
|
88
154
|
### Create a github issue with a replay in the description
|
|
89
155
|
|
|
90
156
|
```sh
|
|
91
|
-
$ gh issue create -w -t "Title" -b "`
|
|
157
|
+
$ gh issue create -w -t "Title" -b "`dashcam --md`"
|
|
92
158
|
```
|
|
93
159
|
|
|
94
160
|
This is where it gets really cool. For example, this single command will create a GitHub issue with a video replay and the mac system logs.
|
|
95
161
|
|
|
96
162
|
```
|
|
97
|
-
gh issue create -w -t "Title" -b "`cat /var/log/system.log |
|
|
163
|
+
gh issue create -w -t "Title" -b "`cat /var/log/system.log | dashcam --md`"
|
|
98
164
|
```
|
|
99
165
|
|
|
100
166
|
### Create a github pull request with a replay in the description
|
|
101
167
|
|
|
102
168
|
```sh
|
|
103
|
-
$ gh pr create -w -t "Title" -b "`
|
|
169
|
+
$ gh pr create -w -t "Title" -b "`dashcam --md`"
|
|
104
170
|
```
|
|
105
171
|
|
|
106
172
|
### Append a 30 second replay to a commit
|
|
107
173
|
|
|
108
174
|
```sh
|
|
109
|
-
$ git commit -am "`
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
## NodeJS SDK
|
|
113
|
-
|
|
114
|
-
```js
|
|
115
|
-
const replayable = require("replayable");
|
|
116
|
-
|
|
117
|
-
process.on("uncaughtException", async (err) => {
|
|
118
|
-
let replay = await replayable.createReplay({
|
|
119
|
-
title: "uncaughtException",
|
|
120
|
-
description: err,
|
|
121
|
-
});
|
|
122
|
-
console.log("Replayable", replay);
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
setTimeout(() => {
|
|
126
|
-
throw new Error("Throw makes it go boom!");
|
|
127
|
-
}, 3000);
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
## Javascript Integration
|
|
131
|
-
|
|
132
|
-
Note that this example does not require any library to be installed as the app exposes the protocol natively.
|
|
133
|
-
|
|
134
|
-
```js
|
|
135
|
-
window.onerror = function myErrorHandler() {
|
|
136
|
-
window.open("replayable://replay/create", "_blank");
|
|
137
|
-
};
|
|
138
|
-
|
|
139
|
-
setTimeout(() => {
|
|
140
|
-
throw new Error("Throw makes it go boom!");
|
|
141
|
-
}, 3000);
|
|
175
|
+
$ git commit -am "`dashcam`"
|
|
142
176
|
```
|
|
143
177
|
|
|
144
178
|
# Advanced Usage
|
|
145
179
|
|
|
146
180
|
```
|
|
147
|
-
Usage:
|
|
181
|
+
Usage: dashcam create [options]
|
|
148
182
|
|
|
149
183
|
Create a replay and output the resulting url or markdown. Will launch desktop app for local editing before publishing.
|
|
150
184
|
|
|
151
185
|
Options:
|
|
152
186
|
-t, --title <string> Title of the replay. Automatically generated if not supplied.
|
|
153
|
-
-d, --description [text] Replay markdown body. This may also be piped in: `cat README.md |
|
|
187
|
+
-d, --description [text] Replay markdown body. This may also be piped in: `cat README.md | dashcam create`
|
|
154
188
|
--md Returns code for a rich markdown image link.
|
|
155
189
|
-h, --help display help for command
|
|
156
190
|
```
|
package/index.js
CHANGED
|
@@ -6,26 +6,24 @@ const { program } = require("commander");
|
|
|
6
6
|
let stdin = "";
|
|
7
7
|
|
|
8
8
|
program
|
|
9
|
-
.name("
|
|
10
|
-
.description(
|
|
11
|
-
|
|
12
|
-
)
|
|
13
|
-
.version("0.0.9");
|
|
9
|
+
.name("dashcam")
|
|
10
|
+
.description("Capture the steps to reproduce every bug.")
|
|
11
|
+
.version("0.1.0");
|
|
14
12
|
|
|
15
13
|
program.showHelpAfterError();
|
|
16
14
|
|
|
17
15
|
program
|
|
18
16
|
.command("create", { isDefault: true })
|
|
19
17
|
.description(
|
|
20
|
-
"Create a
|
|
18
|
+
"Create a clip and output the resulting url or markdown. Will launch desktop app for local editing before publishing."
|
|
21
19
|
)
|
|
22
20
|
.option(
|
|
23
21
|
"-t, --title <string>",
|
|
24
|
-
"Title of the
|
|
22
|
+
"Title of the clip. Automatically generated if not supplied."
|
|
25
23
|
)
|
|
26
24
|
.option(
|
|
27
25
|
"-d, --description [text]",
|
|
28
|
-
"
|
|
26
|
+
"Markdown body. This may also be piped in: `cat README.md | dashcam create`"
|
|
29
27
|
)
|
|
30
28
|
.option("--md", "Returns code for a rich markdown image link.")
|
|
31
29
|
.action(async function (str, options) {
|
package/lib.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
const ipc = require("node-ipc").default;
|
|
2
2
|
const clc = require("cli-color");
|
|
3
3
|
|
|
4
|
-
ipc.config.id = "
|
|
4
|
+
ipc.config.id = "dashcam-cli";
|
|
5
5
|
ipc.config.retry = 1500;
|
|
6
6
|
ipc.config.silent = true;
|
|
7
7
|
ipc.config.maxRetries = 0;
|
|
8
8
|
|
|
9
9
|
const connectToIpc = function () {
|
|
10
10
|
return new Promise((resolve, reject) => {
|
|
11
|
-
ipc.connectTo("
|
|
12
|
-
ipc.of.
|
|
13
|
-
ipc.of.
|
|
11
|
+
ipc.connectTo("dashcam");
|
|
12
|
+
ipc.of.dashcam.on("connect", resolve);
|
|
13
|
+
ipc.of.dashcam.on("error", (e) => {
|
|
14
14
|
if (e.code === "ENOENT") {
|
|
15
15
|
console.log(
|
|
16
|
-
clc.red("Could not connect to
|
|
16
|
+
clc.red("Could not connect to Dashcam Desktop App. Is it running?")
|
|
17
17
|
);
|
|
18
18
|
console.log(
|
|
19
19
|
clc.yellow(
|
|
@@ -22,8 +22,8 @@ const connectToIpc = function () {
|
|
|
22
22
|
);
|
|
23
23
|
}
|
|
24
24
|
});
|
|
25
|
-
ipc.of.
|
|
26
|
-
console.log("Disconnected from
|
|
25
|
+
ipc.of.dashcam.on("disconnect", function () {
|
|
26
|
+
console.log("Disconnected from Dashcam");
|
|
27
27
|
});
|
|
28
28
|
});
|
|
29
29
|
};
|
|
@@ -37,7 +37,7 @@ const createReplay = async function (options = {}) {
|
|
|
37
37
|
await connectToIpc();
|
|
38
38
|
|
|
39
39
|
return new Promise(async (resolve, reject) => {
|
|
40
|
-
ipc.of.
|
|
40
|
+
ipc.of.dashcam.on(
|
|
41
41
|
"upload", //any event or message type your server listens for
|
|
42
42
|
function (data) {
|
|
43
43
|
if (options.md) {
|
|
@@ -50,11 +50,11 @@ const createReplay = async function (options = {}) {
|
|
|
50
50
|
|
|
51
51
|
setTimeout(() => {
|
|
52
52
|
reject(
|
|
53
|
-
"
|
|
53
|
+
"Dashcam Desktop App did not respond in time. Did you publish a replay?"
|
|
54
54
|
);
|
|
55
55
|
}, 60000 * 5);
|
|
56
56
|
|
|
57
|
-
ipc.of.
|
|
57
|
+
ipc.of.dashcam.emit("create", {
|
|
58
58
|
title: options.title,
|
|
59
59
|
description: options.description,
|
|
60
60
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dashcam",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Fix bugs, close pulls, and update your team with desktop instant replay.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"prepare": "husky install"
|
|
9
9
|
},
|
|
10
10
|
"bin": {
|
|
11
|
-
"
|
|
11
|
+
"dashcam": "index.js"
|
|
12
12
|
},
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|