create-nextblock 0.2.16 → 0.2.18
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.
- package/bin/create-nextblock.js +12 -12
- package/package.json +1 -1
package/bin/create-nextblock.js
CHANGED
|
@@ -197,6 +197,7 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
197
197
|
|
|
198
198
|
const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
|
|
199
199
|
let projectId = null;
|
|
200
|
+
|
|
200
201
|
if (await fs.pathExists(configTomlPath)) {
|
|
201
202
|
const configToml = await fs.readFile(configTomlPath, 'utf8');
|
|
202
203
|
const projectMatch = configToml.match(/project_id\s*=\s*"([^"]+)"/);
|
|
@@ -217,10 +218,6 @@ async function runSetupWizard(projectDir, projectName) {
|
|
|
217
218
|
projectId = manual.trim();
|
|
218
219
|
}
|
|
219
220
|
|
|
220
|
-
const configContent = `project_id = "env(SUPABASE_PROJECT_ID)"\n`;
|
|
221
|
-
await fs.writeFile(configTomlPath, configContent);
|
|
222
|
-
clack.note('Created supabase/config.toml with project_id env binding.');
|
|
223
|
-
|
|
224
221
|
clack.note('Please go to your Supabase project dashboard to get the following secrets.');
|
|
225
222
|
const supabaseKeys = await clack.group(
|
|
226
223
|
{
|
|
@@ -673,14 +670,15 @@ async function ensureSupabaseAssets(projectDir) {
|
|
|
673
670
|
await fs.ensureDir(destSupabaseDir);
|
|
674
671
|
|
|
675
672
|
const packageSupabaseDir = await resolvePackageSupabaseDir();
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
|
|
673
|
+
const sources = [packageSupabaseDir].filter(Boolean);
|
|
674
|
+
if (sources.length === 0) {
|
|
675
|
+
clack.note('Warning: No supabase assets found in installed packages.');
|
|
676
|
+
}
|
|
679
677
|
for (const sourceSupabaseDir of sources) {
|
|
680
678
|
const sourceConfig = resolve(sourceSupabaseDir, 'config.toml');
|
|
681
679
|
const destConfig = resolve(destSupabaseDir, 'config.toml');
|
|
682
|
-
if (await fs.pathExists(sourceConfig)) {
|
|
683
|
-
await fs.copy(sourceConfig, destConfig, { overwrite:
|
|
680
|
+
if ((await fs.pathExists(sourceConfig)) && !(await fs.pathExists(destConfig))) {
|
|
681
|
+
await fs.copy(sourceConfig, destConfig, { overwrite: false });
|
|
684
682
|
}
|
|
685
683
|
|
|
686
684
|
const sourceMigrations = resolve(sourceSupabaseDir, 'migrations');
|
|
@@ -695,9 +693,11 @@ async function resolvePackageSupabaseDir() {
|
|
|
695
693
|
try {
|
|
696
694
|
const pkgPath = require.resolve('@nextblock-cms/db/package.json');
|
|
697
695
|
const pkgDir = dirname(pkgPath);
|
|
698
|
-
const
|
|
699
|
-
|
|
700
|
-
|
|
696
|
+
const candidates = [resolve(pkgDir, 'supabase'), resolve(pkgDir, 'lib', 'supabase')];
|
|
697
|
+
for (const candidate of candidates) {
|
|
698
|
+
if (await fs.pathExists(candidate)) {
|
|
699
|
+
return candidate;
|
|
700
|
+
}
|
|
701
701
|
}
|
|
702
702
|
} catch {
|
|
703
703
|
return null;
|