зеркало из https://github.com/mozilla/tsci.git
Issue #115 - Write the current document id to disk
The idea is the metrics application can read this and know where to point to, since the id will be changing week over week.
This commit is contained in:
Родитель
4754318b71
Коммит
02a7dd95d5
|
@ -2,4 +2,5 @@ node_modules
|
|||
data
|
||||
config.json
|
||||
credentials.json
|
||||
currentDoc.json
|
||||
.vscode/
|
||||
|
|
12
helpers.js
12
helpers.js
|
@ -1,5 +1,6 @@
|
|||
const config = require('./config.json');
|
||||
const fetch = require('node-fetch');
|
||||
const fs = require('fs').promises;
|
||||
const retry = require('promise-fn-retry');
|
||||
const util = require('util');
|
||||
|
||||
|
@ -213,6 +214,16 @@ function getQueryDates(inputDate) {
|
|||
return queryDates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the passed in currentDocId to disk, so it can be read from other
|
||||
* consumers.
|
||||
* @param {string} currentDocId
|
||||
*/
|
||||
async function recordCurrentDoc(currentDocId) {
|
||||
return fs.writeFile("currentDoc.json",
|
||||
JSON.stringify({"currentDoc": currentDocId}), 'utf8');
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the list of query dates until the present, starting
|
||||
* at the specified date.
|
||||
|
@ -249,5 +260,6 @@ module.exports = {
|
|||
isMobile,
|
||||
isDesktop,
|
||||
isNotQA,
|
||||
recordCurrentDoc,
|
||||
resumeQueryDates,
|
||||
}
|
||||
|
|
4
index.js
4
index.js
|
@ -66,8 +66,10 @@ const main = async () => {
|
|||
|
||||
for (const writer of writers) {
|
||||
await spreadsheet.shareSheet(drive, currentDocId, writer);
|
||||
console.log(`Current document ► https://docs.google.com/spreadsheets/d/${currentDocId}/edit`);
|
||||
}
|
||||
|
||||
console.log(`Current document ► https://docs.google.com/spreadsheets/d/${currentDocId}/edit`);
|
||||
await helpers.recordCurrentDoc(currentDocId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче