From befbda7fa3d712388789a5a9be1e0597834f86db Mon Sep 17 00:00:00 2001 From: Ben Holmes Date: Fri, 3 May 2024 15:09:39 +0000 Subject: [PATCH] [ci] format --- packages/db/src/core/cli/commands/shell/index.ts | 2 +- packages/db/src/core/cli/migration-queries.ts | 8 ++++---- packages/db/src/core/integration/index.ts | 14 +++++++------- .../db/src/core/integration/vite-plugin-db.ts | 16 ++++++++-------- packages/db/src/core/queries.ts | 16 ++++++++-------- packages/db/test/local-prod.test.js | 2 +- 6 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/db/src/core/cli/commands/shell/index.ts b/packages/db/src/core/cli/commands/shell/index.ts index 0c1883cd20..c93a127fa9 100644 --- a/packages/db/src/core/cli/commands/shell/index.ts +++ b/packages/db/src/core/cli/commands/shell/index.ts @@ -5,12 +5,12 @@ import { createLocalDatabaseClient, createRemoteDatabaseClient, } from '../../../../runtime/db-client.js'; +import { normalizeDatabaseUrl } from '../../../../runtime/index.js'; import { DB_PATH } from '../../../consts.js'; import { SHELL_QUERY_MISSING_ERROR } from '../../../errors.js'; import { getManagedAppTokenOrExit } from '../../../tokens.js'; import type { DBConfigInput } from '../../../types.js'; import { getAstroEnv, getRemoteDatabaseUrl } from '../../../utils.js'; -import { normalizeDatabaseUrl } from '../../../../runtime/index.js'; export async function cmd({ flags, diff --git a/packages/db/src/core/cli/migration-queries.ts b/packages/db/src/core/cli/migration-queries.ts index 94674f9d19..f00d194bf7 100644 --- a/packages/db/src/core/cli/migration-queries.ts +++ b/packages/db/src/core/cli/migration-queries.ts @@ -4,6 +4,10 @@ import * as color from 'kleur/colors'; import { customAlphabet } from 'nanoid'; import stripAnsi from 'strip-ansi'; import { hasPrimaryKey } from '../../runtime/index.js'; +import { isSerializedSQL } from '../../runtime/types.js'; +import { safeFetch } from '../../runtime/utils.js'; +import { MIGRATION_VERSION } from '../consts.js'; +import { RENAME_COLUMN_ERROR, RENAME_TABLE_ERROR } from '../errors.js'; import { getCreateIndexQueries, getCreateTableQuery, @@ -13,10 +17,6 @@ import { hasDefault, schemaTypeToSqlType, } from '../queries.js'; -import { isSerializedSQL } from '../../runtime/types.js'; -import { safeFetch } from '../../runtime/utils.js'; -import { MIGRATION_VERSION } from '../consts.js'; -import { RENAME_COLUMN_ERROR, RENAME_TABLE_ERROR } from '../errors.js'; import { columnSchema } from '../schemas.js'; import { type BooleanColumn, diff --git a/packages/db/src/core/integration/index.ts b/packages/db/src/core/integration/index.ts index 403d1901b3..99b69bed65 100644 --- a/packages/db/src/core/integration/index.ts +++ b/packages/db/src/core/integration/index.ts @@ -1,22 +1,24 @@ import { existsSync } from 'fs'; import { dirname } from 'path'; import { fileURLToPath } from 'url'; +import { LibsqlError } from '@libsql/client'; import type { AstroConfig, AstroIntegration } from 'astro'; import { mkdir, writeFile } from 'fs/promises'; import { blue, yellow } from 'kleur/colors'; import { - createServer, - loadEnv, - mergeConfig, type HMRPayload, type UserConfig, type ViteDevServer, + createServer, + loadEnv, + mergeConfig, } from 'vite'; import parseArgs from 'yargs-parser'; -import { SEED_DEV_FILE_NAME } from '../queries.js'; import { AstroDbError } from '../../runtime/utils.js'; import { CONFIG_FILE_NAMES, DB_PATH } from '../consts.js'; +import { EXEC_DEFAULT_EXPORT_ERROR, EXEC_ERROR } from '../errors.js'; import { resolveDbConfig } from '../load-file.js'; +import { SEED_DEV_FILE_NAME } from '../queries.js'; import { type ManagedAppToken, getManagedAppTokenOrExit } from '../tokens.js'; import { type VitePlugin, getDbDirectoryUrl } from '../utils.js'; import { fileURLIntegration } from './file-url.js'; @@ -24,13 +26,11 @@ import { typegenInternal } from './typegen.js'; import { type LateSeedFiles, type LateTables, - vitePluginDb, type SeedHandler, resolved, + vitePluginDb, } from './vite-plugin-db.js'; import { vitePluginInjectEnvTs } from './vite-plugin-inject-env-ts.js'; -import { LibsqlError } from '@libsql/client'; -import { EXEC_DEFAULT_EXPORT_ERROR, EXEC_ERROR } from '../errors.js'; function astroDBIntegration(): AstroIntegration { let connectToStudio = false; diff --git a/packages/db/src/core/integration/vite-plugin-db.ts b/packages/db/src/core/integration/vite-plugin-db.ts index 865fcd1680..cd334b4deb 100644 --- a/packages/db/src/core/integration/vite-plugin-db.ts +++ b/packages/db/src/core/integration/vite-plugin-db.ts @@ -1,15 +1,15 @@ +import { existsSync } from 'node:fs'; import { fileURLToPath } from 'node:url'; import type { AstroConfig, AstroIntegrationLogger } from 'astro'; -import { SEED_DEV_FILE_NAME, getCreateIndexQueries, getCreateTableQuery } from '../queries.js'; -import { DB_PATH, RUNTIME_IMPORT, RUNTIME_VIRTUAL_IMPORT, VIRTUAL_MODULE_ID } from '../consts.js'; -import type { DBTables } from '../types.js'; -import { type VitePlugin, getDbDirectoryUrl, getRemoteDatabaseUrl, getAstroEnv } from '../utils.js'; -import { createLocalDatabaseClient } from '../../runtime/db-client.js'; import { type SQL, sql } from 'drizzle-orm'; -import { existsSync } from 'node:fs'; -import { normalizeDatabaseUrl } from '../../runtime/index.js'; -import { getResolvedFileUrl } from '../load-file.js'; import { SQLiteAsyncDialect } from 'drizzle-orm/sqlite-core'; +import { createLocalDatabaseClient } from '../../runtime/db-client.js'; +import { normalizeDatabaseUrl } from '../../runtime/index.js'; +import { DB_PATH, RUNTIME_IMPORT, RUNTIME_VIRTUAL_IMPORT, VIRTUAL_MODULE_ID } from '../consts.js'; +import { getResolvedFileUrl } from '../load-file.js'; +import { SEED_DEV_FILE_NAME, getCreateIndexQueries, getCreateTableQuery } from '../queries.js'; +import type { DBTables } from '../types.js'; +import { type VitePlugin, getAstroEnv, getDbDirectoryUrl, getRemoteDatabaseUrl } from '../utils.js'; export const resolved = { module: '\0' + VIRTUAL_MODULE_ID, diff --git a/packages/db/src/core/queries.ts b/packages/db/src/core/queries.ts index ff4d56a5d1..200476c148 100644 --- a/packages/db/src/core/queries.ts +++ b/packages/db/src/core/queries.ts @@ -1,6 +1,14 @@ import { type SQL } from 'drizzle-orm'; import { SQLiteAsyncDialect } from 'drizzle-orm/sqlite-core'; import { bold } from 'kleur/colors'; +import { + FOREIGN_KEY_DNE_ERROR, + FOREIGN_KEY_REFERENCES_EMPTY_ERROR, + FOREIGN_KEY_REFERENCES_LENGTH_ERROR, + REFERENCE_DNE_ERROR, +} from '../runtime/errors.js'; +import { hasPrimaryKey } from '../runtime/index.js'; +import { isSerializedSQL } from '../runtime/types.js'; import type { BooleanColumn, ColumnType, @@ -11,14 +19,6 @@ import type { NumberColumn, TextColumn, } from './types.js'; -import { - FOREIGN_KEY_DNE_ERROR, - FOREIGN_KEY_REFERENCES_EMPTY_ERROR, - FOREIGN_KEY_REFERENCES_LENGTH_ERROR, - REFERENCE_DNE_ERROR, -} from '../runtime/errors.js'; -import { hasPrimaryKey } from '../runtime/index.js'; -import { isSerializedSQL } from '../runtime/types.js'; const sqlite = new SQLiteAsyncDialect(); diff --git a/packages/db/test/local-prod.test.js b/packages/db/test/local-prod.test.js index ff3b2c633c..4796bfc9be 100644 --- a/packages/db/test/local-prod.test.js +++ b/packages/db/test/local-prod.test.js @@ -1,8 +1,8 @@ +import { relative } from 'path'; import { fileURLToPath } from 'url'; import { expect } from 'chai'; import testAdapter from '../../astro/test/test-adapter.js'; import { loadFixture } from '../../astro/test/test-utils.js'; -import { relative } from 'path'; describe('astro:db local database', () => { let fixture;