certs.ts — drizzle-orm Source File
Architecture documentation for certs.ts, a typescript file in the drizzle-orm codebase. 5 imports, 2 dependents.
Entity Profile
Dependency Diagram
graph LR 41aba6b6_e7c2_68d7_c84b_306b1d65e253["certs.ts"] 7ed3e4cd_6a84_096b_f005_ce46d580bc3d["env-paths"] 41aba6b6_e7c2_68d7_c84b_306b1d65e253 --> 7ed3e4cd_6a84_096b_f005_ce46d580bc3d 9a46d98d_eb2d_c1e4_a37b_506dd514a6a7["fs"] 41aba6b6_e7c2_68d7_c84b_306b1d65e253 --> 9a46d98d_eb2d_c1e4_a37b_506dd514a6a7 cca2505c_7428_595e_4a97_5721acbb59e4["promises"] 41aba6b6_e7c2_68d7_c84b_306b1d65e253 --> cca2505c_7428_595e_4a97_5721acbb59e4 e721104b_e6a4_7677_2ec7_3f0180d4a1b5["node:child_process"] 41aba6b6_e7c2_68d7_c84b_306b1d65e253 --> e721104b_e6a4_7677_2ec7_3f0180d4a1b5 412eac48_6e13_8b0f_b7b2_5c943c225130["path"] 41aba6b6_e7c2_68d7_c84b_306b1d65e253 --> 412eac48_6e13_8b0f_b7b2_5c943c225130 e668bfef_9125_1ef0_2f94_a0f9605584bd["api.ts"] e668bfef_9125_1ef0_2f94_a0f9605584bd --> 41aba6b6_e7c2_68d7_c84b_306b1d65e253 5bf76609_579e_d312_b33b_ab5b8b683111["schema.ts"] 5bf76609_579e_d312_b33b_ab5b8b683111 --> 41aba6b6_e7c2_68d7_c84b_306b1d65e253 style 41aba6b6_e7c2_68d7_c84b_306b1d65e253 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
import envPaths from 'env-paths';
import { mkdirSync } from 'fs';
import { access, readFile } from 'fs/promises';
import { exec, ExecOptions } from 'node:child_process';
import { join } from 'path';
export function runCommand(command: string, options: ExecOptions = {}) {
return new Promise<{ exitCode: number }>((resolve) => {
exec(command, options, (error) => {
return resolve({ exitCode: error?.code ?? 0 });
});
});
}
export const certs = async () => {
const res = await runCommand('mkcert --help');
if (res.exitCode === 0) {
const p = envPaths('drizzle-studio', {
suffix: '',
});
// create ~/.local/share/drizzle-studio
mkdirSync(p.data, { recursive: true });
// ~/.local/share/drizzle-studio
const keyPath = join(p.data, 'localhost-key.pem');
const certPath = join(p.data, 'localhost.pem');
try {
// check if the files exist
await Promise.all([access(keyPath), access(certPath)]);
} catch (e) {
// if not create them
await runCommand(`mkcert localhost`, { cwd: p.data });
}
const [key, cert] = await Promise.all([
readFile(keyPath, { encoding: 'utf-8' }),
readFile(certPath, { encoding: 'utf-8' }),
]);
return key && cert ? { key, cert } : null;
}
return null;
};
Domain
Subdomains
Functions
Dependencies
- env-paths
- fs
- node:child_process
- path
- promises
Source
Frequently Asked Questions
What does certs.ts do?
certs.ts is a source file in the drizzle-orm codebase, written in typescript. It belongs to the DrizzleKit domain, SnapshotSerializer subdomain.
What functions are defined in certs.ts?
certs.ts defines 2 function(s): certs, runCommand.
What does certs.ts depend on?
certs.ts imports 5 module(s): env-paths, fs, node:child_process, path, promises.
What files import certs.ts?
certs.ts is imported by 2 file(s): api.ts, schema.ts.
Where is certs.ts in the architecture?
certs.ts is located at drizzle-kit/src/utils/certs.ts (domain: DrizzleKit, subdomain: SnapshotSerializer, directory: drizzle-kit/src/utils).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free