mirror of
https://github.com/withastro/astro.git
synced 2025-01-27 22:19:04 -05:00
[ci] format
This commit is contained in:
parent
3488be9b59
commit
25fe5bd040
21 changed files with 58 additions and 58 deletions
|
@ -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,
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
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,
|
||||
|
@ -10,9 +13,6 @@ import {
|
|||
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,
|
||||
|
|
|
@ -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 {
|
||||
createEmptySnapshot,
|
||||
getMigrations,
|
||||
getMigrationStatus,
|
||||
INITIAL_SNAPSHOT,
|
||||
loadInitialSnapshot,
|
||||
loadMigration,
|
||||
MIGRATION_NEEDED,
|
||||
MIGRATIONS_NOT_INITIALIZED,
|
||||
MIGRATIONS_UP_TO_DATE,
|
||||
MIGRATION_NEEDED,
|
||||
createEmptySnapshot,
|
||||
getMigrationStatus,
|
||||
getMigrations,
|
||||
loadInitialSnapshot,
|
||||
loadMigration,
|
||||
} from '../../migrations.js';
|
||||
import { MISSING_SESSION_ID_ERROR } from '../../../errors.js';
|
||||
|
||||
export async function cmd({
|
||||
astroConfig,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
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,
|
||||
|
@ -7,7 +8,6 @@ import {
|
|||
MIGRATION_NEEDED,
|
||||
getMigrationStatus,
|
||||
} from '../../migrations.js';
|
||||
import type { DBConfig } from '../../../types.js';
|
||||
|
||||
export async function cmd({
|
||||
astroConfig,
|
||||
|
|
|
@ -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,
|
||||
|
@ -13,6 +12,7 @@ import {
|
|||
hasDefault,
|
||||
schemaTypeToSqlType,
|
||||
} from '../../runtime/queries.js';
|
||||
import { isSerializedSQL } from '../../runtime/types.js';
|
||||
import {
|
||||
type BooleanColumn,
|
||||
type ColumnType,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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,
|
||||
|
@ -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';
|
||||
|
||||
|
|
|
@ -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(
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
|
4
packages/db/test/fixtures/basics/db/seed.ts
vendored
4
packages/db/test/fixtures/basics/db/seed.ts
vendored
|
@ -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);
|
||||
|
||||
|
|
2
packages/db/test/fixtures/basics/db/theme.ts
vendored
2
packages/db/test/fixtures/basics/db/theme.ts
vendored
|
@ -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: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { defineTable, defineDB, column } from 'astro:db';
|
||||
import { column, defineDB, defineTable } from 'astro:db';
|
||||
|
||||
const Recipe = defineTable({
|
||||
columns: {
|
||||
|
|
2
packages/db/test/fixtures/recipes/db/seed.ts
vendored
2
packages/db/test/fixtures/recipes/db/seed.ts
vendored
|
@ -1,4 +1,4 @@
|
|||
import { db, Recipe, Ingredient } from 'astro:db';
|
||||
import { Ingredient, Recipe, db } from 'astro:db';
|
||||
|
||||
const pancakes = await db
|
||||
.insert(Recipe)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { defineDB, defineTable, column } from 'astro:db';
|
||||
import { column, defineDB, defineTable } from 'astro:db';
|
||||
|
||||
const Event = defineTable({
|
||||
columns: {
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -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: {
|
||||
|
|
|
@ -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: {
|
||||
|
|
Loading…
Add table
Reference in a new issue