create-nextblock 0.2.3 → 0.2.5

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.
@@ -131,6 +131,9 @@ async function handleCommand(projectDirectory, options) {
131
131
  await ensureEnvExample(projectDir);
132
132
  console.log(chalk.green('.env.example ready.'));
133
133
 
134
+ await ensureSupabaseAssets(projectDir);
135
+ console.log(chalk.green('Supabase migrations ready.'));
136
+
134
137
  if (!yes) {
135
138
  await runSetupWizard(projectDir, projectName);
136
139
  } else {
@@ -199,7 +202,7 @@ async function runSetupWizard(projectDir, projectName) {
199
202
  cwd: projectPath,
200
203
  stdin: 'inherit',
201
204
  stdout: 'pipe',
202
- stderr: 'inherit',
205
+ stderr: 'pipe',
203
206
  });
204
207
  if (linkProcess.stdout) {
205
208
  linkProcess.stdout.on('data', (chunk) => {
@@ -208,7 +211,22 @@ async function runSetupWizard(projectDir, projectName) {
208
211
  process.stdout.write(text);
209
212
  });
210
213
  }
214
+ if (linkProcess.stderr) {
215
+ linkProcess.stderr.on('data', (chunk) => {
216
+ const text = chunk.toString();
217
+ linkOutput += text;
218
+ process.stderr.write(text);
219
+ });
220
+ }
211
221
  await linkProcess;
222
+ if (process.stdin.isTTY) {
223
+ try {
224
+ process.stdin.setRawMode(false);
225
+ } catch (_) {
226
+ // ignore if not supported
227
+ }
228
+ }
229
+ process.stdin.resume();
212
230
 
213
231
  const configTomlPath = resolve(projectPath, 'supabase', 'config.toml');
214
232
  let configToml = '';
@@ -625,11 +643,11 @@ async function ensureGitignore(projectDir) {
625
643
  }
626
644
  }
627
645
 
628
- async function ensureEnvExample(projectDir) {
629
- const destination = resolve(projectDir, '.env.example');
630
- if (await fs.pathExists(destination)) {
631
- return;
632
- }
646
+ async function ensureEnvExample(projectDir) {
647
+ const destination = resolve(projectDir, '.env.example');
648
+ if (await fs.pathExists(destination)) {
649
+ return;
650
+ }
633
651
 
634
652
  const templatePaths = [
635
653
  resolve(TEMPLATE_DIR, '.env.example'),
@@ -673,12 +691,35 @@ SMTP_FROM_NAME=
673
691
 
674
692
  await fs.writeFile(destination, placeholder);
675
693
  }
676
-
677
- async function ensureClientComponents(projectDir) {
678
- const relativePaths = [
679
- 'components/env-var-warning.tsx',
680
- 'app/providers.tsx',
681
- 'app/ToasterProvider.tsx',
694
+
695
+ async function ensureSupabaseAssets(projectDir) {
696
+ const sourceSupabaseDir = resolve(REPO_ROOT, 'libs/db/src/supabase');
697
+ const destSupabaseDir = resolve(projectDir, 'supabase');
698
+
699
+ if (!(await fs.pathExists(sourceSupabaseDir))) {
700
+ return;
701
+ }
702
+
703
+ await fs.ensureDir(destSupabaseDir);
704
+
705
+ const sourceConfig = resolve(sourceSupabaseDir, 'config.toml');
706
+ const destConfig = resolve(destSupabaseDir, 'config.toml');
707
+ if (!(await fs.pathExists(destConfig)) && (await fs.pathExists(sourceConfig))) {
708
+ await fs.copy(sourceConfig, destConfig);
709
+ }
710
+
711
+ const sourceMigrations = resolve(sourceSupabaseDir, 'migrations');
712
+ const destMigrations = resolve(destSupabaseDir, 'migrations');
713
+ if (await fs.pathExists(sourceMigrations)) {
714
+ await fs.copy(sourceMigrations, destMigrations, { overwrite: false, errorOnExist: false });
715
+ }
716
+ }
717
+
718
+ async function ensureClientComponents(projectDir) {
719
+ const relativePaths = [
720
+ 'components/env-var-warning.tsx',
721
+ 'app/providers.tsx',
722
+ 'app/ToasterProvider.tsx',
682
723
  'context/AuthContext.tsx',
683
724
  'context/CurrentContentContext.tsx',
684
725
  'context/LanguageContext.tsx',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-nextblock",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextblock-cms/template",
3
- "version": "0.2.0",
3
+ "version": "0.2.5",
4
4
  "private": true,
5
5
  "scripts": {
6
6
  "dev": "next dev",