@sidebase/base-config 0.1.0

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.
Files changed (40) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +554 -0
  3. package/dist/config.d.mts +189 -0
  4. package/dist/config.d.ts +189 -0
  5. package/dist/config.mjs +46 -0
  6. package/dist/eslint/index.d.mts +55 -0
  7. package/dist/eslint/index.d.ts +55 -0
  8. package/dist/eslint/index.mjs +278 -0
  9. package/dist/prisma/index.d.mts +74 -0
  10. package/dist/prisma/index.d.ts +74 -0
  11. package/dist/prisma/index.mjs +61 -0
  12. package/dist/shared/base-config.CuUhyvQo.d.mts +47 -0
  13. package/dist/shared/base-config.CuUhyvQo.d.ts +47 -0
  14. package/docs/migration.md +764 -0
  15. package/package.json +94 -0
  16. package/presets/base/AGENTS.md +31 -0
  17. package/presets/base/CLAUDE.md +3 -0
  18. package/presets/base/dockerignore +18 -0
  19. package/presets/base/editorconfig +12 -0
  20. package/presets/base/github/workflows/streamctl-upgrade.yml +130 -0
  21. package/presets/base/gitignore +19 -0
  22. package/presets/base/oxlintrc.json +31 -0
  23. package/presets/base/pnpm-workspace.yaml +27 -0
  24. package/presets/base/preset.json +38 -0
  25. package/presets/base/templates/pnpm/only-built-dependency.yml +1 -0
  26. package/presets/base/tsconfig.json +3 -0
  27. package/presets/base/vscode/extensions.json +8 -0
  28. package/presets/base/vscode/settings.json +43 -0
  29. package/presets/config.template.ts +18 -0
  30. package/presets/manifest.json +17 -0
  31. package/presets/nuxt-app/Dockerfile +63 -0
  32. package/presets/nuxt-app/eslint.config.ts +5 -0
  33. package/presets/nuxt-app/github/workflows/ci.yml +66 -0
  34. package/presets/nuxt-app/github/workflows/pr-preview-cleanup.yml +41 -0
  35. package/presets/nuxt-app/preset.json +67 -0
  36. package/presets/nuxt-app/prisma.config.ts +6 -0
  37. package/presets/nuxt-app/templates/ci/e2e-job.yml +39 -0
  38. package/presets/nuxt-app/templates/ci/test-job.yml +13 -0
  39. package/presets/nuxt-app/tsconfig.json +6 -0
  40. package/tsconfig.base.json +19 -0
