Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
bholmesdev authored and astrobot-houston committed Mar 2, 2024
1 parent 3488be9 commit 25fe5bd
Show file tree
Hide file tree
Showing 21 changed files with 57 additions and 57 deletions.
8 changes: 4 additions & 4 deletions packages/db/src/core/cli/commands/execute/index.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { existsSync } from 'node:fs';
import type { AstroConfig } from 'astro';
import type { Arguments } from 'yargs-parser';
import { MISSING_EXECUTE_PATH_ERROR, FILE_NOT_FOUND_ERROR } from '../../../errors.js';
import { existsSync } from 'node:fs';
import { FILE_NOT_FOUND_ERROR, MISSING_EXECUTE_PATH_ERROR } from '../../../errors.js';
import { getStudioVirtualModContents } from '../../../integration/vite-plugin-db.js';
import { bundleFile, importBundledFile } from '../../../load-file.js';
import { getManagedAppTokenOrExit } from '../../../tokens.js';
import { type DBConfig } from '../../../types.js';
import { bundleFile, importBundledFile } from '../../../load-file.js';
import { getStudioVirtualModContents } from '../../../integration/vite-plugin-db.js';

export async function cmd({
astroConfig,
Expand Down
10 changes: 5 additions & 5 deletions packages/db/src/core/cli/commands/gen/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { fileURLToPath } from 'node:url';
import { writeFile } from 'node:fs/promises';
import { relative } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { AstroConfig } from 'astro';
import { bold, bgRed, red, reset } from 'kleur/colors';
import { bgRed, bold, red, reset } from 'kleur/colors';
import type { Arguments } from 'yargs-parser';
import type { DBConfig } from '../../../types.js';
import { getMigrationsDirectoryUrl } from '../../../utils.js';
import { getMigrationQueries } from '../../migration-queries.js';
import {
MIGRATIONS_CREATED,
MIGRATIONS_UP_TO_DATE,
getMigrationStatus,
initializeMigrationsDirectory,
} from '../../migrations.js';
import { getMigrationsDirectoryUrl } from '../../../utils.js';
import type { DBConfig } from '../../../types.js';
import { relative } from 'node:path';

export async function cmd({
astroConfig,
Expand Down
12 changes: 6 additions & 6 deletions packages/db/src/core/cli/commands/push/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,22 @@ import type { AstroConfig } from 'astro';
import { red } from 'kleur/colors';
import prompts from 'prompts';
import type { Arguments } from 'yargs-parser';
import { MISSING_SESSION_ID_ERROR } from '../../../errors.js';
import { getManagedAppTokenOrExit } from '../../../tokens.js';
import { type DBConfig, type DBSnapshot } from '../../../types.js';
import { getMigrationsDirectoryUrl, getRemoteDatabaseUrl } from '../../../utils.js';
import { getMigrationQueries } from '../../migration-queries.js';
import {
INITIAL_SNAPSHOT,
MIGRATIONS_NOT_INITIALIZED,
MIGRATIONS_UP_TO_DATE,
MIGRATION_NEEDED,
createEmptySnapshot,
getMigrations,
getMigrationStatus,
INITIAL_SNAPSHOT,
getMigrations,
loadInitialSnapshot,
loadMigration,
MIGRATION_NEEDED,
MIGRATIONS_NOT_INITIALIZED,
MIGRATIONS_UP_TO_DATE,
} from '../../migrations.js';
import { MISSING_SESSION_ID_ERROR } from '../../../errors.js';

export async function cmd({
astroConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/core/cli/commands/shell/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { sql } from 'drizzle-orm';
import type { Arguments } from 'yargs-parser';
import { createRemoteDatabaseClient } from '../../../../runtime/db-client.js';
import { getManagedAppTokenOrExit } from '../../../tokens.js';
import { getRemoteDatabaseUrl } from '../../../utils.js';
import type { DBConfigInput } from '../../../types.js';
import { getRemoteDatabaseUrl } from '../../../utils.js';

export async function cmd({
flags,
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/core/cli/commands/verify/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { AstroConfig } from 'astro';
import type { Arguments } from 'yargs-parser';
import type { DBConfig } from '../../../types.js';
import { getMigrationQueries } from '../../migration-queries.js';
import {
MIGRATIONS_NOT_INITIALIZED,
MIGRATIONS_UP_TO_DATE,
MIGRATION_NEEDED,
getMigrationStatus,
} from '../../migrations.js';
import type { DBConfig } from '../../../types.js';

export async function cmd({
astroConfig,
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/core/cli/migration-queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import * as color from 'kleur/colors';
import { customAlphabet } from 'nanoid';
import prompts from 'prompts';
import { hasPrimaryKey } from '../../runtime/index.js';
import { isSerializedSQL } from '../../runtime/types.js';
import {
getCreateIndexQueries,
getCreateTableQuery,
Expand All @@ -13,6 +12,7 @@ import {
hasDefault,
schemaTypeToSqlType,
} from '../../runtime/queries.js';
import { isSerializedSQL } from '../../runtime/types.js';
import {
type BooleanColumn,
type ColumnType,
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/core/cli/migrations.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import deepDiff from 'deep-diff';
import { mkdir, readFile, readdir, writeFile } from 'fs/promises';
import { type DBSnapshot, type DBConfig } from '../types.js';
import { cyan, green, yellow } from 'kleur/colors';
import { type DBConfig, type DBSnapshot } from '../types.js';
import { getMigrationsDirectoryUrl } from '../utils.js';
const { applyChange, diff: generateDiff } = deepDiff;

Expand Down
14 changes: 7 additions & 7 deletions packages/db/src/core/integration/index.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { existsSync } from 'fs';
import { CONFIG_FILE_NAMES, DB_PATH } from '../consts.js';
import { dbConfigSchema, type DBConfig } from '../types.js';
import { getDbDirectoryUrl, type VitePlugin } from '../utils.js';
import { errorMap } from './error-map.js';
import { dirname } from 'path';
import { fileURLToPath } from 'url';
import type { AstroIntegration } from 'astro';
import { mkdir, rm, writeFile } from 'fs/promises';
import { blue, yellow } from 'kleur/colors';
import { fileURLIntegration } from './file-url.js';
import { getManagedAppTokenOrExit, type ManagedAppToken } from '../tokens.js';
import { CONFIG_FILE_NAMES, DB_PATH } from '../consts.js';
import { loadDbConfigFile } from '../load-file.js';
import { vitePluginDb, type LateTables } from './vite-plugin-db.js';
import { type ManagedAppToken, getManagedAppTokenOrExit } from '../tokens.js';
import { type DBConfig, dbConfigSchema } from '../types.js';
import { type VitePlugin, getDbDirectoryUrl } from '../utils.js';
import { errorMap } from './error-map.js';
import { fileURLIntegration } from './file-url.js';
import { typegen } from './typegen.js';
import { type LateTables, vitePluginDb } from './vite-plugin-db.js';
import { vitePluginInjectEnvTs } from './vite-plugin-inject-env-ts.js';

function astroDBIntegration(): AstroIntegration {
Expand Down
4 changes: 2 additions & 2 deletions packages/db/src/core/integration/vite-plugin-db.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { fileURLToPath } from 'node:url';
import { normalizePath } from 'vite';
import { SEED_DEV_FILE_NAME } from '../../runtime/queries.js';
import {
DB_PATH,
Expand All @@ -8,8 +9,7 @@ import {
VIRTUAL_MODULE_ID,
} from '../consts.js';
import type { DBTables } from '../types.js';
import { getDbDirectoryUrl, getRemoteDatabaseUrl, type VitePlugin } from '../utils.js';
import { normalizePath } from 'vite';
import { type VitePlugin, getDbDirectoryUrl, getRemoteDatabaseUrl } from '../utils.js';

const LOCAL_DB_VIRTUAL_MODULE_ID = 'astro:local';

Expand Down
6 changes: 3 additions & 3 deletions packages/db/src/core/load-file.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { existsSync } from 'node:fs';
import { unlink, writeFile } from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
import { build as esbuild } from 'esbuild';
import { CONFIG_FILE_NAMES, VIRTUAL_MODULE_ID } from './consts.js';
import { fileURLToPath } from 'node:url';
import { getConfigVirtualModContents } from './integration/vite-plugin-db.js';
import { writeFile, unlink } from 'node:fs/promises';
import { existsSync } from 'node:fs';
import { getDbDirectoryUrl } from './utils.js';

export async function loadDbConfigFile(
Expand Down
2 changes: 1 addition & 1 deletion packages/db/src/runtime/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { LibSQLDatabase } from 'drizzle-orm/libsql';
import { type ColumnBuilderBaseConfig, type ColumnDataType, sql } from 'drizzle-orm';
import type { LibSQLDatabase } from 'drizzle-orm/libsql';
import {
type IndexBuilder,
type SQLiteColumnBuilderBase,
Expand Down
28 changes: 14 additions & 14 deletions packages/db/src/runtime/queries.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
import { LibsqlError } from '@libsql/client';
import { type SQL, 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,
SEED_ERROR,
} from '../core/errors.js';
import type {
BooleanColumn,
ColumnType,
DBColumn,
DBTable,
DBTables,
DBColumn,
DateColumn,
ColumnType,
JsonColumn,
NumberColumn,
TextColumn,
} from '../core/types.js';
import { bold } from 'kleur/colors';
import { type SQL, sql } from 'drizzle-orm';
import { SQLiteAsyncDialect } from 'drizzle-orm/sqlite-core';
import { hasPrimaryKey, type SqliteDB } from './index.js';
import { type SqliteDB, hasPrimaryKey } from './index.js';
import { isSerializedSQL } from './types.js';
import {
FOREIGN_KEY_REFERENCES_LENGTH_ERROR,
FOREIGN_KEY_REFERENCES_EMPTY_ERROR,
REFERENCE_DNE_ERROR,
FOREIGN_KEY_DNE_ERROR,
SEED_ERROR,
} from '../core/errors.js';
import { LibsqlError } from '@libsql/client';

const sqlite = new SQLiteAsyncDialect();

Expand Down
2 changes: 1 addition & 1 deletion packages/db/test/fixtures/basics/db/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { defineDB, defineTable, column } from 'astro:db';
import { Themes } from './theme';
import { column, defineDB, defineTable } from 'astro:db';

const Author = defineTable({
columns: {
Expand Down
4 changes: 2 additions & 2 deletions packages/db/test/fixtures/basics/db/seed.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { db, Author } from 'astro:db';
import { Themes as ThemesConfig } from './theme';
import { asDrizzleTable } from '@astrojs/db/utils';
import { Themes as ThemesConfig } from './theme';
import { Author, db } from 'astro:db';

const Themes = asDrizzleTable('Themes', ThemesConfig);

Expand Down
2 changes: 1 addition & 1 deletion packages/db/test/fixtures/basics/db/theme.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineTable, column, NOW, sql } from 'astro:db';
import { NOW, column, defineTable, sql } from 'astro:db';

export const Themes = defineTable({
columns: {
Expand Down
2 changes: 1 addition & 1 deletion packages/db/test/fixtures/recipes/db/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineTable, defineDB, column } from 'astro:db';
import { column, defineDB, defineTable } from 'astro:db';

const Recipe = defineTable({
columns: {
Expand Down
2 changes: 1 addition & 1 deletion packages/db/test/fixtures/recipes/db/seed.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { db, Recipe, Ingredient } from 'astro:db';
import { Ingredient, Recipe, db } from 'astro:db';

const pancakes = await db
.insert(Recipe)
Expand Down
2 changes: 1 addition & 1 deletion packages/db/test/fixtures/ticketing-example/db/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { defineDB, defineTable, column } from 'astro:db';
import { column, defineDB, defineTable } from 'astro:db';

const Event = defineTable({
columns: {
Expand Down
4 changes: 2 additions & 2 deletions packages/db/test/unit/column-queries.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import {
getCollectionChangeQueries,
getMigrationQueries,
} from '../../dist/core/cli/migration-queries.js';
import { getCreateTableQuery } from '../../dist/runtime/queries.js';
import { column, defineTable } from '../../dist/runtime/config.js';
import { tableSchema } from '../../dist/core/types.js';
import { column, defineTable } from '../../dist/runtime/config.js';
import { NOW } from '../../dist/runtime/index.js';
import { getCreateTableQuery } from '../../dist/runtime/queries.js';

const TABLE_NAME = 'Users';

Expand Down
2 changes: 1 addition & 1 deletion packages/db/test/unit/index-queries.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { getCollectionChangeQueries } from '../../dist/core/cli/migration-queries.js';
import { column } from '../../dist/runtime/config.js';
import { tableSchema } from '../../dist/core/types.js';
import { column } from '../../dist/runtime/config.js';

const userInitial = tableSchema.parse({
columns: {
Expand Down
2 changes: 1 addition & 1 deletion packages/db/test/unit/reference-queries.test.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { getCollectionChangeQueries } from '../../dist/core/cli/migration-queries.js';
import { column, defineTable } from '../../dist/runtime/config.js';
import { tablesSchema } from '../../dist/core/types.js';
import { column, defineTable } from '../../dist/runtime/config.js';

const BaseUser = defineTable({
columns: {
Expand Down

0 comments on commit 25fe5bd

Please sign in to comment.