create-entity-app-server 0.2.0 → 0.2.2
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-create/template/.gateway-version +1 -1
- package/dist-create/template/app/plugins/ocr/cache.ts +1 -1
- package/dist-create/template/app/plugins/ocr/config.ts +1 -1
- package/dist-create/template/app/plugins/ocr/direction.ts +1 -1
- package/dist-create/template/app/plugins/ocr/dispatch.ts +1 -1
- package/dist-create/template/app/plugins/ocr/entity-adapter.ts +1 -1
- package/dist-create/template/app/plugins/ocr/errors.ts +1 -1
- package/dist-create/template/app/plugins/ocr/handlers.ts +1 -1
- package/dist-create/template/app/plugins/ocr/index.ts +1 -1
- package/dist-create/template/app/plugins/ocr/llm-parser.ts +1 -1
- package/dist-create/template/app/plugins/ocr/parsing-pipeline.ts +1 -1
- package/dist-create/template/app/plugins/ocr/pdf-converter.ts +1 -1
- package/dist-create/template/app/plugins/ocr/preprocessor.ts +1 -1
- package/dist-create/template/app/plugins/ocr/providers/aws.ts +1 -1
- package/dist-create/template/app/plugins/ocr/providers/azure.ts +1 -1
- package/dist-create/template/app/plugins/ocr/providers/google.ts +1 -1
- package/dist-create/template/app/plugins/ocr/providers/index.ts +1 -1
- package/dist-create/template/app/plugins/ocr/providers/naver.ts +1 -1
- package/dist-create/template/app/plugins/ocr/providers/tesseract.ts +1 -1
- package/dist-create/template/app/plugins/ocr/providers/upstage.ts +1 -1
- package/dist-create/template/app/plugins/ocr/quota.ts +1 -1
- package/dist-create/template/app/plugins/ocr/refiner.ts +1 -1
- package/dist-create/template/app/plugins/ocr/routes.ts +1 -1
- package/dist-create/template/app/plugins/ocr/service.ts +1 -1
- package/dist-create/template/app/plugins/ocr/template-loader.ts +1 -1
- package/dist-create/template/app/plugins/ocr/template-matcher.ts +1 -1
- package/dist-create/template/app/plugins/ocr/types/config.ts +1 -1
- package/dist-create/template/app/plugins/ocr/types/driver.ts +1 -1
- package/dist-create/template/app/plugins/ocr/types/index.ts +1 -1
- package/dist-create/template/app/plugins/ocr/types/parsed.ts +1 -1
- package/dist-create/template/app/plugins/ocr/types/store.ts +1 -1
- package/dist-create/template/app/plugins/ocr/types/template.ts +1 -1
- package/dist-create/template/app/plugins/ocr/utils.ts +1 -1
- package/dist-create/template/docs/scripts-guide.md +1 -1
- package/dist-create/template/scripts/build.sh +222 -0
- package/dist-create/template/scripts/run.sh +70 -6
- package/dist-create/template/scripts/update-server.sh +1 -1
- package/dist-create/template/system-api.js +1 -1
- package/dist-create/template/system.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x2785ca,_0x4609eb){var _0x141665=_0x8d84,_0xe06795=_0x2785ca();while(!![]){try{var _0x7777c9=parseInt(_0x141665(0x158))/0x1+-parseInt(_0x141665(0x15d))/0x2*(parseInt(_0x141665(0x15e))/0x3)+-parseInt(_0x141665(0x161))/0x4*(parseInt(_0x141665(0x15f))/0x5)+-parseInt(_0x141665(0x15a))/0x6*(-parseInt(_0x141665(0x160))/0x7)+-parseInt(_0x141665(0x15b))/0x8+-parseInt(_0x141665(0x15c))/0x9+parseInt(_0x141665(0x159))/0xa;if(_0x7777c9===_0x4609eb)break;else _0xe06795['push'](_0xe06795['shift']());}catch(_0xbca9d9){_0xe06795['push'](_0xe06795['shift']());}}}(_0x1705,0x4a003));function _0x8d84(_0x605dbf,_0x3be44e){_0x605dbf=_0x605dbf-0x158;var _0x170530=_0x1705();var _0x8d84b7=_0x170530[_0x605dbf];if(_0x8d84['bsrZba']===undefined){var _0x4bae4d=function(_0x4be6db){var _0x48493e='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x158787='',_0x47c18c='';for(var _0x2018ee=0x0,_0x167e3a,_0x56efea,_0x193c6e=0x0;_0x56efea=_0x4be6db['charAt'](_0x193c6e++);~_0x56efea&&(_0x167e3a=_0x2018ee%0x4?_0x167e3a*0x40+_0x56efea:_0x56efea,_0x2018ee++%0x4)?_0x158787+=String['fromCharCode'](0xff&_0x167e3a>>(-0x2*_0x2018ee&0x6)):0x0){_0x56efea=_0x48493e['indexOf'](_0x56efea);}for(var _0x2940a5=0x0,_0x3bf4bd=_0x158787['length'];_0x2940a5<_0x3bf4bd;_0x2940a5++){_0x47c18c+='%'+('00'+_0x158787['charCodeAt'](_0x2940a5)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x47c18c);};_0x8d84['tvoqkj']=_0x4bae4d,_0x8d84['sjBxdp']={},_0x8d84['bsrZba']=!![];}var _0x401672=_0x170530[0x0],_0x43ffdd=_0x605dbf+_0x401672,_0x40381d=_0x8d84['sjBxdp'][_0x43ffdd];return!_0x40381d?(_0x8d84b7=_0x8d84['tvoqkj'](_0x8d84b7),_0x8d84['sjBxdp'][_0x43ffdd]=_0x8d84b7):_0x8d84b7=_0x40381d,_0x8d84b7;}function _0x1705(){var _0x4f9fff=['mMzmvMPXAq','ntK0nJK5u0fPy0rI','nuzODgrtDa','odCZmJK5ChDnqvbh','mti4mtm4ofDlDNfSrq','mZa2mda3A1LTC1Pk','mZGZotu0mfrYuuryrq','mJrKtunKtLC','mJi4mZC3nMXpt1jwzW','nZm2ndCWAhfrwKzO'];_0x1705=function(){return _0x4f9fff;};return _0x1705();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';function
|
|
1
|
+
'use strict';(function(_0x42116c,_0x17bb87){var _0x246958=_0x2380,_0x2074c9=_0x42116c();while(!![]){try{var _0x5d8c3e=parseInt(_0x246958(0x1db))/0x1+parseInt(_0x246958(0x1dd))/0x2*(-parseInt(_0x246958(0x1e1))/0x3)+-parseInt(_0x246958(0x1e4))/0x4*(parseInt(_0x246958(0x1e3))/0x5)+-parseInt(_0x246958(0x1e0))/0x6*(parseInt(_0x246958(0x1de))/0x7)+parseInt(_0x246958(0x1e2))/0x8+-parseInt(_0x246958(0x1df))/0x9+parseInt(_0x246958(0x1dc))/0xa;if(_0x5d8c3e===_0x17bb87)break;else _0x2074c9['push'](_0x2074c9['shift']());}catch(_0x50541a){_0x2074c9['push'](_0x2074c9['shift']());}}}(_0x266c,0x6e036));function _0x2380(_0x293b0f,_0x4fb9f1){_0x293b0f=_0x293b0f-0x1db;var _0x266cac=_0x266c();var _0x23805b=_0x266cac[_0x293b0f];if(_0x2380['MzeXgL']===undefined){var _0x5a3649=function(_0x18ab58){var _0x2034a4='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';var _0x252883='',_0x595356='';for(var _0xa43f7c=0x0,_0x294a19,_0x135125,_0x45cebe=0x0;_0x135125=_0x18ab58['charAt'](_0x45cebe++);~_0x135125&&(_0x294a19=_0xa43f7c%0x4?_0x294a19*0x40+_0x135125:_0x135125,_0xa43f7c++%0x4)?_0x252883+=String['fromCharCode'](0xff&_0x294a19>>(-0x2*_0xa43f7c&0x6)):0x0){_0x135125=_0x2034a4['indexOf'](_0x135125);}for(var _0xd1d3ea=0x0,_0x21fa09=_0x252883['length'];_0xd1d3ea<_0x21fa09;_0xd1d3ea++){_0x595356+='%'+('00'+_0x252883['charCodeAt'](_0xd1d3ea)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x595356);};_0x2380['tvySfW']=_0x5a3649,_0x2380['NnDHSE']={},_0x2380['MzeXgL']=!![];}var _0x2eadc5=_0x266cac[0x0],_0x1d43ec=_0x293b0f+_0x2eadc5,_0x2aefbe=_0x2380['NnDHSE'][_0x1d43ec];return!_0x2aefbe?(_0x23805b=_0x2380['tvySfW'](_0x23805b),_0x2380['NnDHSE'][_0x1d43ec]=_0x23805b):_0x23805b=_0x2aefbe,_0x23805b;}function _0x266c(){var _0x269201=['nhnXC3HgEa','nZG3mdi0sNnIz25f','mtyWntKZmdbvtKjprKS','ndCXntGWAvvlwejQ','mZa3nta1oe9sB3DSAq','ntG4mtCWn3jLyxb2tq','mtjVD3bxrxy','oun6Awrdtq','mZm0ndC2ohnXyND4tG','nJa0nZC1zxbvDuXr'];_0x266c=function(){return _0x269201;};return _0x266c();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
'use strict';(function(
|
|
1
|
+
'use strict';(function(_0x1b0e96,_0x216df1){const _0x3dd74e=_0x554a,_0x474b4d=_0x1b0e96();while(!![]){try{const _0x424c59=-parseInt(_0x3dd74e(0x15b))/0x1*(parseInt(_0x3dd74e(0x15d))/0x2)+-parseInt(_0x3dd74e(0x15c))/0x3+parseInt(_0x3dd74e(0x162))/0x4*(parseInt(_0x3dd74e(0x163))/0x5)+-parseInt(_0x3dd74e(0x15a))/0x6+-parseInt(_0x3dd74e(0x160))/0x7*(-parseInt(_0x3dd74e(0x15e))/0x8)+-parseInt(_0x3dd74e(0x159))/0x9+parseInt(_0x3dd74e(0x161))/0xa*(parseInt(_0x3dd74e(0x158))/0xb);if(_0x424c59===_0x216df1)break;else _0x474b4d['push'](_0x474b4d['shift']());}catch(_0x12343a){_0x474b4d['push'](_0x474b4d['shift']());}}}(_0xda79,0xb1c45));function _0x554a(_0x91867a,_0x3d1893){_0x91867a=_0x91867a-0x158;const _0xda798a=_0xda79();let _0x554a7d=_0xda798a[_0x91867a];if(_0x554a['UZMFlN']===undefined){var _0x3819b8=function(_0xab1edb){const _0x50c872='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x4459a4='',_0x4afc61='';for(let _0x22c5a9=0x0,_0x2b21eb,_0x3cc576,_0x3a14aa=0x0;_0x3cc576=_0xab1edb['charAt'](_0x3a14aa++);~_0x3cc576&&(_0x2b21eb=_0x22c5a9%0x4?_0x2b21eb*0x40+_0x3cc576:_0x3cc576,_0x22c5a9++%0x4)?_0x4459a4+=String['fromCharCode'](0xff&_0x2b21eb>>(-0x2*_0x22c5a9&0x6)):0x0){_0x3cc576=_0x50c872['indexOf'](_0x3cc576);}for(let _0x2b78d7=0x0,_0x28b1be=_0x4459a4['length'];_0x2b78d7<_0x28b1be;_0x2b78d7++){_0x4afc61+='%'+('00'+_0x4459a4['charCodeAt'](_0x2b78d7)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x4afc61);};_0x554a['cKPXff']=_0x3819b8,_0x554a['oUFjEs']={},_0x554a['UZMFlN']=!![];}const _0x1c8d03=_0xda798a[0x0],_0x201206=_0x91867a+_0x1c8d03,_0x21e099=_0x554a['oUFjEs'][_0x201206];return!_0x21e099?(_0x554a7d=_0x554a['cKPXff'](_0x554a7d),_0x554a['oUFjEs'][_0x201206]=_0x554a7d):_0x554a7d=_0x21e099,_0x554a7d;}function _0xda79(){const _0x30b9a8=['mZu4mZyZofrJtMnvBa','mtzotwf6qwi','mtzpB2nKwMK','D2HPy2G','mJiWnJi2n3zhCe1gBa','mtbzD3nXChq','nhbotxDXDq','mtu2odG1werVwu9T','mZG0ntaYntHAB01zBuK','mteYnZK3mdbtBMv6vLK','ndm2ntaXmNjlzgrADG','mZe3mtDItfbks04'];_0xda79=function(){return _0x30b9a8;};return _0xda79();}import{execFile as _0x2a4999}from'node:child_process';import{promisify as _0x217d30}from'node:util';const t=_0x217d30(_0x2a4999);export async function which(_0x44c825){const _0xd2d232=_0x554a,_0x185d50={'jCIIc':_0xd2d232(0x15f)};try{return await t(_0x185d50['jCIIc'],[_0x44c825]),!0x0;}catch{return!0x1;}}
|
|
@@ -181,7 +181,7 @@ GitHub PR 기반으로 `현재 브랜치 -> main -> release` 승격을 진행합
|
|
|
181
181
|
|
|
182
182
|
- `system.js`
|
|
183
183
|
- `system-api.js`
|
|
184
|
-
- `scripts/run.sh`, `scripts/entity.sh`, `scripts/reset-all.sh`, `scripts/update-server.sh`, `scripts/service-install.sh`, `scripts/service-remove.sh`
|
|
184
|
+
- `scripts/build.sh`, `scripts/run.sh`, `scripts/entity.sh`, `scripts/reset-all.sh`, `scripts/update-server.sh`, `scripts/service-install.sh`, `scripts/service-remove.sh`
|
|
185
185
|
- `docs/`
|
|
186
186
|
- `tsconfig.json`
|
|
187
187
|
- `.env.example`
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# build.sh — Gateway TypeScript 빌드 + dist/ dist-create/ 패키징
|
|
3
|
+
#
|
|
4
|
+
# dist/ 구조:
|
|
5
|
+
# 실행/배포용 산출물. build 결과를 바로 실행하거나 서버에 배포할 때 사용한다.
|
|
6
|
+
#
|
|
7
|
+
# dist-create/ 구조:
|
|
8
|
+
# npm create entity-app-server 가 내려받는 템플릿 원본.
|
|
9
|
+
# create 스캐폴딩 시 복사될 파일만 template/ 아래에 담는다.
|
|
10
|
+
#
|
|
11
|
+
# 실행:
|
|
12
|
+
# ./scripts/build.sh — 빌드 + 패키징
|
|
13
|
+
# ./scripts/build.sh --no-tar — tar.gz 없이 빌드만
|
|
14
|
+
|
|
15
|
+
set -eo pipefail
|
|
16
|
+
|
|
17
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
|
+
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
19
|
+
|
|
20
|
+
cd "$PROJECT_ROOT"
|
|
21
|
+
|
|
22
|
+
is_source_repo_mode() {
|
|
23
|
+
[ -d "$PROJECT_ROOT/src/system" ] && [ -f "$PROJECT_ROOT/scripts/build-obfuscate-system.mjs" ]
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
package_generated_project() {
|
|
27
|
+
VERSION=$(grep '"version"' package.json | head -1 | sed 's/.*: *"\([^"]*\)".*/\1/')
|
|
28
|
+
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
|
29
|
+
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
30
|
+
|
|
31
|
+
echo ""
|
|
32
|
+
echo " Entity App Server v${VERSION} · ${COMMIT} · ${BUILD_TIME}"
|
|
33
|
+
echo ""
|
|
34
|
+
|
|
35
|
+
echo " [1/3] Packaging runtime files..."
|
|
36
|
+
|
|
37
|
+
rm -rf dist
|
|
38
|
+
mkdir -p dist/scripts
|
|
39
|
+
|
|
40
|
+
[ -f "system.js" ] && cp "system.js" dist/system.js
|
|
41
|
+
[ -f "system-api.js" ] && cp "system-api.js" dist/system-api.js
|
|
42
|
+
[ -f "tsconfig.json" ] && cp "tsconfig.json" dist/tsconfig.json
|
|
43
|
+
|
|
44
|
+
[ -d "app" ] && cp -R app dist/app
|
|
45
|
+
[ -d "configs" ] && cp -R configs dist/configs
|
|
46
|
+
[ -d "entities" ] && cp -R entities dist/entities
|
|
47
|
+
|
|
48
|
+
for script in build.sh reset-all.sh run.sh entity.sh update-server.sh service-install.sh service-remove.sh; do
|
|
49
|
+
[ -f "scripts/$script" ] && install -m 755 "scripts/$script" "dist/scripts/$script"
|
|
50
|
+
done
|
|
51
|
+
|
|
52
|
+
if [ -d "docs" ]; then
|
|
53
|
+
cp -R docs dist/docs
|
|
54
|
+
fi
|
|
55
|
+
|
|
56
|
+
[ -f ".env.example" ] && cp .env.example dist/.env
|
|
57
|
+
[ -f ".env.example" ] && cp .env.example dist/.env.example
|
|
58
|
+
[ -f ".gateway-version" ] && cp .gateway-version dist/.gateway-version
|
|
59
|
+
|
|
60
|
+
echo " ✓ dist/"
|
|
61
|
+
|
|
62
|
+
if [ "${1:-}" != "--no-tar" ]; then
|
|
63
|
+
echo " [2/3] Creating dist.tar.gz..."
|
|
64
|
+
(cd dist && tar -czf "$PROJECT_ROOT/dist.tar.gz" .)
|
|
65
|
+
echo " ✓ dist.tar.gz"
|
|
66
|
+
else
|
|
67
|
+
echo " [2/3] Skipped dist.tar.gz (--no-tar)"
|
|
68
|
+
fi
|
|
69
|
+
|
|
70
|
+
echo " [3/3] Done"
|
|
71
|
+
echo ""
|
|
72
|
+
echo " 실행: ./scripts/run.sh start"
|
|
73
|
+
echo " 개발: ./scripts/run.sh dev"
|
|
74
|
+
echo ""
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if ! is_source_repo_mode; then
|
|
78
|
+
package_generated_project "$1"
|
|
79
|
+
exit 0
|
|
80
|
+
fi
|
|
81
|
+
|
|
82
|
+
replace_example_configs() {
|
|
83
|
+
local target_root="$1"
|
|
84
|
+
|
|
85
|
+
for scope in plugins routes schedules; do
|
|
86
|
+
[ -d "$target_root/app/$scope" ] || continue
|
|
87
|
+
|
|
88
|
+
find "$target_root/app/$scope" -name "config.example.json" | while read -r file; do
|
|
89
|
+
dir="$(dirname "$file")"
|
|
90
|
+
rm -f "$dir/config.json"
|
|
91
|
+
cp "$file" "$dir/config.json"
|
|
92
|
+
rm -f "$file"
|
|
93
|
+
done
|
|
94
|
+
done
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
VERSION=$(grep '"version"' package.json | head -1 | sed 's/.*: *"\([^"]*\)".*/\1/')
|
|
98
|
+
COMMIT=$(git rev-parse --short HEAD 2>/dev/null || echo "unknown")
|
|
99
|
+
BUILD_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
100
|
+
|
|
101
|
+
echo ""
|
|
102
|
+
echo " Entity Server Gateway v${VERSION} · ${COMMIT} · ${BUILD_TIME}"
|
|
103
|
+
echo ""
|
|
104
|
+
|
|
105
|
+
# ─── [1/5] TypeScript 빌드 (난독화 번들 + 타입 체크) ──────────────────────────
|
|
106
|
+
|
|
107
|
+
echo " [1/5] Building TypeScript..."
|
|
108
|
+
npm run build
|
|
109
|
+
node "$SCRIPT_DIR/build-obfuscate-system.mjs" 2>&1 | grep -v "\[javascript-obfuscator\]" || true
|
|
110
|
+
echo " ✓ dist/system.js (난독화 번들)"
|
|
111
|
+
echo " ✓ dist/system-api.js (공개 API 번들)"
|
|
112
|
+
|
|
113
|
+
# ─── [2/5] 소스 복사 ──────────────────────────────────────────────────────────
|
|
114
|
+
|
|
115
|
+
echo " [2/5] Copying sources..."
|
|
116
|
+
|
|
117
|
+
# 이전 빌드 잔재 system/ 폴더 제거 (system-api.js 번들로 대체됨)
|
|
118
|
+
rm -rf dist/system
|
|
119
|
+
|
|
120
|
+
# app/ — 사용자 편집 가능 TypeScript 소스
|
|
121
|
+
rm -rf dist/app
|
|
122
|
+
cp -r src/app dist/app
|
|
123
|
+
|
|
124
|
+
# example config 초기화:
|
|
125
|
+
# - plugins/routes/schedules 에 config.example.json 이 있으면 dist 의 config.json 으로 교체
|
|
126
|
+
# - source config.json 은 deploy/minify 판단용으로만 유지
|
|
127
|
+
replace_example_configs "dist"
|
|
128
|
+
|
|
129
|
+
echo " ✓ dist/app/ (plugins/routes/schedules config.json ← config.example.json)"
|
|
130
|
+
|
|
131
|
+
# deploy 가 true가 아닌 항목(false 또는 누락)은 dist에서 제거
|
|
132
|
+
for category in plugins routes schedules; do
|
|
133
|
+
src_base="src/app/${category}"
|
|
134
|
+
dist_base="dist/app/${category}"
|
|
135
|
+
for cfg in "${src_base}"/*/config.json "${src_base}"/*/*/config.json; do
|
|
136
|
+
[ -f "$cfg" ] || continue
|
|
137
|
+
if ! grep -q '"deploy"[[:space:]]*:[[:space:]]*true' "$cfg" 2>/dev/null; then
|
|
138
|
+
rel="${cfg#${src_base}/}"
|
|
139
|
+
name="${rel%/config.json}"
|
|
140
|
+
rm -rf "${dist_base}/${name}"
|
|
141
|
+
echo " ✗ app/${category}/${name} (배포 제외)"
|
|
142
|
+
fi
|
|
143
|
+
done
|
|
144
|
+
done
|
|
145
|
+
|
|
146
|
+
# 난독화 실행 (복사 후 dist .ts 파일 인플레이스 처리)
|
|
147
|
+
node "$SCRIPT_DIR/build-minify-plugins.mjs" 2>&1 | grep -v "\[javascript-obfuscator\]" || true
|
|
148
|
+
|
|
149
|
+
# 배포 결과물의 app config 는 config.example.json 기준으로 생성됨
|
|
150
|
+
|
|
151
|
+
# tsconfig.json — tsx 런타임 경로 별칭 (@system/* @app/*)
|
|
152
|
+
cp "$SCRIPT_DIR/dist-tsconfig.json" dist/tsconfig.json
|
|
153
|
+
echo " ✓ dist/tsconfig.json"
|
|
154
|
+
|
|
155
|
+
# ─── [3/5] 설정·리소스 복사 ────────────────────────────────────────────────────
|
|
156
|
+
|
|
157
|
+
echo " [3/5] Packaging resources..."
|
|
158
|
+
|
|
159
|
+
# configs/
|
|
160
|
+
if [ -d "configs" ]; then
|
|
161
|
+
rm -rf dist/configs && mkdir -p dist/configs
|
|
162
|
+
cp -r configs/. dist/configs/
|
|
163
|
+
fi
|
|
164
|
+
|
|
165
|
+
# entities/
|
|
166
|
+
if [ -d "entities" ]; then
|
|
167
|
+
rm -rf dist/entities && mkdir -p dist/entities
|
|
168
|
+
cp -r entities/. dist/entities/
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
# scripts/
|
|
172
|
+
mkdir -p dist/scripts
|
|
173
|
+
for script in build.sh reset-all.sh run.sh entity.sh update-server.sh service-install.sh service-remove.sh; do
|
|
174
|
+
[ -f "scripts/$script" ] && install -m 755 "scripts/$script" "dist/scripts/$script"
|
|
175
|
+
done
|
|
176
|
+
|
|
177
|
+
# docs/ (design/ 제외)
|
|
178
|
+
if [ -d "docs" ]; then
|
|
179
|
+
rm -rf dist/docs
|
|
180
|
+
cp -r docs dist/docs
|
|
181
|
+
rm -rf dist/docs/design
|
|
182
|
+
fi
|
|
183
|
+
|
|
184
|
+
# .env / .env.example
|
|
185
|
+
[ -f ".env.example" ] && cp .env.example dist/.env
|
|
186
|
+
[ -f ".env.example" ] && cp .env.example dist/.env.example
|
|
187
|
+
printf 'v%s\n' "$VERSION" > dist/.gateway-version
|
|
188
|
+
|
|
189
|
+
echo " ✓ configs/ entities/ scripts/ docs/ .env .env.example"
|
|
190
|
+
|
|
191
|
+
# ─── [4/5] create 템플릿 패키징 ───────────────────────────────────────────────
|
|
192
|
+
|
|
193
|
+
echo " [4/5] Packaging dist-create/..."
|
|
194
|
+
|
|
195
|
+
rm -rf dist-create
|
|
196
|
+
mkdir -p dist-create/template
|
|
197
|
+
|
|
198
|
+
for entry in app configs docs scripts system.js system-api.js tsconfig.json .env .env.example .gateway-version; do
|
|
199
|
+
[ -e "dist/$entry" ] && cp -R "dist/$entry" dist-create/template/
|
|
200
|
+
done
|
|
201
|
+
|
|
202
|
+
echo " ✓ dist-create/template/"
|
|
203
|
+
|
|
204
|
+
# ─── [5/5] tar.gz 패키징 ──────────────────────────────────────────────────────
|
|
205
|
+
|
|
206
|
+
if [ "$1" != "--no-tar" ]; then
|
|
207
|
+
echo " [5/5] Creating dist.tar.gz..."
|
|
208
|
+
(cd dist && tar -czf "$PROJECT_ROOT/dist.tar.gz" .)
|
|
209
|
+
echo " ✓ dist.tar.gz"
|
|
210
|
+
else
|
|
211
|
+
echo " [5/5] Skipped dist.tar.gz (--no-tar)"
|
|
212
|
+
fi
|
|
213
|
+
|
|
214
|
+
echo ""
|
|
215
|
+
echo " Done."
|
|
216
|
+
echo ""
|
|
217
|
+
echo " 스크립트 사용법:"
|
|
218
|
+
echo " ./scripts/run.sh start # 프로덕션 실행"
|
|
219
|
+
echo " ./scripts/run.sh stop # 서버 종료"
|
|
220
|
+
echo " ./scripts/run.sh dev # 개발 모드 (tsx watch)"
|
|
221
|
+
echo ""
|
|
222
|
+
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
# run.sh — Entity App Server 실행 / 종료
|
|
3
3
|
#
|
|
4
4
|
# 사용법:
|
|
5
|
-
# ./scripts/run.sh start — 프로덕션 모드 백그라운드 실행 (dist/system.js)
|
|
5
|
+
# ./scripts/run.sh start — 프로덕션 모드 백그라운드 실행 (dist/system.js 또는 system.js)
|
|
6
6
|
# ./scripts/run.sh stop — 실행 중인 서버 종료
|
|
7
7
|
# ./scripts/run.sh dev — 개발 모드 실행 (tsx watch)
|
|
8
8
|
|
|
@@ -210,6 +210,51 @@ ensure_runtime_dependencies_installed() {
|
|
|
210
210
|
exit 1
|
|
211
211
|
}
|
|
212
212
|
|
|
213
|
+
get_log_line_count() {
|
|
214
|
+
if [ -f "$LOG_FILE" ]; then
|
|
215
|
+
wc -l < "$LOG_FILE"
|
|
216
|
+
return
|
|
217
|
+
fi
|
|
218
|
+
|
|
219
|
+
echo "0"
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
print_startup_banner_from_log() {
|
|
223
|
+
local start_line="$1"
|
|
224
|
+
local banner=""
|
|
225
|
+
|
|
226
|
+
for _ in $(seq 1 50); do
|
|
227
|
+
if [ -f "$LOG_FILE" ]; then
|
|
228
|
+
banner=$(sed -n "${start_line},\$p" "$LOG_FILE" | awk '
|
|
229
|
+
BEGIN { capture = 0; banner = "" }
|
|
230
|
+
/^┌/ {
|
|
231
|
+
if (capture == 0) {
|
|
232
|
+
capture = 1
|
|
233
|
+
banner = $0 ORS
|
|
234
|
+
next
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
capture == 1 {
|
|
238
|
+
banner = banner $0 ORS
|
|
239
|
+
if ($0 ~ /^└/) {
|
|
240
|
+
printf "%s", banner
|
|
241
|
+
exit
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
')
|
|
245
|
+
if [ -n "$banner" ]; then
|
|
246
|
+
echo ""
|
|
247
|
+
printf "%s" "$banner"
|
|
248
|
+
echo ""
|
|
249
|
+
return 0
|
|
250
|
+
fi
|
|
251
|
+
fi
|
|
252
|
+
sleep 0.2
|
|
253
|
+
done
|
|
254
|
+
|
|
255
|
+
return 1
|
|
256
|
+
}
|
|
257
|
+
|
|
213
258
|
get_gateway_port() {
|
|
214
259
|
local config_port
|
|
215
260
|
local env_port
|
|
@@ -272,6 +317,20 @@ show_port_in_use_error() {
|
|
|
272
317
|
echo " 먼저 종료하려면: $0 stop"
|
|
273
318
|
}
|
|
274
319
|
|
|
320
|
+
get_runtime_entry() {
|
|
321
|
+
if [ -f "$PROJECT_ROOT/dist/system.js" ]; then
|
|
322
|
+
echo "$PROJECT_ROOT/dist/system.js"
|
|
323
|
+
return 0
|
|
324
|
+
fi
|
|
325
|
+
|
|
326
|
+
if [ -f "$PROJECT_ROOT/system.js" ]; then
|
|
327
|
+
echo "$PROJECT_ROOT/system.js"
|
|
328
|
+
return 0
|
|
329
|
+
fi
|
|
330
|
+
|
|
331
|
+
return 1
|
|
332
|
+
}
|
|
333
|
+
|
|
275
334
|
ensure_port_available() {
|
|
276
335
|
mapfile -t PORT_PIDS < <(find_gateway_pids)
|
|
277
336
|
if [ "${#PORT_PIDS[@]}" -gt 0 ]; then
|
|
@@ -312,7 +371,7 @@ _print_help() {
|
|
|
312
371
|
echo " 사용법: $0 <명령>"
|
|
313
372
|
echo ""
|
|
314
373
|
echo " 명령:"
|
|
315
|
-
echo " start 프로덕션 모드로 백그라운드 실행 (dist/system.js)"
|
|
374
|
+
echo " start 프로덕션 모드로 백그라운드 실행 (dist/system.js 또는 system.js)"
|
|
316
375
|
echo " stop 실행 중인 서버 종료"
|
|
317
376
|
echo " status 실행 상태 확인"
|
|
318
377
|
echo " dev 개발 모드 실행 (tsx watch)"
|
|
@@ -345,14 +404,17 @@ fi
|
|
|
345
404
|
|
|
346
405
|
case "$1" in
|
|
347
406
|
start)
|
|
407
|
+
local_runtime_entry=""
|
|
408
|
+
local log_start_line=""
|
|
348
409
|
ensure_port_available
|
|
349
410
|
ensure_env_ready
|
|
350
411
|
ensure_runtime_dependencies_installed
|
|
351
412
|
verify_entity_server_credentials
|
|
352
413
|
|
|
353
|
-
if
|
|
354
|
-
echo "❌
|
|
355
|
-
echo "
|
|
414
|
+
if ! local_runtime_entry="$(get_runtime_entry)"; then
|
|
415
|
+
echo "❌ 실행할 system.js를 찾지 못했습니다."
|
|
416
|
+
echo " dist/system.js 또는 system.js 중 하나가 있어야 합니다."
|
|
417
|
+
echo " 패키지가 손상됐다면 ./scripts/update-server.sh latest 를 다시 실행하세요."
|
|
356
418
|
exit 1
|
|
357
419
|
fi
|
|
358
420
|
|
|
@@ -368,12 +430,14 @@ case "$1" in
|
|
|
368
430
|
fi
|
|
369
431
|
|
|
370
432
|
mkdir -p "$(dirname "$LOG_FILE")"
|
|
371
|
-
|
|
433
|
+
log_start_line=$(( $(get_log_line_count) + 1 ))
|
|
434
|
+
nohup node --import tsx/esm "$local_runtime_entry" >> "$LOG_FILE" 2>&1 &
|
|
372
435
|
echo $! > "$PID_FILE"
|
|
373
436
|
PID=$(cat "$PID_FILE")
|
|
374
437
|
|
|
375
438
|
sleep 0.3
|
|
376
439
|
if kill -0 "$PID" 2>/dev/null; then
|
|
440
|
+
print_startup_banner_from_log "$log_start_line" || true
|
|
377
441
|
echo "✅ Entity App Server가 백그라운드에서 시작되었습니다 (pid: $PID)"
|
|
378
442
|
echo "상태: ./run.sh status"
|
|
379
443
|
echo "중지: ./run.sh stop"
|
|
@@ -14,7 +14,7 @@ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
|
|
|
14
14
|
PACKAGE_NAME="create-entity-app-server"
|
|
15
15
|
VERSION_FILE="$PROJECT_ROOT/.gateway-version"
|
|
16
16
|
PID_FILE="$PROJECT_ROOT/.gateway.pid"
|
|
17
|
-
MANAGED_SCRIPTS=("run.sh" "entity.sh" "reset-all.sh" "update-server.sh" "service-install.sh" "service-remove.sh")
|
|
17
|
+
MANAGED_SCRIPTS=("build.sh" "run.sh" "entity.sh" "reset-all.sh" "update-server.sh" "service-install.sh" "service-remove.sh")
|
|
18
18
|
MANAGED_FILES=("system.js" "system-api.js" "tsconfig.json" ".env.example" ".gateway-version")
|
|
19
19
|
|
|
20
20
|
cd "$PROJECT_ROOT"
|