@@ -0,0 +1,41 @@
1
+ name: Cleanup PR Preview
2
+
3
+ on:
4
+ pull_request:
5
+ types:
6
+ - unlabeled
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.
10
+ permissions:
11
+ contents: read
12
+
13
+ jobs:
14
+ cleanup:
15
+ # only run if the 'preview' label was the one removed
16
+ if: github.event.label.name == 'preview'
17
+ name: Remove 'preview-deployed' label
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ pull-requests: write
21
+ issues: write
22
+
23
+ steps:
24
+ - name: Remove 'preview-deployed' label
25
+ uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0
26
+ with:
27
+ script: |
28
+ const { owner, repo } = context.repo;
29
+ const issue_number = context.issue.number;
30
+
31
+ // check first if the label exists on the PR
32
+ const { data: labels } = await github.rest.issues.listLabelsOnIssue({
33
+ owner,
34
+ repo,
35
+ issue_number
36
+ });
37
+
38
+ const hasPreviewDeployedLabel = labels.some(label => label.name === 'preview-deployed');
39
+ if (hasPreviewDeployedLabel) {
40
+ await github.rest.issues.removeLabel({ owner, repo, issue_number, name: 'preview-deployed'});
41
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "name": "nuxt-app",
3
+ "extends": ["base"],
4
+ "files": [
5
+ { "path": "tsconfig.json", "strategy": "full", "source": "nuxt-app/tsconfig.json", "adoption": "expected" },
6
+ { "path": "eslint.config.ts", "strategy": "scaffold", "source": "nuxt-app/eslint.config.ts", "shadowedBy": ["eslint.config.mjs", "eslint.config.js", "eslint.config.cjs"] },
7
+ { "path": "prisma.config.ts", "strategy": "scaffold", "source": "nuxt-app/prisma.config.ts" },
8
+ { "path": "Dockerfile", "strategy": "full", "source": "nuxt-app/Dockerfile", "render": "dockerfile", "adoption": "expected" },
9
+ { "path": ".github/workflows/pr-preview-cleanup.yml", "strategy": "full", "source": "nuxt-app/github/workflows/pr-preview-cleanup.yml", "adoption": "expected" },
10
+ { "path": ".github/workflows/ci.yml", "strategy": "full", "source": "nuxt-app/github/workflows/ci.yml", "render": "ci" }
11
+ ],
12
+ "renders": {
13
+ "ci": {
14
+ "placeholders": {
15
+ "NODE_VERSION": { "configPath": "versions.node", "default": "24.13.0", "pattern": "^[\\w.+-]+$" }
16
+ },
17
+ "fragments": [
18
+ { "toggle": "ci.unitTests", "source": "nuxt-app/templates/ci/test-job.yml" },
19
+ { "toggle": "ci.e2e", "source": "nuxt-app/templates/ci/e2e-job.yml" }
20
+ ]
21
+ },
22
+ "dockerfile": {
23
+ "placeholders": {
24
+ "APT_PACKAGES": { "configPath": "docker.aptPackages", "default": "", "pattern": "^$|^[a-z0-9][a-z0-9 +.-]*$", "join": "space" },
25
+ "NODE_VERSION": { "configPath": "versions.node", "default": "24.13.0", "pattern": "^[\\w.+-]+$" },
26
+ "PNPM_VERSION": { "configPath": "versions.pnpm", "default": "10.28.1", "pattern": "^[\\w.+-]+$" },
27
+ "DOCKER_PRE_INSTALL": { "configPath": "docker.preInstall", "default": "" },
28
+ "DOCKER_BUILD_ARGS": { "configPath": "docker.buildArgs", "default": "" },
29
+ "DOCKER_BUILD_STEPS": { "configPath": "docker.buildSteps", "default": "RUN pnpm nuxi prepare\nRUN pnpm prisma generate\nRUN pnpm run build" },
30
+ "DOCKER_FINAL_STAGE": { "configPath": "docker.finalStage", "default": "" },
31
+ "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=6.19.1\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_START_COMMAND": { "configPath": "docker.startCommand", "default": "npm exec prisma migrate deploy && node --max-old-space-size-percentage=75 .output/server/index.mjs" }
33
+ },
34
+ "passthrough": ["PRISMA_VERSION"]
35
+ }
36
+ },
37
+ "configKeys": {
38
+ "ci.unitTests": "boolean",
39
+ "ci.e2e": "boolean",
40
+ "docker.aptPackages": "string[]",
41
+ "docker.preInstall": "string",
42
+ "docker.buildArgs": "string",
43
+ "docker.buildSteps": "string",
44
+ "docker.finalStage": "string",
45
+ "docker.prismaRuntime": "string",
46
+ "docker.startCommand": "string",
47
+ "eslint": "object"
48
+ },
49
+ "versionProfiles": {
50
+ "nuxt-4": {
51
+ "engines.node": ">=24.13.0",
52
+ "engines.pnpm": ">=10.28.1",
53
+ "packageManager": "pnpm@10.28.1",
54
+ "devDependencies.nuxt": "^4.3.0",
55
+ "devDependencies.typescript": "^6.0.2",
56
+ "devDependencies.eslint": "^10.5.0",
57
+ "devDependencies.oxlint": "^1.43.0",
58
+ "devDependencies.prisma": "^6.19.1",
59
+ "devDependencies.@prisma/client": "^6.19.1",
60
+ "devDependencies.jiti": "^2.2.0",
61
+ "devDependencies.json-sort-cli": "^4.1.3",
62
+ "devDependencies.vitest": "^3.0.0",
63
+ "scripts.postinstall": "nuxt prepare",
64
+ "scripts.lint": "oxlint -c .oxlintrc.json --deny-warnings && eslint --max-warnings 0 ."
65
+ }
66
+ }
67
+ }
@@ -0,0 +1,6 @@
1
+ import { buildPrismaConfig } from '@sidebase/base-config/prisma'
2
+ import { defineConfig } from 'prisma/config'
3
+
4
+ // Project-owned wrapper: pass repo flags (views/typedSql) to buildPrismaConfig.
5
+ // Shared logic updates via the @sidebase/base-config version bump.
6
+ export default defineConfig(buildPrismaConfig())
@@ -0,0 +1,39 @@
1
+ e2e:
2
+ runs-on: ubuntu-latest
3
+ # DATABASE_URL matches the postgres service credentials declared below. The
4
+ # service sets user/password/db explicitly rather than relying on the implicit
5
+ # postgres/postgres defaults, so the connection string is unambiguous.
6
+ env:
7
+ DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres
8
+ services:
9
+ postgres:
10
+ image: postgres:16
11
+ env:
12
+ POSTGRES_USER: postgres
13
+ POSTGRES_PASSWORD: postgres
14
+ POSTGRES_DB: postgres
15
+ ports:
16
+ - 5432:5432
17
+ # Gate the steps on the database accepting connections; without a health
18
+ # check the job can start before postgres is ready and fail to connect.
19
+ options: >-
20
+ --health-cmd pg_isready
21
+ --health-interval 10s
22
+ --health-timeout 5s
23
+ --health-retries 5
24
+ steps:
25
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
26
+ - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
27
+ - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
28
+ with:
29
+ node-version: ${{ env.NODE_VERSION }}
30
+ cache: pnpm
31
+ - run: pnpm install --frozen-lockfile
32
+ # tests may import the generated Prisma client
33
+ - run: pnpm prisma generate
34
+ # Schema setup (db push / migrate) and seeding are left to the consumer's
35
+ # test:e2e script on purpose: they are coupled to fixture seeding, which only
36
+ # the app's own harness owns, and CI cannot guess the reset/migrate/seed
37
+ # strategy. This job provides a healthy, reachable DB (DATABASE_URL above) and
38
+ # the generated client; test:e2e must create and seed its own schema.
39
+ - run: pnpm test:e2e
@@ -0,0 +1,13 @@
1
+ test:
2
+ runs-on: ubuntu-latest
3
+ steps:
4
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
5
+ - uses: pnpm/action-setup@0ebf47130e4866e96fce0953f49152a61190b271 # v6.0.9
6
+ - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
7
+ with:
8
+ node-version: ${{ env.NODE_VERSION }}
9
+ cache: pnpm
10
+ - run: pnpm install --frozen-lockfile
11
+ # tests may import the generated Prisma client
12
+ - run: pnpm prisma generate
13
+ - run: pnpm test
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": [
3
+ "@sidebase/base-config/tsconfig.base",
4
+ "./.nuxt/tsconfig.json"
5
+ ]
6
+ }
@@ -0,0 +1,19 @@
1
+ {
2
+ "$schema": "https://json.schemastore.org/tsconfig",
3
+ "display": "@sidebase/base-config strict base",
4
+ "_comment": "Shared strict baseline consumed via `extends: \"@sidebase/base-config/tsconfig.base\"`. Sets only strictness + universal-safe options (no `paths`/`types`/`include`) so it layers cleanly under Nuxt's generated `./.nuxt/tsconfig.json` (last in the extends array wins) without fighting its module resolution.",
5
+ "compilerOptions": {
6
+ "target": "ESNext",
7
+ "module": "ESNext",
8
+ "moduleResolution": "Bundler",
9
+ "esModuleInterop": true,
10
+ "isolatedModules": true,
11
+ "resolveJsonModule": true,
12
+ "skipLibCheck": true,
13
+ "forceConsistentCasingInFileNames": true,
14
+ "strict": true,
15
+ "noUncheckedIndexedAccess": true,
16
+ "noImplicitOverride": true,
17
+ "noFallthroughCasesInSwitch": true
18
+ }
19
+ }