aboutsummaryrefslogtreecommitdiff
path: root/packages/db/src
diff options
context:
space:
mode:
authorGravatar Erika <3019731+Princesseuh@users.noreply.github.com> 2024-09-07 01:07:09 +0200
committerGravatar GitHub <noreply@github.com> 2024-09-07 01:07:09 +0200
commit50ca656dbad6dbb3955b83d9f4dcf4795e98823a (patch)
tree928eb296b12e5f62025afd922f99a2aec0b1a1b2 /packages/db/src
parent5b4e3abbb152146b71c1af05d33c96211000b2a6 (diff)
downloadastro-50ca656dbad6dbb3955b83d9f4dcf4795e98823a.tar.gz
astro-50ca656dbad6dbb3955b83d9f4dcf4795e98823a.tar.zst
astro-50ca656dbad6dbb3955b83d9f4dcf4795e98823a.zip
Merge output: hybrid and output: static (#11824)
* feat: merge hybrid and static * fix: linting * fix: get a bunch of tests passing * fix: make forceServerOutput optional * fix: more tests passing * fix: http2 test * fix: CCC * fix: get unit tests passing * fix: lint * fix: vercel * fix: build * fix: build * fix: db tests * fix: get all normal tests passing * fix: e2e tests * refactor: cleanup code * fix: more tests * fix: windows * fix: apply feedback * perf: do in parallel * fix: tests * fix: tests, for real * fix: make server islands tests server-rendered * fix: apply feedback * nit: remove unnecessary file * fix: test remove test that abuse prerender logic * fix: ensure image endpoint is there on dev reload
Diffstat (limited to 'packages/db/src')
-rw-r--r--packages/db/src/core/integration/index.ts15
1 files changed, 6 insertions, 9 deletions
diff --git a/packages/db/src/core/integration/index.ts b/packages/db/src/core/integration/index.ts
index 2a5824c35..b51f98661 100644
--- a/packages/db/src/core/integration/index.ts
+++ b/packages/db/src/core/integration/index.ts
@@ -4,7 +4,7 @@ import { dirname } from 'node:path';
import { fileURLToPath } from 'node:url';
import type { ManagedAppToken } from '@astrojs/studio';
import { LibsqlError } from '@libsql/client';
-import type { AstroConfig, AstroIntegration } from 'astro';
+import type { AstroIntegration } from 'astro';
import { blue, yellow } from 'kleur/colors';
import {
type HMRPayload,
@@ -59,14 +59,13 @@ function astroDBIntegration(): AstroIntegration {
};
let command: 'dev' | 'build' | 'preview' | 'sync';
- let output: AstroConfig['output'] = 'server';
+ let finalBuildOutput: string;
return {
name: 'astro:db',
hooks: {
'astro:config:setup': async ({ updateConfig, config, command: _command, logger }) => {
command = _command;
root = config.root;
- output = config.output;
if (command === 'preview') return;
@@ -105,9 +104,11 @@ function astroDBIntegration(): AstroIntegration {
},
});
},
- 'astro:config:done': async ({ config, injectTypes }) => {
+ 'astro:config:done': async ({ config, injectTypes, buildOutput }) => {
if (command === 'preview') return;
+ finalBuildOutput = buildOutput;
+
// TODO: refine where we load tables
// @matthewp: may want to load tables by path at runtime
const { dbConfig, dependencies, integrationSeedPaths } = await resolveDbConfig(config);
@@ -159,11 +160,7 @@ function astroDBIntegration(): AstroIntegration {
}, 100);
},
'astro:build:start': async ({ logger }) => {
- if (
- !connectToRemote &&
- !databaseFileEnvDefined() &&
- (output === 'server' || output === 'hybrid')
- ) {
+ if (!connectToRemote && !databaseFileEnvDefined() && finalBuildOutput === 'server') {
const message = `Attempting to build without the --remote flag or the ASTRO_DATABASE_FILE environment variable defined. You probably want to pass --remote to astro build.`;
const hint =
'Learn more connecting to Studio: https://docs.astro.build/en/guides/astro-db/#connect-to-astro-studio';