From 5705200398b07d99badafb977a8401c4129a536c Mon Sep 17 00:00:00 2001 From: Luiz Ferraz Date: Tue, 3 Sep 2024 12:54:20 +0000 Subject: [PATCH] [ci] format --- packages/db/src/core/cli/commands/push/index.ts | 7 ++++++- .../db/src/core/cli/commands/verify/index.ts | 2 +- packages/db/src/core/integration/index.ts | 2 +- packages/db/src/core/utils.ts | 9 ++++++--- packages/db/test/unit/remote-info.test.js | 16 +++++++++------- 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/packages/db/src/core/cli/commands/push/index.ts b/packages/db/src/core/cli/commands/push/index.ts index 0b7b32bf9498..590d4f06ee63 100644 --- a/packages/db/src/core/cli/commands/push/index.ts +++ b/packages/db/src/core/cli/commands/push/index.ts @@ -6,7 +6,12 @@ import { createRemoteDatabaseClient } from '../../../../runtime/index.js'; import { safeFetch } from '../../../../runtime/utils.js'; import { MIGRATION_VERSION } from '../../../consts.js'; import type { DBConfig, DBSnapshot } from '../../../types.js'; -import { type RemoteDatabaseInfo, type Result, getManagedRemoteToken, getRemoteDatabaseInfo } from '../../../utils.js'; +import { + type RemoteDatabaseInfo, + type Result, + getManagedRemoteToken, + getRemoteDatabaseInfo, +} from '../../../utils.js'; import { createCurrentSnapshot, createEmptySnapshot, diff --git a/packages/db/src/core/cli/commands/verify/index.ts b/packages/db/src/core/cli/commands/verify/index.ts index d535fba1feb9..35f489a80333 100644 --- a/packages/db/src/core/cli/commands/verify/index.ts +++ b/packages/db/src/core/cli/commands/verify/index.ts @@ -1,6 +1,7 @@ import type { AstroConfig } from 'astro'; import type { Arguments } from 'yargs-parser'; import type { DBConfig } from '../../../types.js'; +import { getManagedRemoteToken, getRemoteDatabaseInfo } from '../../../utils.js'; import { createCurrentSnapshot, createEmptySnapshot, @@ -8,7 +9,6 @@ import { getMigrationQueries, getProductionCurrentSnapshot, } from '../../migration-queries.js'; -import { getManagedRemoteToken, getRemoteDatabaseInfo } from '../../../utils.js'; export async function cmd({ dbConfig, diff --git a/packages/db/src/core/integration/index.ts b/packages/db/src/core/integration/index.ts index 1b1eeec8e1fc..2a5824c35b4f 100644 --- a/packages/db/src/core/integration/index.ts +++ b/packages/db/src/core/integration/index.ts @@ -178,7 +178,7 @@ function astroDBIntegration(): AstroIntegration { await executeSeedFile({ fileUrl, viteServer: tempViteServer! }); }; }, - 'astro:build:done': async ({ }) => { + 'astro:build:done': async ({}) => { await appToken?.destroy(); await tempViteServer?.close(); }, diff --git a/packages/db/src/core/utils.ts b/packages/db/src/core/utils.ts index 53732c5db3c1..b246997e245a 100644 --- a/packages/db/src/core/utils.ts +++ b/packages/db/src/core/utils.ts @@ -1,4 +1,4 @@ -import { getAstroStudioEnv, getManagedAppTokenOrExit, type ManagedAppToken } from '@astrojs/studio'; +import { type ManagedAppToken, getAstroStudioEnv, getManagedAppTokenOrExit } from '@astrojs/studio'; import type { AstroConfig, AstroIntegration } from 'astro'; import { loadEnv } from 'vite'; import './types.js'; @@ -37,11 +37,14 @@ export function getRemoteDatabaseInfo(): RemoteDatabaseInfo { }; } -export function getManagedRemoteToken(token?: string, dbInfo?: RemoteDatabaseInfo): Promise { +export function getManagedRemoteToken( + token?: string, + dbInfo?: RemoteDatabaseInfo, +): Promise { dbInfo ??= getRemoteDatabaseInfo(); if (dbInfo.type === 'studio') { - return getManagedAppTokenOrExit(token) + return getManagedAppTokenOrExit(token); } const astroEnv = getAstroEnv(); diff --git a/packages/db/test/unit/remote-info.test.js b/packages/db/test/unit/remote-info.test.js index 909feddd7c54..2c58f28b7ba2 100644 --- a/packages/db/test/unit/remote-info.test.js +++ b/packages/db/test/unit/remote-info.test.js @@ -1,7 +1,7 @@ -import test, { after, beforeEach, describe } from "node:test"; -import assert from "node:assert"; -import { getRemoteDatabaseInfo, getManagedRemoteToken } from '../../dist/core/utils.js'; -import { clearEnvironment } from "../test-utils.js"; +import assert from 'node:assert'; +import test, { after, beforeEach, describe } from 'node:test'; +import { getManagedRemoteToken, getRemoteDatabaseInfo } from '../../dist/core/utils.js'; +import { clearEnvironment } from '../test-utils.js'; describe('RemoteDatabaseInfo', () => { beforeEach(() => { @@ -53,10 +53,12 @@ describe('RemoteManagedToken', () => { // Avoid conflicts with other tests beforeEach(() => { clearEnvironment(); - process.env.ASTRO_STUDIO_APP_TOKEN = 'studio token' - process.env.ASTRO_DB_APP_TOKEN = 'db token' + process.env.ASTRO_STUDIO_APP_TOKEN = 'studio token'; + process.env.ASTRO_DB_APP_TOKEN = 'db token'; + }); + after(() => { + clearEnvironment(); }); - after(() => { clearEnvironment(); }); test('given token for default remote', async () => { const { token } = await getManagedRemoteToken('given token');