@mostajs/orm-cli 0.6.2 → 0.6.4
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 +20 -4
- package/package.json +1 -1
package/bin/mostajs.sh
CHANGED
|
@@ -246,10 +246,13 @@ detect_project() {
|
|
|
246
246
|
JSON_SCHEMAS=()
|
|
247
247
|
PKG_MANAGER=""
|
|
248
248
|
|
|
249
|
-
# Prisma
|
|
249
|
+
# Prisma (check prisma/ subdir first, then root)
|
|
250
250
|
if [[ -f "$PROJECT_ROOT/prisma/schema.prisma" ]]; then
|
|
251
251
|
PRISMA_SCHEMA="$PROJECT_ROOT/prisma/schema.prisma"
|
|
252
252
|
DETECTED_TYPES+=("prisma")
|
|
253
|
+
elif [[ -f "$PROJECT_ROOT/schema.prisma" ]]; then
|
|
254
|
+
PRISMA_SCHEMA="$PROJECT_ROOT/schema.prisma"
|
|
255
|
+
DETECTED_TYPES+=("prisma")
|
|
253
256
|
fi
|
|
254
257
|
|
|
255
258
|
# OpenAPI (common names)
|
|
@@ -3947,7 +3950,7 @@ run_subcommand() {
|
|
|
3947
3950
|
local cli_dir
|
|
3948
3951
|
cli_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
3949
3952
|
detect_project
|
|
3950
|
-
[[ ${#DETECTED_TYPES[@]} -eq 0 ]] && { err "No schema found. Bootstrap needs a prisma/schema.prisma
|
|
3953
|
+
[[ ${#DETECTED_TYPES[@]} -eq 0 ]] && { err "No schema found. Bootstrap needs a prisma/schema.prisma, OpenAPI/JSONSchema, or schemas.mjs/schemas.ts."; exit 1; }
|
|
3951
3954
|
|
|
3952
3955
|
local BS_OK_CODEMOD=0 BS_OK_DEPS=0 BS_OK_CONVERT=0 BS_OK_DDL=0
|
|
3953
3956
|
|
|
@@ -3980,10 +3983,23 @@ run_subcommand() {
|
|
|
3980
3983
|
prisma) input="$PRISMA_SCHEMA" ;;
|
|
3981
3984
|
openapi) input="$OPENAPI_FILE" ;;
|
|
3982
3985
|
jsonschema) input="${JSON_SCHEMAS[0]}" ;;
|
|
3986
|
+
native) input="$NATIVE_SCHEMA" ;;
|
|
3983
3987
|
esac
|
|
3984
3988
|
|
|
3985
|
-
|
|
3986
|
-
|
|
3989
|
+
local convert_ok=0
|
|
3990
|
+
if [[ "$type" == "native" ]]; then
|
|
3991
|
+
if run_native_convert "$input" "$GENERATED_DIR/entities.ts" && \
|
|
3992
|
+
[[ -s "$GENERATED_DIR/entities.json" || -s "$GENERATED_DIR/entities.ts" ]]; then
|
|
3993
|
+
convert_ok=1
|
|
3994
|
+
fi
|
|
3995
|
+
else
|
|
3996
|
+
if run_adapter_convert "$type" "$input" "$GENERATED_DIR/entities.ts" && \
|
|
3997
|
+
[[ -s "$GENERATED_DIR/entities.json" || -s "$GENERATED_DIR/entities.ts" ]]; then
|
|
3998
|
+
convert_ok=1
|
|
3999
|
+
fi
|
|
4000
|
+
fi
|
|
4001
|
+
|
|
4002
|
+
if [[ $convert_ok -eq 1 ]]; then
|
|
3987
4003
|
BS_OK_CONVERT=1
|
|
3988
4004
|
ok " schema converted → $GENERATED_DIR/entities.json"
|
|
3989
4005
|
else
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mostajs/orm-cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.4",
|
|
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",
|