@hot-updater/supabase 0.20.0 → 0.20.1

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.
@@ -7826,19 +7826,20 @@ const selectBucket = async (api) => {
7826
7826
  }
7827
7827
  return JSON.parse(selectedBucketId);
7828
7828
  };
7829
- const linkSupabase = async (workdir, projectId) => {
7829
+ const linkSupabase = async (workdir, { projectId, dbPassword }) => {
7830
7830
  const spinner = Y();
7831
- spinner.start("Linking Supabase...");
7832
7831
  try {
7833
7832
  await fs_promises.default.writeFile(path.default.join(workdir, "supabase", "config.toml"), (0, __hot_updater_plugin_core.transformTemplate)(SUPABASE_CONFIG_TEMPLATE, { projectId }));
7833
+ spinner.start("Linking Supabase...");
7834
7834
  await execa("npx", [
7835
7835
  "supabase",
7836
7836
  "link",
7837
7837
  "--project-ref",
7838
7838
  projectId,
7839
7839
  "--workdir",
7840
- workdir
7841
- ], {
7840
+ workdir,
7841
+ dbPassword ? ["--password", dbPassword] : []
7842
+ ].flat(), {
7842
7843
  cwd: workdir,
7843
7844
  input: "",
7844
7845
  stdio: [
@@ -7855,14 +7856,15 @@ const linkSupabase = async (workdir, projectId) => {
7855
7856
  process.exit(1);
7856
7857
  }
7857
7858
  };
7858
- const pushDB = async (workdir) => {
7859
+ const pushDB = async (workdir, { dbPassword }) => {
7859
7860
  try {
7860
7861
  const dbPush = await execa("npx", [
7861
7862
  "supabase",
7862
7863
  "db",
7863
7864
  "push",
7864
- "--include-all"
7865
- ], {
7865
+ "--include-all",
7866
+ dbPassword ? ["--password", dbPassword] : []
7867
+ ].flat(), {
7866
7868
  cwd: workdir,
7867
7869
  stdio: "inherit",
7868
7870
  shell: true
@@ -7949,8 +7951,13 @@ const runInit = async ({ build }) => {
7949
7951
  const content = await fs_promises.default.readFile(filePath, "utf-8");
7950
7952
  await fs_promises.default.writeFile(filePath, (0, __hot_updater_plugin_core.transformTemplate)(content, { BUCKET_NAME: bucket.name }));
7951
7953
  }
7952
- await linkSupabase(tmpDir, project.id);
7953
- await pushDB(tmpDir);
7954
+ const dbPassword = await ge({ message: "Enter your Supabase database password (press Enter to skip if none)" });
7955
+ if (BD(dbPassword)) process.exit(0);
7956
+ await linkSupabase(tmpDir, {
7957
+ projectId: project.id,
7958
+ dbPassword
7959
+ });
7960
+ await pushDB(tmpDir, { dbPassword });
7954
7961
  await deployEdgeFunction(tmpDir, project.id);
7955
7962
  await removeTmpDir();
7956
7963
  await fs_promises.default.writeFile("hot-updater.config.ts", getConfigTemplate(build));
@@ -7959,7 +7966,7 @@ const runInit = async ({ build }) => {
7959
7966
  HOT_UPDATER_SUPABASE_BUCKET_NAME: bucket.name,
7960
7967
  HOT_UPDATER_SUPABASE_URL: `https://${project.id}.supabase.co`
7961
7968
  });
7962
- f.success("Generated '.env' file with Supabase settings.");
7969
+ f.success("Generated '.env.hotupdater' file with Supabase settings.");
7963
7970
  f.success("Generated 'hot-updater.config.ts' file with Supabase settings.");
7964
7971
  Me((0, __hot_updater_plugin_core.transformTemplate)(SOURCE_TEMPLATE, { source: `https://${project.id}.supabase.co/functions/v1/update-server` }));
7965
7972
  f.message(`Next step: ${(0, __hot_updater_plugin_core.link)("https://hot-updater.dev/guide/getting-started/quick-start-with-supabase.html#step-4-add-hotupdater-to-your-project")}`);
package/dist/iac/index.js CHANGED
@@ -7829,19 +7829,20 @@ const selectBucket = async (api) => {
7829
7829
  }
7830
7830
  return JSON.parse(selectedBucketId);
7831
7831
  };
7832
- const linkSupabase = async (workdir, projectId) => {
7832
+ const linkSupabase = async (workdir, { projectId, dbPassword }) => {
7833
7833
  const spinner = Y();
7834
- spinner.start("Linking Supabase...");
7835
7834
  try {
7836
7835
  await fs.writeFile(path$1.join(workdir, "supabase", "config.toml"), transformTemplate(SUPABASE_CONFIG_TEMPLATE, { projectId }));
7836
+ spinner.start("Linking Supabase...");
7837
7837
  await execa("npx", [
7838
7838
  "supabase",
7839
7839
  "link",
7840
7840
  "--project-ref",
7841
7841
  projectId,
7842
7842
  "--workdir",
7843
- workdir
7844
- ], {
7843
+ workdir,
7844
+ dbPassword ? ["--password", dbPassword] : []
7845
+ ].flat(), {
7845
7846
  cwd: workdir,
7846
7847
  input: "",
7847
7848
  stdio: [
@@ -7858,14 +7859,15 @@ const linkSupabase = async (workdir, projectId) => {
7858
7859
  process.exit(1);
7859
7860
  }
7860
7861
  };
7861
- const pushDB = async (workdir) => {
7862
+ const pushDB = async (workdir, { dbPassword }) => {
7862
7863
  try {
7863
7864
  const dbPush = await execa("npx", [
7864
7865
  "supabase",
7865
7866
  "db",
7866
7867
  "push",
7867
- "--include-all"
7868
- ], {
7868
+ "--include-all",
7869
+ dbPassword ? ["--password", dbPassword] : []
7870
+ ].flat(), {
7869
7871
  cwd: workdir,
7870
7872
  stdio: "inherit",
7871
7873
  shell: true
@@ -7952,8 +7954,13 @@ const runInit = async ({ build }) => {
7952
7954
  const content = await fs.readFile(filePath, "utf-8");
7953
7955
  await fs.writeFile(filePath, transformTemplate(content, { BUCKET_NAME: bucket.name }));
7954
7956
  }
7955
- await linkSupabase(tmpDir, project.id);
7956
- await pushDB(tmpDir);
7957
+ const dbPassword = await ge({ message: "Enter your Supabase database password (press Enter to skip if none)" });
7958
+ if (BD(dbPassword)) process.exit(0);
7959
+ await linkSupabase(tmpDir, {
7960
+ projectId: project.id,
7961
+ dbPassword
7962
+ });
7963
+ await pushDB(tmpDir, { dbPassword });
7957
7964
  await deployEdgeFunction(tmpDir, project.id);
7958
7965
  await removeTmpDir();
7959
7966
  await fs.writeFile("hot-updater.config.ts", getConfigTemplate(build));
@@ -7962,7 +7969,7 @@ const runInit = async ({ build }) => {
7962
7969
  HOT_UPDATER_SUPABASE_BUCKET_NAME: bucket.name,
7963
7970
  HOT_UPDATER_SUPABASE_URL: `https://${project.id}.supabase.co`
7964
7971
  });
7965
- f.success("Generated '.env' file with Supabase settings.");
7972
+ f.success("Generated '.env.hotupdater' file with Supabase settings.");
7966
7973
  f.success("Generated 'hot-updater.config.ts' file with Supabase settings.");
7967
7974
  Me(transformTemplate(SOURCE_TEMPLATE, { source: `https://${project.id}.supabase.co/functions/v1/update-server` }));
7968
7975
  f.message(`Next step: ${link("https://hot-updater.dev/guide/getting-started/quick-start-with-supabase.html#step-4-add-hotupdater-to-your-project")}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hot-updater/supabase",
3
3
  "type": "module",
4
- "version": "0.20.0",
4
+ "version": "0.20.1",
5
5
  "description": "React Native OTA solution for self-hosted",
6
6
  "main": "dist/index.cjs",
7
7
  "module": "dist/index.js",
@@ -40,8 +40,8 @@
40
40
  ],
41
41
  "dependencies": {
42
42
  "@supabase/supabase-js": "^2.47.10",
43
- "@hot-updater/plugin-core": "0.20.0",
44
- "@hot-updater/core": "0.20.0"
43
+ "@hot-updater/core": "0.20.1",
44
+ "@hot-updater/plugin-core": "0.20.1"
45
45
  },
46
46
  "devDependencies": {
47
47
  "@clack/prompts": "0.10.0",
@@ -50,7 +50,7 @@
50
50
  "execa": "^9.5.2",
51
51
  "mime": "^4.0.4",
52
52
  "picocolors": "^1.0.0",
53
- "@hot-updater/postgres": "0.20.0"
53
+ "@hot-updater/postgres": "0.20.1"
54
54
  },
55
55
  "scripts": {
56
56
  "build": "tsdown",