mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
[ci] format
This commit is contained in:
parent
cc820c5d5e
commit
5705200398
5 changed files with 23 additions and 13 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
},
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue