@zeppos/zeus-cli 1.1.8 → 1.2.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/{cli.js → main.js} +11 -7
- package/bin/post-command.js +3 -5
- package/index.js +0 -3
- package/modules/bridge.js +18 -21
- package/modules/build.js +86 -215
- package/modules/create.js +244 -0
- package/modules/help.js +16 -16
- package/modules/run.js +23 -83
- package/package.json +41 -51
- package/{api → private-modules/zeppos-app-utils/dist/api}/index.js +64 -98
- package/private-modules/zeppos-app-utils/dist/config/device.js +247 -0
- package/private-modules/zeppos-app-utils/dist/config/index.js +18 -0
- package/private-modules/zeppos-app-utils/dist/config/project.js +104 -0
- package/{utils → private-modules/zeppos-app-utils/dist}/hm-analytics.js +6 -6
- package/private-modules/zeppos-app-utils/dist/index.js +38 -0
- package/private-modules/zeppos-app-utils/dist/logger/index.js +54 -0
- package/private-modules/zeppos-app-utils/dist/logger/my-logger.js +69 -0
- package/private-modules/zeppos-app-utils/dist/modules/build.js +334 -0
- package/{modules → private-modules/zeppos-app-utils/dist/modules}/config.js +31 -57
- package/private-modules/zeppos-app-utils/dist/modules/create/index.js +254 -0
- package/{modules → private-modules/zeppos-app-utils/dist/modules}/create/local-app.js +10 -10
- package/{modules → private-modules/zeppos-app-utils/dist/modules}/create/yeoman-app.js +2 -2
- package/private-modules/zeppos-app-utils/dist/modules/index.js +21 -0
- package/{modules → private-modules/zeppos-app-utils/dist/modules}/login.js +17 -45
- package/{modules → private-modules/zeppos-app-utils/dist/modules}/status.js +32 -42
- package/{public → private-modules/zeppos-app-utils/dist/public}/scripts/png2vglite.py +0 -0
- package/{public → private-modules/zeppos-app-utils/dist/public}/scripts/requirements.txt +0 -0
- package/{public/template/package.json → private-modules/zeppos-app-utils/dist/public/template/v1/_package.json} +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app-side/i18n/en-US.po +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app-side/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/app.json +1 -1
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/assets/default/icon.png +0 -0
- package/{public/template/empty/pages → private-modules/zeppos-app-utils/dist/public/template/v1/empty/page}/i18n/en-US.po +0 -0
- package/{public/template/empty/pages → private-modules/zeppos-app-utils/dist/public/template/v1/empty/page}/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/setting/i18n/en-US.po +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/setting/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/empty/watchface/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/app-side/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/app.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/app.json +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3/icon.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3/image/logo.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3-pro/icon.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gtr3-pro/image/logo.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gts3/icon.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/assets/gts3/image/logo.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3/home/index.page.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3/home/index.page.json +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3/home/index.style.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3-pro/home/index.page.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3-pro/home/index.page.json +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gtr3-pro/home/index.style.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gts3/home/index.page.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gts3/home/index.page.json +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/gts3/home/index.style.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/page/i18n/en-US.po +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/setting/i18n/en-US.po +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/setting/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/hello-world/utils/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/jsconfig.json +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/app.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/app.json +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bg/bg.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/0.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/1.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/2.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/3.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/4.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/5.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/6.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/7.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/8.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/9.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/bigNum/sp.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/btn/back.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/btn/lv.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/btn/red.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/bg.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/bottom.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/center.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/h.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/left.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/m.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/right.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/point/s.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/preview.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/second/second.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/0.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/1.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/2.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/3.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/4.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/5.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/6.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/7.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/8.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/9.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/d.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/smallNum/n.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/1.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/2.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/3.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/4.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/5.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/6.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_ch/7.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/1.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/2.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/3.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/4.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/5.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/6.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/assets/gtr-3-pro/images/week_en/7.png +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/buffer.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/device-polyfill.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/global.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/js-module.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/logger.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/shared/setTimeout.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/watchface/gtr-3-pro/index.js +0 -0
- package/{public/template → private-modules/zeppos-app-utils/dist/public/template/v1}/timer/watchface/round/index.js +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/_package.json +14 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/app.js +28 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/app.json +56 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/consume.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/beer.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/cake.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/chocolate.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/coffee.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/cookies.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/ham.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/hamburger.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/ice cream.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/pizza.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/food/sausage.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/multiply.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/selected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/assets/gts/unselected.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/gts/food-list.js +113 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/gts/index.js +126 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/i18n/en-US.po +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/page/i18n/zh-CN.po +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/constants.js +54 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/storage.js +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/styles-gts-3.js +141 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/calories/utils/styles.js +142 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app-side/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app-side/index.js +13 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app.js +10 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/app.json +60 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/assets/default/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/page/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/page/index.js +7 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/setting/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/setting/index.js +7 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/empty/watchface/index.js +13 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app-side/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app-side/index.js +57 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app.js +23 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/app.json +65 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/assets/common/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/pages/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/pages/index.js +55 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/data.js +67 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/defer.js +35 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/device-polyfill.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/es6-promise.js +1149 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/event.js +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/message-side.js +1145 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/shared/message.js +1151 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/utils/config/constants.js +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/fetch-api/utils/config/device.js +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/app-side/index.js +11 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/app.js +10 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/app.json +101 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gtr/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gtr/image/logo.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gts/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/assets/gts/image/logo.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gtr/home/index.page.js +20 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gtr/home/index.page.json +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gtr/home/index.style.js +18 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gts/home/index.page.js +21 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gts/home/index.page.json +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/gts/home/index.style.js +17 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/page/i18n/en-US.po +3 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/setting/i18n/en-US.po +2 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/setting/index.js +5 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/hello-world/utils/index.js +3 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/jsconfig.json +14 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/.prettierrc.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/app-side/index.js +48 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/app.js +25 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/app.json +75 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/assets/gts/icon.png +0 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/home/index.page.js +155 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/home/index.page.json +1 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/home/index.style.js +93 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/page/i18n/en-US.po +8 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/setting/i18n/en-US.po +5 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/setting/index.js +145 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/data.js +67 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/defer.js +35 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/device-polyfill.js +6 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/es6-promise.js +1149 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/event.js +42 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/message-side.js +1145 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/shared/message.js +1151 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/utils/constants.js +3 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/utils/fs.js +38 -0
- package/private-modules/zeppos-app-utils/dist/public/template/v2/todo-list/utils/index.js +38 -0
- package/private-modules/zeppos-app-utils/dist/simulator.js +58 -0
- package/{modules/storage.js → private-modules/zeppos-app-utils/dist/storage/index.js} +2 -1
- package/private-modules/zeppos-app-utils/dist/tools/index.js +133 -0
- package/private-modules/zeppos-app-utils/dist/websocket.js +165 -0
- package/private-modules/zeppos-app-utils/package.json +51 -0
- package/utils/pre-check.js +9 -35
- package/config/device.js +0 -122
- package/config/project.js +0 -48
- package/font-icon.js +0 -27
- package/modules/create/index.js +0 -358
- package/modules/simulator.js +0 -82
- package/modules/websocket.js +0 -112
- package/utils/common.js +0 -138
- package/utils/logger.js +0 -31
- package/utils/md5.js +0 -11
- package/utils/sleep.js +0 -8
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import {
|
|
2
|
+
statSync,
|
|
3
|
+
writeFileSync as writeFile,
|
|
4
|
+
readFileSync as readFile
|
|
5
|
+
} from '@zos/fs'
|
|
6
|
+
|
|
7
|
+
import { TODO_FILE_NAME } from './constants'
|
|
8
|
+
|
|
9
|
+
export function readFileSync() {
|
|
10
|
+
const fStat = statSync({
|
|
11
|
+
path: this.fileName
|
|
12
|
+
})
|
|
13
|
+
if (fStat) {
|
|
14
|
+
const resData = readFile({
|
|
15
|
+
path: TODO_FILE_NAME,
|
|
16
|
+
options: {
|
|
17
|
+
encoding: 'utf8'
|
|
18
|
+
}
|
|
19
|
+
})
|
|
20
|
+
return !resData ? [] : JSON.parse(resData)
|
|
21
|
+
} else {
|
|
22
|
+
return []
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function writeFileSync(data, merge = true) {
|
|
27
|
+
let params = data
|
|
28
|
+
if (merge) {
|
|
29
|
+
params = [...readFile(), ...data]
|
|
30
|
+
}
|
|
31
|
+
writeFile({
|
|
32
|
+
path: TODO_FILE_NAME,
|
|
33
|
+
data: JSON.stringify(params),
|
|
34
|
+
options: {
|
|
35
|
+
encoding: 'utf8'
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function getScrollListDataConfig(activeIndex, length) {
|
|
2
|
+
const dataTypeConfig = []
|
|
3
|
+
if (activeIndex === -1) {
|
|
4
|
+
dataTypeConfig.push({
|
|
5
|
+
start: 0,
|
|
6
|
+
end: length,
|
|
7
|
+
type_id: 2,
|
|
8
|
+
})
|
|
9
|
+
} else if (activeIndex === 0) {
|
|
10
|
+
dataTypeConfig.push({
|
|
11
|
+
start: 0,
|
|
12
|
+
end: activeIndex,
|
|
13
|
+
type_id: 1,
|
|
14
|
+
})
|
|
15
|
+
dataTypeConfig.push({
|
|
16
|
+
start: activeIndex + 1,
|
|
17
|
+
end: length,
|
|
18
|
+
type_id: 2,
|
|
19
|
+
})
|
|
20
|
+
} else {
|
|
21
|
+
dataTypeConfig.push({
|
|
22
|
+
start: 0,
|
|
23
|
+
end: activeIndex - 1,
|
|
24
|
+
type_id: 2,
|
|
25
|
+
})
|
|
26
|
+
dataTypeConfig.push({
|
|
27
|
+
start: activeIndex,
|
|
28
|
+
end: activeIndex,
|
|
29
|
+
type_id: 1,
|
|
30
|
+
})
|
|
31
|
+
dataTypeConfig.push({
|
|
32
|
+
start: activeIndex + 1,
|
|
33
|
+
end: length,
|
|
34
|
+
type_id: 2,
|
|
35
|
+
})
|
|
36
|
+
}
|
|
37
|
+
return dataTypeConfig
|
|
38
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
exports.__esModule = true;
|
|
3
|
+
exports.Simulator = void 0;
|
|
4
|
+
var socket_io_client_1 = require("socket.io-client");
|
|
5
|
+
var index_1 = require("./index");
|
|
6
|
+
var simulatorStorageKey = index_1.config.simulatorStorageKey;
|
|
7
|
+
var Simulator = (function () {
|
|
8
|
+
function Simulator(url) {
|
|
9
|
+
this.previewId = 1;
|
|
10
|
+
this.previewMethod = 'ide.simulator.preview';
|
|
11
|
+
index_1.logger.info('connecting to simulator');
|
|
12
|
+
this.socket = (0, socket_io_client_1.io)(url);
|
|
13
|
+
this.socket.on('connect', function () {
|
|
14
|
+
var _a;
|
|
15
|
+
index_1.globalStorage.set((_a = {}, _a[simulatorStorageKey.simulatorConnectStatus] = 'connected', _a));
|
|
16
|
+
index_1.logger.success('simulator connected');
|
|
17
|
+
});
|
|
18
|
+
this.socket.on('disconnect', function () {
|
|
19
|
+
var _a;
|
|
20
|
+
index_1.globalStorage.set((_a = {}, _a[simulatorStorageKey.simulatorConnectStatus] = 'disconnected', _a));
|
|
21
|
+
index_1.logger.error('simulator disconnected, please restart the simulator');
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
Simulator.prototype.sendMessage = function (message) {
|
|
25
|
+
this.socket.send(message);
|
|
26
|
+
};
|
|
27
|
+
Simulator.prototype.emit = function (space, jsonData) {
|
|
28
|
+
this.socket.emit(space, jsonData);
|
|
29
|
+
};
|
|
30
|
+
Simulator.prototype.upload = function (data, projectName, target, appid, devices) {
|
|
31
|
+
var dataArr = this.uint8ToArray(new Uint8Array(data));
|
|
32
|
+
var message = this.encodeMessage({
|
|
33
|
+
target: target,
|
|
34
|
+
projectName: projectName,
|
|
35
|
+
appid: appid,
|
|
36
|
+
size: data.byteLength,
|
|
37
|
+
data: dataArr,
|
|
38
|
+
devices: devices
|
|
39
|
+
});
|
|
40
|
+
this.sendMessage(message);
|
|
41
|
+
};
|
|
42
|
+
Simulator.prototype.encodeMessage = function (params) {
|
|
43
|
+
return JSON.stringify({
|
|
44
|
+
jsonrpc: '2.0',
|
|
45
|
+
method: this.previewMethod,
|
|
46
|
+
params: params,
|
|
47
|
+
id: this.previewId
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
Simulator.prototype.decodeMessage = function (data) {
|
|
51
|
+
return JSON.parse(data);
|
|
52
|
+
};
|
|
53
|
+
Simulator.prototype.uint8ToArray = function (source) {
|
|
54
|
+
return Array.prototype.slice.call(source);
|
|
55
|
+
};
|
|
56
|
+
return Simulator;
|
|
57
|
+
}());
|
|
58
|
+
exports.Simulator = Simulator;
|
|
@@ -67,7 +67,8 @@ var instanceStorage = (function () {
|
|
|
67
67
|
};
|
|
68
68
|
instanceStorage.prototype.deleteStorage = function (key) {
|
|
69
69
|
var _this = this;
|
|
70
|
-
var
|
|
70
|
+
var getLocalConfig = require('../config/project').getLocalConfig;
|
|
71
|
+
var loginStorageKey = getLocalConfig().loginStorageKey;
|
|
71
72
|
if (!key) {
|
|
72
73
|
this._storageJsonData = {};
|
|
73
74
|
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
35
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
36
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
37
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
38
|
+
function step(op) {
|
|
39
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
40
|
+
while (_) try {
|
|
41
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
42
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
43
|
+
switch (op[0]) {
|
|
44
|
+
case 0: case 1: t = op; break;
|
|
45
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
46
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
47
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
48
|
+
default:
|
|
49
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
50
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
51
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
52
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
53
|
+
if (t[2]) _.ops.pop();
|
|
54
|
+
_.trys.pop(); continue;
|
|
55
|
+
}
|
|
56
|
+
op = body.call(thisArg, _);
|
|
57
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
58
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
+
};
|
|
64
|
+
exports.__esModule = true;
|
|
65
|
+
exports.checkCreateName = exports.sleep = exports.getDeviceInfoFromAppJson = exports.getInfoFromAppJson = exports.parserZeusCommand = void 0;
|
|
66
|
+
var yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
67
|
+
var path = __importStar(require("path"));
|
|
68
|
+
var fs_extra_1 = __importDefault(require("fs-extra"));
|
|
69
|
+
var index_1 = require("../index");
|
|
70
|
+
var deviceInternalCodeName = index_1.config.deviceInternalCodeName;
|
|
71
|
+
var fs_1 = require("fs");
|
|
72
|
+
var rd = __importStar(require("rd"));
|
|
73
|
+
var parserZeusCommand = function (command) {
|
|
74
|
+
return (0, yargs_parser_1["default"])(command.replace(/^(zeus )/, ''));
|
|
75
|
+
};
|
|
76
|
+
exports.parserZeusCommand = parserZeusCommand;
|
|
77
|
+
var getInfoFromAppJson = function (root) {
|
|
78
|
+
return fs_extra_1["default"].readJSONSync(root, { throws: false });
|
|
79
|
+
};
|
|
80
|
+
exports.getInfoFromAppJson = getInfoFromAppJson;
|
|
81
|
+
var getDeviceInfoFromAppJson = function (root) {
|
|
82
|
+
if (root === void 0) { root = './'; }
|
|
83
|
+
var _a = (0, exports.getInfoFromAppJson)(path.resolve(root, './app.json')), targets = _a.targets, _b = _a.app, appId = _b.appId, appName = _b.appName, appType = _b.appType;
|
|
84
|
+
var _curTarget = process.env._targetDeviceToBuild;
|
|
85
|
+
var targetsContent = _curTarget && targets[_curTarget];
|
|
86
|
+
var platforms = (targetsContent ? targetsContent : targets[Object.keys(targets)[0]]).platforms;
|
|
87
|
+
var _c = platforms[0].deviceSource, deviceSource = _c === void 0 ? 229 : _c;
|
|
88
|
+
var deviceSourceArr = platforms.map(function (item) {
|
|
89
|
+
return item.deviceSource;
|
|
90
|
+
});
|
|
91
|
+
return {
|
|
92
|
+
deviceSource: deviceSource,
|
|
93
|
+
appId: appId,
|
|
94
|
+
appName: appName,
|
|
95
|
+
appType: appType,
|
|
96
|
+
deviceSourceArr: deviceSourceArr,
|
|
97
|
+
targetDeviceInternalName: deviceInternalCodeName[deviceSource]
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
exports.getDeviceInfoFromAppJson = getDeviceInfoFromAppJson;
|
|
101
|
+
var sleep = function (time) {
|
|
102
|
+
if (time === void 0) { time = 100; }
|
|
103
|
+
return new Promise(function (resolve) { return setTimeout(resolve, time); });
|
|
104
|
+
};
|
|
105
|
+
exports.sleep = sleep;
|
|
106
|
+
var checkCreateName = function (command, root, projectName, from) { return __awaiter(void 0, void 0, void 0, function () {
|
|
107
|
+
var workDir, beforeFiles;
|
|
108
|
+
return __generator(this, function (_a) {
|
|
109
|
+
workDir = root;
|
|
110
|
+
beforeFiles = [];
|
|
111
|
+
if (command === 'create') {
|
|
112
|
+
if (projectName) {
|
|
113
|
+
workDir = path.resolve(root, projectName);
|
|
114
|
+
if ((0, fs_1.existsSync)(workDir)) {
|
|
115
|
+
throw new Error("\"".concat(workDir, "/\" already exists."));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
throw new Error('There was a missing parameter: projectName.');
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
rd.eachFileSync(workDir, function (file) {
|
|
124
|
+
beforeFiles.push(file);
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
return [2, {
|
|
128
|
+
beforeFiles: beforeFiles,
|
|
129
|
+
workDir: workDir
|
|
130
|
+
}];
|
|
131
|
+
});
|
|
132
|
+
}); };
|
|
133
|
+
exports.checkCreateName = checkCreateName;
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
exports.__esModule = true;
|
|
6
|
+
exports.WebSocketClass = exports.handleListenMsgEvent = exports.getOptionalConnectDevice = void 0;
|
|
7
|
+
var index_1 = require("./index");
|
|
8
|
+
var ws_1 = __importDefault(require("ws"));
|
|
9
|
+
var os_1 = __importDefault(require("os"));
|
|
10
|
+
var fs_1 = __importDefault(require("fs"));
|
|
11
|
+
function getOptionalConnectDevice(connectDeviceArr) {
|
|
12
|
+
var result = {};
|
|
13
|
+
connectDeviceArr.map(function (item) {
|
|
14
|
+
var clientId = item.clientId, type = item.type, name = item.name, status = item.status;
|
|
15
|
+
if (type === 'debug' && status === 'online') {
|
|
16
|
+
result[name] = clientId;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return result;
|
|
20
|
+
}
|
|
21
|
+
exports.getOptionalConnectDevice = getOptionalConnectDevice;
|
|
22
|
+
function handleListenMsgEvent(msgEventName, data) {
|
|
23
|
+
var _a, _b, _c;
|
|
24
|
+
switch (msgEventName) {
|
|
25
|
+
case 'sysEventPush':
|
|
26
|
+
if (typeof data === 'string') {
|
|
27
|
+
index_1.logger.info(data);
|
|
28
|
+
}
|
|
29
|
+
else if (typeof data === 'object' && ((_a = data === null || data === void 0 ? void 0 : data.params) === null || _a === void 0 ? void 0 : _a.clients)) {
|
|
30
|
+
var connectedDevice = getOptionalConnectDevice(data.params.clients);
|
|
31
|
+
process.env._bridgeOptionalDevice = JSON.stringify(connectedDevice);
|
|
32
|
+
}
|
|
33
|
+
break;
|
|
34
|
+
case 'connectClient':
|
|
35
|
+
var _d = data.result, result = _d === void 0 ? '' : _d, _e = data.error, error = _e === void 0 ? {} : _e;
|
|
36
|
+
if (result && result === 'success') {
|
|
37
|
+
var choiredDevice = process.env._bridgeChoiredDevice;
|
|
38
|
+
index_1.logger.info("successfully connected to ".concat(choiredDevice, "."));
|
|
39
|
+
}
|
|
40
|
+
if (error && JSON.stringify(error) !== '{}') {
|
|
41
|
+
var _f = data.error, _g = _f.code, code = _g === void 0 ? 0 : _g, _h = _f.message, message = _h === void 0 ? '' : _h;
|
|
42
|
+
index_1.logger.error("".concat(code, ": ").concat(message));
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case 'sysSettingPush':
|
|
46
|
+
if (typeof data === 'string') {
|
|
47
|
+
index_1.logger.info(data);
|
|
48
|
+
}
|
|
49
|
+
else if (typeof data === 'object' && ((_b = data === null || data === void 0 ? void 0 : data.params) === null || _b === void 0 ? void 0 : _b.content)) {
|
|
50
|
+
index_1.logger.info(data.params.content);
|
|
51
|
+
}
|
|
52
|
+
break;
|
|
53
|
+
case 'sysMessagePush':
|
|
54
|
+
if (typeof data === 'string') {
|
|
55
|
+
index_1.logger.info(data);
|
|
56
|
+
}
|
|
57
|
+
else if (typeof data === 'object' && ((_c = data === null || data === void 0 ? void 0 : data.params) === null || _c === void 0 ? void 0 : _c.content)) {
|
|
58
|
+
index_1.logger.info(data.params.content);
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case 'logPush':
|
|
62
|
+
if (typeof data === 'string') {
|
|
63
|
+
index_1.logger.info(data);
|
|
64
|
+
}
|
|
65
|
+
else if (typeof data === 'object' && (data === null || data === void 0 ? void 0 : data.params)) {
|
|
66
|
+
var _j = data.params, _k = _j.level, level = _k === void 0 ? 'DEBUG' : _k, _l = _j.time, time = _l === void 0 ? new Date().getTime() : _l, message = _j.message;
|
|
67
|
+
var timeString = time.toString();
|
|
68
|
+
var fTime = Number(timeString.length > 13 ? timeString.substr(0, 13) : timeString);
|
|
69
|
+
var str = "[".concat(level.toUpperCase(), "-").concat(new Date(fTime).toLocaleTimeString(), ".").concat(new Date(fTime).getMilliseconds(), "] ").concat(message);
|
|
70
|
+
index_1.logger.info(str);
|
|
71
|
+
}
|
|
72
|
+
break;
|
|
73
|
+
case 'screenShot':
|
|
74
|
+
var path_1 = "".concat(os_1["default"].homedir(), "/desktop/screenShot.png");
|
|
75
|
+
fs_1["default"].writeFile(path_1, Buffer.from(data.result, 'hex'), function (err) {
|
|
76
|
+
if (err) {
|
|
77
|
+
index_1.logger.log('screenShot error', err);
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
index_1.logger.success("screenShot path:".concat(path_1));
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
break;
|
|
84
|
+
default:
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.handleListenMsgEvent = handleListenMsgEvent;
|
|
89
|
+
var WebSocketClass = (function () {
|
|
90
|
+
function WebSocketClass(_a) {
|
|
91
|
+
var url = _a.url, connectWSCB = _a.connectWSCB, disConnectWSCB = _a.disConnectWSCB;
|
|
92
|
+
var _this = this;
|
|
93
|
+
this.msgEventIDs = {};
|
|
94
|
+
this.handleListenMsgEventReturn = function (data) {
|
|
95
|
+
var message = data.toString('utf8');
|
|
96
|
+
var me = _this;
|
|
97
|
+
if (message.includes('{')) {
|
|
98
|
+
message = JSON.parse(message);
|
|
99
|
+
}
|
|
100
|
+
else if (message === 'ping') {
|
|
101
|
+
me.sendMessage('pong');
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
var _a = message || {}, _b = _a.method, method = _b === void 0 ? '' : _b, _c = _a.id, id = _c === void 0 ? 0 : _c;
|
|
105
|
+
Object.keys(_this.msgEventIDs).forEach(function (item) {
|
|
106
|
+
if (message && !method && _this.msgEventIDs[item] === id) {
|
|
107
|
+
method = item;
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
try {
|
|
111
|
+
handleListenMsgEvent(method, message);
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
index_1.logger.error("handleListenMsgEvent, ".concat(JSON.stringify(error)));
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
this.socket = new ws_1["default"](url);
|
|
118
|
+
this.socket.on('open', function () {
|
|
119
|
+
connectWSCB();
|
|
120
|
+
_this.listenEvent();
|
|
121
|
+
});
|
|
122
|
+
this.socket.on('close', function () {
|
|
123
|
+
disConnectWSCB();
|
|
124
|
+
});
|
|
125
|
+
this.socket.on('error', function (error) {
|
|
126
|
+
index_1.logger.error(error);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
WebSocketClass.prototype.sendMessage = function (params, options) {
|
|
130
|
+
if (options === void 0) { options = {}; }
|
|
131
|
+
var msgParams;
|
|
132
|
+
var msg = params;
|
|
133
|
+
var _a = options.method, method = _a === void 0 ? '' : _a;
|
|
134
|
+
if (method) {
|
|
135
|
+
msgParams = {
|
|
136
|
+
method: method,
|
|
137
|
+
params: params,
|
|
138
|
+
jsonrpc: '2.0',
|
|
139
|
+
id: this.createMsgEventID(method, params === null || params === void 0 ? void 0 : params.type)
|
|
140
|
+
};
|
|
141
|
+
msg = JSON.stringify(msgParams);
|
|
142
|
+
}
|
|
143
|
+
this.socket.send(msg, { binary: false });
|
|
144
|
+
};
|
|
145
|
+
WebSocketClass.prototype.createMsgEventID = function (method, type) {
|
|
146
|
+
var id = parseInt('' + Math.random() * 10000);
|
|
147
|
+
var prop = method;
|
|
148
|
+
var typeMap = {
|
|
149
|
+
'screenshot': 'screenShot'
|
|
150
|
+
};
|
|
151
|
+
if (type && typeMap[type]) {
|
|
152
|
+
prop = typeMap[type];
|
|
153
|
+
}
|
|
154
|
+
this.msgEventIDs[prop] = id;
|
|
155
|
+
return id;
|
|
156
|
+
};
|
|
157
|
+
WebSocketClass.prototype.listenEvent = function () {
|
|
158
|
+
var _this = this;
|
|
159
|
+
this.socket.on('message', function (data) {
|
|
160
|
+
_this.handleListenMsgEventReturn(data);
|
|
161
|
+
});
|
|
162
|
+
};
|
|
163
|
+
return WebSocketClass;
|
|
164
|
+
}());
|
|
165
|
+
exports.WebSocketClass = WebSocketClass;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "zeppos-app-utils",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"author": "",
|
|
7
|
+
"license": "MIT",
|
|
8
|
+
"private": true,
|
|
9
|
+
"scripts": {
|
|
10
|
+
"build": "tsc && pnpm run add",
|
|
11
|
+
"add": "ts-node build.ts && pnpm -F @zeppos/zeus-cli add zeppos-app-utils && pnpm -F zeppos-dev-tools add zeppos-app-utils",
|
|
12
|
+
"clean": "rm -rf node_modules && rm -rf dist"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@zeppos/zpm": "^2.6.6",
|
|
16
|
+
"axios": "^0.27.2",
|
|
17
|
+
"chalk": "^4.1.2",
|
|
18
|
+
"chokidar": "^3.5.3",
|
|
19
|
+
"dotenv": "^16.0.1",
|
|
20
|
+
"findup-sync": "^5.0.0",
|
|
21
|
+
"form-data": "^4.0.0",
|
|
22
|
+
"fs-extra": "^10.1.0",
|
|
23
|
+
"get-port": "5.1.1",
|
|
24
|
+
"inquirer": "^8.1.2",
|
|
25
|
+
"lodash": "^4.17.21",
|
|
26
|
+
"open": "^8.4.0",
|
|
27
|
+
"parse-gitignore": "^2.0.0",
|
|
28
|
+
"qs": "^6.11.0",
|
|
29
|
+
"rd": "^2.0.1",
|
|
30
|
+
"shelljs": "^0.8.5",
|
|
31
|
+
"socket.io-client": "^4.5.1",
|
|
32
|
+
"stoppable": "^1.1.0",
|
|
33
|
+
"update-notifier": "5.1.0",
|
|
34
|
+
"uuid": "^8.3.2",
|
|
35
|
+
"ws": "^8.8.0",
|
|
36
|
+
"yargs-parser": "^20.2.0",
|
|
37
|
+
"yeoman-environment": "^3.9.1"
|
|
38
|
+
},
|
|
39
|
+
"files": [
|
|
40
|
+
"dist"
|
|
41
|
+
],
|
|
42
|
+
"devDependencies": {
|
|
43
|
+
"@types/findup-sync": "^4.0.2",
|
|
44
|
+
"@types/fs-extra": "^9.0.13",
|
|
45
|
+
"@types/parse-gitignore": "^1.0.0",
|
|
46
|
+
"@types/stoppable": "^1.1.1",
|
|
47
|
+
"@types/update-notifier": "5.0.0",
|
|
48
|
+
"@types/yargs-parser": "^21.0.0",
|
|
49
|
+
"@types/yeoman-environment": "^2.10.7"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/utils/pre-check.js
CHANGED
|
@@ -1,27 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
3
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
4
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -64,16 +41,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
64
41
|
exports.__esModule = true;
|
|
65
42
|
exports.initVariable = exports.checkVersion = void 0;
|
|
66
43
|
var chalk_1 = __importDefault(require("chalk"));
|
|
67
|
-
var
|
|
68
|
-
var
|
|
69
|
-
var
|
|
70
|
-
var
|
|
71
|
-
var login_1 = require("../modules/login");
|
|
72
|
-
var project_1 = require("../config/project");
|
|
73
|
-
var _a = require('../package.json'), userVersion = _a.version, userName = _a.name, bin = _a.bin;
|
|
44
|
+
var packageJson = require('package-json');
|
|
45
|
+
var zeppos_app_utils_1 = require("zeppos-app-utils");
|
|
46
|
+
var loginStorageKey = zeppos_app_utils_1.config.getLocalConfig().loginStorageKey;
|
|
47
|
+
var _a = require('../package.json'), userVersion = _a.version, userName = _a.name;
|
|
74
48
|
var versionCheckTimeKey = '____inner_version_check_time';
|
|
75
49
|
var versionKey = '____inner_version';
|
|
76
|
-
var _b =
|
|
50
|
+
var _b = zeppos_app_utils_1.instanceStorage.getStorage(), _c = versionCheckTimeKey, userVersionCheckTime = _b[_c], _d = versionKey, originVersion = _b[_d], _e = loginStorageKey.accountToken, _f = _b[_e], apptoken = _f === void 0 ? '' : _f, _g = loginStorageKey.userid, _h = _b[_g], userid = _h === void 0 ? '' : _h, _j = loginStorageKey.cname, _k = _b[_j], cname = _k === void 0 ? '' : _k, _l = _b.account_env, _accountEnv = _l === void 0 ? 'production' : _l;
|
|
77
51
|
var versionToCode = function (version) {
|
|
78
52
|
if (!version)
|
|
79
53
|
return 0;
|
|
@@ -87,13 +61,13 @@ var checkOriginVersion = function () { return __awaiter(void 0, void 0, void 0,
|
|
|
87
61
|
switch (_b.label) {
|
|
88
62
|
case 0:
|
|
89
63
|
_b.trys.push([0, 2, , 3]);
|
|
90
|
-
return [4, (
|
|
64
|
+
return [4, packageJson(userName, { allVersions: true, registryUrl: 'https://registry.npmjs.org/' })];
|
|
91
65
|
case 1:
|
|
92
66
|
versions = (_b.sent()).versions;
|
|
93
67
|
versionList = Object.keys(versions).filter(function (val) { return !val.includes('beta'); });
|
|
94
68
|
originVersion = versionList[versionList.length - 1];
|
|
95
69
|
userVersionCheckTime = "".concat(+new Date());
|
|
96
|
-
|
|
70
|
+
zeppos_app_utils_1.globalStorage.set((_a = {},
|
|
97
71
|
_a[versionCheckTimeKey] = userVersionCheckTime,
|
|
98
72
|
_a[versionKey] = originVersion,
|
|
99
73
|
_a));
|
|
@@ -120,7 +94,7 @@ var checkVersion = function () { return __awaiter(void 0, void 0, void 0, functi
|
|
|
120
94
|
originVersionCode = versionToCode(originVersion);
|
|
121
95
|
userVersionCode = versionToCode(userVersion);
|
|
122
96
|
if (originVersionCode - userVersionCode >= 100) {
|
|
123
|
-
logger.log(chalk_1["default"].hex('#DB8C41')(
|
|
97
|
+
zeppos_app_utils_1.logger.log(chalk_1["default"].hex('#DB8C41')(zeppos_app_utils_1.config.updateVersion));
|
|
124
98
|
}
|
|
125
99
|
return [2];
|
|
126
100
|
}
|
|
@@ -136,7 +110,7 @@ var initVariable = function (args) { return __awaiter(void 0, void 0, void 0, fu
|
|
|
136
110
|
command = _argv._[0];
|
|
137
111
|
if (!['bridge', 'preview'].includes(command)) return [3, 2];
|
|
138
112
|
if (!(!apptoken || !userid || !cname)) return [3, 2];
|
|
139
|
-
return [4,
|
|
113
|
+
return [4, zeppos_app_utils_1.modules.login().then(function (res) {
|
|
140
114
|
apptoken = res.appToken;
|
|
141
115
|
cname = res.cname;
|
|
142
116
|
userid = res.userId;
|