@rebasepro/cli 0.11.1-canary.g4483771 → 0.11.1-canary.g4d8d6f8
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/dist/index.es.js
CHANGED
|
@@ -1531,26 +1531,6 @@ async function findAvailablePort(startPort) {
|
|
|
1531
1531
|
while (!await isPortAvailable(port)) port++;
|
|
1532
1532
|
return port;
|
|
1533
1533
|
}
|
|
1534
|
-
/**
|
|
1535
|
-
* The CLI's own version, which is the runtime image tag a scaffolded project
|
|
1536
|
-
* pins. They move together: the CLI, the packages and the runtime image are cut
|
|
1537
|
-
* from one release, so the version that installed the project is the version
|
|
1538
|
-
* whose runtime can boot its bundle.
|
|
1539
|
-
*
|
|
1540
|
-
* Falls back to `latest` only when the CLI cannot read its own manifest — a
|
|
1541
|
-
* floating tag is worse than a pinned one, but better than a compose file that
|
|
1542
|
-
* names a version that was never published.
|
|
1543
|
-
*/
|
|
1544
|
-
function readCliVersion() {
|
|
1545
|
-
try {
|
|
1546
|
-
const manifest = path.resolve(cliRoot, "package.json");
|
|
1547
|
-
if (fs.existsSync(manifest)) {
|
|
1548
|
-
const pkg = JSON.parse(fs.readFileSync(manifest, "utf-8"));
|
|
1549
|
-
if (typeof pkg.version === "string" && pkg.version) return pkg.version;
|
|
1550
|
-
}
|
|
1551
|
-
} catch {}
|
|
1552
|
-
return "latest";
|
|
1553
|
-
}
|
|
1554
1534
|
async function configureEnvFile(targetDirectory, databaseUrl) {
|
|
1555
1535
|
const envExamplePath = path.join(targetDirectory, ".env.example");
|
|
1556
1536
|
const envPath = path.join(targetDirectory, ".env");
|
|
@@ -1562,8 +1542,6 @@ async function configureEnvFile(targetDirectory, databaseUrl) {
|
|
|
1562
1542
|
let envContent = fs.readFileSync(envPath, "utf-8");
|
|
1563
1543
|
envContent = envContent.replace(/^JWT_SECRET=.*$/m, `JWT_SECRET=${jwtSecret}`);
|
|
1564
1544
|
envContent = envContent.replace(/^#\s*REBASE_SERVICE_KEY=.*$/m, `REBASE_SERVICE_KEY=${serviceKey}`);
|
|
1565
|
-
const runtimeVersion = readCliVersion();
|
|
1566
|
-
envContent = /^#?\s*REBASE_VERSION=.*$/m.test(envContent) ? envContent.replace(/^#?\s*REBASE_VERSION=.*$/m, `REBASE_VERSION=${runtimeVersion}`) : `${envContent.trimEnd()}\n\n# The Rebase runtime image tag docker-compose.yml pulls.\n# Change this and restart to upgrade; your project bundle is untouched.\nREBASE_VERSION=${runtimeVersion}\n`;
|
|
1567
1545
|
if (databaseUrl) {
|
|
1568
1546
|
if (/[\r\n]/.test(databaseUrl)) throw new Error("Invalid DATABASE_URL: multiline values are not allowed.");
|
|
1569
1547
|
envContent = envContent.replace(/^DATABASE_URL=.*$/m, `DATABASE_URL=${databaseUrl}\nDATABASE_PASSWORD=${dbPassword}`);
|