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
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
export const FRAMEWORKS = {
|
|
2
|
+
nextjs: {
|
|
3
|
+
label: "Next.js",
|
|
4
|
+
family: "node",
|
|
5
|
+
deploymentType: "container",
|
|
6
|
+
defaults: {
|
|
7
|
+
buildCommand: "next build",
|
|
8
|
+
installCommand: "bun install",
|
|
9
|
+
outputDirectory: ".next",
|
|
10
|
+
},
|
|
11
|
+
isServer: true,
|
|
12
|
+
},
|
|
13
|
+
remix: {
|
|
14
|
+
label: "Remix",
|
|
15
|
+
family: "node",
|
|
16
|
+
deploymentType: "container",
|
|
17
|
+
defaults: {
|
|
18
|
+
buildCommand: "bun run build",
|
|
19
|
+
installCommand: "bun install",
|
|
20
|
+
outputDirectory: "build",
|
|
21
|
+
},
|
|
22
|
+
isServer: true,
|
|
23
|
+
},
|
|
24
|
+
react: {
|
|
25
|
+
label: "React",
|
|
26
|
+
family: "node",
|
|
27
|
+
deploymentType: "static",
|
|
28
|
+
defaults: {
|
|
29
|
+
buildCommand: "bun run build",
|
|
30
|
+
installCommand: "bun install",
|
|
31
|
+
outputDirectory: "build",
|
|
32
|
+
},
|
|
33
|
+
isServer: false,
|
|
34
|
+
},
|
|
35
|
+
vite: {
|
|
36
|
+
label: "Vite",
|
|
37
|
+
family: "node",
|
|
38
|
+
deploymentType: "static",
|
|
39
|
+
defaults: {
|
|
40
|
+
buildCommand: "bun run build",
|
|
41
|
+
installCommand: "bun install",
|
|
42
|
+
outputDirectory: "dist",
|
|
43
|
+
},
|
|
44
|
+
isServer: false,
|
|
45
|
+
},
|
|
46
|
+
nuxt: {
|
|
47
|
+
label: "Nuxt",
|
|
48
|
+
family: "node",
|
|
49
|
+
deploymentType: "container",
|
|
50
|
+
defaults: {
|
|
51
|
+
buildCommand: "bun run build",
|
|
52
|
+
installCommand: "bun install",
|
|
53
|
+
outputDirectory: ".output",
|
|
54
|
+
},
|
|
55
|
+
isServer: true,
|
|
56
|
+
},
|
|
57
|
+
svelte: {
|
|
58
|
+
label: "Svelte",
|
|
59
|
+
family: "node",
|
|
60
|
+
deploymentType: "static",
|
|
61
|
+
defaults: {
|
|
62
|
+
buildCommand: "bun run build",
|
|
63
|
+
installCommand: "bun install",
|
|
64
|
+
outputDirectory: "build",
|
|
65
|
+
},
|
|
66
|
+
isServer: false,
|
|
67
|
+
},
|
|
68
|
+
node: {
|
|
69
|
+
label: "Node.js",
|
|
70
|
+
family: "node",
|
|
71
|
+
deploymentType: "container",
|
|
72
|
+
defaults: {
|
|
73
|
+
buildCommand: "bun run build",
|
|
74
|
+
installCommand: "bun install",
|
|
75
|
+
outputDirectory: "dist",
|
|
76
|
+
startCommand: "node dist/index.js",
|
|
77
|
+
},
|
|
78
|
+
isServer: true,
|
|
79
|
+
},
|
|
80
|
+
express: {
|
|
81
|
+
label: "Express",
|
|
82
|
+
family: "node",
|
|
83
|
+
deploymentType: "container",
|
|
84
|
+
defaults: {
|
|
85
|
+
buildCommand: "bun run build",
|
|
86
|
+
installCommand: "bun install",
|
|
87
|
+
outputDirectory: "dist",
|
|
88
|
+
startCommand: "node dist/index.js",
|
|
89
|
+
},
|
|
90
|
+
isServer: true,
|
|
91
|
+
},
|
|
92
|
+
hono: {
|
|
93
|
+
label: "Hono",
|
|
94
|
+
family: "node",
|
|
95
|
+
deploymentType: "container",
|
|
96
|
+
defaults: {
|
|
97
|
+
buildCommand: "bun run build",
|
|
98
|
+
installCommand: "bun install",
|
|
99
|
+
outputDirectory: "dist",
|
|
100
|
+
startCommand: "node dist/index.js",
|
|
101
|
+
},
|
|
102
|
+
isServer: true,
|
|
103
|
+
},
|
|
104
|
+
nestjs: {
|
|
105
|
+
label: "NestJS",
|
|
106
|
+
family: "node",
|
|
107
|
+
deploymentType: "container",
|
|
108
|
+
defaults: {
|
|
109
|
+
buildCommand: "bun run build",
|
|
110
|
+
installCommand: "bun install",
|
|
111
|
+
outputDirectory: "dist",
|
|
112
|
+
startCommand: "node dist/main.js",
|
|
113
|
+
},
|
|
114
|
+
isServer: true,
|
|
115
|
+
},
|
|
116
|
+
astro: {
|
|
117
|
+
label: "Astro",
|
|
118
|
+
family: "node",
|
|
119
|
+
deploymentType: "static",
|
|
120
|
+
defaults: {
|
|
121
|
+
buildCommand: "bun run build",
|
|
122
|
+
installCommand: "bun install",
|
|
123
|
+
outputDirectory: "dist",
|
|
124
|
+
},
|
|
125
|
+
isServer: false,
|
|
126
|
+
},
|
|
127
|
+
static: {
|
|
128
|
+
label: "Static Site",
|
|
129
|
+
family: "node",
|
|
130
|
+
deploymentType: "static",
|
|
131
|
+
defaults: {
|
|
132
|
+
buildCommand: "",
|
|
133
|
+
installCommand: "",
|
|
134
|
+
outputDirectory: ".",
|
|
135
|
+
},
|
|
136
|
+
isServer: false,
|
|
137
|
+
},
|
|
138
|
+
fastapi: {
|
|
139
|
+
label: "FastAPI",
|
|
140
|
+
family: "nixpacks",
|
|
141
|
+
deploymentType: "container",
|
|
142
|
+
defaults: {
|
|
143
|
+
buildCommand: "uv pip install --python 3.11 -r requirements.txt",
|
|
144
|
+
startCommand: "uvicorn main:app --host 0.0.0.0 --port 8080",
|
|
145
|
+
},
|
|
146
|
+
isServer: true,
|
|
147
|
+
},
|
|
148
|
+
flask: {
|
|
149
|
+
label: "Flask",
|
|
150
|
+
family: "nixpacks",
|
|
151
|
+
deploymentType: "container",
|
|
152
|
+
defaults: {
|
|
153
|
+
buildCommand: "uv pip install --python 3.11 -r requirements.txt",
|
|
154
|
+
startCommand: "flask run --host 0.0.0.0 --port 8080",
|
|
155
|
+
},
|
|
156
|
+
isServer: true,
|
|
157
|
+
},
|
|
158
|
+
django: {
|
|
159
|
+
label: "Django",
|
|
160
|
+
family: "nixpacks",
|
|
161
|
+
deploymentType: "container",
|
|
162
|
+
defaults: {
|
|
163
|
+
buildCommand: "uv pip install --python 3.11 -r requirements.txt",
|
|
164
|
+
startCommand: "python3 manage.py runserver 0.0.0.0:8080",
|
|
165
|
+
},
|
|
166
|
+
isServer: true,
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
export function getFramework(id) {
|
|
170
|
+
return FRAMEWORKS[id.toLowerCase()];
|
|
171
|
+
}
|
|
172
|
+
export function getDefaultBuildCommand(frameworkId) {
|
|
173
|
+
return FRAMEWORKS[frameworkId.toLowerCase()]?.defaults.buildCommand;
|
|
174
|
+
}
|
|
175
|
+
export function getDefaultOutputDirectory(frameworkId) {
|
|
176
|
+
return FRAMEWORKS[frameworkId.toLowerCase()]?.defaults.outputDirectory;
|
|
177
|
+
}
|
|
178
|
+
export function getDefaultStartCommand(frameworkId) {
|
|
179
|
+
return FRAMEWORKS[frameworkId.toLowerCase()]?.defaults.startCommand;
|
|
180
|
+
}
|
|
181
|
+
export function getInstallCommand(frameworkId, packageManager) {
|
|
182
|
+
const pm = packageManager.toLowerCase();
|
|
183
|
+
const framework = FRAMEWORKS[frameworkId.toLowerCase()];
|
|
184
|
+
if (pm === "pip" || pm === "poetry") {
|
|
185
|
+
if (pm === "poetry")
|
|
186
|
+
return "poetry install";
|
|
187
|
+
return (framework?.defaults.installCommand || "pip install -r requirements.txt");
|
|
188
|
+
}
|
|
189
|
+
const installCommands = {
|
|
190
|
+
bun: "bun install",
|
|
191
|
+
npm: "npm install",
|
|
192
|
+
yarn: "yarn install",
|
|
193
|
+
pbun: "pbun install",
|
|
194
|
+
};
|
|
195
|
+
return installCommands[pm] || `${pm} install`;
|
|
196
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export type SpendTier = "free" | "low" | "medium" | "high";
|
|
2
|
+
export interface TeamLimits {
|
|
3
|
+
maxProjects: number;
|
|
4
|
+
maxInstancesPerProject: number;
|
|
5
|
+
tier: SpendTier;
|
|
6
|
+
tierLabel: string;
|
|
7
|
+
}
|
|
8
|
+
export declare const SPEND_THRESHOLDS: {
|
|
9
|
+
readonly free: 0;
|
|
10
|
+
readonly low: 10;
|
|
11
|
+
readonly medium: 50;
|
|
12
|
+
readonly high: 200;
|
|
13
|
+
};
|
|
14
|
+
export declare const TIER_LIMITS: Record<SpendTier, TeamLimits>;
|
|
15
|
+
export declare function getLimitsBySpend(totalSpend: number): TeamLimits;
|
|
16
|
+
export declare function getTierLabel(totalSpend: number): string;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
export const SPEND_THRESHOLDS = {
|
|
2
|
+
free: 0,
|
|
3
|
+
low: 10,
|
|
4
|
+
medium: 50,
|
|
5
|
+
high: 200,
|
|
6
|
+
};
|
|
7
|
+
export const TIER_LIMITS = {
|
|
8
|
+
free: {
|
|
9
|
+
maxProjects: 3,
|
|
10
|
+
maxInstancesPerProject: 1,
|
|
11
|
+
tier: "free",
|
|
12
|
+
tierLabel: "Free Usage",
|
|
13
|
+
},
|
|
14
|
+
low: {
|
|
15
|
+
maxProjects: 10,
|
|
16
|
+
maxInstancesPerProject: 2,
|
|
17
|
+
tier: "low",
|
|
18
|
+
tierLabel: "Low Spend",
|
|
19
|
+
},
|
|
20
|
+
medium: {
|
|
21
|
+
maxProjects: Infinity,
|
|
22
|
+
maxInstancesPerProject: 4,
|
|
23
|
+
tier: "medium",
|
|
24
|
+
tierLabel: "Medium Spend",
|
|
25
|
+
},
|
|
26
|
+
high: {
|
|
27
|
+
maxProjects: Infinity,
|
|
28
|
+
maxInstancesPerProject: 10,
|
|
29
|
+
tier: "high",
|
|
30
|
+
tierLabel: "High Spend",
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
export function getLimitsBySpend(totalSpend) {
|
|
34
|
+
if (totalSpend >= SPEND_THRESHOLDS.high)
|
|
35
|
+
return TIER_LIMITS.high;
|
|
36
|
+
if (totalSpend >= SPEND_THRESHOLDS.medium)
|
|
37
|
+
return TIER_LIMITS.medium;
|
|
38
|
+
if (totalSpend >= SPEND_THRESHOLDS.low)
|
|
39
|
+
return TIER_LIMITS.low;
|
|
40
|
+
return TIER_LIMITS.free;
|
|
41
|
+
}
|
|
42
|
+
export function getTierLabel(totalSpend) {
|
|
43
|
+
return getLimitsBySpend(totalSpend).tierLabel;
|
|
44
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
export const TEMPLATES = [
|
|
2
|
+
{
|
|
3
|
+
id: "blank",
|
|
4
|
+
name: "Blank",
|
|
5
|
+
description: "Minimal project setup",
|
|
6
|
+
repoUrl: "https://github.com/onflyt/blank",
|
|
7
|
+
framework: "static",
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
id: "nextjs",
|
|
11
|
+
name: "Next.js Starter",
|
|
12
|
+
description: "Next.js with App Router",
|
|
13
|
+
repoUrl: "https://github.com/onflyt/nextjs-starter",
|
|
14
|
+
framework: "nextjs",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "react-vite",
|
|
18
|
+
name: "React + Vite",
|
|
19
|
+
description: "React with Vite bundler",
|
|
20
|
+
repoUrl: "https://github.com/onflyt/react-vite",
|
|
21
|
+
framework: "react",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: "node-api",
|
|
25
|
+
name: "Node.js API",
|
|
26
|
+
description: "Express/Fastify REST API",
|
|
27
|
+
repoUrl: "https://github.com/onflyt/node-api",
|
|
28
|
+
framework: "node",
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
id: "fastapi",
|
|
32
|
+
name: "FastAPI",
|
|
33
|
+
description: "Python FastAPI backend",
|
|
34
|
+
repoUrl: "https://github.com/onflyt/fastapi-starter",
|
|
35
|
+
framework: "fastapi",
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
id: "ai-agent",
|
|
39
|
+
name: "AI Agent",
|
|
40
|
+
description: "AI Agent starter with OpenAI",
|
|
41
|
+
repoUrl: "https://github.com/onflyt/ai-agent",
|
|
42
|
+
framework: "python",
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
export function getTemplate(id) {
|
|
46
|
+
return TEMPLATES.find((t) => t.id === id);
|
|
47
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "onflyt-cli",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Onflyt CLI - Deploy Node.js and Python APIs to serverless pods. Pay only per use.",
|
|
6
6
|
"repository": {
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
},
|
|
14
14
|
"scripts": {
|
|
15
15
|
"dev": "tsx src/index.tsx",
|
|
16
|
-
"build": "
|
|
16
|
+
"build": "esbuild src/index.tsx --bundle --platform=node --outfile=dist/index.js --format=esm --external:react-devtools-core --external:ink --external:react --external:react-dom --external:figlet",
|
|
17
17
|
"build:prod": "pnpm -r --filter=@miiglu/shared build && esbuild src/index.tsx --bundle --platform=node --outfile=dist/index.js --format=esm --external:react-devtools-core --external:ink --external:react --external:react-dom --external:figlet",
|
|
18
18
|
"start": "node dist/index.js",
|
|
19
19
|
"pack": "npm pack --pack-destination dist"
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
"author": "Miiglu",
|
|
38
38
|
"license": "MIT",
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@miiglu/shared": "workspace:*",
|
|
41
40
|
"@octokit/oauth-methods": "^6.0.2",
|
|
42
41
|
"archiver": "^7.0.1",
|
|
43
42
|
"figlet": "^1.11.0",
|
package/src/App.tsx
CHANGED
package/src/commands/deploy.tsx
CHANGED
package/src/commands/help.tsx
CHANGED
package/src/commands/init.tsx
CHANGED
|
@@ -4,7 +4,7 @@ import { isLoggedIn, getConfig } from "../lib/config.js";
|
|
|
4
4
|
import { api } from "../lib/api.js";
|
|
5
5
|
import { Logo } from "../components/Loading.js";
|
|
6
6
|
import Spinner from "ink-spinner";
|
|
7
|
-
import { FRAMEWORKS } from "
|
|
7
|
+
import { FRAMEWORKS } from "../lib/shared";
|
|
8
8
|
|
|
9
9
|
type Step =
|
|
10
10
|
| "loading"
|
package/src/index.tsx
CHANGED
package/src/lib/deploy-api.ts
CHANGED
|
@@ -11,8 +11,8 @@ import {
|
|
|
11
11
|
} from "fs";
|
|
12
12
|
import { join, relative, basename } from "path";
|
|
13
13
|
import { execSync } from "child_process";
|
|
14
|
-
import { TIER_HOURLY_PRICE, PodTier } from "
|
|
15
|
-
import { getLimitsBySpend, TeamLimits, getTierLabel } from "
|
|
14
|
+
import { TIER_HOURLY_PRICE, PodTier } from "./shared";
|
|
15
|
+
import { getLimitsBySpend, TeamLimits, getTierLabel } from "./shared";
|
|
16
16
|
|
|
17
17
|
export interface Team {
|
|
18
18
|
teamId: string;
|
|
@@ -104,7 +104,7 @@ function formatPrice(price: number): string {
|
|
|
104
104
|
return `$${price.toFixed(3)}/hr`;
|
|
105
105
|
}
|
|
106
106
|
|
|
107
|
-
import { FRAMEWORKS, FrameworkConfig } from "
|
|
107
|
+
import { FRAMEWORKS, FrameworkConfig } from "./shared";
|
|
108
108
|
|
|
109
109
|
export function isPodProject(framework?: string): boolean {
|
|
110
110
|
if (!framework) return false;
|
package/src/lib/framework.ts
CHANGED
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
getFramework,
|
|
6
6
|
getDefaultOutputDirectory,
|
|
7
7
|
FrameworkConfig,
|
|
8
|
-
} from "
|
|
8
|
+
} from "./shared";
|
|
9
9
|
|
|
10
10
|
export interface Framework {
|
|
11
11
|
id: string;
|
|
@@ -224,4 +224,4 @@ export class FrameworkDetector {
|
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
|
|
227
|
-
export { getFramework } from "
|
|
227
|
+
export { getFramework } from "./shared";
|