@mostajs/orm-cli 0.6.1 → 0.6.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.
- package/bin/mostajs.sh +30 -3
- package/package.json +1 -1
package/bin/mostajs.sh
CHANGED
|
@@ -3947,7 +3947,7 @@ run_subcommand() {
|
|
|
3947
3947
|
local cli_dir
|
|
3948
3948
|
cli_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
3949
3949
|
detect_project
|
|
3950
|
-
[[ ${#DETECTED_TYPES[@]} -eq 0 ]] && { err "No schema found. Bootstrap needs a prisma/schema.prisma
|
|
3950
|
+
[[ ${#DETECTED_TYPES[@]} -eq 0 ]] && { err "No schema found. Bootstrap needs a prisma/schema.prisma, OpenAPI/JSONSchema, or schemas.mjs/schemas.ts."; exit 1; }
|
|
3951
3951
|
|
|
3952
3952
|
local BS_OK_CODEMOD=0 BS_OK_DEPS=0 BS_OK_CONVERT=0 BS_OK_DDL=0
|
|
3953
3953
|
|
|
@@ -3980,10 +3980,23 @@ run_subcommand() {
|
|
|
3980
3980
|
prisma) input="$PRISMA_SCHEMA" ;;
|
|
3981
3981
|
openapi) input="$OPENAPI_FILE" ;;
|
|
3982
3982
|
jsonschema) input="${JSON_SCHEMAS[0]}" ;;
|
|
3983
|
+
native) input="$NATIVE_SCHEMA" ;;
|
|
3983
3984
|
esac
|
|
3984
3985
|
|
|
3985
|
-
|
|
3986
|
-
|
|
3986
|
+
local convert_ok=0
|
|
3987
|
+
if [[ "$type" == "native" ]]; then
|
|
3988
|
+
if run_native_convert "$input" "$GENERATED_DIR/entities.ts" && \
|
|
3989
|
+
[[ -s "$GENERATED_DIR/entities.json" || -s "$GENERATED_DIR/entities.ts" ]]; then
|
|
3990
|
+
convert_ok=1
|
|
3991
|
+
fi
|
|
3992
|
+
else
|
|
3993
|
+
if run_adapter_convert "$type" "$input" "$GENERATED_DIR/entities.ts" && \
|
|
3994
|
+
[[ -s "$GENERATED_DIR/entities.json" || -s "$GENERATED_DIR/entities.ts" ]]; then
|
|
3995
|
+
convert_ok=1
|
|
3996
|
+
fi
|
|
3997
|
+
fi
|
|
3998
|
+
|
|
3999
|
+
if [[ $convert_ok -eq 1 ]]; then
|
|
3987
4000
|
BS_OK_CONVERT=1
|
|
3988
4001
|
ok " schema converted → $GENERATED_DIR/entities.json"
|
|
3989
4002
|
else
|
|
@@ -4056,6 +4069,20 @@ SGBD_URI=$bs_uri
|
|
|
4056
4069
|
DB_SCHEMA_STRATEGY=$bs_strategy
|
|
4057
4070
|
CFG
|
|
4058
4071
|
ok " wrote $CONFIG_DIR/config.env (dialect=$bs_dialect)"
|
|
4072
|
+
|
|
4073
|
+
# Also write to .env so the bridge picks it up at runtime
|
|
4074
|
+
# (the bridge reads .env, not .mostajs/config.env)
|
|
4075
|
+
local dotenv="$PROJECT_ROOT/.env"
|
|
4076
|
+
touch "$dotenv"
|
|
4077
|
+
# Remove old entries if present, then append
|
|
4078
|
+
sed -i '/^DB_DIALECT=/d; /^SGBD_URI=/d; /^DB_SCHEMA_STRATEGY=/d' "$dotenv"
|
|
4079
|
+
cat >> "$dotenv" <<ENVVARS
|
|
4080
|
+
DB_DIALECT=$bs_dialect
|
|
4081
|
+
SGBD_URI=$bs_uri
|
|
4082
|
+
DB_SCHEMA_STRATEGY=$bs_strategy
|
|
4083
|
+
ENVVARS
|
|
4084
|
+
ok " wrote DB_DIALECT + SGBD_URI to .env"
|
|
4085
|
+
|
|
4059
4086
|
load_env
|
|
4060
4087
|
fi
|
|
4061
4088
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mostajs/orm-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Universal CLI to integrate @mostajs/orm into any project — one-shot `mostajs bootstrap` migrates a Prisma project (codemod + deps + schema convert + DDL) to 13 databases with zero code change.",
|
|
5
5
|
"author": "Dr Hamid MADANI <drmdh@msn.com>",
|
|
6
6
|
"license": "AGPL-3.0-or-later",
|