Skip to content

Commit a249f0c

Browse files
committed
Added postbuild script.
1 parent 0d33e6d commit a249f0c

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"build-mysql-client": "dotenv prisma generate -- --schema=./prisma/schema.mysql.prisma",
2626
"build-postgresql-schema": "dotenv prisma db pull -- --schema=./prisma/schema.postgresql.prisma",
2727
"build-postgresql-client": "dotenv prisma generate -- --schema=./prisma/schema.postgresql.prisma",
28-
"postbuild": "node scripts/telemetry.js",
28+
"postbuild": "node scripts/postbuild.js",
2929
"copy-db-schema": "node scripts/copy-db-schema.js",
3030
"generate-lang": "npm-run-all extract-lang merge-lang",
3131
"extract-lang": "formatjs extract \"{pages,components}/**/*.js\" --out-file build/messages.json",

scripts/postbuild.js

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
require('dotenv').config();
2+
const sendTelemetry = require('./telemetry');
3+
4+
async function run() {
5+
if (!process.env.TELEMETRY_DISABLE) {
6+
await sendTelemetry();
7+
}
8+
}
9+
10+
run();

scripts/telemetry.js

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
require('dotenv').config();
21
const fs = require('fs-extra');
32
const path = require('path');
43
const os = require('os');
@@ -9,7 +8,7 @@ const pkg = require('../package.json');
98
const dest = path.resolve(__dirname, '../.next/cache/umami.json');
109
const url = 'https://telemetry.umami.is/api/collect';
1110

12-
async function run() {
11+
async function sendTelemetry() {
1312
await fs.ensureFile(dest);
1413

1514
let json = {};
@@ -52,6 +51,4 @@ async function run() {
5251
}
5352
}
5453

55-
if (!process.env.TELEMETRY_DISABLED) {
56-
run();
57-
}
54+
module.exports = sendTelemetry;

0 commit comments

Comments
 (0)