@sidebase/base-config 0.2.0 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  import { defineNuxtBaseConfig } from '@sidebase/base-config'
2
2
 
3
- // Scaffolded by `streamctl init`. `defineNuxtBaseConfig` gives typed editor
4
- // inference for this payload's knobs; the CLI validates the file on every sync.
3
+ // Scaffolded by `streamctl init`. `defineNuxtBaseConfig` types the knobs below.
4
+ // The CLI validates this file on every sync.
5
5
  export default defineNuxtBaseConfig({
6
6
  package: '__PACKAGE__',
7
7
  base: '__BASE__',
@@ -5,24 +5,22 @@ ARG PNPM_VERSION=${PNPM_VERSION}
5
5
  # --- BUILD STAGE ---
6
6
  FROM $NODE_VERSION AS production-base
7
7
 
8
- # A pre-`FROM` ARG is visible only to `FROM`. Re-declare it bare to inherit the
9
- # global value inside this stage, or $PNPM_VERSION expands to empty below.
8
+ # A pre-`FROM` ARG is visible only to `FROM`. Re-declare it bare here, or
9
+ # $PNPM_VERSION expands to empty below and pnpm installs at latest.
10
10
  ARG PNPM_VERSION
11
11
 
12
12
  WORKDIR /app
13
13
 
14
- # Installed directly rather than through corepack: Node 25 no longer bundles
15
- # corepack, and `versions.node` declares no ceiling. npm's global bin is already
16
- # on PATH, so no PNPM_HOME wiring is needed.
14
+ # Not corepack: Node 25 no longer bundles it. npm's global bin is already on
15
+ # PATH, so this needs no PNPM_HOME wiring.
17
16
  RUN npm i -g pnpm@$PNPM_VERSION
18
17
 
19
18
  # Copy pnpm files
20
19
  COPY package.json pnpm-lock.yaml .npmrc* ./
21
20
  ${DOCKER_PRE_INSTALL}
22
- # load packages into the virtual store using only information from a lockfile.
23
- # --ignore-scripts: only package files exist at this layer, so lifecycle scripts
24
- # (e.g. `postinstall: nuxt prepare`) would run against no sources; the explicit
25
- # build steps below (docker.buildSteps) cover them against the full tree.
21
+ # --ignore-scripts: only package files exist at this layer, so a `postinstall`
22
+ # like `nuxt prepare` would run against no sources. The build steps below run it
23
+ # against the full tree instead.
26
24
  RUN pnpm install --ignore-scripts --frozen-lockfile --prefer-offline
27
25
 
28
26
  ARG ARG_NUXT_BUILD_CLIENT_SOURCE_MAPS=false
@@ -37,27 +35,24 @@ ${DOCKER_BUILD_STEPS}
37
35
  # --- FINAL PRODUCTION STAGE ---
38
36
  FROM $NODE_VERSION-slim AS production
39
37
 
40
- # openssl is always installed: the Prisma query engine generated in the build
41
- # stage (debian-openssl-3.0.x) dynamically links libssl3, which slim images do
42
- # not ship. Without it the app crashes on its first query. APT_PACKAGES adds
43
- # project-owned extras on top (docker.aptPackages knob, e.g. "ffmpeg").
38
+ # openssl is always installed: the Prisma query engine links libssl3, which slim
39
+ # images do not ship, and the app would crash on its first query without it.
40
+ # APT_PACKAGES adds project extras on top (docker.aptPackages).
44
41
  ARG APT_PACKAGES="${APT_PACKAGES}"
45
42
  RUN apt-get update && apt-get install -y --no-install-recommends openssl $APT_PACKAGES \
46
43
  && rm -rf /var/lib/apt/lists/*
47
44
 
48
- # copy necessary directories from the production-base stage to the final production
49
- # stage, owned by the runtime uid 1000 rather than root (see the USER switch below)
45
+ # Owned by uid 1000 so a future non-root switch needs no extra chown pass.
50
46
  COPY --chown=node:node --from=production-base /app/.output /app/.output
51
47
 
52
48
  WORKDIR /app
53
49
 
54
50
  ${DOCKER_PRISMA_RUNTIME}
55
51
  ${DOCKER_FINAL_STAGE}
56
- # Drop to the unprivileged `node` user (uid 1000) the base image already ships.
57
- # FIXED and outside every knob, so an override cannot re-root the container.
58
- # Everything the runtime reads or executes is node-owned, and `npm exec` writes
59
- # its npx cache under /home/node/.npm, which the official image creates writable.
60
- USER node
52
+ # The container stays root on purpose. A `USER node` switch here breaks any
53
+ # deployment that overrides the CMD with a command needing root: the prisma-studio
54
+ # pods apt-install postgresql-client on start, which fails as an unprivileged user.
55
+ # Set docker.finalStage to "USER node" to opt back in.
61
56
 
62
57
  # start the app
63
58
  CMD [ "sh", "-c", "${DOCKER_START_COMMAND}" ]
@@ -1,15 +1,14 @@
1
- # Managed by streamctl (full-own, render: ci). NODE_VERSION is a render knob
2
- # sourced from the version baseline. pnpm is not pinned here: action-setup reads
3
- # `packageManager` from package.json, the single reconciled source.
4
- # The build-and-deploy-* preview/staging/production suite is deferred to 0.2.0.
1
+ # Managed by streamctl (full-own, render: ci). Edits here are overwritten on sync.
2
+ # NODE_VERSION comes from the version baseline. pnpm is not pinned here because
3
+ # action-setup reads `packageManager` from package.json.
5
4
  name: CI
6
5
 
7
6
  on:
8
7
  pull_request:
9
8
  branches: [main]
10
9
 
11
- # Least privilege: the jobs only read the repo. Install/build steps run
12
- # third-party code, so a read-only default token limits a malicious script.
10
+ # The jobs only read the repo. Install and build run third-party code, so a
11
+ # read-only default token limits what a malicious package can do.
13
12
  permissions:
14
13
  contents: read
15
14
 
@@ -5,8 +5,8 @@ on:
5
5
  types:
6
6
  - unlabeled
7
7
 
8
- # Default-deny at workflow level so any future job starts read-only; the
9
- # cleanup job below grants itself the exact write scopes it needs.
8
+ # Default-deny so any future job starts read-only. The cleanup job below grants
9
+ # itself the exact write scopes it needs.
10
10
  permissions:
11
11
  contents: read
12
12
 
@@ -29,7 +29,7 @@
29
29
  "DOCKER_BUILD_ARGS": { "configPath": "docker.buildArgs", "default": "" },
30
30
  "DOCKER_BUILD_STEPS": { "configPath": "docker.buildSteps", "default": "RUN pnpm nuxi prepare\nRUN pnpm prisma generate\nRUN pnpm run build" },
31
31
  "DOCKER_FINAL_STAGE": { "configPath": "docker.finalStage", "default": "" },
32
- "DOCKER_PRISMA_RUNTIME": { "configPath": "docker.prismaRuntime", "default": "COPY --chown=node:node --from=production-base /app/prisma /app/prisma\n\n# Prisma CLI version for `migrate deploy`. Defaults to the baseline; override with --build-arg.\nARG PRISMA_VERSION=${PRISMA_VERSION_DEFAULT}\n\n# install prisma to run the `migrate deploy`. Runs as root because /app is\n# root-owned from WORKDIR; hand the install output to the runtime user in the\n# same layer so no later chown duplicates node_modules.\nRUN npm i -D prisma@${PRISMA_VERSION} && chown -R node:node /app/node_modules" },
32
+ "DOCKER_PRISMA_RUNTIME": { "configPath": "docker.prismaRuntime", "default": "COPY --chown=node:node --from=production-base /app/prisma /app/prisma\n\n# Prisma CLI for `migrate deploy`. Override the pin with --build-arg.\nARG PRISMA_VERSION=${PRISMA_VERSION_DEFAULT}\n\n# Chowned to uid 1000 in the same layer, so a later USER switch needs no\n# second pass over node_modules.\nRUN npm i -D prisma@${PRISMA_VERSION} && chown -R node:node /app/node_modules" },
33
33
  "PRISMA_VERSION_DEFAULT": { "configPath": "docker.prismaVersion", "fromDependency": "prisma", "default": "6.19.1", "pattern": "^\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?$" },
34
34
  "DOCKER_START_COMMAND": { "configPath": "docker.startCommand", "default": "npm exec prisma migrate deploy && node --max-old-space-size-percentage=75 .output/server/index.mjs" }
35
35
  },
@@ -34,9 +34,6 @@
34
34
  - run: pnpm install --frozen-lockfile
35
35
  # tests may import the generated Prisma client
36
36
  - run: pnpm prisma generate
37
- # Schema setup (db push / migrate) and seeding are left to the consumer's
38
- # test:e2e script on purpose: they are coupled to fixture seeding, which only
39
- # the app's own harness owns, and CI cannot guess the reset/migrate/seed
40
- # strategy. This job provides a healthy, reachable DB (DATABASE_URL above) and
41
- # the generated client; test:e2e must create and seed its own schema.
37
+ # This job provides a reachable DB and the generated client. Schema setup and
38
+ # seeding belong to test:e2e, which owns the fixture strategy CI cannot guess.
42
39
  - run: pnpm test:e2e
@@ -1,3 +0,0 @@
1
- # CLAUDE.md
2
-
3
- @AGENTS.md