@slicemachine/init 1.1.19-dev-release-0.7.1.0 → 1.1.19-dev-release-feb.0
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/build/index.js +13 -2
- package/build/index.js.map +1 -1
- package/package.json +4 -4
- package/src/index.ts +7 -0
- package/src/utils/noop.ts +3 -0
- package/src/utils/tracker.ts +9 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slicemachine/init",
|
|
3
|
-
"version": "1.1.19-dev-release-
|
|
3
|
+
"version": "1.1.19-dev-release-feb.0",
|
|
4
4
|
"description": "The easiest way to add Slice Machine to your project",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"bin": {
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@hapi/hapi": "^20.2.0",
|
|
23
23
|
"@prismicio/types-internal": "^1.5.3",
|
|
24
|
-
"@slicemachine/client": "1.1.19-dev-release-
|
|
25
|
-
"@slicemachine/core": "1.1.19-dev-release-
|
|
24
|
+
"@slicemachine/client": "1.1.19-dev-release-feb.0",
|
|
25
|
+
"@slicemachine/core": "1.1.19-dev-release-feb.0",
|
|
26
26
|
"adm-zip": "^0.5.9",
|
|
27
27
|
"analytics-node": "^6.0.0",
|
|
28
28
|
"axios": "^0.24.0",
|
|
@@ -67,5 +67,5 @@
|
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=14"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "00c3b4f88c768cad8803fc356b7071dba80aa78e"
|
|
71
71
|
}
|
package/src/index.ts
CHANGED
|
@@ -104,6 +104,13 @@ async function init() {
|
|
|
104
104
|
|
|
105
105
|
setVersion(cwd);
|
|
106
106
|
|
|
107
|
+
// Info about tracking
|
|
108
|
+
if (isTrackingAvailable) {
|
|
109
|
+
logs.writeInfo(
|
|
110
|
+
"We use tracking tools to improve user experience. Learn more: https://prismic.io/docs/slice-machine#tracking"
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
|
|
107
114
|
// Ask the user to run slice-machine.
|
|
108
115
|
displayFinalMessage(cwd, wasStarter, repository, client.apisEndpoints.Wroom);
|
|
109
116
|
}
|
package/src/utils/tracker.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import ServerAnalytics from "analytics-node";
|
|
2
2
|
import { v4 as uuidv4 } from "uuid";
|
|
3
3
|
import { Models } from "@slicemachine/core";
|
|
4
|
+
import noop from "./noop";
|
|
4
5
|
|
|
5
6
|
export enum EventType {
|
|
6
7
|
DownloadLibrary = "SliceMachine Download Library",
|
|
@@ -25,7 +26,10 @@ export class InitTracker {
|
|
|
25
26
|
|
|
26
27
|
this.#isTrackingActive = isTrackingActive;
|
|
27
28
|
this.#anonymousId = uuidv4();
|
|
28
|
-
this.#client = new ServerAnalytics(segmentKey
|
|
29
|
+
this.#client = new ServerAnalytics(segmentKey, {
|
|
30
|
+
flushAt: 1,
|
|
31
|
+
errorHandler: noop,
|
|
32
|
+
});
|
|
29
33
|
} catch (error) {
|
|
30
34
|
// If the client is not correctly setup we are silently failing as the tracker is not a critical feature
|
|
31
35
|
}
|
|
@@ -46,7 +50,10 @@ export class InitTracker {
|
|
|
46
50
|
const payload = {
|
|
47
51
|
event: eventType,
|
|
48
52
|
...identifier,
|
|
49
|
-
properties:
|
|
53
|
+
properties: {
|
|
54
|
+
...attributes,
|
|
55
|
+
nodeVersion: process.versions.node,
|
|
56
|
+
},
|
|
50
57
|
...(this.#repository
|
|
51
58
|
? { context: { groupId: { Repository: this.#repository } } }
|
|
52
59
|
: {}),
|