index.ts — astro Source File
Architecture documentation for index.ts, a typescript file in the astro codebase. 5 imports, 0 dependents.
Entity Profile
Dependency Diagram
graph LR a931fece_62f1_4c62_c89f_02de71023cb2["index.ts"] 97fa73a6_cf67_73a5_b60d_d52bfb00c7d8["./core/types.js"] a931fece_62f1_4c62_c89f_02de71023cb2 --> 97fa73a6_cf67_73a5_b60d_d52bfb00c7d8 6ae6435e_1314_7d59_4826_25e9a2ada03f["./utils.js"] a931fece_62f1_4c62_c89f_02de71023cb2 --> 6ae6435e_1314_7d59_4826_25e9a2ada03f 631e111e_d645_5a8b_135d_7579935eb52e["../../migration-queries.js"] a931fece_62f1_4c62_c89f_02de71023cb2 --> 631e111e_d645_5a8b_135d_7579935eb52e f16d8c76_2866_6150_bd14_0347b59abfe9["astro"] a931fece_62f1_4c62_c89f_02de71023cb2 --> f16d8c76_2866_6150_bd14_0347b59abfe9 efd0f150_4239_ba62_fbb9_bcf24bd27236["yargs-parser"] a931fece_62f1_4c62_c89f_02de71023cb2 --> efd0f150_4239_ba62_fbb9_bcf24bd27236 style a931fece_62f1_4c62_c89f_02de71023cb2 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import type { AstroConfig } from 'astro';
import type { Arguments } from 'yargs-parser';
import type { DBConfig } from '../../../types.js';
import { getRemoteDatabaseInfo, resolveDbAppToken } from '../../../utils.js';
import {
createCurrentSnapshot,
createEmptySnapshot,
formatDataLossMessage,
getMigrationQueries,
getProductionCurrentSnapshot,
} from '../../migration-queries.js';
export async function cmd({
dbConfig,
flags,
}: {
astroConfig: AstroConfig;
dbConfig: DBConfig;
flags: Arguments;
}) {
const isJson = flags.json;
const dbInfo = getRemoteDatabaseInfo();
const appToken = resolveDbAppToken(flags, dbInfo.token);
const productionSnapshot = await getProductionCurrentSnapshot({ ...dbInfo, token: appToken });
const currentSnapshot = createCurrentSnapshot(dbConfig);
const { queries: migrationQueries, confirmations } = await getMigrationQueries({
oldSnapshot: productionSnapshot || createEmptySnapshot(),
newSnapshot: currentSnapshot,
});
const result = { exitCode: 0, message: '', code: '', data: undefined as unknown };
if (migrationQueries.length === 0) {
result.code = 'MATCH';
result.message = `Database schema is up to date.`;
} else {
result.code = 'NO_MATCH';
result.message = `Database schema is out of date.\nRun 'astro db push' to push up your latest changes.`;
}
if (confirmations.length > 0) {
result.code = 'DATA_LOSS';
result.exitCode = 1;
result.data = confirmations;
result.message = formatDataLossMessage(confirmations, !isJson);
}
if (isJson) {
console.log(JSON.stringify(result));
} else {
console.log(result.message);
}
process.exit(result.exitCode);
}
Domain
Subdomains
Functions
Dependencies
- ../../migration-queries.js
- ./core/types.js
- ./utils.js
- astro
- yargs-parser
Source
Frequently Asked Questions
What does index.ts do?
index.ts is a source file in the astro codebase, written in typescript. It belongs to the CoreAstro domain, CoreMiddleware subdomain.
What functions are defined in index.ts?
index.ts defines 1 function(s): cmd.
What does index.ts depend on?
index.ts imports 5 module(s): ../../migration-queries.js, ./core/types.js, ./utils.js, astro, yargs-parser.
Where is index.ts in the architecture?
index.ts is located at packages/db/src/core/cli/commands/verify/index.ts (domain: CoreAstro, subdomain: CoreMiddleware, directory: packages/db/src/core/cli/commands/verify).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free