Skip to content

Commit de31383

Browse files
adriaanvanrossumactions-user
authored andcommitted
Run prettier via GitHub Action
1 parent a914c9a commit de31383

File tree

14 files changed

+121
-117
lines changed

14 files changed

+121
-117
lines changed

compile.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@ const fillTemplate = (template, { overwriteOptions = null } = {}) => {
3030
return template
3131
.replace(
3232
/\{\{\s?nginxHost\s?\}\}/gi,
33-
'<!--# echo var="http_host" default="" -->'
33+
'<!--# echo var="http_host" default="" -->',
3434
)
3535
.replace(
3636
/\{\{\s?nginxProxyHost\s?\}\}/gi,
37-
'<!--# echo var="proxy_hostname" default="" --><!--# echo var="proxy_path" default="/simple" -->'
37+
'<!--# echo var="proxy_hostname" default="" --><!--# echo var="proxy_path" default="/simple" -->',
3838
)
3939
.replace(
4040
/\\?"\{\{\s?overwriteOptions\s?\}\}\\?"/gi,
4141
overwriteOptions
4242
? JSON.stringify(overwriteOptions).replace(/:"([^"]+)"/gi, ":$1")
43-
: "{}"
43+
: "{}",
4444
)
4545
.replace(
4646
/"\{\{\s?cloudFlareCustomDomain\s?\}\}"/gi,
47-
'INSTALL_OPTIONS.custom_domain || "queue.simpleanalyticscdn.com"'
47+
'INSTALL_OPTIONS.custom_domain || "queue.simpleanalyticscdn.com"',
4848
);
4949
};
5050

@@ -284,7 +284,7 @@ const files = templates.reduce((list, template) => {
284284
if (template.variables.sri) {
285285
list.push(
286286
{ ...template, variables: { ...template.variables, sri: true } },
287-
{ ...template, variables: { ...template.variables, sri: false } }
287+
{ ...template, variables: { ...template.variables, sri: false } },
288288
);
289289
} else {
290290
list.push(template);
@@ -346,7 +346,7 @@ for (const file of files) {
346346
filename: originalFileName,
347347
url: `${finalFileName}.map`,
348348
},
349-
}
349+
},
350350
)
351351
: {
352352
code: prepend + rawCode,
@@ -374,7 +374,7 @@ for (const file of files) {
374374
RED,
375375
`[${name}][ERROR] ${input
376376
.split("/")
377-
.pop()} ${description} at line ${lineNumber} position ${index}`
377+
.pop()} ${description} at line ${lineNumber} position ${index}`,
378378
);
379379
continue;
380380
}
@@ -402,15 +402,15 @@ for (const file of files) {
402402

403403
let write = code.replace(
404404
/sourceMappingURL=latest\.js\.map/gi,
405-
`sourceMappingURL=${cdnFileName}.map`
405+
`sourceMappingURL=${cdnFileName}.map`,
406406
);
407407

408408
fs.writeFileSync(versionFile, write);
409409

410410
if (compiledMap) {
411411
let writeCompiled = compiledMap.replace(
412412
/latest\.source\.js/gi,
413-
cdnFileName
413+
cdnFileName,
414414
);
415415

416416
fs.writeFileSync(`${versionFile}.map`, writeCompiled);
@@ -438,7 +438,7 @@ for (const file of files) {
438438
console.log(
439439
` ${name.toLowerCase()} ${fill1}Compiled ${sourceName} ${fill2} ${bytesZeroFilled} bytes ${
440440
variables.sri ? " (SRI)" : ""
441-
}`
441+
}`,
442442
);
443443
}
444444

playground/callback.html

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<meta charset="utf-8" />
@@ -46,15 +46,17 @@
4646
@font-face {
4747
font-family: "Space Grotesk";
4848
font-weight: 500;
49-
src: url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff2")
49+
src:
50+
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff2")
5051
format("woff2"),
5152
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff")
5253
format("woff");
5354
}
5455
@font-face {
5556
font-family: "Space Grotesk";
5657
font-weight: 400;
57-
src: url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff2")
58+
src:
59+
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff2")
5860
format("woff2"),
5961
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff")
6062
format("woff");
@@ -180,7 +182,7 @@ <h2>Automated events</h2>
180182
})
181183
.join(" ");
182184
document.querySelector(
183-
"textarea"
185+
"textarea",
184186
).value += `${type.toUpperCase()}: ${line}\n`;
185187
}
186188

