onflyt-cli 1.0.1-beta.1 → 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 +107 -442
- 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/onflyt.json +10 -0
- package/package.json +5 -7
- package/src/App.tsx +13 -0
- package/src/commands/credits.tsx +151 -0
- package/src/commands/delete.tsx +315 -0
- package/src/commands/deploy.tsx +1039 -0
- package/src/commands/deployments.tsx +331 -0
- package/src/commands/help.tsx +79 -0
- package/src/commands/init.tsx +587 -0
- package/src/commands/login.tsx +207 -0
- package/src/commands/logout.tsx +31 -0
- package/src/commands/logs.tsx +447 -0
- package/src/commands/projects.tsx +287 -0
- package/src/commands/rollback.tsx +455 -0
- package/src/commands/teams.tsx +113 -0
- package/src/commands/whoami.tsx +48 -0
- package/src/components/Loading.tsx +74 -0
- package/src/index.tsx +130 -0
- package/src/lib/api.ts +152 -0
- package/src/lib/config.ts +90 -0
- package/src/lib/deploy-api.ts +511 -0
- package/src/lib/deploy.ts +260 -0
- package/src/lib/framework.ts +227 -0
- package/src/lib/git.ts +179 -0
- package/src/lib/scaffold.ts +225 -0
- package/src/lib/shared.ts +350 -0
- package/src/types.d.ts +5 -0
- package/tsconfig.json +17 -0
- package/README.md +0 -338
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
import { existsSync, mkdirSync, cpSync, rmSync, } from "fs";
|
|
3
|
+
import { join } from "path";
|
|
4
|
+
export class Scaffold {
|
|
5
|
+
cwd;
|
|
6
|
+
onProgress;
|
|
7
|
+
tempDir;
|
|
8
|
+
constructor(cwd, onProgress) {
|
|
9
|
+
this.cwd = cwd;
|
|
10
|
+
this.onProgress = onProgress;
|
|
11
|
+
this.tempDir = join("/tmp", `onflyt-scaffold-${Date.now()}`);
|
|
12
|
+
}
|
|
13
|
+
report(progress) {
|
|
14
|
+
if (this.onProgress) {
|
|
15
|
+
this.onProgress(progress);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
async cloneTemplate(repoUrl, branch = "main") {
|
|
19
|
+
this.report({
|
|
20
|
+
stage: "cloning",
|
|
21
|
+
message: "Cloning template...",
|
|
22
|
+
progress: 0,
|
|
23
|
+
});
|
|
24
|
+
try {
|
|
25
|
+
mkdirSync(this.tempDir, { recursive: true });
|
|
26
|
+
const gitUrl = repoUrl.endsWith(".git") ? repoUrl : `${repoUrl}.git`;
|
|
27
|
+
execSync(`git clone --depth 1 --branch ${branch} ${gitUrl} "${this.tempDir}"`, { stdio: "pipe" });
|
|
28
|
+
this.report({
|
|
29
|
+
stage: "cloning",
|
|
30
|
+
message: "Template cloned",
|
|
31
|
+
progress: 100,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
this.cleanup();
|
|
36
|
+
throw new Error(`Failed to clone template: ${error.message}`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
async installDependencies(packageManager) {
|
|
40
|
+
if (!packageManager || packageManager === "none") {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
this.report({
|
|
44
|
+
stage: "installing",
|
|
45
|
+
message: `Installing dependencies with ${packageManager}...`,
|
|
46
|
+
progress: 0,
|
|
47
|
+
});
|
|
48
|
+
try {
|
|
49
|
+
let installCmd = "";
|
|
50
|
+
switch (packageManager) {
|
|
51
|
+
case "npm":
|
|
52
|
+
installCmd = "npm install";
|
|
53
|
+
break;
|
|
54
|
+
case "yarn":
|
|
55
|
+
installCmd = "yarn install";
|
|
56
|
+
break;
|
|
57
|
+
case "pnpm":
|
|
58
|
+
installCmd = "pnpm install";
|
|
59
|
+
break;
|
|
60
|
+
case "pip":
|
|
61
|
+
installCmd = "pip install -r requirements.txt";
|
|
62
|
+
break;
|
|
63
|
+
case "poetry":
|
|
64
|
+
installCmd = "poetry install";
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
execSync(installCmd, {
|
|
70
|
+
cwd: this.tempDir,
|
|
71
|
+
stdio: "inherit",
|
|
72
|
+
});
|
|
73
|
+
this.report({
|
|
74
|
+
stage: "installing",
|
|
75
|
+
message: "Dependencies installed",
|
|
76
|
+
progress: 100,
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
catch (error) {
|
|
80
|
+
console.error(`Warning: Failed to install dependencies: ${error.message}`);
|
|
81
|
+
console.error("You may need to run the install command manually.");
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
async moveFilesToProject() {
|
|
85
|
+
this.report({
|
|
86
|
+
stage: "cleaning",
|
|
87
|
+
message: "Preparing project files...",
|
|
88
|
+
progress: 50,
|
|
89
|
+
});
|
|
90
|
+
try {
|
|
91
|
+
const items = [
|
|
92
|
+
"package.json",
|
|
93
|
+
"requirements.txt",
|
|
94
|
+
"src",
|
|
95
|
+
"app",
|
|
96
|
+
"lib",
|
|
97
|
+
"components",
|
|
98
|
+
"pages",
|
|
99
|
+
"routes",
|
|
100
|
+
"api",
|
|
101
|
+
"main.py",
|
|
102
|
+
"index.js",
|
|
103
|
+
"server.js",
|
|
104
|
+
"app.js",
|
|
105
|
+
"main.go",
|
|
106
|
+
"Cargo.toml",
|
|
107
|
+
"go.mod",
|
|
108
|
+
"README.md",
|
|
109
|
+
"next.config.js",
|
|
110
|
+
"next.config.mjs",
|
|
111
|
+
"vite.config.ts",
|
|
112
|
+
"vite.config.js",
|
|
113
|
+
"nuxt.config.ts",
|
|
114
|
+
"pyproject.toml",
|
|
115
|
+
];
|
|
116
|
+
for (const item of items) {
|
|
117
|
+
const srcPath = join(this.tempDir, item);
|
|
118
|
+
const destPath = join(this.cwd, item);
|
|
119
|
+
if (existsSync(srcPath) && !existsSync(destPath)) {
|
|
120
|
+
cpSync(srcPath, destPath, { recursive: true });
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
this.report({ stage: "cleaning", message: "Files copied", progress: 90 });
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
console.error(`Warning: Failed to copy some files: ${error.message}`);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
cleanup() {
|
|
130
|
+
try {
|
|
131
|
+
if (existsSync(this.tempDir)) {
|
|
132
|
+
rmSync(this.tempDir, { recursive: true, force: true });
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
// Ignore cleanup errors
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async scaffold(repoUrl, packageManager) {
|
|
140
|
+
try {
|
|
141
|
+
await this.cloneTemplate(repoUrl);
|
|
142
|
+
await this.installDependencies(packageManager);
|
|
143
|
+
await this.moveFilesToProject();
|
|
144
|
+
this.cleanup();
|
|
145
|
+
this.report({
|
|
146
|
+
stage: "done",
|
|
147
|
+
message: "Project scaffolded",
|
|
148
|
+
progress: 100,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
catch (error) {
|
|
152
|
+
this.cleanup();
|
|
153
|
+
throw error;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
export function isGitInstalled() {
|
|
158
|
+
try {
|
|
159
|
+
execSync("git --version", { stdio: "ignore" });
|
|
160
|
+
return true;
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
return false;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
export function isNodeInstalled() {
|
|
167
|
+
try {
|
|
168
|
+
execSync("node --version", { stdio: "ignore" });
|
|
169
|
+
return true;
|
|
170
|
+
}
|
|
171
|
+
catch {
|
|
172
|
+
return false;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
export function initGitRepo(cwd, remoteUrl) {
|
|
176
|
+
try {
|
|
177
|
+
execSync("git init", { cwd, stdio: "pipe" });
|
|
178
|
+
if (remoteUrl) {
|
|
179
|
+
execSync(`git remote add origin ${remoteUrl}`, { cwd, stdio: "pipe" });
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
catch (error) {
|
|
183
|
+
throw new Error(`Failed to init git: ${error.message}`);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
export function generateProjectId() {
|
|
187
|
+
const timestamp = Date.now().toString(36);
|
|
188
|
+
const random = Math.random().toString(36).substring(2, 8);
|
|
189
|
+
return `${timestamp}-${random}`;
|
|
190
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type FrameworkFamily = "node" | "nixpacks";
|
|
2
|
+
export type DeploymentType = "static" | "container";
|
|
3
|
+
export interface FrameworkDefaults {
|
|
4
|
+
buildCommand?: string;
|
|
5
|
+
installCommand?: string;
|
|
6
|
+
outputDirectory?: string;
|
|
7
|
+
startCommand?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface FrameworkConfig {
|
|
10
|
+
label: string;
|
|
11
|
+
family: FrameworkFamily;
|
|
12
|
+
deploymentType: DeploymentType;
|
|
13
|
+
defaults: FrameworkDefaults;
|
|
14
|
+
isServer: boolean;
|
|
15
|
+
}
|
|
16
|
+
export declare const FRAMEWORKS: Record<string, FrameworkConfig>;
|
|
17
|
+
export declare function getFramework(id: string): FrameworkConfig | undefined;
|
|
18
|
+
export declare function getDefaultBuildCommand(frameworkId: string): string | undefined;
|
|
19
|
+
export declare function getDefaultOutputDirectory(frameworkId: string): string | undefined;
|
|
20
|
+
export declare function getDefaultStartCommand(frameworkId: string): string | undefined;
|
|
21
|
+
export declare function getInstallCommand(frameworkId: string, packageManager: string): string;
|
|
@@ -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/onflyt.json
ADDED
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,10 +13,10 @@
|
|
|
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
|
+
"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",
|
|
17
18
|
"start": "node dist/index.js",
|
|
18
|
-
"pack": "npm pack --pack-destination dist"
|
|
19
|
-
"publish": "npm publish --access public --tag beta"
|
|
19
|
+
"pack": "npm pack --pack-destination dist"
|
|
20
20
|
},
|
|
21
21
|
"keywords": [
|
|
22
22
|
"cli",
|
|
@@ -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",
|
|
@@ -59,6 +58,5 @@
|
|
|
59
58
|
},
|
|
60
59
|
"engines": {
|
|
61
60
|
"node": ">=18.0.0"
|
|
62
|
-
}
|
|
63
|
-
"packageManager": "pnpm@10.33.0"
|
|
61
|
+
}
|
|
64
62
|
}
|
package/src/App.tsx
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Text, Box } from "ink";
|
|
3
|
+
|
|
4
|
+
const App = () => {
|
|
5
|
+
return (
|
|
6
|
+
<Box flexDirection="column">
|
|
7
|
+
<Text bold>Onflyt CLI v1.0.1-beta.3</Text>
|
|
8
|
+
<Text>Type onflyt --help for available commands</Text>
|
|
9
|
+
</Box>
|
|
10
|
+
);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default App;
|