dashcam 0.3.0 → 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 +32 -32
- package/lib.js +10 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
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
|
-
Add
|
|
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
|
-
> Why double-back when you can capture it the first time? Playback and share exactly what happened with
|
|
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
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
|
-
Requires that you [install
|
|
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
13
|
## Table of contents
|
|
14
14
|
|
|
15
|
-
- [
|
|
16
|
-
|
|
15
|
+
- [Dashcam API](#dashcam-api)
|
|
16
|
+
- [Install Dashcam Desktop](#install-dashcam-desktop)
|
|
17
17
|
- [Examples](#examples)
|
|
18
18
|
- [Web](#web)
|
|
19
19
|
- [Setup](#setup)
|
|
@@ -45,19 +45,19 @@ Also see [the examples folder](https://github.com/replayableio/cli/tree/main/exa
|
|
|
45
45
|
|
|
46
46
|
### Setup
|
|
47
47
|
|
|
48
|
-
Nothing! The app exposes the protocol to the system natively via `
|
|
48
|
+
Nothing! The app exposes the protocol to the system natively via `dashcam://`.
|
|
49
49
|
|
|
50
50
|
### HTML Anchor Tag
|
|
51
51
|
|
|
52
52
|
```html
|
|
53
|
-
<a href="
|
|
53
|
+
<a href="dashcam://replay/create" target="_blank">Create a Replay</a>
|
|
54
54
|
```
|
|
55
55
|
|
|
56
56
|
### JS Error Handler
|
|
57
57
|
|
|
58
58
|
```js
|
|
59
59
|
window.onerror = function myErrorHandler() {
|
|
60
|
-
window.open("
|
|
60
|
+
window.open("dashcam://replay/create", "_blank");
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
setTimeout(() => {
|
|
@@ -70,31 +70,31 @@ setTimeout(() => {
|
|
|
70
70
|
### Setup
|
|
71
71
|
|
|
72
72
|
```sh
|
|
73
|
-
npm install
|
|
73
|
+
npm install dashcam
|
|
74
74
|
```
|
|
75
75
|
|
|
76
76
|
### Create a Replay
|
|
77
77
|
|
|
78
78
|
```js
|
|
79
|
-
const
|
|
79
|
+
const dashcam = require("dashcam");
|
|
80
80
|
|
|
81
|
-
let replay = await
|
|
81
|
+
let replay = await dashcam.createReplay({
|
|
82
82
|
title: "My New Replay",
|
|
83
|
-
description: `This **renders markdown** or plaintext in monospace font
|
|
83
|
+
description: `This **renders markdown** or plaintext in monospace font.`,
|
|
84
84
|
});
|
|
85
85
|
```
|
|
86
86
|
|
|
87
87
|
### Error Handler
|
|
88
88
|
|
|
89
89
|
```js
|
|
90
|
-
const
|
|
90
|
+
const dashcam = require("dashcam");
|
|
91
91
|
|
|
92
92
|
process.on("uncaughtException", async (err) => {
|
|
93
|
-
let replay = await
|
|
93
|
+
let replay = await dashcam.createReplay({
|
|
94
94
|
title: "uncaughtException",
|
|
95
95
|
description: err,
|
|
96
96
|
});
|
|
97
|
-
console.log("
|
|
97
|
+
console.log("Dashcam", replay);
|
|
98
98
|
});
|
|
99
99
|
|
|
100
100
|
setTimeout(() => {
|
|
@@ -107,36 +107,36 @@ setTimeout(() => {
|
|
|
107
107
|
### Setup
|
|
108
108
|
|
|
109
109
|
```sh
|
|
110
|
-
npm install
|
|
110
|
+
npm install dashcam -g
|
|
111
111
|
```
|
|
112
112
|
|
|
113
113
|
### Create a Replay
|
|
114
114
|
|
|
115
115
|
```sh
|
|
116
|
-
$
|
|
117
|
-
https://
|
|
116
|
+
$ dashcam
|
|
117
|
+
https://dashcam.io/replay/123?share=xyz
|
|
118
118
|
```
|
|
119
119
|
|
|
120
120
|
### Return a rich markdown link
|
|
121
121
|
|
|
122
122
|
```sh
|
|
123
|
-
$
|
|
123
|
+
$ dashcam --md
|
|
124
124
|
|
|
125
|
-
[](https://replayable.io/replay/123?share=xyz)
|
|
126
126
|
|
|
127
|
-
Watch [
|
|
127
|
+
Watch [Dashcam - New Replay](https://dashcam.io/replay/123?share=xyz) on Dashcam
|
|
128
128
|
```
|
|
129
129
|
|
|
130
130
|
### Set a replay title
|
|
131
131
|
|
|
132
132
|
```sh
|
|
133
|
-
$
|
|
133
|
+
$ dashcam -t "My New Title"
|
|
134
134
|
```
|
|
135
135
|
|
|
136
136
|
### Attach the last 20 CLI commands to the replay
|
|
137
137
|
|
|
138
138
|
```sh
|
|
139
|
-
$ history -20 |
|
|
139
|
+
$ history -20 | dashcam
|
|
140
140
|
```
|
|
141
141
|
|
|
142
142
|
### Attach a logfile to the replay
|
|
@@ -144,7 +144,7 @@ $ history -20 | replayable
|
|
|
144
144
|
This will attach the mac system log to the replay.
|
|
145
145
|
|
|
146
146
|
```sh
|
|
147
|
-
$ cat /var/log/system.log |
|
|
147
|
+
$ cat /var/log/system.log | dashcam
|
|
148
148
|
```
|
|
149
149
|
|
|
150
150
|
## GitHub CLI
|
|
@@ -154,37 +154,37 @@ The following examples depend on having the [GitHub CLI](https://cli.github.com/
|
|
|
154
154
|
### Create a github issue with a replay in the description
|
|
155
155
|
|
|
156
156
|
```sh
|
|
157
|
-
$ gh issue create -w -t "Title" -b "`
|
|
157
|
+
$ gh issue create -w -t "Title" -b "`dashcam --md`"
|
|
158
158
|
```
|
|
159
159
|
|
|
160
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.
|
|
161
161
|
|
|
162
162
|
```
|
|
163
|
-
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`"
|
|
164
164
|
```
|
|
165
165
|
|
|
166
166
|
### Create a github pull request with a replay in the description
|
|
167
167
|
|
|
168
168
|
```sh
|
|
169
|
-
$ gh pr create -w -t "Title" -b "`
|
|
169
|
+
$ gh pr create -w -t "Title" -b "`dashcam --md`"
|
|
170
170
|
```
|
|
171
171
|
|
|
172
172
|
### Append a 30 second replay to a commit
|
|
173
173
|
|
|
174
174
|
```sh
|
|
175
|
-
$ git commit -am "`
|
|
175
|
+
$ git commit -am "`dashcam`"
|
|
176
176
|
```
|
|
177
177
|
|
|
178
178
|
# Advanced Usage
|
|
179
179
|
|
|
180
180
|
```
|
|
181
|
-
Usage:
|
|
181
|
+
Usage: dashcam create [options]
|
|
182
182
|
|
|
183
183
|
Create a replay and output the resulting url or markdown. Will launch desktop app for local editing before publishing.
|
|
184
184
|
|
|
185
185
|
Options:
|
|
186
186
|
-t, --title <string> Title of the replay. Automatically generated if not supplied.
|
|
187
|
-
-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`
|
|
188
188
|
--md Returns code for a rich markdown image link.
|
|
189
189
|
-h, --help display help for command
|
|
190
190
|
```
|
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
|
});
|