@ronin/cli
Advanced tools
Comparing version
@@ -944,6 +944,2 @@ #!/usr/bin/env bun | ||
var localRoninPath = path7.join(process.cwd(), "node_modules", "ronin"); | ||
var ronin = await import(localRoninPath); | ||
var roninUtils = await import(path7.join(localRoninPath, "dist/utils")); | ||
var { add, alter, create, drop, get, set } = ronin; | ||
var { getBatchProxy } = roninUtils; | ||
var Protocol = class { | ||
@@ -979,4 +975,7 @@ _queries = []; | ||
getQueryObjects = async (queries) => { | ||
const ronin = await import(localRoninPath); | ||
const roninUtils = await import(path7.join(localRoninPath, "dist/utils")); | ||
const { getBatchProxy } = roninUtils; | ||
const queryObjects = await getBatchProxy( | ||
() => queries.map((query) => this.queryToObject(query).query), | ||
() => queries.map((query) => this.queryToObject(query, ronin).query), | ||
{ asyncContext: new (await import("node:async_hooks")).AsyncLocalStorage() }, | ||
@@ -995,3 +994,4 @@ (queries2) => queries2 | ||
*/ | ||
queryToObject = (query) => { | ||
queryToObject = (query, ronin) => { | ||
const { add, alter, create: create2, drop, get, set } = ronin; | ||
const func = new Function( | ||
@@ -1006,3 +1006,3 @@ "create", | ||
); | ||
return func(create, drop, get, set, alter, add); | ||
return func(create2, drop, get, set, alter, add); | ||
}; | ||
@@ -1051,2 +1051,4 @@ /** | ||
const queries = await import(filePath); | ||
const roninUtils = await import(path7.join(localRoninPath, "dist/utils")); | ||
const { getBatchProxy } = roninUtils; | ||
const queryObjects = getBatchProxy( | ||
@@ -1152,3 +1154,3 @@ () => { | ||
case "create": | ||
await create2(appToken, sessionToken, flags2); | ||
await create(appToken, sessionToken, flags2); | ||
break; | ||
@@ -1170,3 +1172,3 @@ default: { | ||
if (flags2.prod) { | ||
console.log("Applying migration to production database"); | ||
console.log("\nApplying migration to production database"); | ||
await fetch(`https://data.ronin.co/?data-selector=${slug}`, { | ||
@@ -1187,7 +1189,7 @@ method: "POST", | ||
} | ||
console.log("Applying migration to local database"); | ||
console.log("\nApplying migration to local database"); | ||
await db.query(statements.map(({ statement }) => statement)); | ||
fs9.writeFileSync(".ronin/db.sqlite", await db.getContents()); | ||
}; | ||
var create2 = async (appToken, sessionToken, flags2) => { | ||
var create = async (appToken, sessionToken, flags2) => { | ||
let status = "readingConfig"; | ||
@@ -1237,3 +1239,5 @@ const spinner = ora3("Reading configuration").start(); | ||
const migrationsPath = path8.join(process.cwd(), MODELS_IN_CODE_DIR, "migrations"); | ||
fs9.mkdirSync(migrationsPath, { recursive: true }); | ||
if (!fs9.existsSync(migrationsPath)) { | ||
fs9.mkdirSync(migrationsPath, { recursive: true }); | ||
} | ||
fs9.copyFileSync( | ||
@@ -1283,2 +1287,5 @@ path8.join( | ||
const migrationsPath = path8.join(process.cwd(), MODELS_IN_CODE_DIR, "migrations"); | ||
if (!fs9.existsSync(migrationsPath)) { | ||
fs9.mkdirSync(migrationsPath, { recursive: true }); | ||
} | ||
fs9.copyFileSync( | ||
@@ -1347,3 +1354,3 @@ migrationFilePath || path8.join( | ||
// package.json | ||
var version = "0.2.9"; | ||
var version = "0.2.10-corny-ron-1071-experimental-45"; | ||
@@ -1350,0 +1357,0 @@ // src/utils/info.ts |
{ | ||
"name": "@ronin/cli", | ||
"version": "0.2.9", | ||
"version": "0.2.10-corny-ron-1071-experimental-45", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "The command-line interface for RONIN.", |
63277
0.63%1392
0.51%