@mcpher/gas-fakes 1.2.19 → 1.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/gas-fakes.js +4 -4
- package/package.json +1 -1
- package/setup.js +65 -55
package/gas-fakes.js
CHANGED
|
@@ -31,7 +31,7 @@ const VERSION = pjson.version;
|
|
|
31
31
|
// CONSTANTS & UTILITIES
|
|
32
32
|
// -----------------------------------------------------------------------------
|
|
33
33
|
|
|
34
|
-
const CLI_VERSION = "0.0.
|
|
34
|
+
const CLI_VERSION = "0.0.13";
|
|
35
35
|
const MCP_VERSION = "0.0.3";
|
|
36
36
|
const execAsync = promisify(exec);
|
|
37
37
|
|
|
@@ -475,9 +475,9 @@ async function main() {
|
|
|
475
475
|
// We check if the command is not one of the others.
|
|
476
476
|
const knownCommands = program.commands.map((cmd) => cmd.name());
|
|
477
477
|
if (!process.argv.slice(2).some((arg) => knownCommands.includes(arg))) {
|
|
478
|
-
console.error(
|
|
479
|
-
|
|
480
|
-
);
|
|
478
|
+
// console.error(
|
|
479
|
+
// "Error: You must provide a script via --filename or --script, or use a specific command (e.g., init, auth, mcp)."
|
|
480
|
+
// );
|
|
481
481
|
program.help();
|
|
482
482
|
process.exit(1);
|
|
483
483
|
}
|
package/package.json
CHANGED
package/setup.js
CHANGED
|
@@ -145,17 +145,18 @@ export async function initializeConfiguration(options = {}) {
|
|
|
145
145
|
type: "text",
|
|
146
146
|
name: "GCP_PROJECT_ID",
|
|
147
147
|
message: "Enter your GCP Project ID",
|
|
148
|
-
initial:
|
|
148
|
+
initial:
|
|
149
|
+
existingConfig.GCP_PROJECT_ID || process.env.GOOGLE_CLOUD_PROJECT,
|
|
149
150
|
},
|
|
150
151
|
{
|
|
151
152
|
type: "text",
|
|
152
153
|
name: "DRIVE_TEST_FILE_ID",
|
|
153
|
-
message:
|
|
154
|
+
message:
|
|
155
|
+
"Enter a test Drive file ID for authentication checks (optional)",
|
|
154
156
|
initial: existingConfig.DRIVE_TEST_FILE_ID || "",
|
|
155
157
|
},
|
|
156
158
|
];
|
|
157
159
|
|
|
158
|
-
|
|
159
160
|
const basicInfoResponses = await prompts(basicInfoQuestions);
|
|
160
161
|
if (typeof basicInfoResponses.GCP_PROJECT_ID === "undefined") {
|
|
161
162
|
console.log("Initialization cancelled.");
|
|
@@ -176,7 +177,6 @@ export async function initializeConfiguration(options = {}) {
|
|
|
176
177
|
DEFAULT_SCOPES_VALUES.forEach((scope) => console.log(` - ${scope}`));
|
|
177
178
|
responses.DEFAULT_SCOPES = DEFAULT_SCOPES_VALUES;
|
|
178
179
|
|
|
179
|
-
|
|
180
180
|
const extraScopeQuestion = {
|
|
181
181
|
type: "multiselect",
|
|
182
182
|
name: "EXTRA_SCOPES",
|
|
@@ -220,10 +220,11 @@ export async function initializeConfiguration(options = {}) {
|
|
|
220
220
|
title: "Gmail compose",
|
|
221
221
|
value: "https://www.googleapis.com/auth/gmail.compose",
|
|
222
222
|
},
|
|
223
|
-
|
|
224
223
|
].map((scope) => ({
|
|
225
224
|
...scope,
|
|
226
|
-
title: scope.sensitivity
|
|
225
|
+
title: scope.sensitivity
|
|
226
|
+
? `[${scope.sensitivity}] ${scope.title}`
|
|
227
|
+
: scope.title,
|
|
227
228
|
// because we always need drive for ant extra scopes
|
|
228
229
|
selected:
|
|
229
230
|
existingExtraScopes.length > 0
|
|
@@ -252,15 +253,17 @@ export async function initializeConfiguration(options = {}) {
|
|
|
252
253
|
selectedExtraScopes.includes(s.value)
|
|
253
254
|
);
|
|
254
255
|
|
|
255
|
-
|
|
256
256
|
if (usesSensitiveScopes) {
|
|
257
257
|
console.log("\n--------------------------------------------------");
|
|
258
|
-
console.log(
|
|
259
|
-
|
|
258
|
+
console.log(
|
|
259
|
+
"You have selected sensitive or restricted scopes. Google requires an OAuth client credential file for these."
|
|
260
|
+
);
|
|
261
|
+
console.log(
|
|
262
|
+
"See the getting started guide https://github.com/brucemcpherson/gas-fakes/blob/main/GETTING_STARTED.md for how."
|
|
263
|
+
);
|
|
260
264
|
console.log("--------------------------------------------------");
|
|
261
265
|
}
|
|
262
266
|
|
|
263
|
-
|
|
264
267
|
const clientCredentialQuestion = {
|
|
265
268
|
type: "text",
|
|
266
269
|
name: "CLIENT_CREDENTIAL_FILE",
|
|
@@ -306,45 +309,46 @@ export async function initializeConfiguration(options = {}) {
|
|
|
306
309
|
? `\n - Extra: [${responses.EXTRA_SCOPES.join(", ")}]`
|
|
307
310
|
: "\n - Extra: [None]";
|
|
308
311
|
|
|
309
|
-
const remainingQuestions = [
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
) > -1
|
|
329
|
-
? ["CONSOLE", "CLOUD", "BOTH", "NONE"].indexOf(
|
|
312
|
+
const remainingQuestions = [
|
|
313
|
+
{
|
|
314
|
+
type: "toggle",
|
|
315
|
+
name: "QUIET",
|
|
316
|
+
message: "Run gas-fakes package in quiet mode",
|
|
317
|
+
initial: existingConfig.QUIET === "true" ? true : false,
|
|
318
|
+
},
|
|
319
|
+
{
|
|
320
|
+
type: "select",
|
|
321
|
+
name: "LOG_DESTINATION",
|
|
322
|
+
message: `Selected Scopes:${defaultScopesDisplay}${extraScopesDisplay}\n\nEnter logging destination`,
|
|
323
|
+
choices: [
|
|
324
|
+
{ title: "CONSOLE", value: "CONSOLE" },
|
|
325
|
+
{ title: "CLOUD", value: "CLOUD" },
|
|
326
|
+
{ title: "BOTH", value: "BOTH" },
|
|
327
|
+
{ title: "NONE", value: "NONE" },
|
|
328
|
+
],
|
|
329
|
+
initial:
|
|
330
|
+
["CONSOLE", "CLOUD", "BOTH", "NONE"].indexOf(
|
|
330
331
|
existingConfig.LOG_DESTINATION
|
|
331
|
-
)
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
332
|
+
) > -1
|
|
333
|
+
? ["CONSOLE", "CLOUD", "BOTH", "NONE"].indexOf(
|
|
334
|
+
existingConfig.LOG_DESTINATION
|
|
335
|
+
)
|
|
336
|
+
: 0,
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
type: "select",
|
|
340
|
+
name: "STORE_TYPE",
|
|
341
|
+
message: "Enter storage type",
|
|
342
|
+
choices: [
|
|
343
|
+
{ title: "FILE", value: "FILE" },
|
|
344
|
+
{ title: "UPSTASH", value: "UPSTASH" },
|
|
345
|
+
],
|
|
346
|
+
initial:
|
|
347
|
+
["FILE", "UPSTASH"].indexOf(existingConfig.STORE_TYPE?.toUpperCase()) >
|
|
344
348
|
-1
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
349
|
+
? ["FILE", "UPSTASH"].indexOf(existingConfig.STORE_TYPE.toUpperCase())
|
|
350
|
+
: 0,
|
|
351
|
+
},
|
|
348
352
|
];
|
|
349
353
|
|
|
350
354
|
const remainingResponses = await prompts(remainingQuestions);
|
|
@@ -406,16 +410,22 @@ export async function initializeConfiguration(options = {}) {
|
|
|
406
410
|
}
|
|
407
411
|
|
|
408
412
|
// --- File Writing Logic ---
|
|
409
|
-
console.log(`Writing configuration to ${envPath}...`);
|
|
410
|
-
const inits =
|
|
413
|
+
console.log(`Writing configuration to "${envPath}"...`);
|
|
414
|
+
const inits =
|
|
415
|
+
responses.STORE_TYPE !== "UPSTASH"
|
|
416
|
+
? { UPSTASH_REDIS_REST_TOKEN: "", UPSTASH_REDIS_REST_URL: "" }
|
|
417
|
+
: {};
|
|
411
418
|
const finalConfig = { ...existingConfig, ...responses, ...inits };
|
|
412
419
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
420
|
+
console.log("\n------------------ Final output ------------------");
|
|
421
|
+
const envContent = Reflect.ownKeys(finalConfig)
|
|
422
|
+
.map((key) => {
|
|
423
|
+
const item = finalConfig[key];
|
|
424
|
+
const res = `${key}="${(item.toString() || "").trim()}"`;
|
|
425
|
+
console.log(res);
|
|
426
|
+
return res;
|
|
427
|
+
})
|
|
428
|
+
.join("\n");
|
|
419
429
|
/* replacing this to include existing values
|
|
420
430
|
let envContent = `
|
|
421
431
|
# Google Cloud Project ID (required)
|