{"id":33001944,"url":"https://github.com/kaiwu/weui-scalajs","last_synced_at":"2025-11-16T07:00:52.160Z","repository":{"id":174993738,"uuid":"119500707","full_name":"kaiwu/weui-scalajs","owner":"kaiwu","description":"write WeApp with scalajs","archived":false,"fork":false,"pushed_at":"2018-12-31T10:10:46.000Z","size":198,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-10-10T20:48:49.403Z","etag":null,"topics":["sbt","scalajs","weapp"],"latest_commit_sha":null,"homepage":null,"language":"Scala","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kaiwu.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-01-30T07:43:23.000Z","updated_at":"2025-09-02T03:49:26.000Z","dependencies_parsed_at":"2024-01-16T04:29:34.799Z","dependency_job_id":"b6b7ac31-2ec8-4dea-846e-fc4c241544ba","html_url":"https://github.com/kaiwu/weui-scalajs","commit_stats":null,"previous_names":["kaiwu/weui-scalajs"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kaiwu/weui-scalajs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiwu%2Fweui-scalajs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiwu%2Fweui-scalajs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiwu%2Fweui-scalajs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiwu%2Fweui-scalajs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kaiwu","download_url":"https://codeload.github.com/kaiwu/weui-scalajs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kaiwu%2Fweui-scalajs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":284672648,"owners_count":27044736,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-16T02:00:05.974Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["sbt","scalajs","weapp"],"created_at":"2025-11-13T14:00:24.545Z","updated_at":"2025-11-16T07:00:52.150Z","avatar_url":"https://github.com/kaiwu.png","language":"Scala","funding_links":[],"categories":["Demo"],"sub_categories":["数据接口有问题"],"readme":"[![Scala.js](https://www.scala-js.org/assets/badges/scalajs-0.6.17.svg)](https://www.scala-js.org)\n\n# WeApp meets Scala.js\n\nBy implementing [WeUI demo](https://github.com/Tencent/weui-wxss/), this project is a POC that [WeChat App](https://github.com/Wechat-Group/awesome-wechat-weapp)\ncan be implemented with [Scala.js](https://www.scala-js.org/) and [SBT](https://www.scala-sbt.org/), specifically,\nit uses the Scala.js plugin to compile Scala sources and [sbt-less](https://github.com/sbt/sbt-less#sbt-less) to compile style sources.\n\nA few motivations behind the project :\n\n1. Enjoy the Scala ecosystem !\n2. Avoid `this` and `that` of JavaScript and all of its hells and pitfalls, Scala causes much less hassles.\n3. [WePY](https://tencent.github.io/wepy/), the Tencent backed framework, only created extra boilerplates.\n\nFollowing is a typical array of asynchronous calls, written in Scala way\n\n```Scala\ndef onLoad(): Unit = {\n  val info = for {\n    msg  \u003c- Wechat.login{}\n    info \u003c- Wechat.getUserInfo(false,\"en\"){}\n  } yield info\n\n  Wechat.setData(\"userInfo\", info)\n}\n\n```\n## How to use\n\n```\nsbt \u003e assets\nsbt \u003e fullOptJS\n```\n\nThen use [WeApp Development Tool](https://mp.weixin.qq.com/debug/wxadoc/dev/devtools/download.html) to open the `target` directory.\nUnder WeApp circumstances it makes no sense to do `fastOptJS`, since `fullOptJS` generates highly optimized JavaScript already,\nthese options will need to be turned **OFF** from the project's settings:\n\n - convert Es6 to Es5\n - autocomplete on upload\n - compress on upload\n\nEach page is built as a separate sbt project, so one can always use the project specific sbt tasks, for example\n\n```\nsbt \u003e progress/fullOptJS\nsbt \u003e images/assets\n```\n\n## Caveats\n\n### Component\n\nScala.js supports component based development, as illustrated by page `example/component/component`, if a component is written in Javascript\nit can be used directly in pages. If a component is written in Scala.js and it defines custom event, be careful to resolve the needed handlers\nfrom `onReady` of Pages instead of `methods` of Components, because Scala.js cannot (for the good) declare a magic `this`, which is a major\nsources of mystery of Javascript\n\n### Facade\n\nFor demo purpose, it does not complete the entire WeApp [facade](https://mp.weixin.qq.com/debug/wxadoc/dev/api/), nevertheless,\nthis work is straightforward and could be supplemented as WeApp itself is evolving.\n\n### SBT\n\nSBT is [hard](http://www.lihaoyi.com/post/SowhatswrongwithSBT.html)\n\n### Less\n\nTo use `Less` and the sbt plugin, all the secondary component files are prefixed with underscore, such as `_weui.wxss`\n\n### Others\n\nScala.js compiler keeps bundling those Javascript sources in the webjar, which will be picked up and loaded by WeApp. Since WeApp requires the size be less than 2M, we can simply remove the unneeded `classes` folders. You can use the `cleanup.sh` script directly.\n\n```\nproject $ ./cleanup.sh\n```\n\n## License\n\n[MIT](http://opensource.org/licenses/MIT)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaiwu%2Fweui-scalajs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkaiwu%2Fweui-scalajs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkaiwu%2Fweui-scalajs/lists"}