@multiplatform.one/cli 5.0.26 → 6.0.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/bin/multiplatformOne.mjs +0 -21
- package/lib/bin/multiplatformOne.mjs +820 -552
- package/lib/commands/e2e.mjs +409 -0
- package/lib/commands/init.mjs +480 -0
- package/lib/generateVscode.mjs +167 -0
- package/lib/index.mjs +1 -0
- package/lib/types.mjs +1 -0
- package/package.json +37 -43
- package/scripts/clone.sh +17 -0
- package/scripts/frappe-bench.sh +9 -0
- package/scripts/frappe-bootstrap.sh +495 -0
- package/scripts/frappe-clean.sh +31 -0
- package/scripts/frappe-dev.sh +41 -0
- package/scripts/frappe-helpers.sh +94 -0
- package/scripts/frappe.sh +72 -0
- package/scripts/update.sh +29 -25
- package/src/bin/multiplatformOne.ts +604 -539
- package/src/commands/e2e.ts +515 -0
- package/src/commands/init.ts +682 -0
- package/src/generateVscode.ts +216 -0
- package/src/index.ts +0 -21
- package/src/types.ts +3 -26
- package/scripts/cookiecutter.sh +0 -20
- package/scripts/init.sh +0 -5
- package/types/.tsbuildinfo +0 -1
- package/types/bin/multiplatformOne.d.ts +0 -2
- package/types/bin/multiplatformOne.d.ts.map +0 -1
- package/types/index.d.ts +0 -2
- package/types/index.d.ts.map +0 -1
- package/types/types.d.ts +0 -28
- package/types/types.d.ts.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
kill_port() {
|
|
5
|
+
PORT="$1"
|
|
6
|
+
if command -v lsof >/dev/null 2>&1; then
|
|
7
|
+
lsof -i :"$PORT" -t | xargs kill 2>/dev/null || true
|
|
8
|
+
elif command -v ss >/dev/null 2>&1; then
|
|
9
|
+
ss -lptn "sport = :$PORT" 2>/dev/null | awk 'NR>1 {match($0,/pid=([0-9]+)/,a); if(a[1]) print a[1]}' | xargs kill 2>/dev/null || true
|
|
10
|
+
fi
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
_sed() {
|
|
14
|
+
_expr="$1"
|
|
15
|
+
_file="$2"
|
|
16
|
+
if sed --version >/dev/null 2>&1; then
|
|
17
|
+
sed -i "$_expr" "$_file"
|
|
18
|
+
else
|
|
19
|
+
sed -i '' "$_expr" "$_file"
|
|
20
|
+
fi
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if [ -z "$ROOTDIR" ]; then
|
|
24
|
+
ROOTDIR="$(git rev-parse --show-toplevel 2>/dev/null)"
|
|
25
|
+
fi
|
|
26
|
+
DOTENV_FILE="${DOTENV_FILE:-$ROOTDIR/.env}"
|
|
27
|
+
if [ -f "$DOTENV_FILE" ]; then
|
|
28
|
+
. "$DOTENV_FILE"
|
|
29
|
+
fi
|
|
30
|
+
kill_port "${FRAPPE_PORT:-8000}"
|
|
31
|
+
kill_port "${FRAPPE_SOCKETIO_PORT:-9000}"
|
|
32
|
+
BENCH_DIR="${BENCH_DIR:-$ROOTDIR/apps/frappe}"
|
|
33
|
+
sh "$(cd "$(dirname "$0")" && pwd)/frappe-bootstrap.sh"
|
|
34
|
+
cd "$BENCH_DIR"
|
|
35
|
+
. env/bin/activate
|
|
36
|
+
_sed "s|[^ ]*/node |$(command -v node) |g" "$BENCH_DIR/Procfile"
|
|
37
|
+
_sed "s| bench | uv tool run --from frappe-bench bench |g" "$BENCH_DIR/Procfile"
|
|
38
|
+
_sed "s|: *bench |: uv tool run --from frappe-bench bench |g" "$BENCH_DIR/Procfile"
|
|
39
|
+
_sed "s|uv tool run --from frappe-bench bench serve.*--port [0-9][0-9]*|uv tool run --from frappe-bench bench serve --port ${FRAPPE_PORT:-8000}|g" "$BENCH_DIR/Procfile"
|
|
40
|
+
command -v honcho >/dev/null 2>&1 || uv pip install honcho
|
|
41
|
+
exec honcho start "$@"
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
# Shared helper functions for frappe CLI scripts.
|
|
4
|
+
|
|
5
|
+
frappe_keep_init() {
|
|
6
|
+
FRAPPE_KEEP_APPS=" frappe "
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
frappe_add_keep() {
|
|
10
|
+
_name="$1"
|
|
11
|
+
[ -n "$_name" ] || return 0
|
|
12
|
+
case "$FRAPPE_KEEP_APPS" in
|
|
13
|
+
*" $_name "*) ;;
|
|
14
|
+
*) FRAPPE_KEEP_APPS="$FRAPPE_KEEP_APPS$_name " ;;
|
|
15
|
+
esac
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
frappe_collect_keep_apps() {
|
|
19
|
+
# Keep local file-sourced apps from frappe.yaml when they point inside BENCH_DIR/apps.
|
|
20
|
+
if [ -f "$BENCH_DIR/frappe.yaml" ]; then
|
|
21
|
+
_tmp_sources="$(mktemp)" || return 1
|
|
22
|
+
sed -n 's/^[[:space:]]*-[[:space:]]*//p' "$BENCH_DIR/frappe.yaml" > "$_tmp_sources"
|
|
23
|
+
while IFS= read -r _src; do
|
|
24
|
+
[ -n "$_src" ] || continue
|
|
25
|
+
case "$_src" in
|
|
26
|
+
file://* | ./* | ../* | /*) ;;
|
|
27
|
+
*) continue ;;
|
|
28
|
+
esac
|
|
29
|
+
_path="${_src#file://}"
|
|
30
|
+
case "$_path" in
|
|
31
|
+
./* | ../*) _path="$(realpath "$BENCH_DIR/$_path" 2>/dev/null || true)" ;;
|
|
32
|
+
/*) _path="$(realpath "$_path" 2>/dev/null || true)" ;;
|
|
33
|
+
esac
|
|
34
|
+
case "$_path" in
|
|
35
|
+
"$BENCH_DIR/apps/"*) frappe_add_keep "$(basename "$_path")" ;;
|
|
36
|
+
esac
|
|
37
|
+
done < "$_tmp_sources"
|
|
38
|
+
rm -f "$_tmp_sources"
|
|
39
|
+
fi
|
|
40
|
+
|
|
41
|
+
# Keep local file-sourced apps from sites/apps.json when present.
|
|
42
|
+
if [ -f "$BENCH_DIR/sites/apps.json" ]; then
|
|
43
|
+
_tmp_json_apps="$(mktemp)" || return 1
|
|
44
|
+
python3 - "$BENCH_DIR/sites/apps.json" "$BENCH_DIR/apps" > "$_tmp_json_apps" <<'PY'
|
|
45
|
+
import json, os, sys
|
|
46
|
+
apps_json = sys.argv[1]
|
|
47
|
+
apps_root = os.path.realpath(sys.argv[2])
|
|
48
|
+
|
|
49
|
+
def walk(v):
|
|
50
|
+
if isinstance(v, dict):
|
|
51
|
+
for vv in v.values():
|
|
52
|
+
yield from walk(vv)
|
|
53
|
+
elif isinstance(v, list):
|
|
54
|
+
for vv in v:
|
|
55
|
+
yield from walk(vv)
|
|
56
|
+
elif isinstance(v, str):
|
|
57
|
+
yield v
|
|
58
|
+
|
|
59
|
+
with open(apps_json, "r", encoding="utf-8") as f:
|
|
60
|
+
data = json.load(f)
|
|
61
|
+
|
|
62
|
+
seen = set()
|
|
63
|
+
for s in walk(data):
|
|
64
|
+
raw = None
|
|
65
|
+
if s.startswith("file://"):
|
|
66
|
+
raw = s[7:]
|
|
67
|
+
elif s.startswith("./") or s.startswith("../") or s.startswith("/"):
|
|
68
|
+
raw = s
|
|
69
|
+
if not raw:
|
|
70
|
+
continue
|
|
71
|
+
p = os.path.realpath(raw if os.path.isabs(raw) else os.path.join(apps_root, "..", raw))
|
|
72
|
+
if p.startswith(apps_root + os.sep):
|
|
73
|
+
name = os.path.basename(p)
|
|
74
|
+
if name and name not in seen:
|
|
75
|
+
print(name)
|
|
76
|
+
seen.add(name)
|
|
77
|
+
PY
|
|
78
|
+
while IFS= read -r _name; do
|
|
79
|
+
frappe_add_keep "$_name"
|
|
80
|
+
done < "$_tmp_json_apps"
|
|
81
|
+
rm -f "$_tmp_json_apps"
|
|
82
|
+
fi
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
frappe_remove_non_keep_apps() {
|
|
86
|
+
for _d in "$BENCH_DIR/apps"/*/; do
|
|
87
|
+
[ -d "$_d" ] || continue
|
|
88
|
+
_name="$(basename "$_d")"
|
|
89
|
+
case "$FRAPPE_KEEP_APPS" in
|
|
90
|
+
*" $_name "*) ;;
|
|
91
|
+
*) rm -rf "$_d" ;;
|
|
92
|
+
esac
|
|
93
|
+
done
|
|
94
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
set -e
|
|
3
|
+
|
|
4
|
+
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
5
|
+
|
|
6
|
+
usage() {
|
|
7
|
+
cat <<'EOF'
|
|
8
|
+
Usage: frappe.sh <command> [options]
|
|
9
|
+
|
|
10
|
+
Commands:
|
|
11
|
+
dev Start Frappe development server
|
|
12
|
+
bootstrap [--update] Bootstrap Frappe environment
|
|
13
|
+
clean [--cache] Clean bench artifacts
|
|
14
|
+
reset [--cache] [--update]
|
|
15
|
+
Clean then bootstrap
|
|
16
|
+
bench [args...] Run bench command via uv
|
|
17
|
+
EOF
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
command="$1"
|
|
21
|
+
[ -n "$command" ] || {
|
|
22
|
+
usage
|
|
23
|
+
exit 1
|
|
24
|
+
}
|
|
25
|
+
shift || true
|
|
26
|
+
|
|
27
|
+
case "$command" in
|
|
28
|
+
dev)
|
|
29
|
+
exec sh "$SCRIPT_DIR/frappe-dev.sh" "$@"
|
|
30
|
+
;;
|
|
31
|
+
bootstrap)
|
|
32
|
+
exec sh "$SCRIPT_DIR/frappe-bootstrap.sh" "$@"
|
|
33
|
+
;;
|
|
34
|
+
clean)
|
|
35
|
+
exec sh "$SCRIPT_DIR/frappe-clean.sh" "$@"
|
|
36
|
+
;;
|
|
37
|
+
bench)
|
|
38
|
+
exec sh "$SCRIPT_DIR/frappe-bench.sh" "$@"
|
|
39
|
+
;;
|
|
40
|
+
reset)
|
|
41
|
+
CLEAN_ARGS=""
|
|
42
|
+
BOOTSTRAP_ARGS=""
|
|
43
|
+
while [ $# -gt 0 ]; do
|
|
44
|
+
case "$1" in
|
|
45
|
+
--cache)
|
|
46
|
+
CLEAN_ARGS="$CLEAN_ARGS --cache"
|
|
47
|
+
;;
|
|
48
|
+
--update)
|
|
49
|
+
BOOTSTRAP_ARGS="$BOOTSTRAP_ARGS --update"
|
|
50
|
+
;;
|
|
51
|
+
*)
|
|
52
|
+
echo "unknown reset option: $1" >&2
|
|
53
|
+
usage
|
|
54
|
+
exit 1
|
|
55
|
+
;;
|
|
56
|
+
esac
|
|
57
|
+
shift
|
|
58
|
+
done
|
|
59
|
+
# shellcheck disable=SC2086
|
|
60
|
+
sh "$SCRIPT_DIR/frappe-clean.sh" $CLEAN_ARGS
|
|
61
|
+
# shellcheck disable=SC2086
|
|
62
|
+
exec sh "$SCRIPT_DIR/frappe-bootstrap.sh" $BOOTSTRAP_ARGS
|
|
63
|
+
;;
|
|
64
|
+
-h | --help | help)
|
|
65
|
+
usage
|
|
66
|
+
;;
|
|
67
|
+
*)
|
|
68
|
+
echo "unknown command: $command" >&2
|
|
69
|
+
usage
|
|
70
|
+
exit 1
|
|
71
|
+
;;
|
|
72
|
+
esac
|
package/scripts/update.sh
CHANGED
|
@@ -1,42 +1,46 @@
|
|
|
1
1
|
#!/bin/sh
|
|
2
|
+
# Merge from upstream. Run from project root.
|
|
3
|
+
# Usage: update.sh <remote_url> [branch]
|
|
4
|
+
# Example: update.sh https://gitlab.com/bitspur/multiplatform.one/multiplatform.one.git main
|
|
2
5
|
|
|
3
6
|
set -e
|
|
4
7
|
|
|
5
8
|
_get_remote_name() {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
_BASE_NAME="multiplatform"
|
|
10
|
+
_NUMBER="$(date +%s)"
|
|
11
|
+
_REMOTE_NAME="$_BASE_NAME.$_NUMBER"
|
|
12
|
+
while git remote | grep -q "^$_REMOTE_NAME$"; do
|
|
13
|
+
_NUMBER="$((_NUMBER + 1))"
|
|
14
|
+
_REMOTE_NAME="$_BASE_NAME.$_NUMBER"
|
|
15
|
+
done
|
|
16
|
+
echo "$_REMOTE_NAME"
|
|
14
17
|
}
|
|
15
18
|
|
|
19
|
+
if [ $# -lt 1 ]; then
|
|
20
|
+
echo "Usage: $0 <remote_url> [branch]" >&2
|
|
21
|
+
exit 1
|
|
22
|
+
fi
|
|
23
|
+
|
|
24
|
+
REMOTE_URL="$1"
|
|
25
|
+
BRANCH="${2:-main}"
|
|
16
26
|
_PROJECT_DIR="$(pwd)"
|
|
17
|
-
_STAGING_DIR="$(mktemp -d)"
|
|
18
|
-
trap "rm -rf \"$_STAGING_DIR\"" EXIT
|
|
19
|
-
cd "$_STAGING_DIR"
|
|
20
|
-
$COOKIECUTTER "$@"
|
|
21
|
-
cd "$_PROJECT_DIR"
|
|
22
|
-
git clean -fxd
|
|
23
|
-
_COOKIECUTTER_DIR="$_STAGING_DIR/$(ls "$_STAGING_DIR")"
|
|
24
27
|
_INITIAL_COMMIT="$(git rev-parse HEAD)"
|
|
25
28
|
_REMOTE_NAME="$(_get_remote_name)"
|
|
26
|
-
|
|
27
|
-
git
|
|
28
|
-
git
|
|
29
|
+
|
|
30
|
+
git remote add "$_REMOTE_NAME" "$REMOTE_URL"
|
|
31
|
+
git fetch "$_REMOTE_NAME" "$BRANCH"
|
|
32
|
+
git merge --allow-unrelated-histories "$_REMOTE_NAME/$BRANCH" || true
|
|
29
33
|
git remote remove "$_REMOTE_NAME"
|
|
34
|
+
|
|
30
35
|
if [ -f .updateignore ]; then
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
while IFS= read -r pattern; do
|
|
37
|
+
find . -name "$pattern" -exec git checkout "$_INITIAL_COMMIT" -- '{}' +
|
|
38
|
+
done < .updateignore
|
|
34
39
|
fi
|
|
35
40
|
while IFS= read -r pattern; do
|
|
36
|
-
|
|
41
|
+
find . -name "$pattern" -exec git checkout "$_INITIAL_COMMIT" -- '{}' +
|
|
37
42
|
done <<EOF
|
|
38
|
-
|
|
39
|
-
platforms/storybook/.lostpixel/baseline
|
|
43
|
+
apps/storybook/.lostpixel/baseline
|
|
40
44
|
pnpm-lock.yaml
|
|
41
45
|
EOF
|
|
42
|
-
|
|
46
|
+
pnpm lint
|