Skip to content

Commit

Permalink
fix: Migrate packages in xtd to denoxtd
Browse files Browse the repository at this point in the history
Signed-off-by: Yoriyasu Yano <430092+yorinasub17@users.noreply.github.com>
  • Loading branch information
yorinasub17 committed Oct 26, 2023
1 parent 478a9da commit a897f23
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 59 deletions.
12 changes: 8 additions & 4 deletions deno.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions deployments/release/integration_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import {
GitHubComponents,
Octokit,
octokitCreateAppAuth,
random,
sleep,
} from "../../deps.ts";

import {
Expand All @@ -23,7 +25,6 @@ import {
deleteBranch,
getHeadSHA,
} from "../../ghstd/mod.ts";
import { getRandomString, sleep } from "../../xtd/mod.ts";

/**
* start global constants
Expand Down Expand Up @@ -105,7 +106,7 @@ const testCommitterOctokit = new Octokit({

Deno.test("auto-approve happy path for README update", async (t) => {
const repoName = "test-fensak-automated-readme-only";
const branchName = `test/update-readme-${getRandomString(6)}`;
const branchName = `test/update-readme-${random.getRandomString(6)}`;
const defaultBranchName = "main";
let prNum = 0;

Expand Down Expand Up @@ -171,7 +172,7 @@ Deno.test("auto-approve happy path for README update", async (t) => {

Deno.test("manual review required for config update", async (t) => {
const repoName = "test-fensak-automated-readme-only";
const branchName = `test/update-config-${getRandomString(6)}`;
const branchName = `test/update-config-${random.getRandomString(6)}`;
const defaultBranchName = "main";
const previousCheckRuns: number[] = [];
let prNum = 0;
Expand Down Expand Up @@ -285,7 +286,7 @@ Deno.test("manual review required for config update", async (t) => {

Deno.test("failed required rule fails check", async (t) => {
const repoName = "test-fensak-automated-appdeploy";
const branchName = `test/update-config-${getRandomString(6)}`;
const branchName = `test/update-config-${random.getRandomString(6)}`;
const defaultBranchName = "main";
const previousCheckRuns: number[] = [];
let prNum = 0;
Expand Down Expand Up @@ -376,7 +377,7 @@ Deno.test("failed required rule fails check", async (t) => {

Deno.test("passed required rule and passed automerge passes check", async (t) => {
const repoName = "test-fensak-automated-appdeploy";
const branchName = `feature/update-config-${getRandomString(6)}`;
const branchName = `feature/update-config-${random.getRandomString(6)}`;
const defaultBranchName = "main";
const previousCheckRuns: number[] = [];
let prNum = 0;
Expand Down Expand Up @@ -446,7 +447,7 @@ Deno.test("passed required rule and passed automerge passes check", async (t) =>

Deno.test("passed required rule and failed automerge requires review", async (t) => {
const repoName = "test-fensak-automated-appdeploy";
const branchName = `feature/update-config-${getRandomString(6)}`;
const branchName = `feature/update-config-${random.getRandomString(6)}`;
const defaultBranchName = "main";
const previousCheckRuns: number[] = [];
let prNum = 0;
Expand Down Expand Up @@ -585,7 +586,7 @@ async function waitForFensakStagingCheck(
console.debug(
`Fensak Staging check hasn't run yet on head commit on branch ${branchName} in ${owner}/${repoName}. Retrying after 1 second delay.`,
);
await sleep(sleepBetweenRetries);
await sleep.sleep(sleepBetweenRetries);
}

throw new Error(
Expand Down
5 changes: 2 additions & 3 deletions deployments/release/sanitycheck_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@
*/

import { assertEquals } from "../../test_deps.ts";
import { Octokit, Status } from "../../deps.ts";
import { Octokit, sleep, Status } from "../../deps.ts";

import { getHeadSHA } from "../../ghstd/mod.ts";
import { sleep } from "../../xtd/mod.ts";

const fensakOrg = "fensak-io";
const fensakRepo = "fensak";
Expand Down Expand Up @@ -83,7 +82,7 @@ async function waitForDenoDeploy(octokit: Octokit): Promise<void> {
console.debug(
`Deploy fensak-stage job hasn't run yet on head commit on branch ${fensakRepoDefaultBranch} in ${fensakOrg}/${fensakRepo}. Retrying after 1 second delay.`,
);
await sleep(sleepBetweenRetries);
await sleep.sleep(sleepBetweenRetries);
}

throw new Error(
Expand Down
4 changes: 3 additions & 1 deletion deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export type {
} from "https://deno.land/x/oak@v12.6.1/mod.ts";
export { oakCors } from "https://deno.land/x/cors@v1.2.1/mod.ts";

export * as basemiddlewares from "https://raw.githubusercontent.com/fensak-io/denoxtd/v0.2.1/oakmiddlewares/mod.ts";
export * as basemiddlewares from "https://raw.githubusercontent.com/fensak-io/denoxtd/v0.2.2/oakmiddlewares/mod.ts";
export * as random from "https://raw.githubusercontent.com/fensak-io/denoxtd/v0.2.2/random/mod.ts";
export * as sleep from "https://raw.githubusercontent.com/fensak-io/denoxtd/v0.2.2/sleep/mod.ts";

import winston from "npm:winston@^3.10.0";
import WinstonTransport from "npm:winston-transport@^4.5.0";
Expand Down
5 changes: 2 additions & 3 deletions svcdata/store.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
// Copyright (c) Fensak, LLC.
// SPDX-License-Identifier: AGPL-3.0-or-later OR BUSL-1.1

import { crypto } from "../deps.ts";
import { crypto, sleep } from "../deps.ts";

import { logger } from "../logging/mod.ts";
import { sleep } from "../xtd/mod.ts";

import { mainKV } from "./svc.ts";
import {
Expand Down Expand Up @@ -55,7 +54,7 @@ export async function waitForHealthCheckResult(
i + 1
} of ${maxTries}). Retrying after sleep for ${sleepBetweenTries} seconds.`,
);
await sleep(sleepBetweenTries * 1000);
await sleep.sleep(sleepBetweenTries * 1000);
}
}

Expand Down
13 changes: 10 additions & 3 deletions web/mgmt_routes.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,15 @@
// Copyright (c) Fensak, LLC.
// SPDX-License-Identifier: AGPL-3.0-or-later OR BUSL-1.1

import { config, Context, oakCors, Octokit, Router, Status } from "../deps.ts";
import {
config,
Context,
oakCors,
Octokit,
random,
Router,
Status,
} from "../deps.ts";
import type { RouteParams, RouterContext } from "../deps.ts";

import * as middlewares from "../middlewares/mod.ts";
Expand All @@ -20,7 +28,6 @@ import {
} from "../svcdata/mod.ts";
import type { GitHubOrgWithSubscription } from "../svcdata/mod.ts";
import { isOrgManager } from "../ghstd/mod.ts";
import { getRandomString } from "../xtd/mod.ts";

interface APIOrganization {
slug: string;
Expand Down Expand Up @@ -66,7 +73,7 @@ export function attachMgmtAPIRoutes(router: Router): void {
}

async function healthCheck(ctx: Context): Promise<void> {
const requestID = getRandomString(6);
const requestID = random.getRandomString(6);
await enqueueMsg({
type: MessageType.HealthCheck,
payload: {
Expand Down
9 changes: 0 additions & 9 deletions xtd/mod.ts

This file was deleted.

20 changes: 0 additions & 20 deletions xtd/random.ts

This file was deleted.

9 changes: 0 additions & 9 deletions xtd/sleep.ts

This file was deleted.

0 comments on commit a897f23

Please sign in to comment.