@@ -253,7 +255,7 @@ <h2>Automated events</h2>
253255
});
254256

255257
const callbackMetadataLink = document.querySelector(
256-
"[data-metadata-callback]"
258+
"[data-metadata-callback]",
257259
);
258260
callbackMetadataLink.addEventListener("click", (event) => {
259261
event.preventDefault();

playground/events.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!DOCTYPE html>
1+
<!doctype html>
22
<html>
33
<head>
44
<meta charset="utf-8" />
@@ -33,9 +33,9 @@
3333
},
3434
() => {
3535
console.info(
36-
"Simple Analytics auto events: collected before_script_load"
36+
"Simple Analytics auto events: collected before_script_load",
3737
);
38-
}
38+
},
3939
);
4040
</script>
4141

@@ -67,15 +67,17 @@
6767
@font-face {
6868
font-family: "Space Grotesk";
6969
font-weight: 500;
70-
src: url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff2")
70+
src:
71+
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff2")
7172
format("woff2"),
7273
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Medium.woff")
7374
format("woff");
7475
}
7576
@font-face {
7677
font-family: "Space Grotesk";
7778
font-weight: 400;
78-
src: url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff2")
79+
src:
80+
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff2")
7981
format("woff2"),
8082
url("https://assets.simpleanalytics.com/fonts/SpaceGrotesk-Regular.woff")
8183
format("woff");
@@ -207,7 +209,7 @@ <h2>Automated events</h2>
207209
})
208210
.join(" ");
209211
document.querySelector(
210-
"textarea"
212+
"textarea",
211213
).value += `${type.toUpperCase()}: ${line}\n`;
212214
}
213215

src/auto-events.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@
155155
/^https?:\/\//i.test(link.href) &&
156156
new RegExp(
157157
"\\.(" + (optionsLink.downloadsExtensions || []).join("|") + ")$",
158-
"i"
158+
"i",
159159
).test(link.pathname)
160160
) {
161161
collect = "download";

src/default.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
version,
99
defaultNamespace,
1010
sendError,
11-
warn
11+
warn,
1212
) {
1313
try {
1414
/////////////////////
@@ -152,7 +152,7 @@
152152
/** if ignoremetrics **/
153153
// Customers can skip data points
154154
var ignoreMetrics = convertCommaSeparatedToArray(
155-
overwriteOptions.ignoreMetrics || attr(scriptElement, "ignore-metrics")
155+
overwriteOptions.ignoreMetrics || attr(scriptElement, "ignore-metrics"),
156156
);
157157
/** endif **/
158158

@@ -213,7 +213,7 @@
213213
try {
214214
return assign(
215215
metadata,
216-
metadataCollectorFunction.call(window, assign(metadata, data))
216+
metadataCollectorFunction.call(window, assign(metadata, data)),
217217
);
218218
} catch (error) {
219219
warnInFunction("metadata", error);
@@ -284,7 +284,7 @@
284284
ignorePage === path ||
285285
new RegExp(
286286
"^" + filterRegex(ignorePage).replace(/\\\*/gi, "(.*)") + "$",
287-
"i"
287+
"i",
288288
).test(path)
289289
)
290290
return trueVar;
@@ -374,7 +374,7 @@
374374
path: loc.pathname,
375375
}),
376376
undefinedVar,
377-
trueVar
377+
trueVar,
378378
);
379379
};
380380

@@ -387,7 +387,7 @@
387387
sendError(event.message);
388388
}
389389
},
390-
falseVar
390+
falseVar,
391391
);
392392
/** endif **/
393393

@@ -438,22 +438,22 @@
438438
/** if ignorepages **/
439439
// Customers can ignore certain pages
440440
var ignorePages = convertCommaSeparatedToArray(
441-
overwriteOptions.ignorePages || attr(scriptElement, "ignore-pages")
441+
overwriteOptions.ignorePages || attr(scriptElement, "ignore-pages"),
442442
);
443443
/** endif **/
444444

445445
/** if allowparams **/
446446
// Customers can allow params
447447
var allowParams = convertCommaSeparatedToArray(
448-
overwriteOptions.allowParams || attr(scriptElement, "allow-params")
448+
overwriteOptions.allowParams || attr(scriptElement, "allow-params"),
449449
);
450450
/** endif **/
451451

