{"id":33211864,"url":"https://github.com/skyFi/weapp-native","last_synced_at":"2025-11-21T05:03:33.056Z","repository":{"id":57398736,"uuid":"117204974","full_name":"skyFi/weapp-native","owner":"skyFi","description":"weapp-native (wn) 像React组件开发一样来开发微信小程序，开发微信小程序框架 [此项目短时间内已不再维护，有兴趣继续的可以加群联系我]","archived":false,"fork":false,"pushed_at":"2018-12-12T01:46:42.000Z","size":114,"stargazers_count":142,"open_issues_count":4,"forks_count":23,"subscribers_count":13,"default_branch":"master","last_synced_at":"2025-08-28T21:31:57.581Z","etag":null,"topics":["jsx","miniprogram","react","weapp","wn-cli"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/skyFi.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}},"created_at":"2018-01-12T06:53:42.000Z","updated_at":"2024-03-03T14:04:00.000Z","dependencies_parsed_at":"2022-09-01T16:04:25.083Z","dependency_job_id":null,"html_url":"https://github.com/skyFi/weapp-native","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/skyFi/weapp-native","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyFi%2Fweapp-native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyFi%2Fweapp-native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyFi%2Fweapp-native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyFi%2Fweapp-native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skyFi","download_url":"https://codeload.github.com/skyFi/weapp-native/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skyFi%2Fweapp-native/sbom","scorecard":{"id":830445,"data":{"date":"2025-08-11","repo":{"name":"github.com/skyFi/weapp-native","commit":"fc12d1a018498544188ff7601ebf93f39213f662"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.3,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"91 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-6chw-6frg-f759","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-fwr7-v2mv-hh25","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-cwfw-4gq5-mrqx","Warn: Project is vulnerable to: GHSA-g95f-p29q-9xw4","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-c6rq-rjc2-86v2","Warn: Project is vulnerable to: GHSA-mh2h-6j8q-x246","Warn: Project is vulnerable to: GHSA-5q88-cjfq-g2mh","Warn: Project is vulnerable to: GHSA-xp63-6vf5-xf3v","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-qrmc-fj45-qfc2","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-8r6j-v8pm-fqw3","Warn: Project is vulnerable to: MAL-2023-462","Warn: Project is vulnerable to: GHSA-q42p-pg8m-cqh6","Warn: Project is vulnerable to: GHSA-w457-6q6x-cgp9","Warn: Project is vulnerable to: GHSA-62gr-4qp9-h98f","Warn: Project is vulnerable to: GHSA-f52g-6jhx-586p","Warn: Project is vulnerable to: GHSA-2cf5-4w76-r9qv","Warn: Project is vulnerable to: GHSA-3cqr-58rm-57f8","Warn: Project is vulnerable to: GHSA-g9r4-xpmj-mj65","Warn: Project is vulnerable to: GHSA-q2c6-c6pm-g3gh","Warn: Project is vulnerable to: GHSA-765h-qjxv-5f44","Warn: Project is vulnerable to: GHSA-f2jv-r9rf-7988","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-2pr6-76vf-7546","Warn: Project is vulnerable to: GHSA-8j8c-7jfh-h6hx","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-6c8f-qphg-qjgp","Warn: Project is vulnerable to: GHSA-4xc9-xhrj-v574","Warn: Project is vulnerable to: GHSA-x5rq-j2xg-h7qm","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-4xcv-9jjx-gfj3","Warn: Project is vulnerable to: GHSA-f9cm-qmx5-m98h","Warn: Project is vulnerable to: GHSA-7wpw-2hjm-89gp","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-fhjf-83wg-r2j9","Warn: Project is vulnerable to: GHSA-r683-j2x4-v87g","Warn: Project is vulnerable to: GHSA-5fw9-fq32-wv5p","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-gcx4-mw62-g8wm","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-4g88-fppr-53pp","Warn: Project is vulnerable to: GHSA-4jqc-8m5r-9rpr","Warn: Project is vulnerable to: GHSA-j44m-qm6p-hp7m","Warn: Project is vulnerable to: GHSA-3jfq-g458-7qm9","Warn: Project is vulnerable to: GHSA-r628-mhmh-qjhw","Warn: Project is vulnerable to: GHSA-9r2w-394v-53qc","Warn: Project is vulnerable to: GHSA-5955-9wpr-37jh","Warn: Project is vulnerable to: GHSA-qq89-hq3f-393p","Warn: Project is vulnerable to: GHSA-f5x3-32g6-xq36","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-jgrx-mgxx-jf9v","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-662x-fhqg-9p8v","Warn: Project is vulnerable to: GHSA-394c-5j6w-4xmx","Warn: Project is vulnerable to: GHSA-78cj-fxph-m83p","Warn: Project is vulnerable to: GHSA-fhg7-m89q-25r3","Warn: Project is vulnerable to: GHSA-c4w7-xm78-47vh","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp","Warn: Project is vulnerable to: GHSA-8w4h-3cm3-2pm2","Warn: Project is vulnerable to: GHSA-rq8g-5pc5-wrhr","Warn: Project is vulnerable to: GHSA-hr2v-3952-633q","Warn: Project is vulnerable to: GHSA-h6ch-v84p-w6p9","Warn: Project is vulnerable to: GHSA-xf7w-r453-m56c","Warn: Project is vulnerable to: GHSA-44pw-h2cw-w3vq","Warn: Project is vulnerable to: GHSA-jp4x-w63m-7wgm","Warn: Project is vulnerable to: GHSA-c429-5p7v-vgjp","Warn: Project is vulnerable to: GHSA-fvqr-27wr-82fm","Warn: Project is vulnerable to: GHSA-3mpr-hq3p-49h9","Warn: Project is vulnerable to: GHSA-6394-6h9h-cfjg","Warn: Project is vulnerable to: GHSA-6g33-f262-xjp4","Warn: Project is vulnerable to: GHSA-jv35-xqg7-f92r","Warn: Project is vulnerable to: GHSA-2m39-62fm-q8r3","Warn: Project is vulnerable to: GHSA-mf6x-7mm4-x2g7"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-23T17:38:56.309Z","repository_id":57398736,"created_at":"2025-08-23T17:38:56.309Z","updated_at":"2025-08-23T17:38:56.309Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":285560057,"owners_count":27192467,"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-21T02:00:06.175Z","response_time":61,"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":["jsx","miniprogram","react","weapp","wn-cli"],"created_at":"2025-11-16T12:00:20.548Z","updated_at":"2025-11-21T05:03:33.051Z","avatar_url":"https://github.com/skyFi.png","language":"JavaScript","readme":"# **wn-cli**\n\n\u003e 暂不维护，推荐一个 https://github.com/NervJS/taro\n\nwn-cli 像React组件开发一样来开发微信小程序\n\n名字由来：**wn -\u003e weapp native** 取第一个字母\n\n# Install\n\n```\nnpm install wn-cli --save-dev\n// 或者\nyarn add wn-cli --dev\n```\n\n# Usage\n\n```\n// 构建\nnpx wn ./examples ./dist\n\n// 监听模式\nnpx wn ./examples ./dist -w\n```\n如果你遇到一个错误，让拷贝 `wn.js` 文件，请按提示信息将 `node_modules` 中的 `node_modules/wn-cli/dist/wn.js` 文件拷贝到 `modules` 文件夹中\n\n你的目录可能是这样的：\n```\n├── dist\n│   ├── app.js\n│   ├── app.json\n│   ├── app.wxss\n│   ├── modules\n│   │   └── wn.js\n│   ├── pages\n│   │   ├── index\n│   │   │   ├── index.js\n│   │   │   ├── index.json\n│   │   │   └── index.wxml\n│   │   │   └── index.wxss\n│   │   └── me\n│   │       ├── me.js\n│   │       ├── me.json\n│   │       └── me.wxml\n│   │       └── me.wxss\n│   └── project.config.json\n├── package.json\n├── project.config.json\n├── src\n│   ├── app.jsx\n│   ├── app.css\n│   └── pages\n│       ├── index\n│       │   ├── index.css\n│       │   └── index.jsx\n│       └── me\n│       │   ├── me.css\n│           └── me.jsx\n└── yarn.lock\n\n```\n然后在微信开发者工具中打开 `dist/` 文件夹，就可以预览开发了，可以选择你喜欢的编辑器。\n\n# 将来集成的功能\n\n* this 代理 wx, getApp等\n* 优化原生请求 request，避免请求限制\n* 接入 redux\n* 接入 saga\n* 增加 gulp 管理工作流\n* 增加 less 预编译\n* 扩展 `{ }` 操作符\n\n# API\n\n## 注册小程序\n\n创建 `app.jsx` 文件，这也是小程序的入口文件，可能像下面这样写\n```JavaScript\n// src/app.jsx\nimport { App } from 'wn';\n// 引入所有的页面，相对路径\nimport './pages/index/index.jsx';\nimport './pages/me/me.jsx';\n\nexport default class extends App {\n  debug = true\n\n  window = {\n    navigationBarTitleText: 'hello',\n    navigationBarTextStyle: 'black',\n    navigationBarBackgroundColor: '#f4f5f6',\n    backgroundColor: '#f4f5f6',\n  }\n\n  tabBar = {\n    color: '#333333',\n    backgroundColor: '#ffffff',\n    list: [\n      {\n        pagePath: 'pages/index/index', // 编译后js路径\n        text: '首页',\n      },\n      {\n        pagePath: 'pages/me/me',\n        text: '我',\n      },\n    ],\n  }\n\n  myData = '自定义公共变量'\n\n  hello() { return '自定义公共函数' }\n\n  // 生命周期函数\n  onLaunch() { console.log('app: hello onLaunch') }\n  onShow() { console.log('app: hello onShow') }\n  onHide() { console.log('app: hello onHide') }\n  onError() { console.log('app: hello onError') }\n}\n\n```\n\n同样的，可以通过在 `app.js` 同目录下创建 `app.css` ，来书写公用的 `css` 。\n```css\n/* src/app.css */\n.test {\n  color: red;\n}\n```\n如此，小程序就注册好了。\n\n## 创建页面\n\n创建第一个页面，在 `src/pages` 下面创建页面文件，如 `index/index.jsx`，可以这样写：\n```javascript\n// src/pages/index/index.jsx\nimport { Page, wx } from 'wn'\n\nexport default class extends Page {\n  window = {\n    navigationBarTitleText: 'hello'\n  }\n  navigationBarTextStyle = 'black'\n\n  async onShow() {\n    const systemInfo = await wx.getSystemInfo()\n    console.log('系统信息', systemInfo);\n  }\n\n  data = {\n    name: '小程序'\n  }\n\n  render() {\n    return (\n      \u003cview class=\"test\"\u003e\n        你好，{name}      \n      \u003c/view\u003e\n    )\n  }\n}\n\n``` \n\n添加文件作用域的样式文件，相当于`css module`，在 `src/pages/index` 文件夹下面创建同名 `css` 文件 `index.css`，不用再导入，只需要命名和同文件下的 `.jsx` 文件相同就可以了\n```css\n/* src/pages/index/index.css */\n.test {\n  color: blue;\n  text-align: center;\n}\n```\n如此第一个页面就创建好了，接下来你可以添加自己的 `me.jsx` 页面。\n\n## 创建组件\n\n创建第一个组件，如 `header`，在 `src/components`下面创建 `header/header.jsx` 和 `header/header.css`，两文件\n``` javascript\n// src/components/header/header.jsx\nimport { Component } from 'wn'\n\nexport default class extends Component {\n  render() {\n    return (\n      \u003cview class=\"header\"\u003e\n        \u003cslot\u003e\u003c/slot\u003e  \n      \u003c/view\u003e\n    )\n  }\n}\n\n```\n\n* `slot` 表示组件的 `children` 放置的位置，还可以指定位置，设置 `slot` 的 `name`。\n\n```css\n/* src/components/header/header.css */\n.header {\n  color: blue;\n}\n```\n\n## 使用组件\n\n创建了组件后，在页面中使用，首先在页面中导入：\n```javascript\nimport header from '../../components/header/header.jsx';\n```\n然后在需要的时候使用：\n```javascript\nrender() {\n    return (\n      \u003cview class=\"test\"\u003e\n        \u003cheader\u003e\n          hello\n        \u003c/header\u003e\n        你好，{name}      \n      \u003c/view\u003e\n    )\n  }\n```\n也可以组件嵌套等。\n\n# Promise 化微信 API，即使用 Promise 代理 wx 中的异步方法\n\n如：\n\n```javascript\n// ...\nasync onShow() {\n    const systemInfo = await wx.getSystemInfo()\n    console.log(systemInfo);\n  }\n// ...\n```\n\n* 注：原生 `API` 配置中的 `complete` 方法并没有代理\n\n# 以上\n\n* 暂时的功能能满足大多数简单的微信小程序开发，后续在使用中遇到瓶颈了，再配置兼容性开发高级 API 满足需求。\n\n* 最后的目的是能满足所有（99%）微信小程序开发者的需求，全面（99%）覆盖小程序开发。像 `React Native` 开发 `APP` 一样，用`wn-cli` 开发 `weapp （微信小程序）`。\n\n* 离目标还有不小的距离，如果你也是 `React` 派，对微信小程序有兴趣，可以 `fork` 代码共同建设维护这个工程 ，或许比较懒，那就直接提 [`ISSUE`](https://github.com/skyFi/weapp-native/issues/new)，这两样都会使我开心一整天的，当然，你的`star`也会令我开心好久。\n","funding_links":[],"categories":["Frameworks"],"sub_categories":["Mini Program"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FskyFi%2Fweapp-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FskyFi%2Fweapp-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FskyFi%2Fweapp-native/lists"}