@by-association-only/cli 4.0.1 โ 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -4
- package/dist/index.js +20 -5
- package/dist/index.js.map +3 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -189,6 +189,10 @@ async function initializeContext() {
|
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
});
|
|
192
|
+
if (import_prompts2.isCancel(appName)) {
|
|
193
|
+
import_prompts2.outro(import_picocolors.default.red("An app name is required to continue"));
|
|
194
|
+
process.exit(1);
|
|
195
|
+
}
|
|
192
196
|
const repoName = `${String(appName)}-app`;
|
|
193
197
|
const localPath = `./${repoName}`;
|
|
194
198
|
if (fs.existsSync(localPath)) {
|
|
@@ -207,7 +211,7 @@ async function validateEnvironment(initialContext) {
|
|
|
207
211
|
initialContext.spinner.start("Welcome! Checking to make sure your environment is set up correctly.");
|
|
208
212
|
const hasEnvironmentAccessToken = typeof process.env.GITHUB_TOKEN !== "undefined" && process.env.GITHUB_TOKEN.trim() !== "";
|
|
209
213
|
if (!hasEnvironmentAccessToken) {
|
|
210
|
-
import_prompts2.log.warning(`Unable to find a GITHUB_TOKEN environment variable. Please go to https://github.com/settings/tokens/new and create an access token to be able to use the CLI.`);
|
|
214
|
+
import_prompts2.log.warning(`Unable to find a GITHUB_TOKEN environment variable. Please go to https://github.com/settings/tokens/new?description=BAO%20CLI&scopes=repo and create an access token to be able to use the CLI.`);
|
|
211
215
|
}
|
|
212
216
|
const githubAccessToken = process.env.GITHUB_TOKEN || await import_prompts2.text({
|
|
213
217
|
message: "Access token"
|
|
@@ -329,10 +333,13 @@ async function provisionCloudflareResources(context) {
|
|
|
329
333
|
}
|
|
330
334
|
async function cleanup(context) {
|
|
331
335
|
context.spinner.start("Removing unnecessary files from the template");
|
|
332
|
-
import_prompts2.note("Removing default shopify.app.toml", "\uD83E\uDDF9 Cleaning up");
|
|
333
336
|
fs.unlinkSync(path.join(context.localPath, "shopify.app.toml"));
|
|
334
|
-
import_prompts2.note("Removing default shopify.app.production.toml", "\uD83E\uDDF9 Cleaning up");
|
|
335
337
|
fs.unlinkSync(path.join(context.localPath, "shopify.app.production.toml"));
|
|
338
|
+
import_prompts2.note([
|
|
339
|
+
"- Removed default shopify.app.toml",
|
|
340
|
+
"- Removed default shopify.app.production.toml"
|
|
341
|
+
].join(`
|
|
342
|
+
`), "\uD83E\uDDF9 Cleaning up");
|
|
336
343
|
context.spinner.message("Installing packages");
|
|
337
344
|
const packageInstall = Bun.spawn(["bun", "install"], {
|
|
338
345
|
stderr: "ignore",
|
|
@@ -367,5 +374,5 @@ if (command === "create" && subcommand === "app") {
|
|
|
367
374
|
}
|
|
368
375
|
})
|
|
369
376
|
|
|
370
|
-
//# debugId=
|
|
377
|
+
//# debugId=1EFE0422BE0D76DF64756E2164756E21
|
|
371
378
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,15 @@
|
|
|
4
4
|
// packages/cli/src/commands/create.ts
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
-
import {
|
|
7
|
+
import {
|
|
8
|
+
intro,
|
|
9
|
+
isCancel as isCancel2,
|
|
10
|
+
log,
|
|
11
|
+
note,
|
|
12
|
+
outro,
|
|
13
|
+
spinner,
|
|
14
|
+
text
|
|
15
|
+
} from "@clack/prompts";
|
|
8
16
|
import { Octokit } from "octokit";
|
|
9
17
|
import color from "picocolors";
|
|
10
18
|
|
|
@@ -172,6 +180,10 @@ async function initializeContext() {
|
|
|
172
180
|
}
|
|
173
181
|
}
|
|
174
182
|
});
|
|
183
|
+
if (isCancel2(appName)) {
|
|
184
|
+
outro(color.red("An app name is required to continue"));
|
|
185
|
+
process.exit(1);
|
|
186
|
+
}
|
|
175
187
|
const repoName = `${String(appName)}-app`;
|
|
176
188
|
const localPath = `./${repoName}`;
|
|
177
189
|
if (fs.existsSync(localPath)) {
|
|
@@ -190,7 +202,7 @@ async function validateEnvironment(initialContext) {
|
|
|
190
202
|
initialContext.spinner.start("Welcome! Checking to make sure your environment is set up correctly.");
|
|
191
203
|
const hasEnvironmentAccessToken = typeof process.env.GITHUB_TOKEN !== "undefined" && process.env.GITHUB_TOKEN.trim() !== "";
|
|
192
204
|
if (!hasEnvironmentAccessToken) {
|
|
193
|
-
log.warning(`Unable to find a GITHUB_TOKEN environment variable. Please go to https://github.com/settings/tokens/new and create an access token to be able to use the CLI.`);
|
|
205
|
+
log.warning(`Unable to find a GITHUB_TOKEN environment variable. Please go to https://github.com/settings/tokens/new?description=BAO%20CLI&scopes=repo and create an access token to be able to use the CLI.`);
|
|
194
206
|
}
|
|
195
207
|
const githubAccessToken = process.env.GITHUB_TOKEN || await text({
|
|
196
208
|
message: "Access token"
|
|
@@ -312,10 +324,13 @@ async function provisionCloudflareResources(context) {
|
|
|
312
324
|
}
|
|
313
325
|
async function cleanup(context) {
|
|
314
326
|
context.spinner.start("Removing unnecessary files from the template");
|
|
315
|
-
note("Removing default shopify.app.toml", "\uD83E\uDDF9 Cleaning up");
|
|
316
327
|
fs.unlinkSync(path.join(context.localPath, "shopify.app.toml"));
|
|
317
|
-
note("Removing default shopify.app.production.toml", "\uD83E\uDDF9 Cleaning up");
|
|
318
328
|
fs.unlinkSync(path.join(context.localPath, "shopify.app.production.toml"));
|
|
329
|
+
note([
|
|
330
|
+
"- Removed default shopify.app.toml",
|
|
331
|
+
"- Removed default shopify.app.production.toml"
|
|
332
|
+
].join(`
|
|
333
|
+
`), "\uD83E\uDDF9 Cleaning up");
|
|
319
334
|
context.spinner.message("Installing packages");
|
|
320
335
|
const packageInstall = Bun.spawn(["bun", "install"], {
|
|
321
336
|
stderr: "ignore",
|
|
@@ -349,5 +364,5 @@ if (command === "create" && subcommand === "app") {
|
|
|
349
364
|
process.exit(1);
|
|
350
365
|
}
|
|
351
366
|
|
|
352
|
-
//# debugId=
|
|
367
|
+
//# debugId=089482BCDEF9045564756E2164756E21
|
|
353
368
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["packages/cli/src/commands/create.ts", "packages/cli/src/constants.ts", "packages/cli/src/utils.ts", "packages/cli/src/wrangler.ts", "packages/cli/src/index.ts"],
|
|
4
4
|
"sourcesContent": [
|
|
5
|
-
"import * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport {
|
|
5
|
+
"import * as fs from 'node:fs'\nimport * as path from 'node:path'\nimport {\n\tintro,\n\tisCancel,\n\tlog,\n\tnote,\n\toutro,\n\tspinner,\n\ttext,\n} from '@clack/prompts'\nimport { Octokit } from 'octokit'\nimport color from 'picocolors'\nimport { APP_REFERENCE_NAME } from '../constants'\nimport type { PartialCreateContext, ValidatedCreateContext } from '../types'\nimport { GITHUB_INFO } from '../utils'\nimport {\n\tcreateD1Database,\n\tcreateKVNamespace,\n\tcreateR2Bucket,\n\tensureWranglerSessionExists,\n\ttype ResourceProvisionResult,\n\twriteWranglerConfig,\n} from '../wrangler'\n\nexport async function create(): Promise<void> {\n\tconst initialContext = await initializeContext()\n\n\tconst context = await validateEnvironment(initialContext)\n\n\tawait createGithubRepository(context)\n\tawait cloneGithubRepository(context)\n\tawait provisionCloudflareResources(context)\n\tawait cleanup(context)\n\n\tnote(\n\t\t[\n\t\t\t`1. cd ${context.localPath}`,\n\t\t\t'2. shopify app config link',\n\t\t\t'3. bun run dev',\n\t\t].join(`\\n`),\n\t\t`${color.bgYellow(color.black('Next steps.'))}`,\n\t)\n\n\toutro(\n\t\t`Go and build something ${color.underline(color.italic(color.yellow('stupendous')))}.`,\n\t)\n}\n\nasync function initializeContext(): Promise<PartialCreateContext> {\n\tintro(`Setting up a new BAO ${APP_REFERENCE_NAME} project`)\n\n\tconst appName = await text({\n\t\tmessage: 'What is the name of your project?',\n\t\tplaceholder: `my-${APP_REFERENCE_NAME.toLowerCase()}-project`,\n\t\tvalidate: (value) => {\n\t\t\tif (typeof value === 'undefined') return `You must provide a value`\n\n\t\t\tif (!value.match(/^[a-z0-9-]+$/)) {\n\t\t\t\treturn `Invalid app name: ${value}. App names can only contain lowercase letters, numbers, and dashes.`\n\t\t\t}\n\t\t},\n\t})\n\n\tif (isCancel(appName)) {\n\t\toutro(color.red('An app name is required to continue'))\n\n\t\tprocess.exit(1)\n\t}\n\n\tconst repoName = `${String(appName)}-app`\n\tconst localPath = `./${repoName}`\n\n\tif (fs.existsSync(localPath)) {\n\t\tlog.error(`Unable to continue as ${localPath} already exists`)\n\n\t\tprocess.exit(0)\n\t}\n\n\tconst s = spinner()\n\n\treturn {\n\t\tappName: String(appName),\n\t\trepoName,\n\t\tlocalPath,\n\t\tspinner: s,\n\t}\n}\n\nasync function validateEnvironment(\n\tinitialContext: PartialCreateContext,\n): Promise<ValidatedCreateContext> {\n\tinitialContext.spinner.start(\n\t\t'Welcome! Checking to make sure your environment is set up correctly.',\n\t)\n\n\tconst hasEnvironmentAccessToken =\n\t\ttypeof process.env.GITHUB_TOKEN !== 'undefined' &&\n\t\tprocess.env.GITHUB_TOKEN.trim() !== ''\n\n\tif (!hasEnvironmentAccessToken) {\n\t\tlog.warning(\n\t\t\t`Unable to find a GITHUB_TOKEN environment variable. Please go to https://github.com/settings/tokens/new?description=BAO%20CLI&scopes=repo and create an access token to be able to use the CLI.`,\n\t\t)\n\t}\n\n\tconst githubAccessToken =\n\t\tprocess.env.GITHUB_TOKEN ||\n\t\t(await text({\n\t\t\tmessage: 'Access token',\n\t\t}))\n\n\ttry {\n\t\tawait testGithubAccessTokenIsValid(String(githubAccessToken))\n\t} catch (error: any) {\n\t\tlog.error(`Invalid access token: ${error.message}`)\n\n\t\tprocess.exit(0)\n\t}\n\n\tawait ensureWranglerSessionExists(initialContext.spinner)\n\n\tinitialContext.spinner.stop('Validated environment')\n\n\tnote(\n\t\t'Before using R2, Queues, and Durable objects,\\n' +\n\t\t\t\"make sure you've enabled them in the Cloudflare Dashboard.\\n\" +\n\t\t\t'https://dash.cloudflare.com/\\n' +\n\t\t\t'Otherwise, the following commands might fail! ๐ฌ',\n\t\t'๐ Heads-up:',\n\t)\n\n\treturn {\n\t\t...initialContext,\n\t\tgithubPersonalAccessToken: String(githubAccessToken),\n\t\tcloudflare: {},\n\t}\n}\n\nasync function testGithubAccessTokenIsValid(\n\taccessToken: string,\n): Promise<string> {\n\tconst octokit = new Octokit({\n\t\tauth: accessToken,\n\t})\n\n\tconst {\n\t\tdata: { login },\n\t} = await octokit.rest.users.getAuthenticated()\n\n\treturn login\n}\n\nasync function createGithubRepository(\n\tcontext: ValidatedCreateContext,\n): Promise<void> {\n\tcontext.spinner.start(`Creating GitHub Repository ${context.repoName}`)\n\n\tconst octokit = new Octokit({\n\t\tauth: context.githubPersonalAccessToken,\n\t})\n\n\ttry {\n\t\tconst appRepo = await octokit.rest.repos.createUsingTemplate({\n\t\t\ttemplate_owner: GITHUB_INFO.organization,\n\t\t\ttemplate_repo: GITHUB_INFO.templateRepository,\n\t\t\towner: GITHUB_INFO.organization,\n\t\t\tname: context.repoName,\n\t\t\tprivate: true,\n\t\t})\n\n\t\tcontext.repoHttpUrl = appRepo.data.html_url\n\t\tcontext.repoSshUrl = appRepo.data.ssh_url\n\t} catch (error: any) {\n\t\tlog.error(`Unable to create Github Repository ${context.repoName}`)\n\t\tlog.error(error)\n\n\t\tprocess.exit(0)\n\t}\n\n\tcontext.spinner.stop('Github repository created! โญ')\n}\n\nasync function cloneGithubRepository(context: ValidatedCreateContext) {\n\tif (typeof context.repoSshUrl === 'undefined') {\n\t\tlog.error(\n\t\t\t`Unable to clone Github repository ${context.repoName} as can't find the .git URL`,\n\t\t)\n\n\t\tprocess.exit(0)\n\t}\n\n\tcontext.spinner.start(`Cloning ${context.repoName} from GitHub`)\n\n\tawait new Promise((resolve) => setTimeout(resolve, 5000))\n\n\tconst child = Bun.spawn(\n\t\t['git', 'clone', context.repoSshUrl, context.localPath],\n\t\t{\n\t\t\tstderr: 'ignore',\n\t\t\tstdout: 'ignore',\n\t\t},\n\t)\n\n\tawait child.exited\n\n\tif (fs.existsSync(context.localPath)) {\n\t\tcontext.spinner.stop(\n\t\t\t`Successfully cloned repository to ${context.localPath}`,\n\t\t)\n\n\t\treturn\n\t}\n\n\tcontext.spinner.stop()\n\tlog.error(`Unable to clone repository`)\n\n\tprocess.exit(0)\n}\n\nasync function provisionCloudflareResources(context: ValidatedCreateContext) {\n\tnote(\n\t\t[\n\t\t\t'Creating the following Cloudflare resources:',\n\t\t\t'- KV',\n\t\t\t'- D1',\n\t\t\t'- R2 Bucket',\n\t\t].join(`\\n`),\n\t)\n\n\tcontext.spinner.start(`Creating Cloudflare resources`)\n\n\tconst wranglerConfig = {\n\t\t$schema: 'node_modules/wrangler/config-schema.json',\n\t\tname: context.appName,\n\t\tcompatibility_date: '2025-09-21',\n\t\tcompatibility_flags: ['nodejs_compat'],\n\t\tmain: '@tanstack/react-start/server-entry',\n\t\tdev: {\n\t\t\tip: '0.0.0.0',\n\t\t\tport: 8647,\n\t\t},\n\t\tupload_source_maps: true,\n\t\tplacement: {\n\t\t\tmode: 'smart',\n\t\t},\n\t\tobservability: {\n\t\t\tenabled: true,\n\t\t},\n\t}\n\n\tawait writeWranglerConfig(\n\t\t`${context.localPath}/wrangler.json`,\n\t\twranglerConfig,\n\t)\n\n\tconst results: ResourceProvisionResult[] = []\n\n\tcontext.spinner.message(`Creating KV namespace`)\n\tresults.push(await createKVNamespace(context.appName, context.localPath))\n\n\tcontext.spinner.message(`Creating D1 database`)\n\tresults.push(await createD1Database(context.appName, context.localPath))\n\n\tcontext.spinner.message(`Creating R2 bucket`)\n\tresults.push(await createR2Bucket(context.appName, context.localPath))\n\n\tfor (const result of results) {\n\t\tif (!result.success) {\n\t\t\tlog.error(result.message)\n\n\t\t\tprocess.exit(0)\n\t\t}\n\t}\n\n\tcontext.spinner.stop('Cloudflare resources created and wrangler.json updated')\n\n\tconst allResults = results.map((r) => r.message)\n\n\tnote(allResults.join(`\\n`), \"Here's what we did:\")\n}\n\nasync function cleanup(context: ValidatedCreateContext) {\n\tcontext.spinner.start('Removing unnecessary files from the template')\n\n\tfs.unlinkSync(path.join(context.localPath, 'shopify.app.toml'))\n\tfs.unlinkSync(path.join(context.localPath, 'shopify.app.production.toml'))\n\n\tnote(\n\t\t[\n\t\t\t'- Removed default shopify.app.toml',\n\t\t\t'- Removed default shopify.app.production.toml',\n\t\t].join(`\\n`),\n\t\t'๐งน Cleaning up',\n\t)\n\n\tcontext.spinner.message('Installing packages')\n\n\tconst packageInstall = Bun.spawn(['bun', 'install'], {\n\t\tstderr: 'ignore',\n\t\tstdout: 'ignore',\n\t\tcwd: context.localPath,\n\t})\n\tawait packageInstall.exited\n\n\tcontext.spinner.message('Finalising app setup')\n\n\tconst gitAdd = Bun.spawn(['git', 'add', '.'], {\n\t\tstderr: 'ignore',\n\t\tstdout: 'ignore',\n\t\tcwd: context.localPath,\n\t})\n\tawait gitAdd.exited\n\n\tconst gitCommit = Bun.spawn(['git', 'commit', '-m', 'App setup'], {\n\t\tstderr: 'ignore',\n\t\tstdout: 'ignore',\n\t\tcwd: context.localPath,\n\t})\n\tawait gitCommit.exited\n\n\tcontext.spinner.stop()\n}\n",
|
|
6
6
|
"export const APP_REFERENCE_NAME = 'Unisian'\n",
|
|
7
7
|
"export const PACKAGE_RUNNER_COMMAND = 'bunx'\n\nexport const GITHUB_INFO = {\n\torganization: 'baoagency',\n\ttemplateRepository: 'unisian',\n} as const\n",
|
|
8
8
|
"import { readFile, writeFile } from 'node:fs/promises'\nimport { cancel, confirm, isCancel, type spinner } from '@clack/prompts'\nimport { APP_REFERENCE_NAME } from './constants'\nimport { PACKAGE_RUNNER_COMMAND } from './utils'\n\nexport async function runWranglerCommand(\n\tcommand: string[],\n\tcwd?: string,\n): Promise<{\n\tcode: number\n\tstdout: string\n\tstderr: string\n}> {\n\tconst child = Bun.spawn(\n\t\t[PACKAGE_RUNNER_COMMAND, 'wrangler@latest', ...command],\n\t\t{\n\t\t\tstdin: 'pipe',\n\t\t\tstderr: 'pipe',\n\t\t\tcwd,\n\t\t\tenv: {\n\t\t\t\t...process.env,\n\t\t\t\tCLOUDFLARE_ACCOUNT_ID: '824c12820335788e8daf77dba7e7891e',\n\t\t\t},\n\t\t},\n\t)\n\n\tconst stdout = await new Response(child.stdout).text()\n\tconst stderr = await new Response(child.stderr).text()\n\tconst code = await child.exited\n\n\treturn new Promise((resolve, reject) => {\n\t\tif (code === 0) {\n\t\t\tresolve({\n\t\t\t\tcode,\n\t\t\t\tstdout,\n\t\t\t\tstderr,\n\t\t\t})\n\t\t}\n\n\t\treject({\n\t\t\tcode,\n\t\t\tstdout,\n\t\t\tstderr,\n\t\t})\n\t})\n}\n\nexport async function ensureWranglerAuthenticated(): Promise<boolean> {\n\ttry {\n\t\tconst result = await runWranglerCommand(['whoami'])\n\n\t\treturn !result.stdout.includes('You are not authenticated')\n\t} catch {\n\t\t// Some older versions of Wrangler return a non-zero exit code when\n\t\t// you're not logged in.\n\t\treturn false\n\t}\n}\n\nexport async function wranglerLogin(): Promise<void> {\n\tconst child = Bun.spawn([PACKAGE_RUNNER_COMMAND, 'wrangler', 'login'], {\n\t\tstdin: 'inherit',\n\t})\n\tconst code = await child.exited\n\n\treturn await new Promise((resolve, reject) => {\n\t\tif (code === 0) {\n\t\t\tresolve()\n\t\t}\n\n\t\treject()\n\t})\n}\n\nexport async function ensureWranglerSessionExists(\n\ts: ReturnType<typeof spinner>,\n): Promise<void> {\n\ts.message(\n\t\t'Checking to make sure you have the Wrangler CLI installed and authenticated...',\n\t)\n\n\tif (!(await ensureWranglerAuthenticated())) {\n\t\ts.stop(\"Hmm. Looks like you're not logged in yet.\")\n\n\t\tconst wantsToLogIn = await confirm({\n\t\t\tmessage: `You need to be logged into wrangler to setup a ${APP_REFERENCE_NAME} app. Log in now?`,\n\t\t})\n\n\t\tif (isCancel(wantsToLogIn) || !wantsToLogIn) {\n\t\t\tcancel(\n\t\t\t\t`You need to be logged into wrangler to be able to setup a ${APP_REFERENCE_NAME} app.`,\n\t\t\t)\n\n\t\t\tprocess.exit(0)\n\t\t}\n\n\t\tawait wranglerLogin()\n\t}\n}\n\nexport async function getCurrentWranglerConfig(\n\tlocation: string,\n): Promise<Record<string, any>> {\n\treturn JSON.parse(await readFile(location, 'utf-8'))\n}\n\nexport async function writeWranglerConfig(\n\tlocation: string,\n\tconfig: Record<string, any>,\n): Promise<void> {\n\treturn await writeFile(location, JSON.stringify(config, null, 2))\n}\n\nexport type ResourceProvisionResult = {\n\tsuccess: boolean\n\tmessage: string\n}\n\nexport async function createD1Database(\n\tname: string,\n\tcwd?: string,\n): Promise<ResourceProvisionResult> {\n\ttry {\n\t\tawait runWranglerCommand(\n\t\t\t['d1', 'create', name, '--binding=DB', '--update-config=true'],\n\t\t\tcwd,\n\t\t)\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tmessage: `โ
D1 Database: ${name} created!`,\n\t\t}\n\t} catch (error: any) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tmessage: `โ D1 Database: ${error.stderr || error.stdout || error.message}`,\n\t\t}\n\t}\n}\n\nexport async function createKVNamespace(\n\tname: string,\n\tcwd?: string,\n): Promise<ResourceProvisionResult> {\n\ttry {\n\t\tawait runWranglerCommand(\n\t\t\t[\n\t\t\t\t'kv',\n\t\t\t\t'namespace',\n\t\t\t\t'create',\n\t\t\t\tname,\n\t\t\t\t'--binding=BUCKET',\n\t\t\t\t'--update-config=true',\n\t\t\t],\n\t\t\tcwd,\n\t\t)\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tmessage: `โ
KV Namespace: ${name} created!`,\n\t\t}\n\t} catch (error: any) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tmessage: `โ KV Namespace: ${error.stderr || error.stdout || error.message}`,\n\t\t}\n\t}\n}\n\nexport async function createR2Bucket(\n\tname: string,\n\tcwd?: string,\n): Promise<ResourceProvisionResult> {\n\ttry {\n\t\tawait runWranglerCommand(\n\t\t\t[\n\t\t\t\t'r2',\n\t\t\t\t'bucket',\n\t\t\t\t'create',\n\t\t\t\tname,\n\t\t\t\t'--binding=BUCKET',\n\t\t\t\t'--update-config=true',\n\t\t\t],\n\t\t\tcwd,\n\t\t)\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tmessage: `โ
KV Namespace: ${name} created!`,\n\t\t}\n\t} catch (error: any) {\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tmessage: `โ KV Namespace: ${error.stderr || error.stdout || error.message}`,\n\t\t}\n\t}\n}\n",
|
|
9
9
|
"#!/usr/bin/env bun\n\nimport { create } from './commands/create'\n\nconst args = Bun.argv.slice(2)\nconst [command, subcommand] = args\n\nif (command === 'create' && subcommand === 'app') {\n\tcreate().catch(console.error)\n} else {\n\tconsole.error('Unknown command. Usage: bao create app')\n\n\tprocess.exit(1)\n}\n"
|
|
10
10
|
],
|
|
11
|
-
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAoB,IAApB;AACsB,IAAtB;
|
|
12
|
-
"debugId": "
|
|
11
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;AAAoB,IAApB;AACsB,IAAtB;AASO,IARP;AASwB,IAAxB;AACkB,IAAlB;;;ACZO,IAAM,qBAAqB;;;ACA3B,IAAM,yBAAyB;AAE/B,IAAM,cAAc;AAAA,EAC1B,cAAc;AAAA,EACd,oBAAoB;AACrB;;;ACLoC,IAApC;AACwD,IAAxD;AAIA,eAAsB,kBAAkB,CACvC,SACA,KAKE;AAAA,EACF,MAAM,QAAQ,IAAI,MACjB,CAAC,wBAAwB,mBAAmB,GAAG,OAAO,GACtD;AAAA,IACC,OAAO;AAAA,IACP,QAAQ;AAAA,IACR;AAAA,IACA,KAAK;AAAA,SACD,QAAQ;AAAA,MACX,uBAAuB;AAAA,IACxB;AAAA,EACD,CACD;AAAA,EAEA,MAAM,SAAS,MAAM,IAAI,SAAS,MAAM,MAAM,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