@nextnode-solutions/nn 1.1.1 → 1.1.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.
Files changed (2) hide show
  1. package/dist/index.js +30 -4
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -19883,11 +19883,21 @@ $$;
19883
19883
  const initDbSh = `#!/bin/bash
19884
19884
  set -e
19885
19885
 
19886
- # Migration runner for ${appName}
19887
- # Runs all SQL files in /docker-entrypoint-initdb.d/migrations/ in order
19886
+ # Init script for ${appName}
19887
+ # 1. Sets passwords for Supabase service roles
19888
+ # 2. Runs all SQL files in /docker-entrypoint-initdb.d/migrations/ in order
19888
19889
 
19890
+ ROLES_SQL="/etc/postgresql.schema.sql"
19889
19891
  MIGRATIONS_DIR="/docker-entrypoint-initdb.d/migrations"
19890
19892
 
19893
+ # Set passwords for supabase_auth_admin and authenticator
19894
+ if [ -f "$ROLES_SQL" ]; then
19895
+ echo "[${appName}-init] Setting up Supabase role passwords"
19896
+ psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" \\
19897
+ -v POSTGRES_PASSWORD="$POSTGRES_PASSWORD" \\
19898
+ -f "$ROLES_SQL"
19899
+ fi
19900
+
19891
19901
  if [ ! -d "$MIGRATIONS_DIR" ]; then
19892
19902
  echo "[${appName}-init] No migrations directory found, skipping"
19893
19903
  exit 0
@@ -19895,7 +19905,7 @@ fi
19895
19905
 
19896
19906
  for f in "$MIGRATIONS_DIR"/*.sql; do
19897
19907
  if [ -f "$f" ]; then
19898
- echo "[${appName}-init] Running migration: $(basename "$f")"
19908
+ echo "[${appName}-init] Running migration: $(basename \\"$f\\")"
19899
19909
  psql -v ON_ERROR_STOP=1 --username "$POSTGRES_USER" --dbname "$POSTGRES_DB" -f "$f"
19900
19910
  fi
19901
19911
  done
@@ -19973,7 +19983,7 @@ var init_services = __esm({
19973
19983
  });
19974
19984
 
19975
19985
  // src/lib/compose.ts
19976
- import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
19986
+ import { mkdirSync, rmSync, statSync as statSync3, writeFileSync as writeFileSync2 } from "fs";
19977
19987
  import { join } from "path";
19978
19988
  function generateLocalCompose(config, services, ports) {
19979
19989
  const lines = ["services:"];
@@ -20227,6 +20237,14 @@ function writeLocalComposeFiles(projectDir, config, composeContent) {
20227
20237
  const supabaseDir = join(nnDir, "supabase");
20228
20238
  const initDir = join(supabaseDir, "init");
20229
20239
  mkdirSync(initDir, { recursive: true });
20240
+ for (const name of [
20241
+ "kong.yml",
20242
+ "kong-entrypoint.sh",
20243
+ "roles.sql",
20244
+ "init-db.sh"
20245
+ ]) {
20246
+ removeIfDirectory(join(supabaseDir, name));
20247
+ }
20230
20248
  const kongConfig = generateKongConfig(config.services.supabase);
20231
20249
  writeFileSync2(join(supabaseDir, "kong.yml"), kongConfig);
20232
20250
  const initScripts = generateInitScripts(config.project.name);
@@ -20242,6 +20260,14 @@ function writeLocalComposeFiles(projectDir, config, composeContent) {
20242
20260
  }
20243
20261
  consola.info(`Generated compose files in ${nnDir}`);
20244
20262
  }
20263
+ function removeIfDirectory(filePath) {
20264
+ try {
20265
+ if (statSync3(filePath).isDirectory()) {
20266
+ rmSync(filePath, { recursive: true });
20267
+ }
20268
+ } catch {
20269
+ }
20270
+ }
20245
20271
  var init_compose = __esm({
20246
20272
  "src/lib/compose.ts"() {
20247
20273
  "use strict";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextnode-solutions/nn",
3
- "version": "1.1.1",
3
+ "version": "1.1.2",
4
4
  "files": [
5
5
  "dist"
6
6
  ],