hot-updater 0.21.8 → 0.21.9
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 +171 -20
- package/dist/index.js +154 -6
- package/package.json +13 -11
package/dist/index.cjs
CHANGED
|
@@ -59,6 +59,12 @@ let __hot_updater_console = require("@hot-updater/console");
|
|
|
59
59
|
__hot_updater_console = require_chunk.__toESM(__hot_updater_console);
|
|
60
60
|
let node_net = require("node:net");
|
|
61
61
|
node_net = require_chunk.__toESM(node_net);
|
|
62
|
+
let __hot_updater_server = require("@hot-updater/server");
|
|
63
|
+
__hot_updater_server = require_chunk.__toESM(__hot_updater_server);
|
|
64
|
+
let __hot_updater_server_adapters_kysely = require("@hot-updater/server/adapters/kysely");
|
|
65
|
+
__hot_updater_server_adapters_kysely = require_chunk.__toESM(__hot_updater_server_adapters_kysely);
|
|
66
|
+
let kysely = require("kysely");
|
|
67
|
+
kysely = require_chunk.__toESM(kysely);
|
|
62
68
|
let sql_formatter = require("sql-formatter");
|
|
63
69
|
sql_formatter = require_chunk.__toESM(sql_formatter);
|
|
64
70
|
let jiti = require("jiti");
|
|
@@ -11590,21 +11596,21 @@ var require_lib$3 = /* @__PURE__ */ require_chunk.__commonJS({ "../../node_modul
|
|
|
11590
11596
|
return typeof process === "object" && (process.env.FORCE_COLOR === "0" || process.env.FORCE_COLOR === "false") ? false : picocolors.isColorSupported;
|
|
11591
11597
|
}
|
|
11592
11598
|
const compose = (f, g) => (v) => f(g(v));
|
|
11593
|
-
function buildDefs(colors$
|
|
11599
|
+
function buildDefs(colors$6) {
|
|
11594
11600
|
return {
|
|
11595
|
-
keyword: colors$
|
|
11596
|
-
capitalized: colors$
|
|
11597
|
-
jsxIdentifier: colors$
|
|
11598
|
-
punctuator: colors$
|
|
11599
|
-
number: colors$
|
|
11600
|
-
string: colors$
|
|
11601
|
-
regex: colors$
|
|
11602
|
-
comment: colors$
|
|
11603
|
-
invalid: compose(compose(colors$
|
|
11604
|
-
gutter: colors$
|
|
11605
|
-
marker: compose(colors$
|
|
11606
|
-
message: compose(colors$
|
|
11607
|
-
reset: colors$
|
|
11601
|
+
keyword: colors$6.cyan,
|
|
11602
|
+
capitalized: colors$6.yellow,
|
|
11603
|
+
jsxIdentifier: colors$6.yellow,
|
|
11604
|
+
punctuator: colors$6.yellow,
|
|
11605
|
+
number: colors$6.magenta,
|
|
11606
|
+
string: colors$6.green,
|
|
11607
|
+
regex: colors$6.magenta,
|
|
11608
|
+
comment: colors$6.gray,
|
|
11609
|
+
invalid: compose(compose(colors$6.white, colors$6.bgRed), colors$6.bold),
|
|
11610
|
+
gutter: colors$6.gray,
|
|
11611
|
+
marker: compose(colors$6.red, colors$6.bold),
|
|
11612
|
+
message: compose(colors$6.red, colors$6.bold),
|
|
11613
|
+
reset: colors$6.reset
|
|
11608
11614
|
};
|
|
11609
11615
|
}
|
|
11610
11616
|
const defsOn = buildDefs(picocolors.createColors(true));
|
|
@@ -36980,8 +36986,18 @@ function mergePrismaSchema(existingSchema, hotUpdaterModels) {
|
|
|
36980
36986
|
|
|
36981
36987
|
//#endregion
|
|
36982
36988
|
//#region src/commands/generate.ts
|
|
36989
|
+
const SUPPORTED_PROVIDERS = [
|
|
36990
|
+
"postgresql",
|
|
36991
|
+
"mysql",
|
|
36992
|
+
"sqlite"
|
|
36993
|
+
];
|
|
36983
36994
|
async function generate(options) {
|
|
36984
|
-
const { configPath, outputDir = void 0, skipConfirm = false } = options;
|
|
36995
|
+
const { configPath, outputDir = void 0, skipConfirm = false, sql = false } = options;
|
|
36996
|
+
if (sql) return generateStandaloneSQL({
|
|
36997
|
+
outputDir: outputDir || ".",
|
|
36998
|
+
skipConfirm,
|
|
36999
|
+
provider: typeof sql === "string" ? sql : void 0
|
|
37000
|
+
});
|
|
36985
37001
|
try {
|
|
36986
37002
|
const s$1 = __hot_updater_cli_tools.p.spinner();
|
|
36987
37003
|
s$1.start("Loading configuration and analyzing schema");
|
|
@@ -37143,10 +37159,144 @@ async function generatePrismaSchema(schemaCode, outputDir, skipConfirm) {
|
|
|
37143
37159
|
__hot_updater_cli_tools.p.log.success(schemaExists ? "Updated prisma/schema.prisma" : "Created prisma/schema.prisma");
|
|
37144
37160
|
__hot_updater_cli_tools.p.log.info("Next steps:\n 1. Run: npx prisma generate\n 2. Run: npx prisma migrate dev");
|
|
37145
37161
|
}
|
|
37162
|
+
/**
|
|
37163
|
+
* Creates a minimal dummy pool implementation for SQL-only generation
|
|
37164
|
+
* This won't be used for actual database operations
|
|
37165
|
+
*/
|
|
37166
|
+
function createDummyPool() {
|
|
37167
|
+
return {
|
|
37168
|
+
connect: async () => ({
|
|
37169
|
+
query: async () => ({
|
|
37170
|
+
rows: [],
|
|
37171
|
+
command: "SELECT",
|
|
37172
|
+
rowCount: 0
|
|
37173
|
+
}),
|
|
37174
|
+
release: () => {}
|
|
37175
|
+
}),
|
|
37176
|
+
end: async () => {}
|
|
37177
|
+
};
|
|
37178
|
+
}
|
|
37179
|
+
/**
|
|
37180
|
+
* Creates a minimal dummy SQLite database implementation for SQL-only generation
|
|
37181
|
+
* This won't be used for actual database operations
|
|
37182
|
+
*/
|
|
37183
|
+
function createDummySqliteDatabase() {
|
|
37184
|
+
return {
|
|
37185
|
+
close: async () => {},
|
|
37186
|
+
prepare: () => ({
|
|
37187
|
+
all: async () => [],
|
|
37188
|
+
get: async () => void 0,
|
|
37189
|
+
run: async () => ({ changes: 0 }),
|
|
37190
|
+
finalize: async () => {}
|
|
37191
|
+
})
|
|
37192
|
+
};
|
|
37193
|
+
}
|
|
37194
|
+
/**
|
|
37195
|
+
* Creates a Kysely dialect based on the selected database provider
|
|
37196
|
+
*/
|
|
37197
|
+
function createDialect(provider) {
|
|
37198
|
+
switch (provider) {
|
|
37199
|
+
case "postgresql": return new kysely.PostgresDialect({ pool: createDummyPool() });
|
|
37200
|
+
case "mysql": return new kysely.MysqlDialect({ pool: createDummyPool() });
|
|
37201
|
+
case "sqlite": return new kysely.SqliteDialect({ database: createDummySqliteDatabase() });
|
|
37202
|
+
}
|
|
37203
|
+
}
|
|
37204
|
+
/**
|
|
37205
|
+
* Generate standalone SQL file using Kysely preset without reading config
|
|
37206
|
+
*/
|
|
37207
|
+
async function generateStandaloneSQL(options) {
|
|
37208
|
+
const { outputDir, skipConfirm, provider } = options;
|
|
37209
|
+
try {
|
|
37210
|
+
let dbType;
|
|
37211
|
+
if (provider) {
|
|
37212
|
+
if (!SUPPORTED_PROVIDERS.includes(provider)) {
|
|
37213
|
+
__hot_updater_cli_tools.p.log.error(`Invalid provider: ${provider}\nValid options: ${SUPPORTED_PROVIDERS.join(", ")}`);
|
|
37214
|
+
process.exit(1);
|
|
37215
|
+
}
|
|
37216
|
+
dbType = provider;
|
|
37217
|
+
} else if (skipConfirm) dbType = "postgresql";
|
|
37218
|
+
else {
|
|
37219
|
+
const selected = await __hot_updater_cli_tools.p.select({
|
|
37220
|
+
message: "Select database type",
|
|
37221
|
+
options: [
|
|
37222
|
+
{
|
|
37223
|
+
value: "postgresql",
|
|
37224
|
+
label: "PostgreSQL"
|
|
37225
|
+
},
|
|
37226
|
+
{
|
|
37227
|
+
value: "mysql",
|
|
37228
|
+
label: "MySQL"
|
|
37229
|
+
},
|
|
37230
|
+
{
|
|
37231
|
+
value: "sqlite",
|
|
37232
|
+
label: "SQLite"
|
|
37233
|
+
}
|
|
37234
|
+
]
|
|
37235
|
+
});
|
|
37236
|
+
if (__hot_updater_cli_tools.p.isCancel(selected)) {
|
|
37237
|
+
__hot_updater_cli_tools.p.cancel("Operation cancelled");
|
|
37238
|
+
process.exit(0);
|
|
37239
|
+
}
|
|
37240
|
+
dbType = selected;
|
|
37241
|
+
}
|
|
37242
|
+
const s$1 = __hot_updater_cli_tools.p.spinner();
|
|
37243
|
+
s$1.start("Generating SQL from database schema");
|
|
37244
|
+
const adapter = (0, __hot_updater_server_adapters_kysely.kyselyAdapter)({
|
|
37245
|
+
db: new kysely.Kysely({ dialect: createDialect(dbType) }),
|
|
37246
|
+
provider: dbType
|
|
37247
|
+
});
|
|
37248
|
+
const result = await __hot_updater_server.HotUpdaterDB.client(adapter).createMigrator().migrateToLatest({
|
|
37249
|
+
mode: "from-schema",
|
|
37250
|
+
updateSettings: false
|
|
37251
|
+
});
|
|
37252
|
+
s$1.stop("SQL generation complete");
|
|
37253
|
+
if (!result.getSQL) {
|
|
37254
|
+
__hot_updater_cli_tools.p.log.error("SQL generation is not supported by the database adapter.\nThis may indicate a configuration issue.");
|
|
37255
|
+
process.exit(1);
|
|
37256
|
+
}
|
|
37257
|
+
const sql = result.getSQL();
|
|
37258
|
+
if (!sql || sql.trim() === "") {
|
|
37259
|
+
__hot_updater_cli_tools.p.log.error("No SQL was generated from the schema.\nThe schema may be empty or invalid.");
|
|
37260
|
+
process.exit(1);
|
|
37261
|
+
}
|
|
37262
|
+
const formattedSql = (0, sql_formatter.format)(sql, {
|
|
37263
|
+
language: dbType,
|
|
37264
|
+
tabWidth: 2,
|
|
37265
|
+
keywordCase: "upper"
|
|
37266
|
+
});
|
|
37267
|
+
const absoluteOutputDir = path.default.resolve(process.cwd(), outputDir);
|
|
37268
|
+
await (0, fs_promises.mkdir)(absoluteOutputDir, { recursive: true });
|
|
37269
|
+
const filename = "hot-updater.sql";
|
|
37270
|
+
const outputPath = path.default.join(absoluteOutputDir, filename);
|
|
37271
|
+
const fileExists = await (0, fs_promises.access)(outputPath).then(() => true).catch(() => false);
|
|
37272
|
+
if (!skipConfirm) {
|
|
37273
|
+
__hot_updater_cli_tools.p.log.info("\nGenerated SQL preview:\n");
|
|
37274
|
+
console.log(formattedSql);
|
|
37275
|
+
console.log("");
|
|
37276
|
+
if (fileExists) __hot_updater_cli_tools.p.log.warn(`File ${filename} already exists and will be overwritten.`);
|
|
37277
|
+
const shouldContinue = await __hot_updater_cli_tools.p.confirm({
|
|
37278
|
+
message: `Save to ${filename}?`,
|
|
37279
|
+
initialValue: true
|
|
37280
|
+
});
|
|
37281
|
+
if (__hot_updater_cli_tools.p.isCancel(shouldContinue) || !shouldContinue) {
|
|
37282
|
+
__hot_updater_cli_tools.p.cancel("Operation cancelled");
|
|
37283
|
+
process.exit(0);
|
|
37284
|
+
}
|
|
37285
|
+
} else if (fileExists) __hot_updater_cli_tools.p.log.warn(`Overwriting existing file: ${outputPath}`);
|
|
37286
|
+
await (0, fs_promises.writeFile)(outputPath, formattedSql, "utf-8");
|
|
37287
|
+
__hot_updater_cli_tools.p.log.success(`SQL file created: ${outputPath}`);
|
|
37288
|
+
} catch (error) {
|
|
37289
|
+
__hot_updater_cli_tools.p.log.error("Failed to generate standalone SQL");
|
|
37290
|
+
if (error instanceof Error) {
|
|
37291
|
+
__hot_updater_cli_tools.p.log.error(error.message);
|
|
37292
|
+
if (process.env["DEBUG"]) console.error(error.stack);
|
|
37293
|
+
}
|
|
37294
|
+
process.exit(1);
|
|
37295
|
+
}
|
|
37296
|
+
}
|
|
37146
37297
|
|
|
37147
37298
|
//#endregion
|
|
37148
37299
|
//#region src/commands/migrate.ts
|
|
37149
|
-
var import_picocolors = /* @__PURE__ */ require_chunk.__toESM(require_picocolors(), 1);
|
|
37150
37300
|
/**
|
|
37151
37301
|
* Format migration operations into human-readable changes
|
|
37152
37302
|
*/
|
|
@@ -37170,7 +37320,7 @@ function formatOperations(operations) {
|
|
|
37170
37320
|
const maxNameLength = Math.max(...columns.map((c$1) => c$1.name.length));
|
|
37171
37321
|
for (const col of columns) {
|
|
37172
37322
|
const paddedName = col.name.padEnd(maxNameLength);
|
|
37173
|
-
changes.push(` ${
|
|
37323
|
+
changes.push(` ${__hot_updater_cli_tools.colors.cyan(paddedName)} ${__hot_updater_cli_tools.colors.yellow(col.type)}`);
|
|
37174
37324
|
}
|
|
37175
37325
|
}
|
|
37176
37326
|
}
|
|
@@ -37354,11 +37504,12 @@ dbCommand.command("migrate").description("Run database migration (creates tables
|
|
|
37354
37504
|
skipConfirm: options.yes
|
|
37355
37505
|
});
|
|
37356
37506
|
});
|
|
37357
|
-
dbCommand.command("generate").description("Generate SQL migration file (does not execute)").argument("
|
|
37507
|
+
dbCommand.command("generate").description("Generate SQL migration file (does not execute)").argument("[configPath]", "path to the config file that exports hotUpdater (not required with --sql)").argument("[outputDir]", "output directory (default: hot-updater_migrations)").option("-y, --yes", "skip confirmation prompt", false).option("--sql [provider]", "generate standalone SQL file without reading config. Optional provider: postgresql, mysql, sqlite (default: interactive selection)").action(async (configPath, outputDir, options) => {
|
|
37358
37508
|
await generate({
|
|
37359
|
-
configPath,
|
|
37509
|
+
configPath: configPath || "",
|
|
37360
37510
|
outputDir,
|
|
37361
|
-
skipConfirm: options.yes
|
|
37511
|
+
skipConfirm: options.yes,
|
|
37512
|
+
sql: options.sql === true ? true : options.sql || false
|
|
37362
37513
|
});
|
|
37363
37514
|
});
|
|
37364
37515
|
if (process.env["NODE_ENV"] === "development") program.command("build:native").description("build a new native artifact and deploy").addOption(new Option("-p, --platform <platform>", "specify the platform").choices(["ios", "android"])).addOption(new Option("-o, --output-path <outputPath>", "the path where the artifacts will be generated")).addOption(interactiveCommandOption).addOption(new Option("-m, --message <message>", "Specify a custom message for this deployment. If not provided, the latest git commit message will be used as the deployment message")).action(async (options) => {
|
package/dist/index.js
CHANGED
|
@@ -29,6 +29,9 @@ import { createServer } from "http";
|
|
|
29
29
|
import { Http2ServerRequest } from "http2";
|
|
30
30
|
import app from "@hot-updater/console";
|
|
31
31
|
import net from "node:net";
|
|
32
|
+
import { HotUpdaterDB } from "@hot-updater/server";
|
|
33
|
+
import { kyselyAdapter } from "@hot-updater/server/adapters/kysely";
|
|
34
|
+
import { Kysely, MysqlDialect, PostgresDialect, SqliteDialect } from "kysely";
|
|
32
35
|
import { format } from "sql-formatter";
|
|
33
36
|
import { createJiti } from "jiti";
|
|
34
37
|
|
|
@@ -36954,8 +36957,18 @@ function mergePrismaSchema(existingSchema, hotUpdaterModels) {
|
|
|
36954
36957
|
|
|
36955
36958
|
//#endregion
|
|
36956
36959
|
//#region src/commands/generate.ts
|
|
36960
|
+
const SUPPORTED_PROVIDERS = [
|
|
36961
|
+
"postgresql",
|
|
36962
|
+
"mysql",
|
|
36963
|
+
"sqlite"
|
|
36964
|
+
];
|
|
36957
36965
|
async function generate(options) {
|
|
36958
|
-
const { configPath, outputDir = void 0, skipConfirm = false } = options;
|
|
36966
|
+
const { configPath, outputDir = void 0, skipConfirm = false, sql = false } = options;
|
|
36967
|
+
if (sql) return generateStandaloneSQL({
|
|
36968
|
+
outputDir: outputDir || ".",
|
|
36969
|
+
skipConfirm,
|
|
36970
|
+
provider: typeof sql === "string" ? sql : void 0
|
|
36971
|
+
});
|
|
36959
36972
|
try {
|
|
36960
36973
|
const s$1 = p.spinner();
|
|
36961
36974
|
s$1.start("Loading configuration and analyzing schema");
|
|
@@ -37117,10 +37130,144 @@ async function generatePrismaSchema(schemaCode, outputDir, skipConfirm) {
|
|
|
37117
37130
|
p.log.success(schemaExists ? "Updated prisma/schema.prisma" : "Created prisma/schema.prisma");
|
|
37118
37131
|
p.log.info("Next steps:\n 1. Run: npx prisma generate\n 2. Run: npx prisma migrate dev");
|
|
37119
37132
|
}
|
|
37133
|
+
/**
|
|
37134
|
+
* Creates a minimal dummy pool implementation for SQL-only generation
|
|
37135
|
+
* This won't be used for actual database operations
|
|
37136
|
+
*/
|
|
37137
|
+
function createDummyPool() {
|
|
37138
|
+
return {
|
|
37139
|
+
connect: async () => ({
|
|
37140
|
+
query: async () => ({
|
|
37141
|
+
rows: [],
|
|
37142
|
+
command: "SELECT",
|
|
37143
|
+
rowCount: 0
|
|
37144
|
+
}),
|
|
37145
|
+
release: () => {}
|
|
37146
|
+
}),
|
|
37147
|
+
end: async () => {}
|
|
37148
|
+
};
|
|
37149
|
+
}
|
|
37150
|
+
/**
|
|
37151
|
+
* Creates a minimal dummy SQLite database implementation for SQL-only generation
|
|
37152
|
+
* This won't be used for actual database operations
|
|
37153
|
+
*/
|
|
37154
|
+
function createDummySqliteDatabase() {
|
|
37155
|
+
return {
|
|
37156
|
+
close: async () => {},
|
|
37157
|
+
prepare: () => ({
|
|
37158
|
+
all: async () => [],
|
|
37159
|
+
get: async () => void 0,
|
|
37160
|
+
run: async () => ({ changes: 0 }),
|
|
37161
|
+
finalize: async () => {}
|
|
37162
|
+
})
|
|
37163
|
+
};
|
|
37164
|
+
}
|
|
37165
|
+
/**
|
|
37166
|
+
* Creates a Kysely dialect based on the selected database provider
|
|
37167
|
+
*/
|
|
37168
|
+
function createDialect(provider) {
|
|
37169
|
+
switch (provider) {
|
|
37170
|
+
case "postgresql": return new PostgresDialect({ pool: createDummyPool() });
|
|
37171
|
+
case "mysql": return new MysqlDialect({ pool: createDummyPool() });
|
|
37172
|
+
case "sqlite": return new SqliteDialect({ database: createDummySqliteDatabase() });
|
|
37173
|
+
}
|
|
37174
|
+
}
|
|
37175
|
+
/**
|
|
37176
|
+
* Generate standalone SQL file using Kysely preset without reading config
|
|
37177
|
+
*/
|
|
37178
|
+
async function generateStandaloneSQL(options) {
|
|
37179
|
+
const { outputDir, skipConfirm, provider } = options;
|
|
37180
|
+
try {
|
|
37181
|
+
let dbType;
|
|
37182
|
+
if (provider) {
|
|
37183
|
+
if (!SUPPORTED_PROVIDERS.includes(provider)) {
|
|
37184
|
+
p.log.error(`Invalid provider: ${provider}\nValid options: ${SUPPORTED_PROVIDERS.join(", ")}`);
|
|
37185
|
+
process.exit(1);
|
|
37186
|
+
}
|
|
37187
|
+
dbType = provider;
|
|
37188
|
+
} else if (skipConfirm) dbType = "postgresql";
|
|
37189
|
+
else {
|
|
37190
|
+
const selected = await p.select({
|
|
37191
|
+
message: "Select database type",
|
|
37192
|
+
options: [
|
|
37193
|
+
{
|
|
37194
|
+
value: "postgresql",
|
|
37195
|
+
label: "PostgreSQL"
|
|
37196
|
+
},
|
|
37197
|
+
{
|
|
37198
|
+
value: "mysql",
|
|
37199
|
+
label: "MySQL"
|
|
37200
|
+
},
|
|
37201
|
+
{
|
|
37202
|
+
value: "sqlite",
|
|
37203
|
+
label: "SQLite"
|
|
37204
|
+
}
|
|
37205
|
+
]
|
|
37206
|
+
});
|
|
37207
|
+
if (p.isCancel(selected)) {
|
|
37208
|
+
p.cancel("Operation cancelled");
|
|
37209
|
+
process.exit(0);
|
|
37210
|
+
}
|
|
37211
|
+
dbType = selected;
|
|
37212
|
+
}
|
|
37213
|
+
const s$1 = p.spinner();
|
|
37214
|
+
s$1.start("Generating SQL from database schema");
|
|
37215
|
+
const adapter = kyselyAdapter({
|
|
37216
|
+
db: new Kysely({ dialect: createDialect(dbType) }),
|
|
37217
|
+
provider: dbType
|
|
37218
|
+
});
|
|
37219
|
+
const result = await HotUpdaterDB.client(adapter).createMigrator().migrateToLatest({
|
|
37220
|
+
mode: "from-schema",
|
|
37221
|
+
updateSettings: false
|
|
37222
|
+
});
|
|
37223
|
+
s$1.stop("SQL generation complete");
|
|
37224
|
+
if (!result.getSQL) {
|
|
37225
|
+
p.log.error("SQL generation is not supported by the database adapter.\nThis may indicate a configuration issue.");
|
|
37226
|
+
process.exit(1);
|
|
37227
|
+
}
|
|
37228
|
+
const sql = result.getSQL();
|
|
37229
|
+
if (!sql || sql.trim() === "") {
|
|
37230
|
+
p.log.error("No SQL was generated from the schema.\nThe schema may be empty or invalid.");
|
|
37231
|
+
process.exit(1);
|
|
37232
|
+
}
|
|
37233
|
+
const formattedSql = format(sql, {
|
|
37234
|
+
language: dbType,
|
|
37235
|
+
tabWidth: 2,
|
|
37236
|
+
keywordCase: "upper"
|
|
37237
|
+
});
|
|
37238
|
+
const absoluteOutputDir = path$1.resolve(process.cwd(), outputDir);
|
|
37239
|
+
await mkdir(absoluteOutputDir, { recursive: true });
|
|
37240
|
+
const filename = "hot-updater.sql";
|
|
37241
|
+
const outputPath = path$1.join(absoluteOutputDir, filename);
|
|
37242
|
+
const fileExists = await access(outputPath).then(() => true).catch(() => false);
|
|
37243
|
+
if (!skipConfirm) {
|
|
37244
|
+
p.log.info("\nGenerated SQL preview:\n");
|
|
37245
|
+
console.log(formattedSql);
|
|
37246
|
+
console.log("");
|
|
37247
|
+
if (fileExists) p.log.warn(`File ${filename} already exists and will be overwritten.`);
|
|
37248
|
+
const shouldContinue = await p.confirm({
|
|
37249
|
+
message: `Save to ${filename}?`,
|
|
37250
|
+
initialValue: true
|
|
37251
|
+
});
|
|
37252
|
+
if (p.isCancel(shouldContinue) || !shouldContinue) {
|
|
37253
|
+
p.cancel("Operation cancelled");
|
|
37254
|
+
process.exit(0);
|
|
37255
|
+
}
|
|
37256
|
+
} else if (fileExists) p.log.warn(`Overwriting existing file: ${outputPath}`);
|
|
37257
|
+
await writeFile(outputPath, formattedSql, "utf-8");
|
|
37258
|
+
p.log.success(`SQL file created: ${outputPath}`);
|
|
37259
|
+
} catch (error) {
|
|
37260
|
+
p.log.error("Failed to generate standalone SQL");
|
|
37261
|
+
if (error instanceof Error) {
|
|
37262
|
+
p.log.error(error.message);
|
|
37263
|
+
if (process.env["DEBUG"]) console.error(error.stack);
|
|
37264
|
+
}
|
|
37265
|
+
process.exit(1);
|
|
37266
|
+
}
|
|
37267
|
+
}
|
|
37120
37268
|
|
|
37121
37269
|
//#endregion
|
|
37122
37270
|
//#region src/commands/migrate.ts
|
|
37123
|
-
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
37124
37271
|
/**
|
|
37125
37272
|
* Format migration operations into human-readable changes
|
|
37126
37273
|
*/
|
|
@@ -37144,7 +37291,7 @@ function formatOperations(operations) {
|
|
|
37144
37291
|
const maxNameLength = Math.max(...columns.map((c$1) => c$1.name.length));
|
|
37145
37292
|
for (const col of columns) {
|
|
37146
37293
|
const paddedName = col.name.padEnd(maxNameLength);
|
|
37147
|
-
changes.push(` ${
|
|
37294
|
+
changes.push(` ${colors.cyan(paddedName)} ${colors.yellow(col.type)}`);
|
|
37148
37295
|
}
|
|
37149
37296
|
}
|
|
37150
37297
|
}
|
|
@@ -37328,11 +37475,12 @@ dbCommand.command("migrate").description("Run database migration (creates tables
|
|
|
37328
37475
|
skipConfirm: options.yes
|
|
37329
37476
|
});
|
|
37330
37477
|
});
|
|
37331
|
-
dbCommand.command("generate").description("Generate SQL migration file (does not execute)").argument("
|
|
37478
|
+
dbCommand.command("generate").description("Generate SQL migration file (does not execute)").argument("[configPath]", "path to the config file that exports hotUpdater (not required with --sql)").argument("[outputDir]", "output directory (default: hot-updater_migrations)").option("-y, --yes", "skip confirmation prompt", false).option("--sql [provider]", "generate standalone SQL file without reading config. Optional provider: postgresql, mysql, sqlite (default: interactive selection)").action(async (configPath, outputDir, options) => {
|
|
37332
37479
|
await generate({
|
|
37333
|
-
configPath,
|
|
37480
|
+
configPath: configPath || "",
|
|
37334
37481
|
outputDir,
|
|
37335
|
-
skipConfirm: options.yes
|
|
37482
|
+
skipConfirm: options.yes,
|
|
37483
|
+
sql: options.sql === true ? true : options.sql || false
|
|
37336
37484
|
});
|
|
37337
37485
|
});
|
|
37338
37486
|
if (process.env["NODE_ENV"] === "development") program.command("build:native").description("build a new native artifact and deploy").addOption(new Option("-p, --platform <platform>", "specify the platform").choices(["ios", "android"])).addOption(new Option("-o, --output-path <outputPath>", "the path where the artifacts will be generated")).addOption(interactiveCommandOption).addOption(new Option("-m, --message <message>", "Specify a custom message for this deployment. If not provided, the latest git commit message will be used as the deployment message")).action(async (options) => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hot-updater",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.21.
|
|
4
|
+
"version": "0.21.9",
|
|
5
5
|
"bin": {
|
|
6
6
|
"hot-updater": "./dist/index.js"
|
|
7
7
|
},
|
|
@@ -52,12 +52,14 @@
|
|
|
52
52
|
"@expo/fingerprint": "0.13.4",
|
|
53
53
|
"cosmiconfig": "9.0.0",
|
|
54
54
|
"jiti": "2.6.1",
|
|
55
|
+
"kysely": "0.28.8",
|
|
55
56
|
"sql-formatter": "15.6.10",
|
|
56
57
|
"cosmiconfig-typescript-loader": "5.0.0",
|
|
57
|
-
"@hot-updater/
|
|
58
|
-
"@hot-updater/core": "0.21.
|
|
59
|
-
"@hot-updater/plugin-core": "0.21.
|
|
60
|
-
"@hot-updater/
|
|
58
|
+
"@hot-updater/console": "0.21.9",
|
|
59
|
+
"@hot-updater/core": "0.21.9",
|
|
60
|
+
"@hot-updater/plugin-core": "0.21.9",
|
|
61
|
+
"@hot-updater/cli-tools": "0.21.9",
|
|
62
|
+
"@hot-updater/server": "0.21.9"
|
|
61
63
|
},
|
|
62
64
|
"devDependencies": {
|
|
63
65
|
"semver": "^7.6.3",
|
|
@@ -87,12 +89,12 @@
|
|
|
87
89
|
"plist": "^3.1.0",
|
|
88
90
|
"read-package-up": "^11.0.0",
|
|
89
91
|
"uuidv7": "^1.0.2",
|
|
90
|
-
"@hot-updater/aws": "0.21.
|
|
91
|
-
"@hot-updater/server": "0.21.
|
|
92
|
-
"@hot-updater/
|
|
93
|
-
"@hot-updater/
|
|
94
|
-
"@hot-updater/
|
|
95
|
-
"@hot-updater/
|
|
92
|
+
"@hot-updater/aws": "0.21.9",
|
|
93
|
+
"@hot-updater/server": "0.21.9",
|
|
94
|
+
"@hot-updater/supabase": "0.21.9",
|
|
95
|
+
"@hot-updater/cloudflare": "0.21.9",
|
|
96
|
+
"@hot-updater/test-utils": "0.21.9",
|
|
97
|
+
"@hot-updater/firebase": "0.21.9"
|
|
96
98
|
},
|
|
97
99
|
"peerDependencies": {
|
|
98
100
|
"@hot-updater/aws": "*",
|