@korajs/cli 0.3.4 → 0.4.0
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/bin.cjs +266 -222
- package/dist/bin.cjs.map +1 -1
- package/dist/bin.js +25 -11
- package/dist/bin.js.map +1 -1
- package/dist/{chunk-HNVCNPER.js → chunk-CMSX76KM.js} +5 -2
- package/dist/chunk-CMSX76KM.js.map +1 -0
- package/dist/{chunk-ULTO5NFA.js → chunk-MVP5PDT4.js} +2 -2
- package/dist/chunk-MVP5PDT4.js.map +1 -0
- package/dist/{chunk-MIMLCXSX.js → chunk-YGVO4POI.js} +242 -215
- package/dist/chunk-YGVO4POI.js.map +1 -0
- package/dist/create.cjs +4 -1
- package/dist/create.cjs.map +1 -1
- package/dist/create.js +2 -2
- package/dist/index.cjs +244 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -26
- package/dist/index.d.ts +26 -26
- package/dist/index.js +2 -2
- package/package.json +2 -2
- package/templates/tauri-react/src-tauri/tauri.conf.json +1 -1
- package/dist/chunk-HNVCNPER.js.map +0 -1
- package/dist/chunk-MIMLCXSX.js.map +0 -1
- package/dist/chunk-ULTO5NFA.js.map +0 -1
package/dist/bin.cjs
CHANGED
|
@@ -190,6 +190,7 @@ function promptConfirm(message, defaultValue = false, options) {
|
|
|
190
190
|
resolve9(false);
|
|
191
191
|
return;
|
|
192
192
|
}
|
|
193
|
+
;
|
|
193
194
|
(options?.output ?? process.stdout).write(" Please answer with y or n\n");
|
|
194
195
|
ask();
|
|
195
196
|
});
|
|
@@ -671,7 +672,9 @@ async function resolveCreatePreferencesFlow(params) {
|
|
|
671
672
|
}
|
|
672
673
|
if (flags.db !== void 0) {
|
|
673
674
|
if (!isDatabaseValue(flags.db)) {
|
|
674
|
-
throw new Error(
|
|
675
|
+
throw new Error(
|
|
676
|
+
`Invalid --db value "${flags.db}". Expected one of: none, sqlite, postgres.`
|
|
677
|
+
);
|
|
675
678
|
}
|
|
676
679
|
effective.db = flags.db;
|
|
677
680
|
} else if (!effective.sync) {
|
|
@@ -1352,7 +1355,15 @@ var import_node_path16 = require("path");
|
|
|
1352
1355
|
var import_citty2 = require("citty");
|
|
1353
1356
|
|
|
1354
1357
|
// src/commands/deploy/adapters/adapter.ts
|
|
1355
|
-
var DEPLOY_PLATFORMS = [
|
|
1358
|
+
var DEPLOY_PLATFORMS = [
|
|
1359
|
+
"fly",
|
|
1360
|
+
"railway",
|
|
1361
|
+
"aws-ecs",
|
|
1362
|
+
"aws-lightsail",
|
|
1363
|
+
"render",
|
|
1364
|
+
"docker",
|
|
1365
|
+
"kora-cloud"
|
|
1366
|
+
];
|
|
1356
1367
|
function isDeployPlatform(value) {
|
|
1357
1368
|
return DEPLOY_PLATFORMS.includes(value);
|
|
1358
1369
|
}
|
|
@@ -1363,8 +1374,8 @@ var import_node_path8 = require("path");
|
|
|
1363
1374
|
|
|
1364
1375
|
// src/commands/deploy/builder/client-builder.ts
|
|
1365
1376
|
var import_node_child_process3 = require("child_process");
|
|
1366
|
-
var import_promises5 = require("fs/promises");
|
|
1367
1377
|
var import_node_fs3 = require("fs");
|
|
1378
|
+
var import_promises5 = require("fs/promises");
|
|
1368
1379
|
var import_node_path6 = require("path");
|
|
1369
1380
|
async function buildClient(options) {
|
|
1370
1381
|
const viteEntryPoint = await resolveProjectBinaryEntryPoint(options.projectRoot, "vite", "vite");
|
|
@@ -1522,37 +1533,46 @@ var AwsEcsAdapter = class {
|
|
|
1522
1533
|
};
|
|
1523
1534
|
const region = config.region ?? "us-east-1";
|
|
1524
1535
|
const repoName = `kora/${config.appName}`;
|
|
1525
|
-
const createRepo = await this.runner.run(
|
|
1526
|
-
"
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1536
|
+
const createRepo = await this.runner.run(
|
|
1537
|
+
"aws",
|
|
1538
|
+
[
|
|
1539
|
+
"ecr",
|
|
1540
|
+
"create-repository",
|
|
1541
|
+
"--repository-name",
|
|
1542
|
+
repoName,
|
|
1543
|
+
"--region",
|
|
1544
|
+
region,
|
|
1545
|
+
"--image-scanning-configuration",
|
|
1546
|
+
"scanOnPush=true"
|
|
1547
|
+
],
|
|
1548
|
+
config.projectRoot
|
|
1549
|
+
);
|
|
1535
1550
|
if (createRepo.exitCode !== 0 && !createRepo.stderr.includes("RepositoryAlreadyExistsException")) {
|
|
1536
1551
|
throw new Error(`Failed to create ECR repository: ${createRepo.stderr}`);
|
|
1537
1552
|
}
|
|
1538
|
-
const identity = await this.runner.run(
|
|
1553
|
+
const identity = await this.runner.run(
|
|
1554
|
+
"aws",
|
|
1555
|
+
["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
|
|
1556
|
+
config.projectRoot
|
|
1557
|
+
);
|
|
1539
1558
|
const accountId = identity.stdout.trim();
|
|
1540
|
-
await this.runner.run(
|
|
1541
|
-
"
|
|
1542
|
-
"create-cluster",
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1559
|
+
await this.runner.run(
|
|
1560
|
+
"aws",
|
|
1561
|
+
["ecs", "create-cluster", "--cluster-name", config.appName, "--region", region],
|
|
1562
|
+
config.projectRoot
|
|
1563
|
+
);
|
|
1564
|
+
await this.runner.run(
|
|
1565
|
+
"aws",
|
|
1566
|
+
[
|
|
1567
|
+
"logs",
|
|
1568
|
+
"create-log-group",
|
|
1569
|
+
"--log-group-name",
|
|
1570
|
+
`/ecs/${config.appName}`,
|
|
1571
|
+
"--region",
|
|
1572
|
+
region
|
|
1573
|
+
],
|
|
1574
|
+
config.projectRoot
|
|
1575
|
+
);
|
|
1556
1576
|
return {
|
|
1557
1577
|
applicationId: `${accountId}.dkr.ecr.${region}.amazonaws.com/${repoName}`,
|
|
1558
1578
|
databaseId: null,
|
|
@@ -1585,50 +1605,42 @@ var AwsEcsAdapter = class {
|
|
|
1585
1605
|
const context = this.requireContext();
|
|
1586
1606
|
const region = context.region ?? "us-east-1";
|
|
1587
1607
|
const repoName = `kora/${context.appName}`;
|
|
1588
|
-
const loginPassword = await this.runner.run(
|
|
1589
|
-
"
|
|
1590
|
-
"get-login-password",
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
], context.projectRoot);
|
|
1608
|
+
const loginPassword = await this.runner.run(
|
|
1609
|
+
"aws",
|
|
1610
|
+
["ecr", "get-login-password", "--region", region],
|
|
1611
|
+
context.projectRoot
|
|
1612
|
+
);
|
|
1594
1613
|
if (loginPassword.exitCode !== 0) {
|
|
1595
1614
|
throw new Error(`ECR login failed: ${loginPassword.stderr}`);
|
|
1596
1615
|
}
|
|
1597
|
-
const identity = await this.runner.run(
|
|
1598
|
-
"
|
|
1599
|
-
"get-caller-identity",
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
"--output",
|
|
1603
|
-
"text"
|
|
1604
|
-
], context.projectRoot);
|
|
1616
|
+
const identity = await this.runner.run(
|
|
1617
|
+
"aws",
|
|
1618
|
+
["sts", "get-caller-identity", "--query", "Account", "--output", "text"],
|
|
1619
|
+
context.projectRoot
|
|
1620
|
+
);
|
|
1605
1621
|
const accountId = identity.stdout.trim();
|
|
1606
1622
|
const ecrUri = `${accountId}.dkr.ecr.${region}.amazonaws.com`;
|
|
1607
1623
|
const imageUri = `${ecrUri}/${repoName}:latest`;
|
|
1608
|
-
const dockerLogin = await this.runner.run(
|
|
1609
|
-
"
|
|
1610
|
-
"--username",
|
|
1611
|
-
|
|
1612
|
-
|
|
1613
|
-
ecrUri
|
|
1614
|
-
], artifacts.deployDirectory);
|
|
1624
|
+
const dockerLogin = await this.runner.run(
|
|
1625
|
+
"docker",
|
|
1626
|
+
["login", "--username", "AWS", "--password-stdin", ecrUri],
|
|
1627
|
+
artifacts.deployDirectory
|
|
1628
|
+
);
|
|
1615
1629
|
this.logger.step("Building Docker image...");
|
|
1616
|
-
const dockerBuild = await this.runner.run(
|
|
1617
|
-
"
|
|
1618
|
-
"--platform",
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
imageUri,
|
|
1622
|
-
"."
|
|
1623
|
-
], artifacts.deployDirectory);
|
|
1630
|
+
const dockerBuild = await this.runner.run(
|
|
1631
|
+
"docker",
|
|
1632
|
+
["build", "--platform", "linux/amd64", "-t", imageUri, "."],
|
|
1633
|
+
artifacts.deployDirectory
|
|
1634
|
+
);
|
|
1624
1635
|
if (dockerBuild.exitCode !== 0) {
|
|
1625
1636
|
throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
|
|
1626
1637
|
}
|
|
1627
1638
|
this.logger.step("Pushing image to ECR...");
|
|
1628
|
-
const dockerPush = await this.runner.run(
|
|
1629
|
-
"
|
|
1630
|
-
imageUri
|
|
1631
|
-
|
|
1639
|
+
const dockerPush = await this.runner.run(
|
|
1640
|
+
"docker",
|
|
1641
|
+
["push", imageUri],
|
|
1642
|
+
artifacts.deployDirectory
|
|
1643
|
+
);
|
|
1632
1644
|
if (dockerPush.exitCode !== 0) {
|
|
1633
1645
|
throw new Error(`Docker push failed: ${dockerPush.stderr}`);
|
|
1634
1646
|
}
|
|
@@ -1639,52 +1651,55 @@ var AwsEcsAdapter = class {
|
|
|
1639
1651
|
cpu: "256",
|
|
1640
1652
|
memory: "512",
|
|
1641
1653
|
executionRoleArn: `arn:aws:iam::${accountId}:role/ecsTaskExecutionRole`,
|
|
1642
|
-
containerDefinitions: [
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1654
|
+
containerDefinitions: [
|
|
1655
|
+
{
|
|
1656
|
+
name: context.appName,
|
|
1657
|
+
image: imageUri,
|
|
1658
|
+
essential: true,
|
|
1659
|
+
portMappings: [{ containerPort: 3001, protocol: "tcp" }],
|
|
1660
|
+
logConfiguration: {
|
|
1661
|
+
logDriver: "awslogs",
|
|
1662
|
+
options: {
|
|
1663
|
+
"awslogs-group": `/ecs/${context.appName}`,
|
|
1664
|
+
"awslogs-region": region,
|
|
1665
|
+
"awslogs-stream-prefix": "ecs"
|
|
1666
|
+
}
|
|
1667
|
+
},
|
|
1668
|
+
healthCheck: {
|
|
1669
|
+
command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
|
|
1670
|
+
interval: 30,
|
|
1671
|
+
timeout: 5,
|
|
1672
|
+
retries: 3,
|
|
1673
|
+
startPeriod: 60
|
|
1653
1674
|
}
|
|
1654
|
-
},
|
|
1655
|
-
healthCheck: {
|
|
1656
|
-
command: ["CMD-SHELL", "curl -f http://localhost:3001/health || exit 1"],
|
|
1657
|
-
interval: 30,
|
|
1658
|
-
timeout: 5,
|
|
1659
|
-
retries: 3,
|
|
1660
|
-
startPeriod: 60
|
|
1661
1675
|
}
|
|
1662
|
-
|
|
1676
|
+
]
|
|
1663
1677
|
});
|
|
1664
|
-
const registerTask = await this.runner.run(
|
|
1665
|
-
"
|
|
1666
|
-
"register-task-definition",
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
"--region",
|
|
1670
|
-
region
|
|
1671
|
-
], context.projectRoot);
|
|
1678
|
+
const registerTask = await this.runner.run(
|
|
1679
|
+
"aws",
|
|
1680
|
+
["ecs", "register-task-definition", "--cli-input-json", taskDef, "--region", region],
|
|
1681
|
+
context.projectRoot
|
|
1682
|
+
);
|
|
1672
1683
|
if (registerTask.exitCode !== 0) {
|
|
1673
1684
|
throw new Error(`Task definition registration failed: ${registerTask.stderr}`);
|
|
1674
1685
|
}
|
|
1675
|
-
const updateService = await this.runner.run(
|
|
1676
|
-
"
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
1687
|
-
|
|
1686
|
+
const updateService = await this.runner.run(
|
|
1687
|
+
"aws",
|
|
1688
|
+
[
|
|
1689
|
+
"ecs",
|
|
1690
|
+
"update-service",
|
|
1691
|
+
"--cluster",
|
|
1692
|
+
context.appName,
|
|
1693
|
+
"--service",
|
|
1694
|
+
context.appName,
|
|
1695
|
+
"--task-definition",
|
|
1696
|
+
context.appName,
|
|
1697
|
+
"--force-new-deployment",
|
|
1698
|
+
"--region",
|
|
1699
|
+
region
|
|
1700
|
+
],
|
|
1701
|
+
context.projectRoot
|
|
1702
|
+
);
|
|
1688
1703
|
const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
|
|
1689
1704
|
if (updateService.exitCode !== 0) {
|
|
1690
1705
|
this.logger.step("Service not found, creating new service...");
|
|
@@ -1709,19 +1724,23 @@ var AwsEcsAdapter = class {
|
|
|
1709
1724
|
async rollback(deploymentId) {
|
|
1710
1725
|
const context = this.requireContext();
|
|
1711
1726
|
const region = context.region ?? "us-east-1";
|
|
1712
|
-
const result = await this.runner.run(
|
|
1713
|
-
"
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1727
|
+
const result = await this.runner.run(
|
|
1728
|
+
"aws",
|
|
1729
|
+
[
|
|
1730
|
+
"ecs",
|
|
1731
|
+
"update-service",
|
|
1732
|
+
"--cluster",
|
|
1733
|
+
context.appName,
|
|
1734
|
+
"--service",
|
|
1735
|
+
context.appName,
|
|
1736
|
+
"--task-definition",
|
|
1737
|
+
`${context.appName}:${deploymentId}`,
|
|
1738
|
+
"--force-new-deployment",
|
|
1739
|
+
"--region",
|
|
1740
|
+
region
|
|
1741
|
+
],
|
|
1742
|
+
context.projectRoot
|
|
1743
|
+
);
|
|
1725
1744
|
if (result.exitCode !== 0) {
|
|
1726
1745
|
throw new Error(`ECS rollback failed: ${result.stderr}`);
|
|
1727
1746
|
}
|
|
@@ -1764,16 +1783,20 @@ var AwsEcsAdapter = class {
|
|
|
1764
1783
|
async status() {
|
|
1765
1784
|
const context = this.requireContext();
|
|
1766
1785
|
const region = context.region ?? "us-east-1";
|
|
1767
|
-
const result = await this.runner.run(
|
|
1768
|
-
"
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1786
|
+
const result = await this.runner.run(
|
|
1787
|
+
"aws",
|
|
1788
|
+
[
|
|
1789
|
+
"ecs",
|
|
1790
|
+
"describe-services",
|
|
1791
|
+
"--cluster",
|
|
1792
|
+
context.appName,
|
|
1793
|
+
"--services",
|
|
1794
|
+
context.appName,
|
|
1795
|
+
"--region",
|
|
1796
|
+
region
|
|
1797
|
+
],
|
|
1798
|
+
context.projectRoot
|
|
1799
|
+
);
|
|
1777
1800
|
if (result.exitCode !== 0) {
|
|
1778
1801
|
return { state: "failed", message: result.stderr };
|
|
1779
1802
|
}
|
|
@@ -1882,18 +1905,22 @@ var AwsLightsailAdapter = class {
|
|
|
1882
1905
|
};
|
|
1883
1906
|
const region = config.region ?? "us-east-1";
|
|
1884
1907
|
const serviceName = sanitizeLightsailName(config.appName);
|
|
1885
|
-
const createService = await this.runner.run(
|
|
1886
|
-
"
|
|
1887
|
-
|
|
1888
|
-
|
|
1889
|
-
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1908
|
+
const createService = await this.runner.run(
|
|
1909
|
+
"aws",
|
|
1910
|
+
[
|
|
1911
|
+
"lightsail",
|
|
1912
|
+
"create-container-service",
|
|
1913
|
+
"--service-name",
|
|
1914
|
+
serviceName,
|
|
1915
|
+
"--power",
|
|
1916
|
+
"nano",
|
|
1917
|
+
"--scale",
|
|
1918
|
+
"1",
|
|
1919
|
+
"--region",
|
|
1920
|
+
region
|
|
1921
|
+
],
|
|
1922
|
+
config.projectRoot
|
|
1923
|
+
);
|
|
1897
1924
|
if (createService.exitCode !== 0 && !createService.stderr.includes("already exists")) {
|
|
1898
1925
|
throw new Error(`Failed to create Lightsail container service: ${createService.stderr}`);
|
|
1899
1926
|
}
|
|
@@ -1931,30 +1958,31 @@ var AwsLightsailAdapter = class {
|
|
|
1931
1958
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
1932
1959
|
const imageTag = `${serviceName}:latest`;
|
|
1933
1960
|
this.logger.step("Building Docker image...");
|
|
1934
|
-
const dockerBuild = await this.runner.run(
|
|
1935
|
-
"
|
|
1936
|
-
"--platform",
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
imageTag,
|
|
1940
|
-
"."
|
|
1941
|
-
], artifacts.deployDirectory);
|
|
1961
|
+
const dockerBuild = await this.runner.run(
|
|
1962
|
+
"docker",
|
|
1963
|
+
["build", "--platform", "linux/amd64", "-t", imageTag, "."],
|
|
1964
|
+
artifacts.deployDirectory
|
|
1965
|
+
);
|
|
1942
1966
|
if (dockerBuild.exitCode !== 0) {
|
|
1943
1967
|
throw new Error(`Docker build failed: ${dockerBuild.stderr}`);
|
|
1944
1968
|
}
|
|
1945
1969
|
this.logger.step("Pushing image to Lightsail...");
|
|
1946
|
-
const pushImage = await this.runner.run(
|
|
1947
|
-
"
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
1952
|
-
|
|
1953
|
-
|
|
1954
|
-
|
|
1955
|
-
|
|
1956
|
-
|
|
1957
|
-
|
|
1970
|
+
const pushImage = await this.runner.run(
|
|
1971
|
+
"aws",
|
|
1972
|
+
[
|
|
1973
|
+
"lightsail",
|
|
1974
|
+
"push-container-image",
|
|
1975
|
+
"--service-name",
|
|
1976
|
+
serviceName,
|
|
1977
|
+
"--label",
|
|
1978
|
+
"latest",
|
|
1979
|
+
"--image",
|
|
1980
|
+
imageTag,
|
|
1981
|
+
"--region",
|
|
1982
|
+
region
|
|
1983
|
+
],
|
|
1984
|
+
artifacts.deployDirectory
|
|
1985
|
+
);
|
|
1958
1986
|
if (pushImage.exitCode !== 0) {
|
|
1959
1987
|
throw new Error(`Lightsail image push failed: ${pushImage.stderr}`);
|
|
1960
1988
|
}
|
|
@@ -1985,29 +2013,30 @@ var AwsLightsailAdapter = class {
|
|
|
1985
2013
|
unhealthyThreshold: 3
|
|
1986
2014
|
}
|
|
1987
2015
|
});
|
|
1988
|
-
const createDeploy = await this.runner.run(
|
|
1989
|
-
"
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
|
|
2016
|
+
const createDeploy = await this.runner.run(
|
|
2017
|
+
"aws",
|
|
2018
|
+
[
|
|
2019
|
+
"lightsail",
|
|
2020
|
+
"create-container-service-deployment",
|
|
2021
|
+
"--service-name",
|
|
2022
|
+
serviceName,
|
|
2023
|
+
"--containers",
|
|
2024
|
+
containers,
|
|
2025
|
+
"--public-endpoint",
|
|
2026
|
+
publicEndpoint,
|
|
2027
|
+
"--region",
|
|
2028
|
+
region
|
|
2029
|
+
],
|
|
2030
|
+
context.projectRoot
|
|
2031
|
+
);
|
|
2000
2032
|
if (createDeploy.exitCode !== 0) {
|
|
2001
2033
|
throw new Error(`Lightsail deployment failed: ${createDeploy.stderr}`);
|
|
2002
2034
|
}
|
|
2003
|
-
const serviceInfo = await this.runner.run(
|
|
2004
|
-
"
|
|
2005
|
-
"get-container-services",
|
|
2006
|
-
|
|
2007
|
-
|
|
2008
|
-
"--region",
|
|
2009
|
-
region
|
|
2010
|
-
], context.projectRoot);
|
|
2035
|
+
const serviceInfo = await this.runner.run(
|
|
2036
|
+
"aws",
|
|
2037
|
+
["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
|
|
2038
|
+
context.projectRoot
|
|
2039
|
+
);
|
|
2011
2040
|
const rawUrl = parseLightsailUrl(serviceInfo.stdout) ?? `https://${serviceName}.${region}.cs.amazonlightsail.com`;
|
|
2012
2041
|
const serviceUrl = rawUrl.replace(/\/+$/, "");
|
|
2013
2042
|
const deploymentId = (/* @__PURE__ */ new Date()).toISOString();
|
|
@@ -2021,14 +2050,18 @@ var AwsLightsailAdapter = class {
|
|
|
2021
2050
|
const context = this.requireContext();
|
|
2022
2051
|
const region = context.region ?? "us-east-1";
|
|
2023
2052
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
2024
|
-
const deployments = await this.runner.run(
|
|
2025
|
-
"
|
|
2026
|
-
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
2053
|
+
const deployments = await this.runner.run(
|
|
2054
|
+
"aws",
|
|
2055
|
+
[
|
|
2056
|
+
"lightsail",
|
|
2057
|
+
"get-container-service-deployments",
|
|
2058
|
+
"--service-name",
|
|
2059
|
+
serviceName,
|
|
2060
|
+
"--region",
|
|
2061
|
+
region
|
|
2062
|
+
],
|
|
2063
|
+
context.projectRoot
|
|
2064
|
+
);
|
|
2032
2065
|
if (deployments.exitCode !== 0) {
|
|
2033
2066
|
throw new Error(`Lightsail rollback failed: ${deployments.stderr}`);
|
|
2034
2067
|
}
|
|
@@ -2036,18 +2069,22 @@ var AwsLightsailAdapter = class {
|
|
|
2036
2069
|
if (!previousDeployment) {
|
|
2037
2070
|
throw new Error("No previous deployment found to rollback to.");
|
|
2038
2071
|
}
|
|
2039
|
-
const redeploy = await this.runner.run(
|
|
2040
|
-
"
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2072
|
+
const redeploy = await this.runner.run(
|
|
2073
|
+
"aws",
|
|
2074
|
+
[
|
|
2075
|
+
"lightsail",
|
|
2076
|
+
"create-container-service-deployment",
|
|
2077
|
+
"--service-name",
|
|
2078
|
+
serviceName,
|
|
2079
|
+
"--containers",
|
|
2080
|
+
JSON.stringify(previousDeployment.containers),
|
|
2081
|
+
"--public-endpoint",
|
|
2082
|
+
JSON.stringify(previousDeployment.publicEndpoint),
|
|
2083
|
+
"--region",
|
|
2084
|
+
region
|
|
2085
|
+
],
|
|
2086
|
+
context.projectRoot
|
|
2087
|
+
);
|
|
2051
2088
|
if (redeploy.exitCode !== 0) {
|
|
2052
2089
|
throw new Error(`Lightsail rollback deployment failed: ${redeploy.stderr}`);
|
|
2053
2090
|
}
|
|
@@ -2094,14 +2131,11 @@ var AwsLightsailAdapter = class {
|
|
|
2094
2131
|
const context = this.requireContext();
|
|
2095
2132
|
const region = context.region ?? "us-east-1";
|
|
2096
2133
|
const serviceName = sanitizeLightsailName(context.appName);
|
|
2097
|
-
const result = await this.runner.run(
|
|
2098
|
-
"
|
|
2099
|
-
"get-container-services",
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
"--region",
|
|
2103
|
-
region
|
|
2104
|
-
], context.projectRoot);
|
|
2134
|
+
const result = await this.runner.run(
|
|
2135
|
+
"aws",
|
|
2136
|
+
["lightsail", "get-container-services", "--service-name", serviceName, "--region", region],
|
|
2137
|
+
context.projectRoot
|
|
2138
|
+
);
|
|
2105
2139
|
if (result.exitCode !== 0) {
|
|
2106
2140
|
return { state: "failed", message: result.stderr };
|
|
2107
2141
|
}
|
|
@@ -2166,12 +2200,7 @@ ${error.message}` });
|
|
|
2166
2200
|
});
|
|
2167
2201
|
}
|
|
2168
2202
|
};
|
|
2169
|
-
var PASSTHROUGH_ENV_VARS = [
|
|
2170
|
-
"DATABASE_URL",
|
|
2171
|
-
"AUTH_SECRET",
|
|
2172
|
-
"PUBLIC_URL",
|
|
2173
|
-
"NODE_ENV"
|
|
2174
|
-
];
|
|
2203
|
+
var PASSTHROUGH_ENV_VARS = ["DATABASE_URL", "AUTH_SECRET", "PUBLIC_URL", "NODE_ENV"];
|
|
2175
2204
|
function sanitizeLightsailName(name) {
|
|
2176
2205
|
return name.toLowerCase().replace(/[^a-z0-9-]/g, "-").replace(/-{2,}/g, "-").replace(/^-|-$/g, "").slice(0, 255) || "kora-app";
|
|
2177
2206
|
}
|
|
@@ -3050,7 +3079,8 @@ function generateDeployPackageJson(nativeDependencies) {
|
|
|
3050
3079
|
type: "module",
|
|
3051
3080
|
dependencies: nativeDependencies
|
|
3052
3081
|
};
|
|
3053
|
-
return JSON.stringify(pkg, null, 2)
|
|
3082
|
+
return `${JSON.stringify(pkg, null, 2)}
|
|
3083
|
+
`;
|
|
3054
3084
|
}
|
|
3055
3085
|
function generateDockerIgnore() {
|
|
3056
3086
|
return [
|
|
@@ -3382,7 +3412,7 @@ var deployCommand = (0, import_citty2.defineCommand)({
|
|
|
3382
3412
|
nativeDependencies: {
|
|
3383
3413
|
"better-sqlite3": "^11.0.0",
|
|
3384
3414
|
"drizzle-orm": "^0.45.2",
|
|
3385
|
-
|
|
3415
|
+
postgres: "^3.4.0"
|
|
3386
3416
|
}
|
|
3387
3417
|
});
|
|
3388
3418
|
await writeDockerIgnoreArtifact(deployDirectory);
|
|
@@ -3736,7 +3766,14 @@ var SchemaWatcher = class {
|
|
|
3736
3766
|
this.watcher = null;
|
|
3737
3767
|
}
|
|
3738
3768
|
async regenerate() {
|
|
3739
|
-
const koraBinJs = (0, import_node_path18.join)(
|
|
3769
|
+
const koraBinJs = (0, import_node_path18.join)(
|
|
3770
|
+
this.config.projectRoot,
|
|
3771
|
+
"node_modules",
|
|
3772
|
+
"@korajs",
|
|
3773
|
+
"cli",
|
|
3774
|
+
"dist",
|
|
3775
|
+
"bin.js"
|
|
3776
|
+
);
|
|
3740
3777
|
const hasTsx = await hasTsxInstalled(this.config.projectRoot);
|
|
3741
3778
|
const command = process.execPath;
|
|
3742
3779
|
const args = hasTsx ? ["--import", "tsx", koraBinJs, "generate", "types", "--schema", this.config.schemaPath] : [koraBinJs, "generate", "types", "--schema", this.config.schemaPath];
|
|
@@ -3872,7 +3909,9 @@ var devCommand = (0, import_citty3.defineCommand)({
|
|
|
3872
3909
|
if (await fileExists2(candidate)) {
|
|
3873
3910
|
configuredSchemaPath = candidate;
|
|
3874
3911
|
} else {
|
|
3875
|
-
logger.warn(
|
|
3912
|
+
logger.warn(
|
|
3913
|
+
`Configured schema file not found: ${candidate}. Falling back to auto-detection.`
|
|
3914
|
+
);
|
|
3876
3915
|
}
|
|
3877
3916
|
}
|
|
3878
3917
|
const schemaPath = configuredSchemaPath ?? await findSchemaFile(projectRoot);
|
|
@@ -4026,7 +4065,8 @@ function isPostgresEnvRequested(config) {
|
|
|
4026
4065
|
const sync = config?.dev?.sync;
|
|
4027
4066
|
if (typeof sync !== "object" || sync === null) return false;
|
|
4028
4067
|
if (sync.store === "postgres") return true;
|
|
4029
|
-
if (typeof sync.store === "object" && sync.store !== null && sync.store.type === "postgres")
|
|
4068
|
+
if (typeof sync.store === "object" && sync.store !== null && sync.store.type === "postgres")
|
|
4069
|
+
return true;
|
|
4030
4070
|
return false;
|
|
4031
4071
|
}
|
|
4032
4072
|
var MANAGED_SYNC_BOOTSTRAP_SCRIPT = `
|
|
@@ -4347,7 +4387,8 @@ function isBreakingChange(change) {
|
|
|
4347
4387
|
if (change.type === "field-changed") {
|
|
4348
4388
|
if (change.before.kind !== change.after.kind) return true;
|
|
4349
4389
|
if (change.before.itemKind !== change.after.itemKind) return true;
|
|
4350
|
-
if (serializeEnum(change.before.enumValues) !== serializeEnum(change.after.enumValues))
|
|
4390
|
+
if (serializeEnum(change.before.enumValues) !== serializeEnum(change.after.enumValues))
|
|
4391
|
+
return true;
|
|
4351
4392
|
if (change.before.required !== change.after.required && change.after.required) return true;
|
|
4352
4393
|
return false;
|
|
4353
4394
|
}
|
|
@@ -4731,9 +4772,7 @@ async function runSqliteMigration(path, statements, migrationId, fromVersion, to
|
|
|
4731
4772
|
async function loadSqliteDriver(projectRoot) {
|
|
4732
4773
|
try {
|
|
4733
4774
|
const { createRequire } = await import("module");
|
|
4734
|
-
const requireFrom = createRequire(
|
|
4735
|
-
projectRoot ? `${projectRoot}/package.json` : import_meta3.url
|
|
4736
|
-
);
|
|
4775
|
+
const requireFrom = createRequire(projectRoot ? `${projectRoot}/package.json` : import_meta3.url);
|
|
4737
4776
|
const Database = requireFrom("better-sqlite3");
|
|
4738
4777
|
return {
|
|
4739
4778
|
open(path) {
|
|
@@ -5011,7 +5050,12 @@ var migrateCommand = (0, import_citty5.defineCommand)({
|
|
|
5011
5050
|
return;
|
|
5012
5051
|
}
|
|
5013
5052
|
await (0, import_promises15.mkdir)(outputDir, { recursive: true });
|
|
5014
|
-
const migrationPath = await writeMigrationFile(
|
|
5053
|
+
const migrationPath = await writeMigrationFile(
|
|
5054
|
+
outputDir,
|
|
5055
|
+
diff.fromVersion,
|
|
5056
|
+
diff.toVersion,
|
|
5057
|
+
generated
|
|
5058
|
+
);
|
|
5015
5059
|
await writeSchemaSnapshot(snapshotFile, currentSchema);
|
|
5016
5060
|
logger.blank();
|
|
5017
5061
|
logger.success(`Generated migration: ${migrationPath}`);
|