452452
/** if nonuniquehostnames **/
453453
// Customers can allow params
454454
var nonUniqueHostnames = convertCommaSeparatedToArray(
455455
overwriteOptions.nonUniqueHostnames ||
456-
attr(scriptElement, "non-unique-hostnames")
456+
attr(scriptElement, "non-unique-hostnames"),
457457
);
458458
/** endif **/
459459

@@ -554,12 +554,12 @@
554554
/** if ignorednt **/
555555
if (!collectDnt && doNotTrack in nav && nav[doNotTrack] == "1")
556556
return warn(
557-
notSendingWhen + doNotTrack + " is enabled. See " + docsUrl + "/dnt"
557+
notSendingWhen + doNotTrack + " is enabled. See " + docsUrl + "/dnt",
558558
);
559559
/** else **/
560560
if (doNotTrack in nav && nav[doNotTrack] == "1")
561561
return warn(
562-
notSendingWhen + doNotTrack + " is enabled. See " + docsUrl + "/dnt"
562+
notSendingWhen + doNotTrack + " is enabled. See " + docsUrl + "/dnt",
563563
);
564564
/** endif **/
565565

@@ -574,7 +574,7 @@
574574
locationHostname +
575575
". See " +
576576
docsUrl +
577-
"/overwrite-domain-name"
577+
"/overwrite-domain-name",
578578
);
579579

580580
/////////////////////
@@ -645,7 +645,7 @@
645645
hiddenStart = now();
646646
} else msHidden += now() - hiddenStart;
647647
},
648-
falseVar
648+
falseVar,
649649
);
650650
/** endif **/
651651

@@ -661,15 +661,15 @@
661661
body[offsetHeight] || 0,
662662
documentElement[clientHeight] || 0,
663663
documentElement[scrollHeight] || 0,
664-
documentElement[offsetHeight] || 0
664+
documentElement[offsetHeight] || 0,
665665
);
666666
return Math.min(
667667
100,
668668
Math.round(
669669
(100 * ((documentElement.scrollTop || 0) + documentClientHeight)) /
670670
height /
671-
5
672-
) * 5
671+
5,
672+
) * 5,
673673
);
674674
} catch (error) {
675675
warn(error);
@@ -684,7 +684,7 @@
684684
function () {
685685
if (scrolled < position()) scrolled = position();
686686
},
687-
falseVar
687+
falseVar,
688688
);
689689
});
690690
/** endif **/
@@ -738,7 +738,7 @@
738738
isPushState,
739739
deleteSourceInfo,
740740
sameSite,
741-
metadata
741+
metadata,
742742
) {
743743
if (isPushState) sendOnLeave("" + payload.page_id, trueVar);
744744
if (collectDataOnLeave) payload.page_id = uuid();
@@ -783,7 +783,7 @@
783783
page.viewport_height =
784784
Math.max(
785785
documentElement[clientHeight] || 0,
786-
window.innerHeight || 0
786+
window.innerHeight || 0,
787787
) || null;
788788
}
789789
/** endif **/
@@ -857,7 +857,7 @@
857857
isPushState,
858858
isPushState || userNavigated || !collectMetricByString("r"), // r = referrers
859859
sameSite,
860-
metadata
860+
metadata,
861861
);
862862
};
863863

@@ -924,15 +924,15 @@
924924
function () {
925925
pageview(1);
926926
},
927-
falseVar
927+
falseVar,
928928
);
929929

930930
addEventListenerFunc(
931931
"popstate",
932932
function () {
933933
pageview(1);
934934
},
935-
falseVar
935+
falseVar,
936936
);
937937
}
938938
/** endif **/
@@ -945,7 +945,7 @@
945945
function () {
946946
pageview(1);
947947
},
948-
falseVar
948+
falseVar,
949949
);
950950
}
951951
/** endif **/
@@ -992,7 +992,7 @@
992992
if (validTypes.indexOf(typeof eventOutput) < 0) {
993993
warnInFunction(
994994
eventFunctionName,
995-
event + " returns no string: " + eventOutput
995+
event + " returns no string: " + eventOutput,
996996
);
997997
return callback();
998998
}
@@ -1026,7 +1026,7 @@
10261026
metadata: stringify(metadata),
10271027
/** endif **/
10281028
}),
1029-
callback
1029+
callback,
10301030
);
10311031
}
10321032
};
@@ -1069,5 +1069,5 @@
10691069
"{{baseUrl}}",
10701070
"{{apiUrlPrefix}}",
10711071
"{{scriptName}}",
1072-
"{{namespace}}"
1072+
"{{namespace}}",
10731073
);

0 commit comments

Comments
 (0)