summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Luiz Ferraz <Princesseuh@users.noreply.github.com> 2024-09-03 12:54:20 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2024-09-03 12:54:20 +0000
commit5705200398b07d99badafb977a8401c4129a536c (patch)
treea11056bd41cb23dae9e0588897d87f637375a544
parentcc820c5d5e176a8d71594d612af75e1c94b9bf02 (diff)
downloadastro-5705200398b07d99badafb977a8401c4129a536c.tar.gz
astro-5705200398b07d99badafb977a8401c4129a536c.tar.zst
astro-5705200398b07d99badafb977a8401c4129a536c.zip
[ci] format
-rw-r--r--packages/db/src/core/cli/commands/push/index.ts7
-rw-r--r--packages/db/src/core/cli/commands/verify/index.ts2
-rw-r--r--packages/db/src/core/integration/index.ts2
-rw-r--r--packages/db/src/core/utils.ts9
-rw-r--r--packages/db/test/unit/remote-info.test.js16
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 0b7b32bf9..590d4f06e 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 d535fba1f..35f489a80 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 1b1eeec8e..2a5824c35 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 53732c5db..b246997e2 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<ManagedAppToken> {
+export function getManagedRemoteToken(
+ token?: string,
+ dbInfo?: RemoteDatabaseInfo,
+): Promise<ManagedAppToken> {
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 909feddd7..2c58f28b7 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');