[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svn main 001 rem #6486

Merged
merged 6 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { needProjectId } from "../projectUtils";
import requireInteractive from "../requireInteractive";
import { doSetup } from "../init/features/frameworks";

export const command = new Command("stacks:create")
.description("Create a stack in a Firebase project")
export const command = new Command("backends:create")
.description("Create a backend in a Firebase project")
.before(requireInteractive)
.action(async (options: Options) => {
const projectId = needProjectId(options);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@
import { promptOnce } from "../prompt";
import * as utils from "../utils";

export const command = new Command("stacks:delete")
.description("Delete a stack from a Firebase project")
export const command = new Command("backends:delete")
.description("Delete a backend from a Firebase project")
.option("-l, --location <location>", "App Backend location", "us-central1")
.option("-s, --stackId <stackId>", "Stack Id", "")
.option("-s, --backendId <backendId>", "Backend Id", "")
.withForce()
.action(async (options: Options) => {
const projectId = needProjectId(options);
const location = options.location as string;
const stackId = options.stackId as string;
if (!stackId) {
throw new FirebaseError("Stack id can't be empty.");
const backendId = options.backendId as string;
if (!backendId) {
throw new FirebaseError("Backend id can't be empty.");
}
const confirmDeletion = await promptOnce(
{
type: "confirm",
name: "force",
default: false,
message: "You are about to delete the Stack with id: " + stackId + "\n Are you sure?",
message: "You are about to delete the Backend with id: " + backendId + "\n Are you sure?",
},
options
);
Expand All @@ -32,12 +32,12 @@
}

try {
await gcp.deleteStack(projectId, location, stackId);
utils.logSuccess(`Successfully deleted the stack: ${stackId}`);
await gcp.deleteBackend(projectId, location, backendId);
utils.logSuccess(`Successfully deleted the backend: ${backendId}`);
} catch (err: any) {

Check warning on line 37 in src/commands/frameworks-backends-delete.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type
throw new FirebaseError(
`Failed to delete stack: ${stackId}. Please check the parameters you have provided.`,
`Failed to delete backend: ${backendId}. Please check the parameters you have provided.`,
{ original: err }

Check warning on line 40 in src/commands/frameworks-backends-delete.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value
);
}
});
4 changes: 2 additions & 2 deletions src/commands/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
/**
* Loads all commands for our parser.
*/
export function load(client: any): any {

Check warning on line 6 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type

Check warning on line 6 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unexpected any. Specify a different type
function loadCommand(name: string) {

Check warning on line 7 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Missing return type on function
const t0 = process.hrtime.bigint();
const { command: cmd } = require(`./${name}`);

Check warning on line 9 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe assignment of an `any` value

Check warning on line 9 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Require statement not part of import statement
cmd.register(client);

Check warning on line 10 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe member access .register on an `any` value

Check warning on line 10 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe call of an `any` typed value
const t1 = process.hrtime.bigint();
const diffMS = (t1 - t0) / BigInt(1e6);
if (diffMS > 75) {
Expand All @@ -15,7 +15,7 @@
// console.error(`Loading ${name} took ${diffMS}ms`);
}

return cmd.runner();

Check warning on line 18 in src/commands/index.ts

View workflow job for this annotation

GitHub Actions / lint (18)

Unsafe return of an `any` typed value
}

const t0 = process.hrtime.bigint();
Expand Down Expand Up @@ -155,9 +155,9 @@
client.frameworks = {};
client.frameworks.stacks = {};
client.frameworks.stacks.list = loadCommand("frameworks-stacks-list");
client.frameworks.stacks.create = loadCommand("frameworks-stacks-create");
client.frameworks.stacks.create = loadCommand("frameworks-backends-create");
client.frameworks.stacks.create = loadCommand("frameworks-stacks-get");
client.frameworks.stacks.create = loadCommand("frameworks-stacks-delete");
client.frameworks.stacks.create = loadCommand("frameworks-backends-delete");
}
client.login = loadCommand("login");
client.login.add = loadCommand("login-add");
Expand Down
8 changes: 4 additions & 4 deletions src/gcp/frameworks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,14 @@ export async function listStack(projectId: string, location: string): Promise<Li
}

/**
* Deletes a Stack with stackId in a given project and location.
* Deletes a Backend with backendId in a given project and location.
*/
export async function deleteStack(
export async function deleteBackend(
projectId: string,
location: string,
stackId: string
backendId: string
): Promise<Operation> {
const name = `projects/${projectId}/locations/${location}/backends/${stackId}`;
const name = `projects/${projectId}/locations/${location}/backends/${backendId}`;
const res = await client.delete<Operation>(name);

return res.body;
Expand Down
Loading