@maka/maka-cli 5.12.0 → 5.14.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/bundle/typescript/package.json +2 -1
- package/bundle/typescript/src/commands/aws/ci.sub.cmd.js +1 -0
- package/bundle/typescript/src/commands/aws/ci.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/build/build.js +13 -37
- package/bundle/typescript/src/commands/build/build.js.map +1 -1
- package/bundle/typescript/src/commands/create.js +13 -28
- package/bundle/typescript/src/commands/create.js.map +1 -1
- package/bundle/typescript/src/commands/deploy/_index.d.ts +1 -0
- package/bundle/typescript/src/commands/deploy/_index.js +1 -0
- package/bundle/typescript/src/commands/deploy/_index.js.map +1 -1
- package/bundle/typescript/src/commands/deploy/deploy.command.js +1 -0
- package/bundle/typescript/src/commands/deploy/deploy.command.js.map +1 -1
- package/bundle/typescript/src/commands/deploy/github.sub.cmd.d.ts +1 -0
- package/bundle/typescript/src/commands/deploy/github.sub.cmd.js +147 -0
- package/bundle/typescript/src/commands/deploy/github.sub.cmd.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/ask.js +2 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/ask.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js +5 -5
- package/bundle/typescript/src/commands/game/sideQuest/commands/attack.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/bluff.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/bluff.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/call.js +48 -37
- package/bundle/typescript/src/commands/game/sideQuest/commands/call.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js +14 -14
- package/bundle/typescript/src/commands/game/sideQuest/commands/cast.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/catalog.js +25 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/catalog.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/contacts.js +6 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/contacts.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/crew.d.ts +43 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/crew.js +259 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/crew.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js +6 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/end-call.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/give.js +15 -2
- package/bundle/typescript/src/commands/game/sideQuest/commands/give.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.js +8 -6
- package/bundle/typescript/src/commands/game/sideQuest/commands/go.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/grapple.js +3 -3
- package/bundle/typescript/src/commands/game/sideQuest/commands/grapple.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js +3 -3
- package/bundle/typescript/src/commands/game/sideQuest/commands/hack.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/haggle.d.ts +5 -4
- package/bundle/typescript/src/commands/game/sideQuest/commands/haggle.js +45 -27
- package/bundle/typescript/src/commands/game/sideQuest/commands/haggle.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/job-offer.js +12 -7
- package/bundle/typescript/src/commands/game/sideQuest/commands/job-offer.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/lead.d.ts +5 -4
- package/bundle/typescript/src/commands/game/sideQuest/commands/lead.js +31 -17
- package/bundle/typescript/src/commands/game/sideQuest/commands/lead.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/look.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/order.js +21 -10
- package/bundle/typescript/src/commands/game/sideQuest/commands/order.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/palm.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/palm.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/perform.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/perform.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/pick.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/reboot.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/reload.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/rest.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.js +21 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/say.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/search.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/search.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.d.ts +2 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js +81 -3
- package/bundle/typescript/src/commands/game/sideQuest/commands/sheet.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/source.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/source.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/take.js +3 -3
- package/bundle/typescript/src/commands/game/sideQuest/commands/take.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.js +4 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/talk.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/commands/use.js +2 -0
- package/bundle/typescript/src/commands/game/sideQuest/commands/use.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-chunks.d.ts +15 -2
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-chunks.js +70 -35
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-chunks.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.d.ts +16 -5
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js +36 -8
- package/bundle/typescript/src/commands/game/sideQuest/factories/scene-seed-generator.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/game.d.ts +139 -4
- package/bundle/typescript/src/commands/game/sideQuest/game.js +591 -85
- package/bundle/typescript/src/commands/game/sideQuest/game.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/headless.d.ts +86 -0
- package/bundle/typescript/src/commands/game/sideQuest/headless.js +185 -0
- package/bundle/typescript/src/commands/game/sideQuest/headless.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js +50 -4
- package/bundle/typescript/src/commands/game/sideQuest/models/npc.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.d.ts +59 -11
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js +242 -109
- package/bundle/typescript/src/commands/game/sideQuest/models/scene.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/scenes/scene2.json +11 -11
- package/bundle/typescript/src/commands/game/sideQuest/types/save-file.d.ts +22 -2
- package/bundle/typescript/src/commands/game/sideQuest/types/seed/scene-seed.d.ts +8 -0
- package/bundle/typescript/src/commands/game/sideQuest/ui.js +7 -5
- package/bundle/typescript/src/commands/game/sideQuest/ui.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.d.ts +6 -4
- package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js +36 -24
- package/bundle/typescript/src/commands/game/sideQuest/utilities/auto-fight.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.d.ts +7 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js +59 -18
- package/bundle/typescript/src/commands/game/sideQuest/utilities/combat-exchange.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/command-queue.d.ts +19 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/command-queue.js +56 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/command-queue.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/crew-ledger.d.ts +21 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/crew-ledger.js +25 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/crew-ledger.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/emitter.d.ts +44 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/emitter.js +22 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/emitter.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.d.ts +4 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js +5 -2
- package/bundle/typescript/src/commands/game/sideQuest/utilities/fuzzy-match.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/hints.d.ts +4 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/hints.js +24 -7
- package/bundle/typescript/src/commands/game/sideQuest/utilities/hints.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/logger.d.ts +6 -5
- package/bundle/typescript/src/commands/game/sideQuest/utilities/logger.js +30 -6
- package/bundle/typescript/src/commands/game/sideQuest/utilities/logger.js.map +1 -1
- package/bundle/typescript/src/commands/game/sideQuest/utilities/session-context.d.ts +28 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/session-context.js +9 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/session-context.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/social.d.ts +50 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/social.js +166 -0
- package/bundle/typescript/src/commands/game/sideQuest/utilities/social.js.map +1 -0
- package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js +1 -1
- package/bundle/typescript/src/commands/game/sideQuest.sub.cmd.js.map +1 -1
- package/bundle/typescript/src/commands/generate.js +7 -0
- package/bundle/typescript/src/commands/generate.js.map +1 -1
- package/bundle/typescript/src/commands/run/run.command.js +31 -31
- package/bundle/typescript/src/commands/run/run.command.js.map +1 -1
- package/bundle/typescript/src/templates/meteor/config/deploy.sh.template +73 -0
- package/bundle/typescript/src/templates/meteor/config/nginx.conf.template +31 -0
- package/bundle/typescript/src/templates/meteor/github/workflows/deploy.yaml +82 -0
- package/bundle/typescript/src/tools/mpi/mpi.class.d.ts +18 -0
- package/bundle/typescript/src/tools/mpi/mpi.class.js +276 -3
- package/bundle/typescript/src/tools/mpi/mpi.class.js.map +1 -1
- package/bundle/typescript/src/tools/mpi/sdk-runtime.d.ts +6 -0
- package/bundle/typescript/src/tools/mpi/sdk-runtime.js +64 -0
- package/bundle/typescript/src/tools/mpi/sdk-runtime.js.map +1 -0
- package/bundle/typescript/src/tools/pkg/pkg.class.js +89 -78
- package/bundle/typescript/src/tools/pkg/pkg.class.js.map +1 -1
- package/bundle/typescript/src/tools/scaffold/scaffold.class.js +23 -7
- package/bundle/typescript/src/tools/scaffold/scaffold.class.js.map +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.command.js","sourceRoot":"","sources":["../../../../../src/commands/run/run.command.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"run.command.js","sourceRoot":"","sources":["../../../../../src/commands/run/run.command.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAAE,MAA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G,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAE/C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,gBAAgB,CAC1C,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CACnD,CAAC;QACF,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;QAC3C,qEAAqE;QACrE,oEAAoE;QACpE,MAAM,OAAO,GAAG,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;QAExF,MAAM,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC;YACvB,MAAM;YACN,IAAI;YACJ,OAAO;YACP,YAAY,EAAE,oBAAoB;YAClC,UAAU,EAAE,MAAM,KAAK,YAAY;YACnC,aAAa,EAAE,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;YAC7C,GAAG;YACH,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,SAAS;SAChC,CAAC,CAAC;IACL,CAAC;IAAC,OAAM,CAAC,EAAE,CAAC;QACV,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;QACb,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC,CAAC;AAEH,eAAe,GAAG,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
sudo apt-get update
|
|
2
|
+
# install git and nginx
|
|
3
|
+
sudo apt install build-essential git nginx -y
|
|
4
|
+
# setup node and npm with the proper node version using nvm
|
|
5
|
+
git clone https://gist.github.com/c427ccd6f4377b39299b9d402f5d51fe.git ~/maka-env/nvm-install
|
|
6
|
+
rm -rf ~/.bash_profile ~/.bashrc
|
|
7
|
+
touch ~/.bash_profile ~/.bashrc
|
|
8
|
+
echo "test -f ~/.bashrc && . ~/.bashrc" > ~/.bash_profile
|
|
9
|
+
chmod +x ~/maka-env/nvm-install/nvm-install.sh && ~/maka-env/nvm-install/nvm-install.sh
|
|
10
|
+
source ~/.bashrc
|
|
11
|
+
nvm install <%= nodeVersion %> || nvm install <%= fallbackVersion %>
|
|
12
|
+
[ "$(nvm current)" == "<%= nodeVersion %>" ] && nvm alias default <%= nodeVersion %> || nvm alias default <%= fallbackVersion %>
|
|
13
|
+
npm install -g pm2@latest
|
|
14
|
+
npm install -g @dotenvx/dotenvx@latest
|
|
15
|
+
pm2 install pm2-logrotate
|
|
16
|
+
pm2 set pm2-logrotate:max_size 20M
|
|
17
|
+
pm2 set pm2-logrotate:compress true
|
|
18
|
+
pm2 set pm2-logrotate:retain 30
|
|
19
|
+
rm -rf ~/maka-env/nvm-install
|
|
20
|
+
# Prepare nginx
|
|
21
|
+
[ -d /etc/systemd/system/nginx.service.d ] && echo "nginx.service.d exists" || sudo mkdir /etc/systemd/system/nginx.service.d
|
|
22
|
+
printf "[Service]\nExecStartPost=/bin/sleep 0.1\n" > override.conf
|
|
23
|
+
sudo cp override.conf /etc/systemd/system/nginx.service.d/override.conf
|
|
24
|
+
sudo systemctl daemon-reload || null
|
|
25
|
+
sudo systemctl stop nginx
|
|
26
|
+
sudo nginx -s stop
|
|
27
|
+
sudo cp ~/nginx.conf /etc/nginx/sites-enabled/default
|
|
28
|
+
sudo systemctl daemon-reload && sudo systemctl start nginx
|
|
29
|
+
# Ensure certbot is installed and re-inject the SSL server block that
|
|
30
|
+
# `sudo cp` above just overwrote (domain/email from letsencrypt.json).
|
|
31
|
+
# certbot --nginx is idempotent: skips reissuing a still-valid cert but
|
|
32
|
+
# always makes sure the nginx config has the SSL block wired in.
|
|
33
|
+
sudo snap install core >/dev/null 2>&1
|
|
34
|
+
sudo snap refresh core >/dev/null 2>&1
|
|
35
|
+
sudo snap install --classic certbot >/dev/null 2>&1 || true
|
|
36
|
+
[ -L /usr/bin/certbot ] || sudo ln -s /snap/bin/certbot /usr/bin/certbot
|
|
37
|
+
sudo certbot --nginx --agree-tos --expand -n --domains <%= domainNames %> --email <%= emailUpdate %>
|
|
38
|
+
# Decompress the bundle
|
|
39
|
+
echo "Attempting to decompress the bundle"
|
|
40
|
+
if [ -f app.tar.gz ]; then
|
|
41
|
+
echo "Bundle found, decompressing"
|
|
42
|
+
tar -xf app.tar.gz
|
|
43
|
+
elif [ -f app.tar.gz.bk ]; then
|
|
44
|
+
echo "No bundle found, using backup"
|
|
45
|
+
cp app.tar.gz.bk app.tar.gz
|
|
46
|
+
tar -xf app.tar.gz
|
|
47
|
+
else
|
|
48
|
+
echo "Could not find app.tar.gz, exiting!"
|
|
49
|
+
exit 1
|
|
50
|
+
fi
|
|
51
|
+
cd bundle/programs/server
|
|
52
|
+
npm install
|
|
53
|
+
npm audit fix --force
|
|
54
|
+
cd ~
|
|
55
|
+
# Reset pm2
|
|
56
|
+
pm2 delete all
|
|
57
|
+
# updating PM2 to latest
|
|
58
|
+
pm2 update
|
|
59
|
+
# Bring up pm2 with environment
|
|
60
|
+
if [ -f ~/process.env ]; then
|
|
61
|
+
dotenvx run -f ~/process.env -- pm2 start ~/pm2.config.js
|
|
62
|
+
else
|
|
63
|
+
pm2 start ~/pm2.config.js
|
|
64
|
+
fi
|
|
65
|
+
# Configure pm2 to start on boot
|
|
66
|
+
pm2 startup
|
|
67
|
+
sudo env PATH=$PATH:$(which npm) $(which pm2) startup systemd -u <%= ec2User %> --hp /home/<%= ec2User %>
|
|
68
|
+
pm2 save
|
|
69
|
+
# remove backup tar, if any
|
|
70
|
+
# rm -f ~/app.tar.gz.bk
|
|
71
|
+
# backup tar bundle
|
|
72
|
+
mv ~/app.tar.gz ~/app.tar.gz.bk
|
|
73
|
+
exit 0
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
server_tokens off;
|
|
2
|
+
map $http_upgrade $connection_upgrade {
|
|
3
|
+
default upgrade;
|
|
4
|
+
'' close;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
server {
|
|
8
|
+
listen 80 default_server;
|
|
9
|
+
listen [::]:80 default_server ipv6only=on;
|
|
10
|
+
<% if (domainNames) { -%>
|
|
11
|
+
server_name <%= domainNames.split(',').map(function(d) { return d.trim(); }).join(' ') %>;
|
|
12
|
+
<% } -%>
|
|
13
|
+
if ($http_user_agent ~ "MSIE" ) {
|
|
14
|
+
return 303 https://browser-update.org/update.html;
|
|
15
|
+
}
|
|
16
|
+
location = /favicon.ico {
|
|
17
|
+
alias /home/<%= ec2User %>/bundle/programs/web.browser/app;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
location / {
|
|
21
|
+
proxy_pass http://0.0.0.0:3000;
|
|
22
|
+
proxy_http_version 1.1;
|
|
23
|
+
proxy_set_header Upgrade $http_upgrade;
|
|
24
|
+
proxy_set_header Connection "upgrade";
|
|
25
|
+
proxy_set_header X-Forwarded-For $remote_addr;
|
|
26
|
+
proxy_set_header Host $host;
|
|
27
|
+
if ($uri != '/') {
|
|
28
|
+
expires 30d;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
name: Deploy to EC2
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [<%= branch %>]
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
|
|
8
|
+
concurrency:
|
|
9
|
+
group: deploy-<%= envName %>
|
|
10
|
+
cancel-in-progress: false
|
|
11
|
+
|
|
12
|
+
permissions:
|
|
13
|
+
contents: read
|
|
14
|
+
|
|
15
|
+
jobs:
|
|
16
|
+
deploy:
|
|
17
|
+
runs-on: ubuntu-latest
|
|
18
|
+
environment: <%= envName %>
|
|
19
|
+
env:
|
|
20
|
+
EC2_HOST: <%= ec2Host %>
|
|
21
|
+
EC2_USER: <%= ec2User %>
|
|
22
|
+
steps:
|
|
23
|
+
- uses: actions/checkout@v4
|
|
24
|
+
|
|
25
|
+
- uses: actions/setup-node@v4
|
|
26
|
+
with:
|
|
27
|
+
node-version: "<%= nodeVersion %>"
|
|
28
|
+
|
|
29
|
+
- name: Install root dependencies (maka-cli)
|
|
30
|
+
run: npm ci
|
|
31
|
+
|
|
32
|
+
- name: Install Meteor
|
|
33
|
+
run: node_modules/.bin/maka install meteor
|
|
34
|
+
|
|
35
|
+
- name: Install app dependencies
|
|
36
|
+
run: npm ci
|
|
37
|
+
working-directory: app
|
|
38
|
+
|
|
39
|
+
- name: Build production bundle
|
|
40
|
+
run: node_modules/.bin/maka build --force
|
|
41
|
+
|
|
42
|
+
- name: Configure SSH
|
|
43
|
+
env:
|
|
44
|
+
EC2_PEM_KEY: ${{ secrets.EC2_<%= envUpper %>_PEM }}
|
|
45
|
+
run: |
|
|
46
|
+
install -m 700 -d ~/.ssh
|
|
47
|
+
install -m 600 /dev/null ~/.ssh/deploy_key
|
|
48
|
+
printf '%s\n' "$EC2_PEM_KEY" > ~/.ssh/deploy_key
|
|
49
|
+
ssh-keyscan -H "$EC2_HOST" >> ~/.ssh/known_hosts
|
|
50
|
+
|
|
51
|
+
- name: Write dotenvx decryption key
|
|
52
|
+
env:
|
|
53
|
+
DOTENV_PRIVATE_KEY_<%= dotenvKeyName %>: ${{ secrets.DOTENV_PRIVATE_KEY_<%= dotenvKeyName %> }}
|
|
54
|
+
run: |
|
|
55
|
+
install -m 600 /dev/null /tmp/.env.keys
|
|
56
|
+
echo "DOTENV_PRIVATE_KEY_<%= dotenvKeyName %>=$DOTENV_PRIVATE_KEY_<%= dotenvKeyName %>" > /tmp/.env.keys
|
|
57
|
+
|
|
58
|
+
- name: Upload bundle and config
|
|
59
|
+
run: |
|
|
60
|
+
scp -i ~/.ssh/deploy_key build/app.tar.gz "$EC2_USER@$EC2_HOST:~/app.tar.gz"
|
|
61
|
+
scp -i ~/.ssh/deploy_key config/<%= envName %>/pm2.config.js "$EC2_USER@$EC2_HOST:~/pm2.config.js"
|
|
62
|
+
scp -i ~/.ssh/deploy_key config/<%= envName %>/settings.json "$EC2_USER@$EC2_HOST:~/settings.json"
|
|
63
|
+
scp -i ~/.ssh/deploy_key config/<%= envName %>/nginx.conf "$EC2_USER@$EC2_HOST:~/nginx.conf"
|
|
64
|
+
scp -i ~/.ssh/deploy_key config/<%= envName %>/deploy.sh "$EC2_USER@$EC2_HOST:~/deploy.sh"
|
|
65
|
+
scp -i ~/.ssh/deploy_key config/<%= envName %>/process.env "$EC2_USER@$EC2_HOST:~/process.env"
|
|
66
|
+
scp -i ~/.ssh/deploy_key /tmp/.env.keys "$EC2_USER@$EC2_HOST:~/.env.keys"
|
|
67
|
+
rm -f /tmp/.env.keys
|
|
68
|
+
|
|
69
|
+
- name: Release
|
|
70
|
+
run: ssh -i ~/.ssh/deploy_key "$EC2_USER@$EC2_HOST" "chmod 600 ~/process.env ~/.env.keys && chmod +x ~/deploy.sh && ~/deploy.sh"
|
|
71
|
+
|
|
72
|
+
- name: Post-deploy health check
|
|
73
|
+
if: always()
|
|
74
|
+
run: |
|
|
75
|
+
ssh -i ~/.ssh/deploy_key "$EC2_USER@$EC2_HOST" '
|
|
76
|
+
echo "--- pm2 status ---"
|
|
77
|
+
pm2 status
|
|
78
|
+
echo "--- pm2 logs (last 60 lines) ---"
|
|
79
|
+
pm2 logs --lines 60 --nostream
|
|
80
|
+
echo "--- localhost:3000 ---"
|
|
81
|
+
curl -sS -o /dev/null -w "HTTP %{http_code}\n" http://localhost:3000/ || true
|
|
82
|
+
'
|
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
import { FSI } from '../fsi/fsi.class.js';
|
|
2
2
|
import { CFG } from '../cfg/cfg.class.js';
|
|
3
3
|
import { PKG } from '../pkg/pkg.class.js';
|
|
4
|
+
export interface IBuildViaSdkOptions {
|
|
5
|
+
appDir: string;
|
|
6
|
+
outputPath: string;
|
|
7
|
+
directory: boolean;
|
|
8
|
+
release: string;
|
|
9
|
+
}
|
|
10
|
+
export interface IRunViaSdkOptions {
|
|
11
|
+
appDir: string;
|
|
12
|
+
port: number;
|
|
13
|
+
release: string;
|
|
14
|
+
mongoUrl?: string;
|
|
15
|
+
settingsPath?: string;
|
|
16
|
+
production?: boolean;
|
|
17
|
+
enableLogging?: boolean;
|
|
18
|
+
env?: string;
|
|
19
|
+
}
|
|
4
20
|
export declare class MPI {
|
|
5
21
|
private static instance;
|
|
6
22
|
private fsi;
|
|
@@ -23,4 +39,6 @@ export declare class MPI {
|
|
|
23
39
|
enableLogging?: boolean;
|
|
24
40
|
env?: string;
|
|
25
41
|
}): Promise<void>;
|
|
42
|
+
buildViaSdk(options: IBuildViaSdkOptions): Promise<void>;
|
|
43
|
+
runViaSdk(options: IRunViaSdkOptions): Promise<void>;
|
|
26
44
|
}
|
|
@@ -4,11 +4,24 @@ import fs from 'fs';
|
|
|
4
4
|
import os from 'os';
|
|
5
5
|
import { execSync } from 'child_process';
|
|
6
6
|
import spawn from 'cross-spawn';
|
|
7
|
+
import * as tar from 'tar';
|
|
8
|
+
import { createRequire } from 'module';
|
|
7
9
|
import { pascalCase } from "change-case";
|
|
10
|
+
import sdk, { ensureSdkInit, hardExit } from './sdk-runtime.js';
|
|
8
11
|
import { Log } from '../log/log.class.js';
|
|
9
12
|
import { Actions } from '../actions/actions.class.js';
|
|
10
13
|
import { MustBeInProjectError } from '../../error.js';
|
|
11
14
|
const homeDir = os.homedir();
|
|
15
|
+
// @maka/meteor-sdk's "./tools/*" exports subpath serves raw, untranspiled
|
|
16
|
+
// tools/ source files that rely on the SDK's own Babel/.ts-extension
|
|
17
|
+
// require hook (installed lazily by sdk.init(), inside its bootstrap()).
|
|
18
|
+
// A static ESM `import ... from '@maka/meteor-sdk/tools/...'` bypasses
|
|
19
|
+
// that hook entirely -- Node's own ESM resolver statically links the raw
|
|
20
|
+
// file before the hook ever runs, and fails on the first extensionless
|
|
21
|
+
// `import ... from '../fs/watch'` inside it (ERR_MODULE_NOT_FOUND).
|
|
22
|
+
// Loading it via a real CJS require(), lazily, *after* ensureSdkInit()
|
|
23
|
+
// has run, goes through the hook correctly instead. See runViaSdk().
|
|
24
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
12
25
|
const errorHandler = (caller, error) => {
|
|
13
26
|
if (process.env['MAKA_DEV'] === 'True') {
|
|
14
27
|
Log.error(`Error in ${caller}`);
|
|
@@ -271,9 +284,15 @@ export class MPI {
|
|
|
271
284
|
}
|
|
272
285
|
async invokeMeteorCommand(cmd, args, options) {
|
|
273
286
|
try {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
287
|
+
// 'publish' runs from a plain Meteor package directory (just a
|
|
288
|
+
// package.js), which has no .maka project marker at all -- see the
|
|
289
|
+
// cwd computation below, which already special-cases 'publish' for
|
|
290
|
+
// the same reason.
|
|
291
|
+
if (cmd !== 'publish') {
|
|
292
|
+
const projectDir = this.fsi.findProjectDirectory();
|
|
293
|
+
if (!projectDir) {
|
|
294
|
+
throw new MustBeInProjectError();
|
|
295
|
+
}
|
|
277
296
|
}
|
|
278
297
|
if (cmd === 'run') {
|
|
279
298
|
const portIdx = args.indexOf('-p');
|
|
@@ -526,5 +545,259 @@ export class MPI {
|
|
|
526
545
|
process.exit(1);
|
|
527
546
|
}
|
|
528
547
|
}
|
|
548
|
+
// Found while testing buildViaSdk(): a plain process.exit() reliably
|
|
549
|
+
// hung (never actually terminated) after a successful build going
|
|
550
|
+
// through the SDK, specifically on Windows -- process.getActiveResourcesInfo()
|
|
551
|
+
// showed one pending FSReqCallback at that point. Root cause traced to
|
|
552
|
+
// tools/tool-env/cleanup.js's `process.on('exit', runHandlers)`, where
|
|
553
|
+
// runHandlers is async (a real Node anti-pattern: 'exit' handlers must
|
|
554
|
+
// be synchronous) -- on Windows this can wedge normal process.exit()
|
|
555
|
+
// when a handler's fire-and-forget async work races shutdown.
|
|
556
|
+
// process.reallyExit() (undocumented, but long-standing in Node)
|
|
557
|
+
// bypasses 'exit' listeners entirely and terminates immediately;
|
|
558
|
+
// falling back to process.exit() if it's ever unavailable.
|
|
559
|
+
// SDK-backed replacement for invokeMeteorCommand('build', ...). Unlike
|
|
560
|
+
// the real `meteor build` (proxied via invokeMeteorCommand elsewhere in
|
|
561
|
+
// this file for every other command), this never shells out to a
|
|
562
|
+
// meteor binary at all.
|
|
563
|
+
async buildViaSdk(options) {
|
|
564
|
+
// Cleaned up inline before each hardExit() call below, not via a
|
|
565
|
+
// `finally` block: hardExit() uses process.reallyExit() (see its own
|
|
566
|
+
// comment), which can cut off a pending `finally` the same way it
|
|
567
|
+
// cuts off everything else after it's called.
|
|
568
|
+
let tempDir = null;
|
|
569
|
+
const cleanupTempDir = () => {
|
|
570
|
+
if (!tempDir)
|
|
571
|
+
return;
|
|
572
|
+
try {
|
|
573
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
574
|
+
}
|
|
575
|
+
catch {
|
|
576
|
+
// Best-effort cleanup only.
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
try {
|
|
580
|
+
// The old subprocess flow ran `meteor build` with cwd = appDir; the
|
|
581
|
+
// in-process SDK build inherits the CLI's cwd (the maka project
|
|
582
|
+
// root) instead. The build pipeline hands compilers cwd-relative
|
|
583
|
+
// file paths (e.g. babel-compiler passes "node_modules/graphql/
|
|
584
|
+
// index.mjs" as SWC's `filename`), so a wrong cwd makes SWC's
|
|
585
|
+
// input-source-map lookups miss and spam one non-fatal ERROR per
|
|
586
|
+
// file with a sourceMappingURL comment. Both this and runViaSdk()
|
|
587
|
+
// are terminal (hardExit), so no need to restore cwd.
|
|
588
|
+
process.chdir(options.appDir);
|
|
589
|
+
await ensureSdkInit(options.release);
|
|
590
|
+
const project = await sdk.loadProject(options.appDir);
|
|
591
|
+
if (options.directory) {
|
|
592
|
+
await sdk.bundle(project, {
|
|
593
|
+
outputPath: options.outputPath,
|
|
594
|
+
minifyMode: 'production',
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
else {
|
|
598
|
+
// sdk.bundle() (like bundler.bundle() underneath it) only ever
|
|
599
|
+
// writes a raw directory -- the app.tar.gz step lived in the now-
|
|
600
|
+
// deleted CLI's own build command, never in the bundler itself.
|
|
601
|
+
// Reproduce it here with the tar dependency this package already has.
|
|
602
|
+
tempDir = fs.mkdtempSync(path.join(os.tmpdir(), 'maka-build-'));
|
|
603
|
+
await sdk.bundle(project, {
|
|
604
|
+
outputPath: tempDir,
|
|
605
|
+
minifyMode: 'production',
|
|
606
|
+
});
|
|
607
|
+
fs.mkdirSync(path.dirname(options.outputPath), { recursive: true });
|
|
608
|
+
await tar.create({ gzip: true, file: options.outputPath, cwd: tempDir }, fs.readdirSync(tempDir));
|
|
609
|
+
}
|
|
610
|
+
Log.success(`Build complete: ${options.outputPath}`);
|
|
611
|
+
cleanupTempDir();
|
|
612
|
+
hardExit(0);
|
|
613
|
+
}
|
|
614
|
+
catch (e) {
|
|
615
|
+
errorHandler('buildViaSdk()', e);
|
|
616
|
+
cleanupTempDir();
|
|
617
|
+
hardExit(1);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
// SDK-backed replacement for invokeMeteorCommand('run', ...). Unlike
|
|
621
|
+
// `meteor run`, meteor-sdk's createAppRunner() doesn't manage a mongod
|
|
622
|
+
// process for us (see its README) -- that lifecycle now belongs here,
|
|
623
|
+
// reusing the exact same MongoRunner class the real `meteor run`
|
|
624
|
+
// command itself is built on.
|
|
625
|
+
async runViaSdk(options) {
|
|
626
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
627
|
+
let mongoRunner = null;
|
|
628
|
+
let handle = null;
|
|
629
|
+
let logStream = null;
|
|
630
|
+
let logFilePath = null;
|
|
631
|
+
const getTimestamp = () => {
|
|
632
|
+
const now = new Date();
|
|
633
|
+
const pad = (n, len = 2) => String(n).padStart(len, '0');
|
|
634
|
+
return `[${pad(now.getHours())}:${pad(now.getMinutes())}:${pad(now.getSeconds())}.${pad(now.getMilliseconds(), 3)}]`;
|
|
635
|
+
};
|
|
636
|
+
const writeLog = (line) => {
|
|
637
|
+
if (!logStream)
|
|
638
|
+
return;
|
|
639
|
+
logStream.write(`${getTimestamp()} ${line}\n`);
|
|
640
|
+
};
|
|
641
|
+
const shutdown = async (exitCode, signal) => {
|
|
642
|
+
try {
|
|
643
|
+
if (handle)
|
|
644
|
+
await handle.stop();
|
|
645
|
+
}
|
|
646
|
+
catch (e) {
|
|
647
|
+
errorHandler('runViaSdk() handle.stop()', e);
|
|
648
|
+
}
|
|
649
|
+
try {
|
|
650
|
+
mongoRunner?.stop();
|
|
651
|
+
}
|
|
652
|
+
catch (e) {
|
|
653
|
+
errorHandler('runViaSdk() mongoRunner.stop()', e);
|
|
654
|
+
}
|
|
655
|
+
if (logStream) {
|
|
656
|
+
const timestamp = new Date().toISOString();
|
|
657
|
+
logStream.write(`\n${'='.repeat(80)}\n`);
|
|
658
|
+
logStream.write(`Session ${signal ? 'Interrupted' : 'Ended'}: ${timestamp}\n`);
|
|
659
|
+
if (signal)
|
|
660
|
+
logStream.write(`Signal: ${signal}\n`);
|
|
661
|
+
logStream.write(`${'='.repeat(80)}\n\n`);
|
|
662
|
+
logStream.end();
|
|
663
|
+
}
|
|
664
|
+
// Deliberately not calling sdk.close() here: for a one-shot process
|
|
665
|
+
// that's about to exit anyway, skipping close() and exiting
|
|
666
|
+
// directly avoids a real @parcel/watcher-teardown crash on Windows
|
|
667
|
+
// under Git Bash/MSYS2, verified this session and documented in
|
|
668
|
+
// @maka/meteor-sdk@0.1.3's own README.
|
|
669
|
+
hardExit(exitCode);
|
|
670
|
+
};
|
|
671
|
+
try {
|
|
672
|
+
// Same cwd fix as buildViaSdk() -- see its comment. Must happen
|
|
673
|
+
// before the SDK starts building/watching the app.
|
|
674
|
+
process.chdir(options.appDir);
|
|
675
|
+
// sdk.init() (inside ensureSdkInit) installs the Babel/.ts require
|
|
676
|
+
// hook that MongoRunner's own raw tools/ source depends on -- must
|
|
677
|
+
// happen before we require() it below.
|
|
678
|
+
await ensureSdkInit(options.release);
|
|
679
|
+
let mongoUrl = options.mongoUrl;
|
|
680
|
+
let oplogUrl;
|
|
681
|
+
if (!mongoUrl) {
|
|
682
|
+
const { MongoRunner } = requireFromHere('@maka/meteor-sdk/tools/runners/run-mongo.js');
|
|
683
|
+
const mongoPort = await this.fsi.getAvailablePort(3001);
|
|
684
|
+
const projectLocalDir = path.join(options.appDir, '.meteor', 'local');
|
|
685
|
+
fs.mkdirSync(projectLocalDir, { recursive: true });
|
|
686
|
+
mongoRunner = new MongoRunner({ projectLocalDir, port: mongoPort });
|
|
687
|
+
await mongoRunner.start();
|
|
688
|
+
mongoUrl = mongoRunner.mongoUrl();
|
|
689
|
+
oplogUrl = mongoRunner.oplogUrl();
|
|
690
|
+
}
|
|
691
|
+
const project = await sdk.loadProject(options.appDir);
|
|
692
|
+
if (options.enableLogging) {
|
|
693
|
+
const env = options.env || 'local';
|
|
694
|
+
logFilePath = this.fsi.getLogFilePath(env, 'run');
|
|
695
|
+
logStream = fs.createWriteStream(logFilePath, { flags: 'a' });
|
|
696
|
+
this.fsi.rotateLogs(env, 'run', 10);
|
|
697
|
+
const logsDir = this.fsi.getLogsDirectory();
|
|
698
|
+
const latestLogPath = path.join(logsDir, `run-${env}-latest.log`);
|
|
699
|
+
if (fs.existsSync(latestLogPath)) {
|
|
700
|
+
try {
|
|
701
|
+
fs.unlinkSync(latestLogPath);
|
|
702
|
+
}
|
|
703
|
+
catch { /* ignore */ }
|
|
704
|
+
}
|
|
705
|
+
try {
|
|
706
|
+
if (process.platform === 'win32') {
|
|
707
|
+
fs.copyFileSync(logFilePath, latestLogPath);
|
|
708
|
+
}
|
|
709
|
+
else {
|
|
710
|
+
fs.symlinkSync(path.basename(logFilePath), latestLogPath);
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
catch { /* not critical */ }
|
|
714
|
+
const timestamp = new Date().toISOString();
|
|
715
|
+
logStream.write(`\n${'='.repeat(80)}\n`);
|
|
716
|
+
logStream.write(`Maka Run Session Started: ${timestamp}\n`);
|
|
717
|
+
logStream.write(`Environment: ${env}\n`);
|
|
718
|
+
logStream.write(`${'='.repeat(80)}\n\n`);
|
|
719
|
+
Log.notice(`Logging to: ${path.relative(process.cwd(), logFilePath)}`);
|
|
720
|
+
}
|
|
721
|
+
handle = await sdk.createAppRunner(project, {
|
|
722
|
+
port: options.port,
|
|
723
|
+
mongoUrl,
|
|
724
|
+
oplogUrl,
|
|
725
|
+
once: false,
|
|
726
|
+
settingsFile: options.settingsPath,
|
|
727
|
+
buildOptions: {
|
|
728
|
+
minifyMode: options.production ? 'production' : 'development',
|
|
729
|
+
},
|
|
730
|
+
});
|
|
731
|
+
handle.on('exit', (result) => {
|
|
732
|
+
// Not JSON.stringify(result) as a whole -- some outcomes (e.g. a
|
|
733
|
+
// version mismatch) attach a full WatchSet, whose own toJSON()
|
|
734
|
+
// isn't safe to call in every case (hit a real crash here:
|
|
735
|
+
// "Cannot read properties of undefined (reading 'map')" inside
|
|
736
|
+
// tools/fs/watch.ts's WatchSet.toJSON()). Just the fields that
|
|
737
|
+
// matter for a log line.
|
|
738
|
+
const summary = `outcome=${result.outcome}` +
|
|
739
|
+
(result.code !== undefined ? ` code=${result.code}` : '') +
|
|
740
|
+
(result.signal !== undefined ? ` signal=${result.signal}` : '');
|
|
741
|
+
// outcome=changed is the normal dev-loop restart (a file changed);
|
|
742
|
+
// the SDK already prints "=> Server modified -- restarting..." for
|
|
743
|
+
// it -- and does so as a newline-less temporary status line, which
|
|
744
|
+
// a console print here would garble mid-line. Log file only.
|
|
745
|
+
if (result.outcome !== 'changed') {
|
|
746
|
+
Log.notice(`Exited: ${summary}`);
|
|
747
|
+
}
|
|
748
|
+
writeLog(`Exited: ${summary}`);
|
|
749
|
+
// Mirrors the terminal-outcome logic in meteor-sdk's own
|
|
750
|
+
// createAppRunner() onRunEnd (npm-packages/meteor-sdk/src/run.js):
|
|
751
|
+
// these outcomes end the dev loop for good -- every other outcome
|
|
752
|
+
// (changed, a crash with a code/signal) restarts it. Without this,
|
|
753
|
+
// a run that dies on its own (e.g. wrong-release) left this
|
|
754
|
+
// process parked on the keep-alive promise below with mongod
|
|
755
|
+
// still running until the user noticed and hit Ctrl+C.
|
|
756
|
+
const terminal = result.outcome === 'conflicting-versions' ||
|
|
757
|
+
result.outcome === 'wrong-release' ||
|
|
758
|
+
result.outcome === 'proxy-failure' ||
|
|
759
|
+
(result.outcome === 'terminated' &&
|
|
760
|
+
result.signal === undefined &&
|
|
761
|
+
result.code === undefined);
|
|
762
|
+
if (terminal) {
|
|
763
|
+
void shutdown(result.outcome === 'terminated' ? 0 : 1);
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
const safeStringify = (value) => {
|
|
767
|
+
try {
|
|
768
|
+
return JSON.stringify(value);
|
|
769
|
+
}
|
|
770
|
+
catch {
|
|
771
|
+
return String(value);
|
|
772
|
+
}
|
|
773
|
+
};
|
|
774
|
+
sdk.on('log', ({ level, args }) => {
|
|
775
|
+
const line = args.map((a) => (typeof a === 'string' ? a : safeStringify(a))).join(' ');
|
|
776
|
+
// The SDK's console tap emits an event for every Console call
|
|
777
|
+
// *before* the original method's own level check runs, so debug-
|
|
778
|
+
// level chatter the tool's Console itself suppresses at default
|
|
779
|
+
// verbosity (tropohouse download notes, "Doing HTTP request",
|
|
780
|
+
// ...) still arrives here. Match upstream `meteor run`: keep it
|
|
781
|
+
// out of the console, but keep it in the log file, where the
|
|
782
|
+
// extra detail is useful.
|
|
783
|
+
if (level !== 'debug') {
|
|
784
|
+
process.stdout.write(line + '\n'); // console: no timestamps
|
|
785
|
+
}
|
|
786
|
+
writeLog(line); // log file: with timestamps
|
|
787
|
+
});
|
|
788
|
+
await handle.start();
|
|
789
|
+
Log.success(`Running: http://localhost:${options.port}`);
|
|
790
|
+
process.on('SIGINT', () => { void shutdown(0, 'SIGINT'); });
|
|
791
|
+
process.on('SIGTERM', () => { void shutdown(0, 'SIGTERM'); });
|
|
792
|
+
// Block here for the lifetime of the run, same as the execSync/
|
|
793
|
+
// spawn-based invokeMeteorCommand('run', ...) path did -- only the
|
|
794
|
+
// SIGINT/SIGTERM handlers above ever resolve this.
|
|
795
|
+
await new Promise(() => { });
|
|
796
|
+
}
|
|
797
|
+
catch (e) {
|
|
798
|
+
errorHandler('runViaSdk()', e);
|
|
799
|
+
await shutdown(1);
|
|
800
|
+
}
|
|
801
|
+
}
|
|
529
802
|
}
|
|
530
803
|
//# sourceMappingURL=mpi.class.js.map
|