Skip to content

Commit db81523

Browse files
committed
Rename constants to uppercase
1 parent 3410dc5 commit db81523

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

update_remote_settings_records.mjs

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ if (
4545
process.exit(FAILURE_RET_VALUE);
4646
}
4747

48-
const rsBrowsersCollectionEndpoint = `${process.env.SERVER}/buckets/main-workspace/collections/devtools-compatibility-browsers`;
49-
const rsBrowsersRecordsEndpoint = `${rsBrowsersCollectionEndpoint}/records`;
50-
const isDryRun = process.env.DRY_RUN == "1";
48+
const COLLECTION_ENDPOINT = `${process.env.SERVER}/buckets/main-workspace/collections/devtools-compatibility-browsers`;
49+
const RECORDS_ENDPOINT = `${COLLECTION_ENDPOINT}/records`;
50+
const IS_DRY_RUN = process.env.DRY_RUN == "1";
5151

5252
const HEADERS = {
5353
"Content-Type": "application/json",
@@ -155,8 +155,8 @@ async function update() {
155155
}
156156

157157
async function getRSRecords() {
158-
console.log(`Get existing records from ${rsBrowsersCollectionEndpoint}`);
159-
const response = await fetch(rsBrowsersRecordsEndpoint, {
158+
console.log(`Get existing records from ${COLLECTION_ENDPOINT}`);
159+
const response = await fetch(RECORDS_ENDPOINT, {
160160
method: "GET",
161161
headers: HEADERS,
162162
});
@@ -177,16 +177,16 @@ async function getRSRecords() {
177177
*/
178178
async function createRecord(browserMdn) {
179179
console.log(
180-
isDryRun ? "[DRY_RUN]" : "",
180+
IS_DRY_RUN ? "[DRY_RUN]" : "",
181181
"Create",
182182
browserMdn.browserid,
183183
browserMdn.version
184184
);
185-
if (isDryRun) {
185+
if (IS_DRY_RUN) {
186186
return true;
187187
}
188188

189-
const response = await fetch(`${rsBrowsersRecordsEndpoint}`, {
189+
const response = await fetch(`${RECORDS_ENDPOINT}`, {
190190
method: "POST",
191191
body: JSON.stringify({ data: browserMdn }),
192192
headers: HEADERS,
@@ -210,16 +210,16 @@ async function createRecord(browserMdn) {
210210
*/
211211
async function updateRecord(record, browserMdn) {
212212
console.log(
213-
isDryRun ? "[DRY_RUN]" : "",
213+
IS_DRY_RUN ? "[DRY_RUN]" : "",
214214
"Update",
215215
record.browserid,
216216
record.version
217217
);
218-
if (isDryRun) {
218+
if (IS_DRY_RUN) {
219219
return true;
220220
}
221221

222-
const response = await fetch(`${rsBrowsersRecordsEndpoint}/${record.id}`, {
222+
const response = await fetch(`${RECORDS_ENDPOINT}/${record.id}`, {
223223
method: "PUT",
224224
body: JSON.stringify({ data: browserMdn }),
225225
headers: HEADERS,
@@ -241,16 +241,16 @@ async function updateRecord(record, browserMdn) {
241241
*/
242242
async function deleteRecord(record) {
243243
console.log(
244-
isDryRun ? "[DRY_RUN]" : "",
244+
IS_DRY_RUN ? "[DRY_RUN]" : "",
245245
"Delete",
246246
record.browserid,
247247
record.version
248248
);
249-
if (isDryRun) {
249+
if (IS_DRY_RUN) {
250250
return true;
251251
}
252252

253-
const response = await fetch(`${rsBrowsersRecordsEndpoint}/${record.id}`, {
253+
const response = await fetch(`${RECORDS_ENDPOINT}/${record.id}`, {
254254
method: "DELETE",
255255
headers: HEADERS,
256256
});
@@ -267,12 +267,12 @@ async function deleteRecord(record) {
267267
* Ask for review on the collection.
268268
*/
269269
async function requestReview() {
270-
console.log(isDryRun ? "[DRY_RUN]" : "", "Requesting review");
271-
if (isDryRun) {
270+
console.log(IS_DRY_RUN ? "[DRY_RUN]" : "", "Requesting review");
271+
if (IS_DRY_RUN) {
272272
return true;
273273
}
274274

275-
const response = await fetch(rsBrowsersCollectionEndpoint, {
275+
const response = await fetch(COLLECTION_ENDPOINT, {
276276
method: "PATCH",
277277
body: JSON.stringify({ data: { status: "to-review" } }),
278278
headers: HEADERS,
@@ -291,12 +291,12 @@ async function requestReview() {
291291
* ⚠️ This only works on the `dev` server.
292292
*/
293293
async function approveChanges() {
294-
console.log(isDryRun ? "[DRY_RUN]" : "", "Approving changes");
295-
if (isDryRun) {
294+
console.log(IS_DRY_RUN ? "[DRY_RUN]" : "", "Approving changes");
295+
if (IS_DRY_RUN) {
296296
return true;
297297
}
298298

299-
const response = await fetch(rsBrowsersCollectionEndpoint, {
299+
const response = await fetch(COLLECTION_ENDPOINT, {
300300
method: "PATCH",
301301
body: JSON.stringify({ data: { status: "to-sign" } }),
302302
headers: HEADERS,

0 commit comments

Comments
 (0)