neonctl 1.32.0 → 1.32.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.
- package/commands/bootstrap/index.js +27 -12
- package/package.json +4 -3
|
@@ -52,6 +52,13 @@ function getExecutorProgram(packageManager) {
|
|
|
52
52
|
return 'bunx';
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
+
function writeEnvFile({ fileName, secrets, }) {
|
|
56
|
+
let content = '';
|
|
57
|
+
for (const secret of secrets) {
|
|
58
|
+
content += `${secret.key}=${secret.value}\n`;
|
|
59
|
+
}
|
|
60
|
+
writeFileSync(fileName, content, 'utf8');
|
|
61
|
+
}
|
|
55
62
|
const bootstrap = async (props) => {
|
|
56
63
|
const out = writer(props);
|
|
57
64
|
if (isCi()) {
|
|
@@ -395,12 +402,6 @@ const bootstrap = async (props) => {
|
|
|
395
402
|
if (finalOptions.auth === 'auth.js') {
|
|
396
403
|
// Generate AUTH_SECRET using openssl
|
|
397
404
|
const authSecret = execSync('openssl rand -base64 33').toString().trim();
|
|
398
|
-
// Content for the .env.local file
|
|
399
|
-
const content = `DATABASE_URL=${connectionString}
|
|
400
|
-
AUTH_SECRET=${authSecret}`;
|
|
401
|
-
// Write the content to the .env.local file
|
|
402
|
-
writeFileSync(`${appName}/.env.local`, content, 'utf8');
|
|
403
|
-
writeFileSync(`${appName}/.dev.vars`, content, 'utf8'); // cloudflare
|
|
404
405
|
environmentVariables.push({
|
|
405
406
|
key: 'DATABASE_URL',
|
|
406
407
|
value: connectionString,
|
|
@@ -421,13 +422,13 @@ AUTH_SECRET=${authSecret}`;
|
|
|
421
422
|
value: authSecret,
|
|
422
423
|
kind: 'runtime',
|
|
423
424
|
});
|
|
425
|
+
// Write the content to the .env.local file
|
|
426
|
+
writeEnvFile({
|
|
427
|
+
fileName: `${appName}/.env.local`,
|
|
428
|
+
secrets: environmentVariables.filter((e) => e.kind === 'runtime'),
|
|
429
|
+
});
|
|
424
430
|
}
|
|
425
431
|
else {
|
|
426
|
-
// Content for the .env.local file
|
|
427
|
-
const content = `DATABASE_URL=${connectionString}`;
|
|
428
|
-
// Write the content to the .env.local file
|
|
429
|
-
writeFileSync(`${appName}/.env.local`, content, 'utf8');
|
|
430
|
-
writeFileSync(`${appName}/.dev.vars`, content, 'utf8'); // cloudflare
|
|
431
432
|
environmentVariables.push({
|
|
432
433
|
key: 'DATABASE_URL',
|
|
433
434
|
value: connectionString,
|
|
@@ -438,6 +439,11 @@ AUTH_SECRET=${authSecret}`;
|
|
|
438
439
|
value: connectionString,
|
|
439
440
|
kind: 'runtime',
|
|
440
441
|
});
|
|
442
|
+
// Write the content to the .env.local file
|
|
443
|
+
writeEnvFile({
|
|
444
|
+
fileName: `${appName}/.env.local`,
|
|
445
|
+
secrets: environmentVariables.filter((e) => e.kind === 'runtime'),
|
|
446
|
+
});
|
|
441
447
|
}
|
|
442
448
|
out.text(`Created a Next.js project in ${chalk.blue(appName)}.\n\nYou can now run ${chalk.blue(`cd ${appName} && ${finalOptions.packageManager} run dev`)}`);
|
|
443
449
|
}
|
|
@@ -481,7 +487,7 @@ AUTH_SECRET=${authSecret}`;
|
|
|
481
487
|
value: 'cloudflare',
|
|
482
488
|
description: 'We will install the Wrangler CLI globally.',
|
|
483
489
|
},
|
|
484
|
-
{ title: '
|
|
490
|
+
{ title: 'Skip this step', value: -1 },
|
|
485
491
|
],
|
|
486
492
|
initial: 0,
|
|
487
493
|
});
|
|
@@ -559,4 +565,13 @@ ${environmentVariables
|
|
|
559
565
|
}
|
|
560
566
|
}
|
|
561
567
|
trackEvent('create-app', { phase: 'success-finish' });
|
|
568
|
+
if (finalOptions.framework === 'Next.js') {
|
|
569
|
+
log.info(chalk.green(`
|
|
570
|
+
|
|
571
|
+
You can now run:
|
|
572
|
+
|
|
573
|
+
cd ${appName} && ${finalOptions.packageManager} run dev
|
|
574
|
+
|
|
575
|
+
to start the app locally.`));
|
|
576
|
+
}
|
|
562
577
|
};
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"url": "git+ssh://git@github.com/neondatabase/neonctl.git"
|
|
6
6
|
},
|
|
7
7
|
"type": "module",
|
|
8
|
-
"version": "1.32.
|
|
8
|
+
"version": "1.32.1",
|
|
9
9
|
"description": "CLI tool for NeonDB Cloud management",
|
|
10
10
|
"main": "index.js",
|
|
11
11
|
"author": "NeonDB",
|
|
@@ -90,8 +90,9 @@
|
|
|
90
90
|
},
|
|
91
91
|
"scripts": {
|
|
92
92
|
"watch": "tsc --watch",
|
|
93
|
-
"
|
|
94
|
-
"lint
|
|
93
|
+
"typecheck": "tsc --noEmit",
|
|
94
|
+
"lint": "npm run typecheck && eslint src --ext .ts && prettier --check .",
|
|
95
|
+
"lint:fix": "npm run typecheck && eslint src --ext .ts --fix && prettier --w .",
|
|
95
96
|
"build": "bun generateParams && bun clean && tsc && cp src/*.html package*.json README.md ./dist",
|
|
96
97
|
"clean": "rm -rf dist",
|
|
97
98
|
"generateParams": "bun generateOptionsFromSpec.ts",
|