onflyt-cli 1.0.1-beta.2 → 1.0.1-beta.3
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.
Potentially problematic release.
This version of onflyt-cli might be problematic. Click here for more details.
- package/dist/App.d.ts +3 -0
- package/dist/App.js +8 -0
- package/dist/commands/credits.d.ts +3 -0
- package/dist/commands/credits.js +101 -0
- package/dist/commands/delete.d.ts +7 -0
- package/dist/commands/delete.js +220 -0
- package/dist/commands/deploy.d.ts +6 -0
- package/dist/commands/deploy.js +715 -0
- package/dist/commands/deployments.d.ts +6 -0
- package/dist/commands/deployments.js +225 -0
- package/dist/commands/help.d.ts +3 -0
- package/dist/commands/help.js +76 -0
- package/dist/commands/init.d.ts +11 -0
- package/dist/commands/init.js +422 -0
- package/dist/commands/login.d.ts +6 -0
- package/dist/commands/login.js +150 -0
- package/dist/commands/logout.d.ts +3 -0
- package/dist/commands/logout.js +19 -0
- package/dist/commands/logs.d.ts +7 -0
- package/dist/commands/logs.js +307 -0
- package/dist/commands/projects.d.ts +3 -0
- package/dist/commands/projects.js +203 -0
- package/dist/commands/rollback.d.ts +6 -0
- package/dist/commands/rollback.js +316 -0
- package/dist/commands/teams.d.ts +3 -0
- package/dist/commands/teams.js +81 -0
- package/dist/commands/whoami.d.ts +3 -0
- package/dist/commands/whoami.js +34 -0
- package/dist/components/Loading.d.ts +13 -0
- package/dist/components/Loading.js +42 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +77 -116
- package/dist/lib/api.d.ts +27 -0
- package/dist/lib/api.js +109 -0
- package/dist/lib/config.d.ts +32 -0
- package/dist/lib/config.js +52 -0
- package/dist/lib/deploy-api.d.ts +97 -0
- package/dist/lib/deploy-api.js +335 -0
- package/dist/lib/deploy.d.ts +36 -0
- package/dist/lib/deploy.js +181 -0
- package/dist/lib/framework.d.ts +27 -0
- package/dist/lib/framework.js +184 -0
- package/dist/lib/git.d.ts +25 -0
- package/dist/lib/git.js +149 -0
- package/dist/lib/scaffold.d.ts +21 -0
- package/dist/lib/scaffold.js +190 -0
- package/dist/shared/frameworks/registry.d.ts +21 -0
- package/dist/shared/frameworks/registry.js +196 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/limits.d.ts +16 -0
- package/dist/shared/limits.js +44 -0
- package/dist/shared/pricing.d.ts +2 -0
- package/dist/shared/pricing.js +7 -0
- package/dist/shared/templates/registry.d.ts +9 -0
- package/dist/shared/templates/registry.js +47 -0
- package/package.json +2 -3
- package/src/App.tsx +1 -1
- package/src/commands/deploy.tsx +1 -1
- package/src/commands/help.tsx +1 -1
- package/src/commands/init.tsx +1 -1
- package/src/commands/projects.tsx +1 -1
- package/src/components/Loading.tsx +1 -1
- package/src/index.tsx +1 -1
- package/src/lib/deploy-api.ts +3 -3
- package/src/lib/framework.ts +2 -2
- package/src/lib/shared.ts +350 -0
package/dist/index.js
CHANGED
|
@@ -1833,7 +1833,16 @@ var init_api = __esm({
|
|
|
1833
1833
|
}
|
|
1834
1834
|
});
|
|
1835
1835
|
|
|
1836
|
-
//
|
|
1836
|
+
// src/lib/shared.ts
|
|
1837
|
+
function getLimitsBySpend(totalSpend) {
|
|
1838
|
+
if (totalSpend >= SPEND_THRESHOLDS.high) return TIER_LIMITS.high;
|
|
1839
|
+
if (totalSpend >= SPEND_THRESHOLDS.medium) return TIER_LIMITS.medium;
|
|
1840
|
+
if (totalSpend >= SPEND_THRESHOLDS.low) return TIER_LIMITS.low;
|
|
1841
|
+
return TIER_LIMITS.free;
|
|
1842
|
+
}
|
|
1843
|
+
function getTierLabel(totalSpend) {
|
|
1844
|
+
return getLimitsBySpend(totalSpend).tierLabel;
|
|
1845
|
+
}
|
|
1837
1846
|
function getDefaultBuildCommand(frameworkId) {
|
|
1838
1847
|
return FRAMEWORKS[frameworkId.toLowerCase()]?.defaults.buildCommand;
|
|
1839
1848
|
}
|
|
@@ -1847,22 +1856,60 @@ function getInstallCommand(frameworkId, packageManager) {
|
|
|
1847
1856
|
const pm = packageManager.toLowerCase();
|
|
1848
1857
|
const framework = FRAMEWORKS[frameworkId.toLowerCase()];
|
|
1849
1858
|
if (pm === "pip" || pm === "poetry") {
|
|
1850
|
-
if (pm === "poetry")
|
|
1851
|
-
return "poetry install";
|
|
1859
|
+
if (pm === "poetry") return "poetry install";
|
|
1852
1860
|
return framework?.defaults.installCommand || "pip install -r requirements.txt";
|
|
1853
1861
|
}
|
|
1854
1862
|
const installCommands = {
|
|
1855
|
-
bun: "bun install",
|
|
1856
1863
|
npm: "npm install",
|
|
1864
|
+
bun: "bun install",
|
|
1857
1865
|
yarn: "yarn install",
|
|
1858
|
-
|
|
1866
|
+
pnpm: "pnpm install"
|
|
1859
1867
|
};
|
|
1860
1868
|
return installCommands[pm] || `${pm} install`;
|
|
1861
1869
|
}
|
|
1862
|
-
var FRAMEWORKS;
|
|
1863
|
-
var
|
|
1864
|
-
"
|
|
1870
|
+
var TIER_HOURLY_PRICE, SPEND_THRESHOLDS, TIER_LIMITS, FRAMEWORKS, TEMPLATES;
|
|
1871
|
+
var init_shared = __esm({
|
|
1872
|
+
"src/lib/shared.ts"() {
|
|
1865
1873
|
"use strict";
|
|
1874
|
+
TIER_HOURLY_PRICE = {
|
|
1875
|
+
micro: 0,
|
|
1876
|
+
lite: 0.015,
|
|
1877
|
+
standard: 0.05,
|
|
1878
|
+
pro: 0.08,
|
|
1879
|
+
business: 0.12
|
|
1880
|
+
};
|
|
1881
|
+
SPEND_THRESHOLDS = {
|
|
1882
|
+
free: 0,
|
|
1883
|
+
low: 10,
|
|
1884
|
+
medium: 50,
|
|
1885
|
+
high: 200
|
|
1886
|
+
};
|
|
1887
|
+
TIER_LIMITS = {
|
|
1888
|
+
free: {
|
|
1889
|
+
maxProjects: 3,
|
|
1890
|
+
maxInstancesPerProject: 1,
|
|
1891
|
+
tier: "free",
|
|
1892
|
+
tierLabel: "Free Usage"
|
|
1893
|
+
},
|
|
1894
|
+
low: {
|
|
1895
|
+
maxProjects: 10,
|
|
1896
|
+
maxInstancesPerProject: 2,
|
|
1897
|
+
tier: "low",
|
|
1898
|
+
tierLabel: "Low Spend"
|
|
1899
|
+
},
|
|
1900
|
+
medium: {
|
|
1901
|
+
maxProjects: Infinity,
|
|
1902
|
+
maxInstancesPerProject: 4,
|
|
1903
|
+
tier: "medium",
|
|
1904
|
+
tierLabel: "Medium Spend"
|
|
1905
|
+
},
|
|
1906
|
+
high: {
|
|
1907
|
+
maxProjects: Infinity,
|
|
1908
|
+
maxInstancesPerProject: 10,
|
|
1909
|
+
tier: "high",
|
|
1910
|
+
tierLabel: "High Spend"
|
|
1911
|
+
}
|
|
1912
|
+
};
|
|
1866
1913
|
FRAMEWORKS = {
|
|
1867
1914
|
nextjs: {
|
|
1868
1915
|
label: "Next.js",
|
|
@@ -1880,7 +1927,7 @@ var init_registry = __esm({
|
|
|
1880
1927
|
family: "node",
|
|
1881
1928
|
deploymentType: "container",
|
|
1882
1929
|
defaults: {
|
|
1883
|
-
buildCommand: "
|
|
1930
|
+
buildCommand: "npm run build",
|
|
1884
1931
|
installCommand: "bun install",
|
|
1885
1932
|
outputDirectory: "build"
|
|
1886
1933
|
},
|
|
@@ -1891,7 +1938,7 @@ var init_registry = __esm({
|
|
|
1891
1938
|
family: "node",
|
|
1892
1939
|
deploymentType: "static",
|
|
1893
1940
|
defaults: {
|
|
1894
|
-
buildCommand: "
|
|
1941
|
+
buildCommand: "npm run build",
|
|
1895
1942
|
installCommand: "bun install",
|
|
1896
1943
|
outputDirectory: "build"
|
|
1897
1944
|
},
|
|
@@ -1902,7 +1949,7 @@ var init_registry = __esm({
|
|
|
1902
1949
|
family: "node",
|
|
1903
1950
|
deploymentType: "static",
|
|
1904
1951
|
defaults: {
|
|
1905
|
-
buildCommand: "
|
|
1952
|
+
buildCommand: "npm run build",
|
|
1906
1953
|
installCommand: "bun install",
|
|
1907
1954
|
outputDirectory: "dist"
|
|
1908
1955
|
},
|
|
@@ -1913,7 +1960,7 @@ var init_registry = __esm({
|
|
|
1913
1960
|
family: "node",
|
|
1914
1961
|
deploymentType: "container",
|
|
1915
1962
|
defaults: {
|
|
1916
|
-
buildCommand: "
|
|
1963
|
+
buildCommand: "npm run build",
|
|
1917
1964
|
installCommand: "bun install",
|
|
1918
1965
|
outputDirectory: ".output"
|
|
1919
1966
|
},
|
|
@@ -1924,7 +1971,7 @@ var init_registry = __esm({
|
|
|
1924
1971
|
family: "node",
|
|
1925
1972
|
deploymentType: "static",
|
|
1926
1973
|
defaults: {
|
|
1927
|
-
buildCommand: "
|
|
1974
|
+
buildCommand: "npm run build",
|
|
1928
1975
|
installCommand: "bun install",
|
|
1929
1976
|
outputDirectory: "build"
|
|
1930
1977
|
},
|
|
@@ -1935,7 +1982,7 @@ var init_registry = __esm({
|
|
|
1935
1982
|
family: "node",
|
|
1936
1983
|
deploymentType: "container",
|
|
1937
1984
|
defaults: {
|
|
1938
|
-
buildCommand: "
|
|
1985
|
+
buildCommand: "npm run build",
|
|
1939
1986
|
installCommand: "bun install",
|
|
1940
1987
|
outputDirectory: "dist",
|
|
1941
1988
|
startCommand: "node dist/index.js"
|
|
@@ -1947,7 +1994,7 @@ var init_registry = __esm({
|
|
|
1947
1994
|
family: "node",
|
|
1948
1995
|
deploymentType: "container",
|
|
1949
1996
|
defaults: {
|
|
1950
|
-
buildCommand: "
|
|
1997
|
+
buildCommand: "npm run build",
|
|
1951
1998
|
installCommand: "bun install",
|
|
1952
1999
|
outputDirectory: "dist",
|
|
1953
2000
|
startCommand: "node dist/index.js"
|
|
@@ -1959,7 +2006,7 @@ var init_registry = __esm({
|
|
|
1959
2006
|
family: "node",
|
|
1960
2007
|
deploymentType: "container",
|
|
1961
2008
|
defaults: {
|
|
1962
|
-
buildCommand: "
|
|
2009
|
+
buildCommand: "npm run build",
|
|
1963
2010
|
installCommand: "bun install",
|
|
1964
2011
|
outputDirectory: "dist",
|
|
1965
2012
|
startCommand: "node dist/index.js"
|
|
@@ -1971,7 +2018,7 @@ var init_registry = __esm({
|
|
|
1971
2018
|
family: "node",
|
|
1972
2019
|
deploymentType: "container",
|
|
1973
2020
|
defaults: {
|
|
1974
|
-
buildCommand: "
|
|
2021
|
+
buildCommand: "npm run build",
|
|
1975
2022
|
installCommand: "bun install",
|
|
1976
2023
|
outputDirectory: "dist",
|
|
1977
2024
|
startCommand: "node dist/main.js"
|
|
@@ -1983,7 +2030,7 @@ var init_registry = __esm({
|
|
|
1983
2030
|
family: "node",
|
|
1984
2031
|
deploymentType: "static",
|
|
1985
2032
|
defaults: {
|
|
1986
|
-
buildCommand: "
|
|
2033
|
+
buildCommand: "npm run build",
|
|
1987
2034
|
installCommand: "bun install",
|
|
1988
2035
|
outputDirectory: "dist"
|
|
1989
2036
|
},
|
|
@@ -2031,14 +2078,6 @@ var init_registry = __esm({
|
|
|
2031
2078
|
isServer: true
|
|
2032
2079
|
}
|
|
2033
2080
|
};
|
|
2034
|
-
}
|
|
2035
|
-
});
|
|
2036
|
-
|
|
2037
|
-
// ../shared/dist/templates/registry.js
|
|
2038
|
-
var TEMPLATES;
|
|
2039
|
-
var init_registry2 = __esm({
|
|
2040
|
-
"../shared/dist/templates/registry.js"() {
|
|
2041
|
-
"use strict";
|
|
2042
2081
|
TEMPLATES = [
|
|
2043
2082
|
{
|
|
2044
2083
|
id: "blank",
|
|
@@ -2086,84 +2125,6 @@ var init_registry2 = __esm({
|
|
|
2086
2125
|
}
|
|
2087
2126
|
});
|
|
2088
2127
|
|
|
2089
|
-
// ../shared/dist/pricing.js
|
|
2090
|
-
var TIER_HOURLY_PRICE;
|
|
2091
|
-
var init_pricing = __esm({
|
|
2092
|
-
"../shared/dist/pricing.js"() {
|
|
2093
|
-
"use strict";
|
|
2094
|
-
TIER_HOURLY_PRICE = {
|
|
2095
|
-
micro: 0,
|
|
2096
|
-
lite: 0.015,
|
|
2097
|
-
standard: 0.05,
|
|
2098
|
-
pro: 0.08,
|
|
2099
|
-
business: 0.12
|
|
2100
|
-
};
|
|
2101
|
-
}
|
|
2102
|
-
});
|
|
2103
|
-
|
|
2104
|
-
// ../shared/dist/limits.js
|
|
2105
|
-
function getLimitsBySpend(totalSpend) {
|
|
2106
|
-
if (totalSpend >= SPEND_THRESHOLDS.high)
|
|
2107
|
-
return TIER_LIMITS.high;
|
|
2108
|
-
if (totalSpend >= SPEND_THRESHOLDS.medium)
|
|
2109
|
-
return TIER_LIMITS.medium;
|
|
2110
|
-
if (totalSpend >= SPEND_THRESHOLDS.low)
|
|
2111
|
-
return TIER_LIMITS.low;
|
|
2112
|
-
return TIER_LIMITS.free;
|
|
2113
|
-
}
|
|
2114
|
-
function getTierLabel(totalSpend) {
|
|
2115
|
-
return getLimitsBySpend(totalSpend).tierLabel;
|
|
2116
|
-
}
|
|
2117
|
-
var SPEND_THRESHOLDS, TIER_LIMITS;
|
|
2118
|
-
var init_limits = __esm({
|
|
2119
|
-
"../shared/dist/limits.js"() {
|
|
2120
|
-
"use strict";
|
|
2121
|
-
SPEND_THRESHOLDS = {
|
|
2122
|
-
free: 0,
|
|
2123
|
-
low: 10,
|
|
2124
|
-
medium: 50,
|
|
2125
|
-
high: 200
|
|
2126
|
-
};
|
|
2127
|
-
TIER_LIMITS = {
|
|
2128
|
-
free: {
|
|
2129
|
-
maxProjects: 3,
|
|
2130
|
-
maxInstancesPerProject: 1,
|
|
2131
|
-
tier: "free",
|
|
2132
|
-
tierLabel: "Free Usage"
|
|
2133
|
-
},
|
|
2134
|
-
low: {
|
|
2135
|
-
maxProjects: 10,
|
|
2136
|
-
maxInstancesPerProject: 2,
|
|
2137
|
-
tier: "low",
|
|
2138
|
-
tierLabel: "Low Spend"
|
|
2139
|
-
},
|
|
2140
|
-
medium: {
|
|
2141
|
-
maxProjects: Infinity,
|
|
2142
|
-
maxInstancesPerProject: 4,
|
|
2143
|
-
tier: "medium",
|
|
2144
|
-
tierLabel: "Medium Spend"
|
|
2145
|
-
},
|
|
2146
|
-
high: {
|
|
2147
|
-
maxProjects: Infinity,
|
|
2148
|
-
maxInstancesPerProject: 10,
|
|
2149
|
-
tier: "high",
|
|
2150
|
-
tierLabel: "High Spend"
|
|
2151
|
-
}
|
|
2152
|
-
};
|
|
2153
|
-
}
|
|
2154
|
-
});
|
|
2155
|
-
|
|
2156
|
-
// ../shared/dist/index.js
|
|
2157
|
-
var init_dist = __esm({
|
|
2158
|
-
"../shared/dist/index.js"() {
|
|
2159
|
-
"use strict";
|
|
2160
|
-
init_registry();
|
|
2161
|
-
init_registry2();
|
|
2162
|
-
init_pricing();
|
|
2163
|
-
init_limits();
|
|
2164
|
-
}
|
|
2165
|
-
});
|
|
2166
|
-
|
|
2167
2128
|
// src/lib/deploy-api.ts
|
|
2168
2129
|
var deploy_api_exports = {};
|
|
2169
2130
|
__export(deploy_api_exports, {
|
|
@@ -2431,9 +2392,9 @@ var init_deploy_api = __esm({
|
|
|
2431
2392
|
"use strict";
|
|
2432
2393
|
init_api();
|
|
2433
2394
|
init_config();
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2395
|
+
init_shared();
|
|
2396
|
+
init_shared();
|
|
2397
|
+
init_shared();
|
|
2437
2398
|
INSTANCE_OPTIONS = [
|
|
2438
2399
|
{
|
|
2439
2400
|
id: "micro",
|
|
@@ -9933,7 +9894,7 @@ var Help = () => {
|
|
|
9933
9894
|
\x1B[38;2;255;191;0m
|
|
9934
9895
|
\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557
|
|
9935
9896
|
\u2551 \u25E1 \uFF2F\uFF2E\uFF26\uFF2C\uFF39\uFF34 \u2551
|
|
9936
|
-
\u2551 Deploy CLI v1.0.1-beta.
|
|
9897
|
+
\u2551 Deploy CLI v1.0.1-beta.3 \u2551
|
|
9937
9898
|
\u255A\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255D
|
|
9938
9899
|
\x1B[0m
|
|
9939
9900
|
|
|
@@ -10662,7 +10623,7 @@ var bigText = (str) => {
|
|
|
10662
10623
|
return c;
|
|
10663
10624
|
}).join("");
|
|
10664
10625
|
};
|
|
10665
|
-
var Logo = () => /* @__PURE__ */ React3.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React3.createElement(Box, { alignItems: "center" }, /* @__PURE__ */ React3.createElement(Box, { flexDirection: "column", marginRight: 0.5 }, /* @__PURE__ */ React3.createElement(Text2, { color: "rgb(255,191,0)" }, " \u2B21 ")), /* @__PURE__ */ React3.createElement(Text2, { bold: true, color: "rgb(255,191,0)" }, bigText("Onflyt")), /* @__PURE__ */ React3.createElement(Text2, null, " "), /* @__PURE__ */ React3.createElement(Text2, { bold: true, color: "black", backgroundColor: "rgb(255,191,0)" }, " ", "v1.0.1-beta.
|
|
10626
|
+
var Logo = () => /* @__PURE__ */ React3.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React3.createElement(Box, { alignItems: "center" }, /* @__PURE__ */ React3.createElement(Box, { flexDirection: "column", marginRight: 0.5 }, /* @__PURE__ */ React3.createElement(Text2, { color: "rgb(255,191,0)" }, " \u2B21 ")), /* @__PURE__ */ React3.createElement(Text2, { bold: true, color: "rgb(255,191,0)" }, bigText("Onflyt")), /* @__PURE__ */ React3.createElement(Text2, null, " "), /* @__PURE__ */ React3.createElement(Text2, { bold: true, color: "black", backgroundColor: "rgb(255,191,0)" }, " ", "v1.0.1-beta.3", " ")), /* @__PURE__ */ React3.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text2, { dimColor: true }, "\u2500".repeat(30))));
|
|
10666
10627
|
var ErrorDisplay = ({ message }) => /* @__PURE__ */ React3.createElement(Box, { flexDirection: "column" }, /* @__PURE__ */ React3.createElement(Logo, null), /* @__PURE__ */ React3.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text2, { bold: true, color: "red" }, "\u2716 Error")), /* @__PURE__ */ React3.createElement(Box, { marginTop: 1 }, /* @__PURE__ */ React3.createElement(Text2, { color: "red" }, message)));
|
|
10667
10628
|
|
|
10668
10629
|
// src/commands/login.tsx
|
|
@@ -10796,7 +10757,7 @@ init_config();
|
|
|
10796
10757
|
init_api();
|
|
10797
10758
|
import React7, { useEffect as useEffect3, useState as useState2 } from "react";
|
|
10798
10759
|
import { Text as Text6, Box as Box5, useInput } from "ink";
|
|
10799
|
-
|
|
10760
|
+
init_shared();
|
|
10800
10761
|
var ProjectsList = () => {
|
|
10801
10762
|
const [step, setStep] = useState2("loading");
|
|
10802
10763
|
const [teams, setTeams] = useState2([]);
|
|
@@ -11059,8 +11020,8 @@ var GitDetector = class {
|
|
|
11059
11020
|
};
|
|
11060
11021
|
|
|
11061
11022
|
// src/lib/framework.ts
|
|
11062
|
-
|
|
11063
|
-
|
|
11023
|
+
init_shared();
|
|
11024
|
+
init_shared();
|
|
11064
11025
|
import { existsSync as existsSync2, readFileSync as readFileSync3 } from "fs";
|
|
11065
11026
|
import { join as join2 } from "path";
|
|
11066
11027
|
var FRAMEWORK_LIST = Object.entries(FRAMEWORKS).map(
|
|
@@ -11244,7 +11205,7 @@ function initGitRepo(cwd, remoteUrl) {
|
|
|
11244
11205
|
}
|
|
11245
11206
|
|
|
11246
11207
|
// src/commands/init.tsx
|
|
11247
|
-
|
|
11208
|
+
init_shared();
|
|
11248
11209
|
var FRAMEWORK_LIST2 = Object.entries(FRAMEWORKS).map(([id, config]) => ({
|
|
11249
11210
|
id,
|
|
11250
11211
|
name: config.label
|
|
@@ -11732,7 +11693,7 @@ import React11, { useEffect as useEffect6, useState as useState5, useCallback }
|
|
|
11732
11693
|
import { Box as Box7, Text as Text8, useInput as useInput3 } from "ink";
|
|
11733
11694
|
import { readFileSync as readFileSync5, existsSync as existsSync5 } from "fs";
|
|
11734
11695
|
init_deploy_api();
|
|
11735
|
-
|
|
11696
|
+
init_shared();
|
|
11736
11697
|
init_api();
|
|
11737
11698
|
var Deploy = ({ teamFlag }) => {
|
|
11738
11699
|
const [step, setStep] = useState5("loading");
|
|
@@ -13021,14 +12982,14 @@ import { render } from "ink";
|
|
|
13021
12982
|
import React16 from "react";
|
|
13022
12983
|
import { Text as Text13, Box as Box12 } from "ink";
|
|
13023
12984
|
var App = () => {
|
|
13024
|
-
return /* @__PURE__ */ React16.createElement(Box12, { flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Text13, { bold: true }, "Onflyt CLI v1.0.1-beta.
|
|
12985
|
+
return /* @__PURE__ */ React16.createElement(Box12, { flexDirection: "column" }, /* @__PURE__ */ React16.createElement(Text13, { bold: true }, "Onflyt CLI v1.0.1-beta.3"), /* @__PURE__ */ React16.createElement(Text13, null, "Type onflyt --help for available commands"));
|
|
13025
12986
|
};
|
|
13026
12987
|
var App_default = App;
|
|
13027
12988
|
|
|
13028
12989
|
// src/index.tsx
|
|
13029
12990
|
var cli = meow(
|
|
13030
12991
|
`
|
|
13031
|
-
Onflyt CLI v1.0.1-beta.
|
|
12992
|
+
Onflyt CLI v1.0.1-beta.3
|
|
13032
12993
|
|
|
13033
12994
|
Usage
|
|
13034
12995
|
$ onflyt <command>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface ApiError {
|
|
2
|
+
success: false;
|
|
3
|
+
error: string;
|
|
4
|
+
code?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface ApiSuccess<T> {
|
|
7
|
+
success: true;
|
|
8
|
+
data: T;
|
|
9
|
+
}
|
|
10
|
+
export type ApiResponse<T> = ApiError | ApiSuccess<T>;
|
|
11
|
+
export declare class ApiClient {
|
|
12
|
+
private token;
|
|
13
|
+
constructor();
|
|
14
|
+
setToken(token: string): void;
|
|
15
|
+
private request;
|
|
16
|
+
get<T>(endpoint: string): Promise<T>;
|
|
17
|
+
post<T>(endpoint: string, body?: unknown): Promise<T>;
|
|
18
|
+
patch<T>(endpoint: string, body?: unknown): Promise<T>;
|
|
19
|
+
delete<T>(endpoint: string): Promise<T>;
|
|
20
|
+
uploadFile<T>(endpoint: string, filePath: string, filename: string, onProgress?: (uploaded: number, total: number) => void): Promise<T>;
|
|
21
|
+
}
|
|
22
|
+
export declare class ApiException extends Error {
|
|
23
|
+
status: number;
|
|
24
|
+
code?: string | undefined;
|
|
25
|
+
constructor(message: string, status: number, code?: string | undefined);
|
|
26
|
+
}
|
|
27
|
+
export declare const api: ApiClient;
|
package/dist/lib/api.js
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { API_URL, getConfig } from "./config.js";
|
|
2
|
+
export class ApiClient {
|
|
3
|
+
token;
|
|
4
|
+
constructor() {
|
|
5
|
+
const config = getConfig();
|
|
6
|
+
this.token = config.token || null;
|
|
7
|
+
}
|
|
8
|
+
setToken(token) {
|
|
9
|
+
this.token = token;
|
|
10
|
+
}
|
|
11
|
+
async request(endpoint, options = {}) {
|
|
12
|
+
const headers = {
|
|
13
|
+
"Content-Type": "application/json",
|
|
14
|
+
...(options.headers || {}),
|
|
15
|
+
};
|
|
16
|
+
if (this.token) {
|
|
17
|
+
headers["Authorization"] = `Bearer ${this.token}`;
|
|
18
|
+
}
|
|
19
|
+
const response = await fetch(`${API_URL}${endpoint}`, {
|
|
20
|
+
...options,
|
|
21
|
+
headers,
|
|
22
|
+
});
|
|
23
|
+
const text = await response.text();
|
|
24
|
+
if (!response.ok) {
|
|
25
|
+
let errorMessage = `Request failed with status ${response.status}`;
|
|
26
|
+
try {
|
|
27
|
+
const data = JSON.parse(text);
|
|
28
|
+
errorMessage = data.error || errorMessage;
|
|
29
|
+
}
|
|
30
|
+
catch { }
|
|
31
|
+
throw new ApiException(errorMessage, response.status);
|
|
32
|
+
}
|
|
33
|
+
if (!text) {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const data = JSON.parse(text);
|
|
38
|
+
if (data.success === false) {
|
|
39
|
+
throw new ApiException(data.error || "Request failed", response.status, data.code);
|
|
40
|
+
}
|
|
41
|
+
if (data.success === true) {
|
|
42
|
+
return data.data || data;
|
|
43
|
+
}
|
|
44
|
+
return data;
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return text;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async get(endpoint) {
|
|
51
|
+
return this.request(endpoint, { method: "GET" });
|
|
52
|
+
}
|
|
53
|
+
async post(endpoint, body) {
|
|
54
|
+
return this.request(endpoint, {
|
|
55
|
+
method: "POST",
|
|
56
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async patch(endpoint, body) {
|
|
60
|
+
return this.request(endpoint, {
|
|
61
|
+
method: "PATCH",
|
|
62
|
+
body: body ? JSON.stringify(body) : undefined,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
async delete(endpoint) {
|
|
66
|
+
return this.request(endpoint, { method: "DELETE" });
|
|
67
|
+
}
|
|
68
|
+
async uploadFile(endpoint, filePath, filename, onProgress) {
|
|
69
|
+
const { readFileSync } = await import("fs");
|
|
70
|
+
const fileBuffer = readFileSync(filePath);
|
|
71
|
+
const totalSize = fileBuffer.length;
|
|
72
|
+
const response = await fetch(`${API_URL}${endpoint}`, {
|
|
73
|
+
method: "POST",
|
|
74
|
+
body: fileBuffer,
|
|
75
|
+
headers: {
|
|
76
|
+
"Content-Type": "application/zip",
|
|
77
|
+
"Content-Length": String(totalSize),
|
|
78
|
+
Authorization: this.token ? `Bearer ${this.token}` : "",
|
|
79
|
+
},
|
|
80
|
+
});
|
|
81
|
+
const text = await response.text();
|
|
82
|
+
if (!response.ok) {
|
|
83
|
+
let errorMessage = `Upload failed with status ${response.status}`;
|
|
84
|
+
try {
|
|
85
|
+
const data = JSON.parse(text);
|
|
86
|
+
errorMessage = data.error || errorMessage;
|
|
87
|
+
}
|
|
88
|
+
catch { }
|
|
89
|
+
throw new ApiException(errorMessage, response.status);
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
return JSON.parse(text);
|
|
93
|
+
}
|
|
94
|
+
catch {
|
|
95
|
+
return text;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export class ApiException extends Error {
|
|
100
|
+
status;
|
|
101
|
+
code;
|
|
102
|
+
constructor(message, status, code) {
|
|
103
|
+
super(message);
|
|
104
|
+
this.status = status;
|
|
105
|
+
this.code = code;
|
|
106
|
+
this.name = "ApiException";
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
export const api = new ApiClient();
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const API_URL: string;
|
|
2
|
+
export interface Config {
|
|
3
|
+
token?: string;
|
|
4
|
+
user?: {
|
|
5
|
+
id: string;
|
|
6
|
+
email: string;
|
|
7
|
+
name: string;
|
|
8
|
+
avatar?: string;
|
|
9
|
+
};
|
|
10
|
+
defaultTeam?: string;
|
|
11
|
+
lastLogin?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function getConfig(): Config;
|
|
14
|
+
export declare function saveConfig(config: Config): void;
|
|
15
|
+
export declare function clearConfig(): void;
|
|
16
|
+
export declare function isLoggedIn(): boolean;
|
|
17
|
+
export interface ProjectConfig {
|
|
18
|
+
id?: string;
|
|
19
|
+
name: string;
|
|
20
|
+
teamId?: string;
|
|
21
|
+
framework: string;
|
|
22
|
+
buildCommand?: string;
|
|
23
|
+
outputDirectory?: string;
|
|
24
|
+
installCommand?: string;
|
|
25
|
+
startCommand?: string;
|
|
26
|
+
gitRepoUrl?: string;
|
|
27
|
+
gitBranch?: string;
|
|
28
|
+
gitRepoId?: number;
|
|
29
|
+
}
|
|
30
|
+
export declare function getProjectConfig(cwd?: string): ProjectConfig | null;
|
|
31
|
+
export declare function saveProjectConfig(config: ProjectConfig, cwd?: string): void;
|
|
32
|
+
export declare function hasProjectConfig(cwd?: string): boolean;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { homedir } from "os";
|
|
2
|
+
import { join } from "path";
|
|
3
|
+
import { readFileSync, writeFileSync, existsSync, mkdirSync } from "fs";
|
|
4
|
+
const CONFIG_DIR = join(homedir(), ".onflyt");
|
|
5
|
+
const CONFIG_FILE = join(CONFIG_DIR, "config.json");
|
|
6
|
+
const PROJECT_CONFIG_FILE = "onflyt.json";
|
|
7
|
+
export const API_URL = process.env.ONFLYT_API_URL || "";
|
|
8
|
+
export function getConfig() {
|
|
9
|
+
try {
|
|
10
|
+
if (existsSync(CONFIG_FILE)) {
|
|
11
|
+
return JSON.parse(readFileSync(CONFIG_FILE, "utf-8"));
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
// Return empty config if file doesn't exist or is invalid
|
|
16
|
+
}
|
|
17
|
+
return {};
|
|
18
|
+
}
|
|
19
|
+
export function saveConfig(config) {
|
|
20
|
+
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
21
|
+
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
22
|
+
}
|
|
23
|
+
export function clearConfig() {
|
|
24
|
+
if (existsSync(CONFIG_FILE)) {
|
|
25
|
+
const config = getConfig();
|
|
26
|
+
saveConfig({});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export function isLoggedIn() {
|
|
30
|
+
const config = getConfig();
|
|
31
|
+
return !!config.token;
|
|
32
|
+
}
|
|
33
|
+
export function getProjectConfig(cwd = process.cwd()) {
|
|
34
|
+
try {
|
|
35
|
+
const configPath = join(cwd, PROJECT_CONFIG_FILE);
|
|
36
|
+
if (existsSync(configPath)) {
|
|
37
|
+
return JSON.parse(readFileSync(configPath, "utf-8"));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
// Return null if file doesn't exist or is invalid
|
|
42
|
+
}
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
export function saveProjectConfig(config, cwd = process.cwd()) {
|
|
46
|
+
const configPath = join(cwd, PROJECT_CONFIG_FILE);
|
|
47
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
48
|
+
}
|
|
49
|
+
export function hasProjectConfig(cwd = process.cwd()) {
|
|
50
|
+
const configPath = join(cwd, PROJECT_CONFIG_FILE);
|
|
51
|
+
return existsSync(configPath);
|
|
52
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { PodTier } from "./shared";
|
|
2
|
+
import { TeamLimits } from "./shared";
|
|
3
|
+
export interface Team {
|
|
4
|
+
teamId: string;
|
|
5
|
+
role: string;
|
|
6
|
+
team: {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
slug: string;
|
|
10
|
+
plan: string;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface Balance {
|
|
14
|
+
balanceUSD: number;
|
|
15
|
+
balanceFormatted: string;
|
|
16
|
+
}
|
|
17
|
+
export interface ProjectConfig {
|
|
18
|
+
name: string;
|
|
19
|
+
framework?: string;
|
|
20
|
+
buildCommand?: string;
|
|
21
|
+
outputDirectory?: string;
|
|
22
|
+
installCommand?: string;
|
|
23
|
+
startCommand?: string;
|
|
24
|
+
gitRepoUrl?: string;
|
|
25
|
+
gitBranch?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface InstanceOption {
|
|
28
|
+
id: PodTier;
|
|
29
|
+
label: string;
|
|
30
|
+
cpu: string;
|
|
31
|
+
ram: string;
|
|
32
|
+
disk: string;
|
|
33
|
+
maxReplicas: number;
|
|
34
|
+
hourly: string;
|
|
35
|
+
}
|
|
36
|
+
export declare const INSTANCE_OPTIONS: InstanceOption[];
|
|
37
|
+
export declare function isPodProject(framework?: string): boolean;
|
|
38
|
+
export declare function getDeploymentType(framework?: string): "static" | "container";
|
|
39
|
+
export declare function getProjectConfig(): ProjectConfig | null;
|
|
40
|
+
export declare function loadTeamsWithBalances(): Promise<{
|
|
41
|
+
teams: Team[];
|
|
42
|
+
balances: Record<string, Balance>;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function getTeamDetails(teamId: string): Promise<{
|
|
45
|
+
totalLifetimeSpend: number;
|
|
46
|
+
balanceUSD: number;
|
|
47
|
+
}>;
|
|
48
|
+
export declare function getTeamLimits(totalSpend: number): TeamLimits;
|
|
49
|
+
export declare function getTeamPlanLabel(totalSpend: number): string;
|
|
50
|
+
export declare function findOrCreateProject(teamId: string, projectName: string, framework?: string, gitUrl?: string, instanceSize?: PodTier, maxInstances?: number): Promise<{
|
|
51
|
+
id: string;
|
|
52
|
+
name: string;
|
|
53
|
+
isNew: boolean;
|
|
54
|
+
existingProject?: any;
|
|
55
|
+
}>;
|
|
56
|
+
export declare function updateProjectSettings(projectId: string, instanceSize?: PodTier, maxInstances?: number): Promise<void>;
|
|
57
|
+
export declare function getProjectDetails(projectId: string): Promise<any>;
|
|
58
|
+
export declare function startDeployment(projectId: string, branch?: string, instanceSize?: PodTier, replicas?: number, envVars?: Array<{
|
|
59
|
+
key: string;
|
|
60
|
+
value: string;
|
|
61
|
+
}>): Promise<string>;
|
|
62
|
+
export type DeploymentStatus = "queued" | "building" | "provisioning" | "deployed" | "failed";
|
|
63
|
+
export interface DeploymentDetails {
|
|
64
|
+
status: DeploymentStatus;
|
|
65
|
+
url?: string;
|
|
66
|
+
previewUrl?: string;
|
|
67
|
+
}
|
|
68
|
+
export declare function getDeploymentStatus(deploymentId: string): Promise<DeploymentDetails>;
|
|
69
|
+
export declare function streamLogs(deploymentId: string, onLog: (log: string) => void, onError: () => void): () => void;
|
|
70
|
+
export interface StoredLog {
|
|
71
|
+
timestamp: number;
|
|
72
|
+
level: "error" | "warn" | "info" | "debug";
|
|
73
|
+
message: string;
|
|
74
|
+
source?: "build" | "runtime";
|
|
75
|
+
replicaIndex?: number;
|
|
76
|
+
}
|
|
77
|
+
export interface StoredLogsResult {
|
|
78
|
+
logs: StoredLog[];
|
|
79
|
+
total: number;
|
|
80
|
+
hasMore: boolean;
|
|
81
|
+
}
|
|
82
|
+
export declare function getStoredLogs(deploymentId: string, options?: {
|
|
83
|
+
source?: "build" | "runtime";
|
|
84
|
+
replicaIndex?: number;
|
|
85
|
+
limit?: number;
|
|
86
|
+
offset?: number;
|
|
87
|
+
search?: string;
|
|
88
|
+
}): Promise<StoredLogsResult>;
|
|
89
|
+
export declare function createProjectZip(sourceDir: string, outputPath: string, excludePatterns?: string[]): Promise<string>;
|
|
90
|
+
export declare function deployManual(projectId: string, zipPath: string, framework?: string, instanceSize?: PodTier, replicas?: number, envVars?: Array<{
|
|
91
|
+
key: string;
|
|
92
|
+
value: string;
|
|
93
|
+
}>, onUploadProgress?: (uploaded: number, total: number) => void, buildSettings?: {
|
|
94
|
+
buildCommand?: string;
|
|
95
|
+
outputDirectory?: string;
|
|
96
|
+
installCommand?: string;
|
|
97
|
+
}): Promise<string>;
|