prepare-package 1.1.1 → 1.1.2
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/dist/index.js +16 -7
- package/package.json +1 -1
- package/src/index.js +16 -7
package/dist/index.js
CHANGED
|
@@ -73,8 +73,8 @@ module.exports = async function (options) {
|
|
|
73
73
|
if (options.isPostInstall) {
|
|
74
74
|
// Send analytics
|
|
75
75
|
await sendAnalytics(thisPackageJSON, theirPackageJSON)
|
|
76
|
-
.then(() => {
|
|
77
|
-
console.log(chalk.green(`[prepare-package]: Sent analytics...`));
|
|
76
|
+
.then((r) => {
|
|
77
|
+
console.log(chalk.green(`[prepare-package]: Sent analytics code=${r.status}...`));
|
|
78
78
|
})
|
|
79
79
|
.catch(e => {
|
|
80
80
|
console.log(chalk.red(`[prepare-package]: Failed to send analytics...`, e));
|
|
@@ -113,19 +113,28 @@ function sendAnalytics(thisPackageJSON, theirPackageJSON) {
|
|
|
113
113
|
const mac = getDeviceUniqueId();
|
|
114
114
|
const uuid = uuidv5(mac, '4caf995a-3d43-451b-b34d-e535d2663bc1');
|
|
115
115
|
const simpleOS = getSimpleOS(os.platform());
|
|
116
|
+
const name = (theirPackageJSON.name || 'unknown')
|
|
117
|
+
// Replace anything not a letter, number, or underscore with an underscore
|
|
118
|
+
.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
119
|
+
// Remove leading and trailing underscores
|
|
120
|
+
.replace(/^_+|_+$/g, '')
|
|
121
|
+
// Remove multiple underscores
|
|
122
|
+
.replace(/_+/g, '_');
|
|
123
|
+
|
|
124
|
+
// Build body
|
|
116
125
|
const body = {
|
|
117
126
|
client_id: uuid,
|
|
118
127
|
user_id: uuid,
|
|
119
128
|
// timestamp_micros: new Date().getTime() * 1000,
|
|
120
129
|
user_properties: {
|
|
121
|
-
operating_system: simpleOS,
|
|
130
|
+
// operating_system: simpleOS, // CAUSES EVENT TO NOT BE SENT
|
|
122
131
|
},
|
|
123
132
|
user_data: {
|
|
124
133
|
},
|
|
125
134
|
// consent: {},
|
|
126
135
|
// non_personalized_ads: false,
|
|
127
136
|
events: [{
|
|
128
|
-
name:
|
|
137
|
+
name: name,
|
|
129
138
|
params: {
|
|
130
139
|
packageName: theirPackageJSON.name,
|
|
131
140
|
packageVersion: theirPackageJSON.version,
|
|
@@ -167,13 +176,13 @@ function sendAnalytics(thisPackageJSON, theirPackageJSON) {
|
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
// Log the options
|
|
170
|
-
|
|
171
|
-
console.log(chalk.blue(`[prepare-package]: Sending analytics...`, mac, uuid));
|
|
179
|
+
console.log(chalk.blue(`[prepare-package]: Sending analytics...`, mac, uuid), body, body.events[0].params);
|
|
180
|
+
// console.log(chalk.blue(`[prepare-package]: Sending analytics...`, mac, uuid));
|
|
172
181
|
|
|
173
182
|
// Send event
|
|
174
183
|
fetch(url, {
|
|
175
184
|
method: 'post',
|
|
176
|
-
response: '
|
|
185
|
+
response: 'raw',
|
|
177
186
|
tries: 2,
|
|
178
187
|
timeout: 30000,
|
|
179
188
|
body: body,
|
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -73,8 +73,8 @@ module.exports = async function (options) {
|
|
|
73
73
|
if (options.isPostInstall) {
|
|
74
74
|
// Send analytics
|
|
75
75
|
await sendAnalytics(thisPackageJSON, theirPackageJSON)
|
|
76
|
-
.then(() => {
|
|
77
|
-
console.log(chalk.green(`[prepare-package]: Sent analytics...`));
|
|
76
|
+
.then((r) => {
|
|
77
|
+
console.log(chalk.green(`[prepare-package]: Sent analytics code=${r.status}...`));
|
|
78
78
|
})
|
|
79
79
|
.catch(e => {
|
|
80
80
|
console.log(chalk.red(`[prepare-package]: Failed to send analytics...`, e));
|
|
@@ -113,19 +113,28 @@ function sendAnalytics(thisPackageJSON, theirPackageJSON) {
|
|
|
113
113
|
const mac = getDeviceUniqueId();
|
|
114
114
|
const uuid = uuidv5(mac, '4caf995a-3d43-451b-b34d-e535d2663bc1');
|
|
115
115
|
const simpleOS = getSimpleOS(os.platform());
|
|
116
|
+
const name = (theirPackageJSON.name || 'unknown')
|
|
117
|
+
// Replace anything not a letter, number, or underscore with an underscore
|
|
118
|
+
.replace(/[^a-zA-Z0-9_]/g, '_')
|
|
119
|
+
// Remove leading and trailing underscores
|
|
120
|
+
.replace(/^_+|_+$/g, '')
|
|
121
|
+
// Remove multiple underscores
|
|
122
|
+
.replace(/_+/g, '_');
|
|
123
|
+
|
|
124
|
+
// Build body
|
|
116
125
|
const body = {
|
|
117
126
|
client_id: uuid,
|
|
118
127
|
user_id: uuid,
|
|
119
128
|
// timestamp_micros: new Date().getTime() * 1000,
|
|
120
129
|
user_properties: {
|
|
121
|
-
operating_system: simpleOS,
|
|
130
|
+
// operating_system: simpleOS, // CAUSES EVENT TO NOT BE SENT
|
|
122
131
|
},
|
|
123
132
|
user_data: {
|
|
124
133
|
},
|
|
125
134
|
// consent: {},
|
|
126
135
|
// non_personalized_ads: false,
|
|
127
136
|
events: [{
|
|
128
|
-
name:
|
|
137
|
+
name: name,
|
|
129
138
|
params: {
|
|
130
139
|
packageName: theirPackageJSON.name,
|
|
131
140
|
packageVersion: theirPackageJSON.version,
|
|
@@ -167,13 +176,13 @@ function sendAnalytics(thisPackageJSON, theirPackageJSON) {
|
|
|
167
176
|
}
|
|
168
177
|
|
|
169
178
|
// Log the options
|
|
170
|
-
|
|
171
|
-
console.log(chalk.blue(`[prepare-package]: Sending analytics...`, mac, uuid));
|
|
179
|
+
console.log(chalk.blue(`[prepare-package]: Sending analytics...`, mac, uuid), body, body.events[0].params);
|
|
180
|
+
// console.log(chalk.blue(`[prepare-package]: Sending analytics...`, mac, uuid));
|
|
172
181
|
|
|
173
182
|
// Send event
|
|
174
183
|
fetch(url, {
|
|
175
184
|
method: 'post',
|
|
176
|
-
response: '
|
|
185
|
+
response: 'raw',
|
|
177
186
|
tries: 2,
|
|
178
187
|
timeout: 30000,
|
|
179
188
|
body: body,
|