@barn.dev/cli 0.0.1-next.20260215045621.1330de7 → 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +107 -45
- package/package.json +15 -15
- package/LICENSE +0 -190
package/dist/index.mjs
CHANGED
|
@@ -4048,6 +4048,7 @@ const DeployStatusEnum = _enum([
|
|
|
4048
4048
|
const DeploymentSchema = object({
|
|
4049
4049
|
id: string().uuid(),
|
|
4050
4050
|
appId: string().uuid(),
|
|
4051
|
+
environmentId: string().uuid(),
|
|
4051
4052
|
flyAppName: string(),
|
|
4052
4053
|
image: string().nullable(),
|
|
4053
4054
|
internalPort: number().int(),
|
|
@@ -4061,6 +4062,15 @@ const DeployLogSchema = object({
|
|
|
4061
4062
|
message: string(),
|
|
4062
4063
|
createdAt: date()
|
|
4063
4064
|
});
|
|
4065
|
+
const EnvironmentSchema = object({
|
|
4066
|
+
id: string().uuid(),
|
|
4067
|
+
orgId: string().uuid(),
|
|
4068
|
+
name: string(),
|
|
4069
|
+
slug: string(),
|
|
4070
|
+
position: number().int(),
|
|
4071
|
+
isDev: boolean(),
|
|
4072
|
+
createdAt: date()
|
|
4073
|
+
});
|
|
4064
4074
|
/** Create or update an app in the current org */
|
|
4065
4075
|
const upsertAppContract = oc.input(object({
|
|
4066
4076
|
name: string().min(1),
|
|
@@ -4072,11 +4082,12 @@ const listAppsContract = oc.input(_void()).output(object({ apps: array(AppSchema
|
|
|
4072
4082
|
/** Get a single app by slug */
|
|
4073
4083
|
const getAppContract = oc.input(object({ slug: string() })).output(object({ app: AppSchema }));
|
|
4074
4084
|
/**
|
|
4075
|
-
* Deploy an app.
|
|
4085
|
+
* Deploy an app to an environment.
|
|
4076
4086
|
* Accepts a source tarball — the server builds and deploys it.
|
|
4077
4087
|
*/
|
|
4078
4088
|
const deployAppContract = oc.input(object({
|
|
4079
4089
|
slug: string().min(1),
|
|
4090
|
+
envSlug: string().min(1),
|
|
4080
4091
|
source: _instanceof(File)
|
|
4081
4092
|
})).output(object({
|
|
4082
4093
|
deploymentId: string().uuid(),
|
|
@@ -4123,37 +4134,53 @@ const DatabaseSchema = object({
|
|
|
4123
4134
|
name: string(),
|
|
4124
4135
|
engine: DbEngine,
|
|
4125
4136
|
accessMode: DbAccessMode,
|
|
4126
|
-
host: string().nullable(),
|
|
4127
|
-
port: number().int().nullable(),
|
|
4128
|
-
database: string().nullable(),
|
|
4129
4137
|
createdAt: date(),
|
|
4130
4138
|
updatedAt: date()
|
|
4131
4139
|
});
|
|
4132
|
-
const
|
|
4133
|
-
|
|
4134
|
-
|
|
4135
|
-
|
|
4136
|
-
|
|
4137
|
-
|
|
4138
|
-
|
|
4140
|
+
const DatabaseConnectionSchema = object({
|
|
4141
|
+
id: string().uuid(),
|
|
4142
|
+
databaseId: string().uuid(),
|
|
4143
|
+
environmentId: string().uuid(),
|
|
4144
|
+
environmentSlug: string(),
|
|
4145
|
+
host: string(),
|
|
4146
|
+
port: number().int(),
|
|
4147
|
+
database: string(),
|
|
4148
|
+
createdAt: date()
|
|
4149
|
+
});
|
|
4150
|
+
const DatabaseWithConnectionsSchema = object({
|
|
4151
|
+
id: string().uuid(),
|
|
4152
|
+
orgId: string().uuid(),
|
|
4153
|
+
name: string(),
|
|
4154
|
+
engine: DbEngine,
|
|
4155
|
+
accessMode: DbAccessMode,
|
|
4156
|
+
createdAt: date(),
|
|
4157
|
+
updatedAt: date(),
|
|
4158
|
+
connections: array(DatabaseConnectionSchema)
|
|
4159
|
+
});
|
|
4160
|
+
const CreateDatabaseInput = object({
|
|
4139
4161
|
name: string().min(1).max(100),
|
|
4140
|
-
|
|
4141
|
-
|
|
4142
|
-
})
|
|
4162
|
+
engine: DbEngine,
|
|
4163
|
+
accessMode: DbAccessMode.default("read_only")
|
|
4164
|
+
});
|
|
4143
4165
|
const SetConnectionInput = discriminatedUnion("engine", [object({
|
|
4144
4166
|
engine: literal("postgres"),
|
|
4145
4167
|
databaseId: string().uuid(),
|
|
4168
|
+
environmentId: string().uuid(),
|
|
4146
4169
|
details: PostgresDetails
|
|
4147
4170
|
}), object({
|
|
4148
4171
|
engine: literal("mysql"),
|
|
4149
4172
|
databaseId: string().uuid(),
|
|
4173
|
+
environmentId: string().uuid(),
|
|
4150
4174
|
details: MysqlDetails
|
|
4151
4175
|
})]);
|
|
4152
|
-
const createDatabaseContract = oc.input(CreateDatabaseInput).output(object({ database:
|
|
4153
|
-
const listDatabasesContract = oc.input(_void()).output(object({ databases: array(
|
|
4176
|
+
const createDatabaseContract = oc.input(CreateDatabaseInput).output(object({ database: DatabaseWithConnectionsSchema }));
|
|
4177
|
+
const listDatabasesContract = oc.input(_void()).output(object({ databases: array(DatabaseWithConnectionsSchema) }));
|
|
4154
4178
|
const deleteDatabaseContract = oc.input(object({ id: string().uuid() })).output(object({ ok: boolean() }));
|
|
4155
|
-
const setConnectionContract = oc.input(SetConnectionInput).output(object({
|
|
4156
|
-
const removeConnectionContract = oc.input(object({
|
|
4179
|
+
const setConnectionContract = oc.input(SetConnectionInput).output(object({ connection: DatabaseConnectionSchema }));
|
|
4180
|
+
const removeConnectionContract = oc.input(object({
|
|
4181
|
+
databaseId: string().uuid(),
|
|
4182
|
+
environmentId: string().uuid()
|
|
4183
|
+
})).output(object({ ok: boolean() }));
|
|
4157
4184
|
const testConnectionContract = oc.input(discriminatedUnion("engine", [object({
|
|
4158
4185
|
engine: literal("postgres"),
|
|
4159
4186
|
details: PostgresDetails
|
|
@@ -4171,6 +4198,7 @@ const DbIdentitySchema = object({
|
|
|
4171
4198
|
userId: string().uuid(),
|
|
4172
4199
|
orgId: string().uuid(),
|
|
4173
4200
|
databaseId: string().uuid(),
|
|
4201
|
+
environmentId: string().uuid(),
|
|
4174
4202
|
proxyUsername: string(),
|
|
4175
4203
|
createdAt: date(),
|
|
4176
4204
|
updatedAt: date()
|
|
@@ -4179,9 +4207,14 @@ const DbIdentitySchema = object({
|
|
|
4179
4207
|
const DbIdentityWithDetailsSchema = DbIdentitySchema.extend({
|
|
4180
4208
|
userName: string(),
|
|
4181
4209
|
userEmail: string(),
|
|
4182
|
-
databaseName: string()
|
|
4210
|
+
databaseName: string(),
|
|
4211
|
+
environmentSlug: string(),
|
|
4212
|
+
environmentName: string()
|
|
4213
|
+
});
|
|
4214
|
+
const CreateDbIdentityInput = object({
|
|
4215
|
+
databaseId: string().uuid(),
|
|
4216
|
+
environmentId: string().uuid()
|
|
4183
4217
|
});
|
|
4184
|
-
const CreateDbIdentityInput = object({ databaseId: string().uuid() });
|
|
4185
4218
|
const ListDbIdentitiesInput = object({ databaseId: string().uuid().optional() });
|
|
4186
4219
|
const DeleteDbIdentityInput = object({ id: string().uuid() });
|
|
4187
4220
|
const CreateDbIdentityOutput = object({
|
|
@@ -4219,6 +4252,9 @@ const createDbIdentityContract = oc.input(CreateDbIdentityInput).output(CreateDb
|
|
|
4219
4252
|
const listDbIdentitiesContract = oc.input(ListDbIdentitiesInput).output(ListDbIdentitiesOutput);
|
|
4220
4253
|
const deleteDbIdentityContract = oc.input(DeleteDbIdentityInput).output(object({ ok: boolean() }));
|
|
4221
4254
|
const resolveCredentialsContract = oc.input(ResolveCredentialsInput).output(ResolveCredentialsOutput);
|
|
4255
|
+
const listEnvironmentsContract = oc.input(_void()).output(object({ environments: array(EnvironmentSchema) }));
|
|
4256
|
+
const createEnvironmentContract = oc.input(object({ name: string().min(1).max(50) })).output(object({ environment: EnvironmentSchema }));
|
|
4257
|
+
const deleteEnvironmentContract = oc.input(object({ id: string().uuid() })).output(object({ ok: boolean() }));
|
|
4222
4258
|
const healthCheckContract = oc.input(_void()).output(object({
|
|
4223
4259
|
ok: boolean(),
|
|
4224
4260
|
env: string()
|
|
@@ -4440,10 +4476,10 @@ function createCliAuthClient(apiBaseUrl, getToken) {
|
|
|
4440
4476
|
//#endregion
|
|
4441
4477
|
//#region src/env.ts
|
|
4442
4478
|
const env = {
|
|
4443
|
-
"PUBLIC_API_URL": "https://api.
|
|
4444
|
-
"PUBLIC_PORTAL_URL": "https://
|
|
4479
|
+
"PUBLIC_API_URL": "https://api.barnteam.dev:4000",
|
|
4480
|
+
"PUBLIC_PORTAL_URL": "https://barnteam.dev:4000"
|
|
4445
4481
|
};
|
|
4446
|
-
const barnEnv = "
|
|
4482
|
+
const barnEnv = "dev";
|
|
4447
4483
|
|
|
4448
4484
|
//#endregion
|
|
4449
4485
|
//#region src/lib/auth-store.ts
|
|
@@ -4606,9 +4642,9 @@ async function context() {
|
|
|
4606
4642
|
if (!loggedIn) {
|
|
4607
4643
|
push("## Authentication");
|
|
4608
4644
|
push("Not signed in. Run `barn login` to authenticate and unlock:");
|
|
4609
|
-
push("- Deploying apps");
|
|
4645
|
+
push("- Deploying apps to environments");
|
|
4610
4646
|
push("- Connecting databases");
|
|
4611
|
-
push("- Viewing your team's apps");
|
|
4647
|
+
push("- Viewing your team's environments and apps");
|
|
4612
4648
|
push();
|
|
4613
4649
|
}
|
|
4614
4650
|
push("## Available Templates");
|
|
@@ -4620,7 +4656,7 @@ async function context() {
|
|
|
4620
4656
|
push("- barn init -t vite-hono Create a React + Vite + Hono app (non-interactive)");
|
|
4621
4657
|
push("- barn configure Add barn to an existing project");
|
|
4622
4658
|
push(`- barn dev Start local development (http://{slug}.${DEV_DOMAIN}:${DEV_PROXY_PORT})`);
|
|
4623
|
-
push("- barn deploy
|
|
4659
|
+
push("- barn deploy -e <env> Deploy to an environment");
|
|
4624
4660
|
push("- barn login Authenticate with barn.dev");
|
|
4625
4661
|
push("- barn whoami Show current user and org");
|
|
4626
4662
|
push("- barn context Print this context for AI tools");
|
|
@@ -4628,12 +4664,20 @@ async function context() {
|
|
|
4628
4664
|
if (auth) {
|
|
4629
4665
|
const api = createApiClient(rpcUrl$1);
|
|
4630
4666
|
try {
|
|
4631
|
-
const
|
|
4667
|
+
const [envsResult, dbsResult] = await Promise.all([api.environments.list.call(void 0), api.databases.list.call(void 0)]);
|
|
4668
|
+
const environments = envsResult.environments;
|
|
4669
|
+
if (environments.length > 0) {
|
|
4670
|
+
push("## Environments");
|
|
4671
|
+
for (const e of environments) push(`- ${e.name} (slug: ${e.slug})`);
|
|
4672
|
+
push();
|
|
4673
|
+
}
|
|
4674
|
+
const databases = dbsResult.databases;
|
|
4632
4675
|
if (databases.length > 0) {
|
|
4633
4676
|
push("## Databases");
|
|
4634
4677
|
for (const db of databases) {
|
|
4678
|
+
const connSlugs = (db.connections ?? []).map((c) => c.environmentSlug).filter(Boolean);
|
|
4635
4679
|
push(`- ${db.name} (engine: ${db.engine}, access: ${db.accessMode})`);
|
|
4636
|
-
if (
|
|
4680
|
+
if (connSlugs.length > 0) push(` Connections: ${connSlugs.join(", ")}`);
|
|
4637
4681
|
}
|
|
4638
4682
|
push();
|
|
4639
4683
|
}
|
|
@@ -4676,6 +4720,7 @@ async function context() {
|
|
|
4676
4720
|
push("Import from @barn.dev/sdk:");
|
|
4677
4721
|
push("- getUser() Returns { id, email, name } for the authenticated user");
|
|
4678
4722
|
push("- getConnectionString(name) Returns database connection string by alias");
|
|
4723
|
+
push("- getEnv() Returns environment slug (dev/staging/prod)");
|
|
4679
4724
|
push("- middleware.hono() Hono middleware adapter");
|
|
4680
4725
|
push("- middleware.express() Express middleware adapter");
|
|
4681
4726
|
push("- middleware.nextjs() Next.js middleware adapter");
|
|
@@ -4684,7 +4729,7 @@ async function context() {
|
|
|
4684
4729
|
push("1. barn init -t nextjs -n my-app");
|
|
4685
4730
|
push("2. cd my-app");
|
|
4686
4731
|
push("3. barn dev");
|
|
4687
|
-
push("4. barn deploy");
|
|
4732
|
+
push("4. barn deploy -e prod");
|
|
4688
4733
|
console.log(lines.join("\n"));
|
|
4689
4734
|
}
|
|
4690
4735
|
|
|
@@ -4740,7 +4785,7 @@ const k$1 = {
|
|
|
4740
4785
|
reset: useColor$1 ? "\x1B[0m" : ""
|
|
4741
4786
|
};
|
|
4742
4787
|
async function deploy(options) {
|
|
4743
|
-
const { app: appFilter, follow } = options;
|
|
4788
|
+
const { env: envSlug, app: appFilter, follow } = options;
|
|
4744
4789
|
const auth = getAuthState();
|
|
4745
4790
|
if (!auth) {
|
|
4746
4791
|
console.error("\n Not logged in. Run `barn login` first.\n");
|
|
@@ -4779,7 +4824,7 @@ async function deploy(options) {
|
|
|
4779
4824
|
process.exit(1);
|
|
4780
4825
|
}
|
|
4781
4826
|
console.log();
|
|
4782
|
-
console.log(` ${k$1.bold}Deploying${k$1.reset} as ${userName} (${orgName})`);
|
|
4827
|
+
console.log(` ${k$1.bold}Deploying${k$1.reset} as ${userName} (${orgName}) to ${k$1.cyan}${envSlug}${k$1.reset}`);
|
|
4783
4828
|
console.log();
|
|
4784
4829
|
for (const app of apps) {
|
|
4785
4830
|
const slug = app.config.slug;
|
|
@@ -4796,10 +4841,10 @@ async function deploy(options) {
|
|
|
4796
4841
|
process.exit(1);
|
|
4797
4842
|
}
|
|
4798
4843
|
}
|
|
4799
|
-
if (follow) await deployWithFollow(api, apps);
|
|
4800
|
-
else await deployNonBlocking(api, apps);
|
|
4844
|
+
if (follow) await deployWithFollow(api, apps, envSlug);
|
|
4845
|
+
else await deployNonBlocking(api, apps, envSlug);
|
|
4801
4846
|
}
|
|
4802
|
-
async function deployNonBlocking(api, apps) {
|
|
4847
|
+
async function deployNonBlocking(api, apps, envSlug) {
|
|
4803
4848
|
const maxSlug = Math.max(...apps.map((a) => a.config.slug.length));
|
|
4804
4849
|
let hasFailure = false;
|
|
4805
4850
|
for (const app of apps) {
|
|
@@ -4820,6 +4865,7 @@ async function deployNonBlocking(api, apps) {
|
|
|
4820
4865
|
const sourceFile = new File([ab], `${slug}.tar.gz`, { type: "application/gzip" });
|
|
4821
4866
|
const result = await api.apps.deploy({
|
|
4822
4867
|
slug,
|
|
4868
|
+
envSlug,
|
|
4823
4869
|
source: sourceFile
|
|
4824
4870
|
});
|
|
4825
4871
|
const elapsed = `${k$1.dim}${fmtTime$1(t0)}${k$1.reset}`;
|
|
@@ -4837,7 +4883,7 @@ async function deployNonBlocking(api, apps) {
|
|
|
4837
4883
|
console.log();
|
|
4838
4884
|
if (hasFailure) process.exit(1);
|
|
4839
4885
|
}
|
|
4840
|
-
async function deployWithFollow(api, apps) {
|
|
4886
|
+
async function deployWithFollow(api, apps, envSlug) {
|
|
4841
4887
|
const states = apps.map((a) => ({
|
|
4842
4888
|
slug: a.config.slug,
|
|
4843
4889
|
step: "pack",
|
|
@@ -4863,7 +4909,7 @@ async function deployWithFollow(api, apps) {
|
|
|
4863
4909
|
draw();
|
|
4864
4910
|
const timer = isTTY$1 ? setInterval(draw, 80) : null;
|
|
4865
4911
|
if (!isTTY$1) console.log(" Deploying...");
|
|
4866
|
-
const results = await Promise.allSettled(apps.map((app, i) => deployOneApp(api, app, states[i])));
|
|
4912
|
+
const results = await Promise.allSettled(apps.map((app, i) => deployOneApp(api, app, envSlug, states[i])));
|
|
4867
4913
|
if (timer) clearInterval(timer);
|
|
4868
4914
|
if (isTTY$1 && drawn > 0) {
|
|
4869
4915
|
process.stdout.write(`\x1b[${drawn}A`);
|
|
@@ -4904,7 +4950,7 @@ function fmtTime$1(t0) {
|
|
|
4904
4950
|
if (s < 60) return `${s}s`;
|
|
4905
4951
|
return `${Math.floor(s / 60)}m${String(s % 60).padStart(2, "0")}s`;
|
|
4906
4952
|
}
|
|
4907
|
-
async function deployOneApp(api, app, state) {
|
|
4953
|
+
async function deployOneApp(api, app, envSlug, state) {
|
|
4908
4954
|
const slug = app.config.slug;
|
|
4909
4955
|
state.step = "pack";
|
|
4910
4956
|
let tarBuffer;
|
|
@@ -4924,6 +4970,7 @@ async function deployOneApp(api, app, state) {
|
|
|
4924
4970
|
const sourceFile = new File([ab], `${slug}.tar.gz`, { type: "application/gzip" });
|
|
4925
4971
|
const result = await api.apps.deploy({
|
|
4926
4972
|
slug,
|
|
4973
|
+
envSlug,
|
|
4927
4974
|
source: sourceFile
|
|
4928
4975
|
});
|
|
4929
4976
|
deploymentId = result.deploymentId;
|
|
@@ -5029,9 +5076,14 @@ function escapeHtml(s) {
|
|
|
5029
5076
|
* Inject the barn toolbar into an HTML page.
|
|
5030
5077
|
*
|
|
5031
5078
|
* Inserts a fixed-position bar before </body> showing the app name,
|
|
5032
|
-
* authenticated user, and a back-link.
|
|
5079
|
+
* optional environment, authenticated user, and a back-link.
|
|
5033
5080
|
*/
|
|
5034
5081
|
function injectToolbar(html, opts) {
|
|
5082
|
+
const appSlug = JSON.stringify(opts.appSlug);
|
|
5083
|
+
const userName = escapeHtml(opts.identity.name);
|
|
5084
|
+
const userEmail = escapeHtml(opts.identity.email);
|
|
5085
|
+
const backUrl = JSON.stringify(opts.backUrl);
|
|
5086
|
+
const backLabel = opts.backLabel ?? "portal";
|
|
5035
5087
|
const toolbarScript = `
|
|
5036
5088
|
<script data-barn-toolbar>
|
|
5037
5089
|
(function() {
|
|
@@ -5040,11 +5092,13 @@ function injectToolbar(html, opts) {
|
|
|
5040
5092
|
bar.style.cssText = 'position:fixed;top:0;left:0;right:0;height:36px;background:#2c1810;color:#faf6f1;display:flex;align-items:center;padding:0 16px;font-family:-apple-system,BlinkMacSystemFont,system-ui,sans-serif;font-size:12px;z-index:999999;gap:12px;box-shadow:0 1px 3px rgba(44,24,16,0.3)';
|
|
5041
5093
|
bar.innerHTML = '<span style="font-weight:600;letter-spacing:0.02em;color:#c0392b">barn</span>'
|
|
5042
5094
|
+ '<span style="color:#6b4226">|</span>'
|
|
5043
|
-
+ '<span>' + ${
|
|
5095
|
+
+ '<span>' + ${appSlug} + '</span>'
|
|
5096
|
+
${opts.envSlug ? `+ '<span style="color:#6b4226">|</span>'
|
|
5097
|
+
+ '<span style="color:#8b6f5a;font-size:11px">' + ${JSON.stringify(opts.envSlug)} + '</span>'` : ""}
|
|
5044
5098
|
+ '<span style="color:#6b4226">|</span>'
|
|
5045
|
-
+ '<span style="color:#8b6f5a">${
|
|
5099
|
+
+ '<span style="color:#8b6f5a">${userName} <${userEmail}></span>'
|
|
5046
5100
|
+ '<span style="flex:1"></span>'
|
|
5047
|
-
+ '<a href=' + ${
|
|
5101
|
+
+ '<a href=' + ${backUrl} + ' style="color:#c0392b;text-decoration:none;font-size:11px">\\u2190 ${backLabel}</a>';
|
|
5048
5102
|
document.body.style.paddingTop = '36px';
|
|
5049
5103
|
document.body.prepend(bar);
|
|
5050
5104
|
})();
|
|
@@ -5262,12 +5316,15 @@ async function dev(options) {
|
|
|
5262
5316
|
if (orgs && orgs.length > 0) await authClient.organization.setActive({ organizationId: orgs[0].id });
|
|
5263
5317
|
}
|
|
5264
5318
|
let orgDatabases = [];
|
|
5319
|
+
let orgEnvironments = [];
|
|
5265
5320
|
try {
|
|
5266
5321
|
orgDatabases = (await api.databases.list()).databases;
|
|
5322
|
+
orgEnvironments = (await api.environments.list()).environments;
|
|
5267
5323
|
} catch {
|
|
5268
|
-
console.log(" Could not fetch databases — skipping DB env vars.");
|
|
5324
|
+
console.log(" Could not fetch databases/environments — skipping DB env vars.");
|
|
5269
5325
|
}
|
|
5270
|
-
|
|
5326
|
+
const devEnv = orgEnvironments.find((e) => e.slug === "dev");
|
|
5327
|
+
if (devEnv && orgDatabases.length > 0) for (const app of apps) {
|
|
5271
5328
|
const dbConfig = app.config.databases;
|
|
5272
5329
|
if (!dbConfig) continue;
|
|
5273
5330
|
const envVars = {};
|
|
@@ -5278,7 +5335,10 @@ async function dev(options) {
|
|
|
5278
5335
|
continue;
|
|
5279
5336
|
}
|
|
5280
5337
|
try {
|
|
5281
|
-
const result = await api.dbIdentities.create({
|
|
5338
|
+
const result = await api.dbIdentities.create({
|
|
5339
|
+
databaseId: dbRow.id,
|
|
5340
|
+
environmentId: devEnv.id
|
|
5341
|
+
});
|
|
5282
5342
|
envVars[`BARN_DB_${alias.toUpperCase()}_URL`] = result.connectionString;
|
|
5283
5343
|
} catch (err) {
|
|
5284
5344
|
const msg = err instanceof Error ? err.message : String(err);
|
|
@@ -5313,6 +5373,7 @@ async function dev(options) {
|
|
|
5313
5373
|
BARN_USER_EMAIL: user.email,
|
|
5314
5374
|
BARN_USER_NAME: user.name,
|
|
5315
5375
|
BARN_APP_SLUG: app.config.slug,
|
|
5376
|
+
BARN_ENV_SLUG: "dev",
|
|
5316
5377
|
BARN_SIGNING_SECRET: signingSecret,
|
|
5317
5378
|
...dbEnv
|
|
5318
5379
|
}
|
|
@@ -5903,8 +5964,9 @@ program.command("dev").description("Start local development with barn").action(a
|
|
|
5903
5964
|
baseDomain: DEV_DOMAIN
|
|
5904
5965
|
});
|
|
5905
5966
|
});
|
|
5906
|
-
program.command("deploy").description("Deploy apps").option("-a, --app <slug>", "Deploy a specific app (default: all)").option("-f, --follow", "Wait for deploy to finish and stream progress").action(async (opts) => {
|
|
5967
|
+
program.command("deploy").description("Deploy apps to an environment").requiredOption("-e, --env <slug>", "Target environment (e.g. dev, staging, prod)").option("-a, --app <slug>", "Deploy a specific app (default: all)").option("-f, --follow", "Wait for deploy to finish and stream progress").action(async (opts) => {
|
|
5907
5968
|
await deploy({
|
|
5969
|
+
env: opts.env,
|
|
5908
5970
|
app: opts.app,
|
|
5909
5971
|
follow: opts.follow
|
|
5910
5972
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@barn.dev/cli",
|
|
3
|
-
"version": "0.0.1
|
|
3
|
+
"version": "0.0.1",
|
|
4
4
|
"description": "CLI for barn.dev — scaffold, develop, and deploy internal tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -32,7 +32,13 @@
|
|
|
32
32
|
"engines": {
|
|
33
33
|
"node": ">=18"
|
|
34
34
|
},
|
|
35
|
+
"scripts": {
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"dev": "tsdown --watch",
|
|
38
|
+
"typecheck": "tsc --noEmit"
|
|
39
|
+
},
|
|
35
40
|
"dependencies": {
|
|
41
|
+
"@barn.dev/templates": "workspace:*",
|
|
36
42
|
"@hono/node-server": "^1.19.9",
|
|
37
43
|
"@inquirer/prompts": "^8.2.0",
|
|
38
44
|
"@orpc/client": "^1.13.5",
|
|
@@ -41,21 +47,15 @@
|
|
|
41
47
|
"commander": "^14.0.3",
|
|
42
48
|
"hono": "^4.11.9",
|
|
43
49
|
"jiti": "^2.6.1",
|
|
44
|
-
"open": "^11.0.0"
|
|
45
|
-
"@barn.dev/templates": "0.0.1-next.20260215045621.1330de7"
|
|
50
|
+
"open": "^11.0.0"
|
|
46
51
|
},
|
|
47
52
|
"devDependencies": {
|
|
53
|
+
"@barn/auth": "workspace:*",
|
|
54
|
+
"@barn/contracts": "workspace:*",
|
|
55
|
+
"@barn/proxy-shared": "workspace:*",
|
|
56
|
+
"@barn.dev/sdk": "workspace:*",
|
|
57
|
+
"@barn/shared": "workspace:*",
|
|
48
58
|
"tsdown": "^0.20.3",
|
|
49
|
-
"typescript": "^5.9.3"
|
|
50
|
-
"@barn/auth": "0.0.1",
|
|
51
|
-
"@barn/contracts": "0.0.1",
|
|
52
|
-
"@barn/proxy-shared": "0.0.1",
|
|
53
|
-
"@barn.dev/sdk": "0.0.1-next.20260215045621.1330de7",
|
|
54
|
-
"@barn/shared": "0.0.1"
|
|
55
|
-
},
|
|
56
|
-
"scripts": {
|
|
57
|
-
"build": "tsdown",
|
|
58
|
-
"dev": "tsdown --watch",
|
|
59
|
-
"typecheck": "tsc --noEmit"
|
|
59
|
+
"typescript": "^5.9.3"
|
|
60
60
|
}
|
|
61
|
-
}
|
|
61
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,190 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding any notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
Copyright 2025 Olive Studio Inc.
|
|
179
|
-
|
|
180
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
-
you may not use this file except in compliance with the License.
|
|
182
|
-
You may obtain a copy of the License at
|
|
183
|
-
|
|
184
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
-
|
|
186
|
-
Unless required by applicable law or agreed to in writing, software
|
|
187
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
-
See the License for the specific language governing permissions and
|
|
190
|
-
limitations under the License.
|