Error Fix and Console Logging format.

This commit is contained in:
2026-07-17 11:39:58 +01:00
parent 7e45c40c8a
commit 26702cec4f
7 changed files with 261 additions and 107 deletions
+7 -21
View File
@@ -1,7 +1,7 @@
const readline = require('readline');
const {google} = require('googleapis');
const {createStarterConfig, getDefaultConfigPath, writeConfigFile} = require('./config');
const {getFirstServiceAccountAuthClient} = require('./auth');
const {fetchSpreadsheetTitle} = require('./sheets');
function createPrompt() {
const rl = readline.createInterface({input: process.stdin, output: process.stdout});
@@ -82,26 +82,6 @@ async function pauseForEnter(ask) {
await ask('Press Enter to close this window...');
}
async function fetchSpreadsheetTitle(context, documentId) {
const sheetOptions = {version: 'v4'};
if (context.authClient) {
sheetOptions.auth = context.authClient;
}
const sheets = google.sheets(sheetOptions);
const request = {
spreadsheetId: documentId,
fields: 'properties/title',
};
if (context.apiKey) {
request.key = context.apiKey;
}
const response = await sheets.spreadsheets.get(request);
return response.data.properties?.title || documentId;
}
function buildTitleContext(authMode, config) {
if (authMode === 'apiKeys' && Array.isArray(config.apiKeys) && config.apiKeys.length > 0) {
return {apiKey: config.apiKeys[0].key};
@@ -162,6 +142,12 @@ async function runOnboarding() {
serviceAccounts: [],
documents: [],
};
Object.defineProperty(config, '__configPath', {
value: configPath,
enumerable: false,
configurable: true,
writable: true,
});
if (authMode === 'apiKeys') {
for (let index = 0; index < credentialCount; index += 1) {