@baic/yolk-cli 2.0.1-alpha.1 → 2.0.1-alpha.12
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/{templates/web/base/LICENSE → LICENSE} +1 -1
- package/README.md +6 -6
- package/{bin → lib}/index.d.ts +0 -0
- package/lib/index.js +2 -0
- package/package.json +25 -21
- package/templates/{miniapp/base/.editorconfig.tpl → miniprogram/.editorconfig} +0 -0
- package/templates/miniprogram/.eslintrc +6 -0
- package/templates/{miniapp/base/.prettierignore.tpl → miniprogram/.prettierignore} +0 -0
- package/templates/{miniapp/base/.prettierrc.tpl → miniprogram/.prettierrc} +0 -0
- package/templates/{miniapp/base → miniprogram}/.stylelintrc.json +1 -1
- package/templates/{miniapp/base → miniprogram}/LICENSE +0 -0
- package/templates/{mobile/base → miniprogram}/README.md.tpl +5 -1
- package/templates/miniprogram/babel.config.js +3 -0
- package/templates/miniprogram/config/index.ts.tpl +11 -0
- package/templates/miniprogram/global.d.ts +33 -0
- package/templates/{miniapp/base → miniprogram}/package.json.tpl +2 -3
- package/templates/{miniapp/base → miniprogram}/project.config.json.tpl +18 -3
- package/templates/{miniapp/base → miniprogram}/project.tt.json.tpl +0 -0
- package/templates/{miniapp/base → miniprogram}/src/app.config.ts +1 -3
- package/templates/{miniapp/base → miniprogram}/src/app.scss +0 -0
- package/templates/miniprogram/src/app.tsx +19 -0
- package/templates/{miniapp/base → miniprogram}/src/common/request.ts +1 -1
- package/templates/{web/base → miniprogram}/src/common/util.ts +1 -1
- package/templates/{miniapp/base → miniprogram}/src/components/index.ts +0 -0
- package/templates/miniprogram/src/constants.ts +1 -0
- package/templates/{miniapp/base → miniprogram}/src/hooks/index.ts +0 -0
- package/templates/{miniapp/base → miniprogram}/src/images/empty.gif +0 -0
- package/templates/{miniapp/base → miniprogram}/src/index.html +0 -0
- package/templates/miniprogram/src/pages/demo/examples/Input.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/MobileInput.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/MoneyInput.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/NumberInput.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/Textarea.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/TimerButton.tsx +3 -0
- package/templates/miniprogram/src/pages/demo/examples/usePreload.tsx +10 -0
- package/templates/miniprogram/src/pages/demo/index.config.ts +5 -0
- package/templates/{miniapp/base/src/pages/index → miniprogram/src/pages/demo}/index.module.scss +0 -0
- package/templates/miniprogram/src/pages/demo/index.tsx +44 -0
- package/templates/{miniapp/base → miniprogram}/src/pages/index/index.config.ts +0 -0
- package/templates/miniprogram/src/pages/index/index.module.scss +3 -0
- package/templates/{miniapp/base → miniprogram}/src/pages/index/index.tsx +1 -3
- package/templates/miniprogram/src/theme.scss +4 -0
- package/templates/{miniapp/base → miniprogram}/src/types/user.d.ts +0 -0
- package/templates/{miniapp/base → miniprogram}/tsconfig.json +3 -9
- package/templates/mobile/{base/.editorconfig.tpl → .editorconfig} +0 -0
- package/templates/mobile/{base/.eslintrc.tpl → .eslintrc} +0 -0
- package/templates/mobile/{base/.prettierignore.tpl → .prettierignore} +0 -0
- package/templates/mobile/{base/.prettierrc.tpl → .prettierrc} +0 -0
- package/templates/mobile/{base/.stylelintrc.json → .stylelintrc.json} +1 -1
- package/templates/mobile/{base/.umirc.ts.tpl → .umirc.ts.tpl} +1 -1
- package/templates/mobile/{base/LICENSE → LICENSE} +0 -0
- package/templates/{miniapp/base → mobile}/README.md.tpl +6 -2
- package/templates/{web/base → mobile}/package.json.tpl +2 -3
- package/templates/mobile/{base/public → public}/favicon.ico +0 -0
- package/templates/mobile/src/app.tsx +24 -0
- package/templates/mobile/src/common/request.ts +3 -0
- package/templates/{miniapp/base → mobile}/src/common/util.ts +1 -1
- package/templates/mobile/{base/src → src}/components/index.ts +0 -0
- package/templates/mobile/{base/src → src}/global.less +1 -1
- package/templates/mobile/src/layouts/index.tsx +4 -0
- package/templates/mobile/src/pages/404.tsx +10 -0
- package/templates/mobile/src/pages/demo/examples/BarCode.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/Iconfont.tsx +18 -0
- package/templates/mobile/src/pages/demo/examples/Loading.tsx +12 -0
- package/templates/mobile/src/pages/demo/examples/QrCode.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/Required.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/TimerButton.tsx +4 -0
- package/templates/mobile/src/pages/demo/examples/usePreload.tsx +9 -0
- package/templates/mobile/src/pages/demo/index.tsx +39 -0
- package/templates/mobile/src/pages/index.tsx +3 -0
- package/templates/mobile/{base/src → src}/types/user.d.ts +1 -1
- package/templates/{web/base → mobile}/tsconfig.json +2 -2
- package/templates/mobile/typings.d.ts +16 -0
- package/templates/web/{base/.editorconfig.tpl → .editorconfig} +0 -0
- package/templates/web/{base/.eslintrc.tpl → .eslintrc} +0 -0
- package/templates/web/{base/.prettierignore.tpl → .prettierignore} +0 -0
- package/templates/web/{base/.prettierrc.tpl → .prettierrc} +0 -0
- package/templates/web/{base/.stylelintrc.json → .stylelintrc.json} +1 -1
- package/templates/web/.umirc.ts +6 -0
- package/templates/web/LICENSE +21 -0
- package/templates/web/{base/README.md.tpl → README.md.tpl} +6 -2
- package/templates/{mobile/base → web}/package.json.tpl +2 -3
- package/templates/web/{base/public → public}/favicon.ico +0 -0
- package/templates/web/src/app.tsx +25 -0
- package/templates/web/src/common/request.ts +3 -0
- package/templates/{mobile/base → web}/src/common/util.ts +1 -1
- package/templates/web/{base/src → src}/components/index.ts +0 -0
- package/templates/web/{base/src → src}/global.less +1 -1
- package/templates/web/src/layouts/index.tsx +4 -0
- package/templates/web/{base/src → src}/pages/404.tsx +0 -0
- package/templates/web/src/pages/demo/examples/BankInput.tsx +14 -0
- package/templates/web/src/pages/demo/examples/BarCode.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Collapse.tsx +4 -0
- package/templates/web/src/pages/demo/examples/DatePicker.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Flex.tsx +10 -0
- package/templates/web/src/pages/demo/examples/Grid/1.tsx +25 -0
- package/templates/web/src/pages/demo/examples/Grid/2.tsx +26 -0
- package/templates/web/src/pages/demo/examples/Grid/3.tsx +37 -0
- package/templates/web/src/pages/demo/examples/Grid/4.tsx +44 -0
- package/templates/web/src/pages/demo/examples/Grid/5.tsx +37 -0
- package/templates/web/src/pages/demo/examples/Grid/6.tsx +28 -0
- package/templates/web/src/pages/demo/examples/Iconfont.tsx +18 -0
- package/templates/web/src/pages/demo/examples/ImagePreview.tsx +20 -0
- package/templates/web/src/pages/demo/examples/Input/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Input/2.tsx +80 -0
- package/templates/web/src/pages/demo/examples/LinkButton/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/LinkButton/2.tsx +9 -0
- package/templates/web/src/pages/demo/examples/LinkButton/3.tsx +12 -0
- package/templates/web/src/pages/demo/examples/Loading.tsx +12 -0
- package/templates/web/src/pages/demo/examples/MobileInput.tsx +4 -0
- package/templates/web/src/pages/demo/examples/NumberInput.tsx +4 -0
- package/templates/web/src/pages/demo/examples/QrCode.tsx +4 -0
- package/templates/web/src/pages/demo/examples/RangeNumber/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/RangeNumber/2.tsx +16 -0
- package/templates/web/src/pages/demo/examples/Required.tsx +4 -0
- package/templates/web/src/pages/demo/examples/SearchLayout.tsx +46 -0
- package/templates/web/src/pages/demo/examples/Table/1.tsx +64 -0
- package/templates/web/src/pages/demo/examples/Table/2.tsx +29 -0
- package/templates/web/src/pages/demo/examples/Table/3.tsx +39 -0
- package/templates/web/src/pages/demo/examples/Table/4.tsx +42 -0
- package/templates/web/src/pages/demo/examples/TimerButton.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Title/1.tsx +4 -0
- package/templates/web/src/pages/demo/examples/Title/2.tsx +5 -0
- package/templates/web/src/pages/demo/examples/WaterMark.tsx +8 -0
- package/templates/web/src/pages/demo/examples/Wrapper.tsx +40 -0
- package/templates/web/src/pages/demo/examples/usePreload.tsx +9 -0
- package/templates/web/src/pages/demo/index.tsx +133 -0
- package/templates/web/src/pages/index.tsx +3 -0
- package/templates/web/{base/src → src}/types/user.d.ts +1 -1
- package/templates/{mobile/base → web}/tsconfig.json +2 -2
- package/templates/web/typings.d.ts +16 -0
- package/bin/index.js +0 -2
- package/templates/miniapp/base/.eslintrc.js.tpl +0 -6
- package/templates/miniapp/base/.gitignore.tpl +0 -38
- package/templates/miniapp/base/babel.config.js +0 -3
- package/templates/miniapp/base/config/index.ts.tpl +0 -8
- package/templates/miniapp/base/global.d.ts +0 -18
- package/templates/miniapp/base/src/app.tsx +0 -26
- package/templates/miniapp/base/src/constants.ts +0 -1
- package/templates/miniapp/base/src/store/index.ts +0 -34
- package/templates/miniapp/base/src/theme.scss +0 -4
- package/templates/mobile/base/.gitignore.tpl +0 -33
- package/templates/mobile/base/__tests__/__snapshots__/pages.test.tsx.snap +0 -88
- package/templates/mobile/base/__tests__/pages.test.tsx +0 -11
- package/templates/mobile/base/src/app.tsx +0 -27
- package/templates/mobile/base/src/common/request.ts +0 -3
- package/templates/mobile/base/src/layouts/index.less +0 -103
- package/templates/mobile/base/src/layouts/index.tsx +0 -48
- package/templates/mobile/base/src/pages/404.tsx +0 -12
- package/templates/mobile/base/src/pages/index.tsx +0 -3
- package/templates/mobile/base/src/store/index.ts +0 -17
- package/templates/mobile/base/typings.d.ts +0 -8
- package/templates/web/base/.gitignore.tpl +0 -33
- package/templates/web/base/.umirc.ts.tpl +0 -6
- package/templates/web/base/__tests__/__snapshots__/pages.test.tsx.snap +0 -112
- package/templates/web/base/__tests__/pages.test.tsx +0 -11
- package/templates/web/base/src/app.tsx +0 -36
- package/templates/web/base/src/common/request.ts +0 -3
- package/templates/web/base/src/layouts/index.less +0 -11
- package/templates/web/base/src/layouts/index.tsx +0 -94
- package/templates/web/base/src/pages/index.tsx +0 -3
- package/templates/web/base/src/store/index.ts +0 -17
- package/templates/web/base/typings.d.ts +0 -8
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ $ yolk build
|
|
|
26
26
|
|
|
27
27
|
## .yolkrc
|
|
28
28
|
|
|
29
|
-
##### yolk内置配置文件
|
|
29
|
+
##### yolk 内置配置文件
|
|
30
30
|
|
|
31
31
|
```json
|
|
32
32
|
{
|
|
@@ -36,8 +36,8 @@ $ yolk build
|
|
|
36
36
|
|
|
37
37
|
#### API
|
|
38
38
|
|
|
39
|
-
|
|
|
40
|
-
|
|
|
41
|
-
| eslintIgnore
|
|
42
|
-
|
|
|
43
|
-
|
|
|
39
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
40
|
+
| :-------------: | :------------------------------------------------------: | :-----------------------: | :----: |
|
|
41
|
+
| eslintIgnore | 忽略 commit 时 eslint 代码检查,符合 glob 语法 | string \| RegExp \| array | - |
|
|
42
|
+
| stylelintIgnore | 忽略 commit 时 stylelint 代码检查,符合 glob 语法 | string \| RegExp \| array | - |
|
|
43
|
+
| strict | 严格模式,关闭以后使用项目定义的 eslint 规则进行提交检查 | boolean | - |
|
package/{bin → lib}/index.d.ts
RENAMED
|
File without changes
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
#! /usr/bin/env node
|
|
2
|
+
"use strict";var e=require("@babel/runtime/helpers/interopRequireDefault"),t=require("@babel/runtime/helpers/typeof"),n=e(require("@babel/runtime/helpers/toArray")),r=e(require("@babel/runtime/helpers/toConsumableArray")),a=e(require("@babel/runtime/helpers/defineProperty")),i=e(require("lodash/isString")),o=e(require("lodash/pick")),c=e(require("lodash/chunk")),s=e(require("fs")),u=e(require("path")),l=e(require("os")),f=e(require("commander")),d=e(require("inquirer")),p=require("child_process"),m=e(require("ora")),y=e(require("glob")),g=e(require("minimatch")),v=e(require("mustache")),h=e(require("mkdirp")),b=e(require("rimraf")),j=require("prettier"),S=x(require("miniprogram-ci")),k=e(require("../package.json"));function w(e){if("function"!==typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(w=function(e){return e?n:t})(e)}function x(e,n){if(!n&&e&&e.__esModule)return e;if(null===e||"object"!==t(e)&&"function"!==typeof e)return{default:e};var r=w(n);if(r&&r.has(e))return r.get(e);var a={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var c=i?Object.getOwnPropertyDescriptor(e,o):null;c&&(c.get||c.set)?Object.defineProperty(a,o,c):a[o]=e[o]}return a["default"]=e,r&&r.set(e,a),a}function O(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function P(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?O(Object(n),!0).forEach((function(t){(0,a["default"])(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var q=require("staged-git-files"),F=process.cwd(),E="##### CREATED BY YOLK #####",D={ts:"typescript",tsx:"typescript",less:"less",sass:"scss",scss:"scss",css:"css"},B="utf-8",I=60,R=["**/node_modules/**","**/.umi/**","**/.umi-production/**","**/build/**","**/dist/**","**/lib/**","**/public/**","**/assets/**","**/h5+app/**","**/mock/**","**/yolk/**","**/yolk-web/**","**/yolk-web-ui/**","**/yolk-mobile/**","**/yolk-mobile-ui/**","**/yolk-miniprogram/**","**/yolk-miniprogram-ui/**"],Q=(0,m["default"])(),T=function(e){return e&&Q.warn(Buffer.from(e,B).toString())},_=function(e){return e&&Q.fail(Buffer.from(e,B).toString())},L=function(e){return e&&Q.succeed(Buffer.from(e,B).toString())},N=function(e){return e&&Q.info(Buffer.from(e,B).toString())},A=function(e){return"win32"===process.platform?"".concat(e,".cmd"):e},M=function(){L("yolk complete!"),process.exit(0)},K=function(){T("yolk break!"),process.exit(0)},C=function(e){var t=e.command,n=e.args,r=e.complete,a=e.close,i=e.exit,o=void 0===i||i,c=(0,p.spawn)(A(t),n||[],{stdio:"inherit"}).on("close",(function(e){e?(a&&a(),_("yolk close!"),process.exit(e)):(r&&r(),o&&M())}));process.on("SIGINT",(function(){f["default"].runningCommand&&f["default"].runningCommand.kill("SIGKILL"),c.kill(),K()}))},$=function(e,t,n){d["default"].prompt([{type:"list",name:"type",message:"\u9009\u62e9\u5e73\u53f0",default:"web",choices:[{name:"web",value:"web"},{name:"mobile",value:"mobile"},{name:"\u5c0f\u7a0b\u5e8f",value:"miniprogram"}]},{type:"input",name:"projectName",message:"\u9879\u76ee\u540d\u79f0",default:u["default"].basename(u["default"].basename(process.cwd()))},{type:"list",name:"dependenciesInstallType",message:"\u9009\u62e9\u4f9d\u8d56\u5b89\u88c5\u65b9\u5f0f",default:!1,choices:[{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"},{name:"\u4e0d\u521d\u59cb\u5316",value:!1}]}]).then((function(r){var a={projectName:r.projectName,mobile:"mobile"===r.type,dependenciesInstallType:r.dependenciesInstallType};t||(t=u["default"].join(__dirname,"../templates/".concat(r.type))),L("\u590d\u5236\u6a21\u7248 ".concat(u["default"].basename(t)));var i=y["default"].sync("**/*",{cwd:t,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(i.forEach((function(n){if(t){var r=u["default"].join(t,n);if(!s["default"].statSync(r).isDirectory())if(n.endsWith(".tpl")){var i=s["default"].readFileSync(r,B),o=u["default"].join(e,n.replace(/\.tpl$/,"")),c=v["default"].render(i,a);h["default"].sync(u["default"].dirname(o)),L("\u521b\u5efa ".concat(u["default"].relative(e,o))),s["default"].writeFileSync(o,c,B)}else{L("\u521b\u5efa ".concat(n));var l=u["default"].join(e,n);h["default"].sync(u["default"].dirname(l)),s["default"].copyFileSync(r,l)}}})),L("\u590d\u5236\u6a21\u7248 success!"),n&&s["default"].existsSync(t)&&(0,b["default"])(t,(function(){L("\u7f13\u5b58\u5220\u9664 success! ".concat(u["default"].basename(t||"")))})),r.dependenciesInstallType)switch(L("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),r.dependenciesInstallType){case"npm":C({command:"npm",args:["install"]});break;case"yarn":default:C({command:"yarn",args:["install"]});break}L("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},J=function(e,t){return $(e,t,!0)},U=function(){var e=y["default"].sync("*.yolkrc*",{cwd:F,dot:!0});if(!e.length)return{};var t=u["default"].join(F,e[0]);if(!s["default"].existsSync(t))return{};try{return JSON.parse(s["default"].readFileSync(t,B))||{}}catch(n){return _(n.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}},W=function(){var e=u["default"].join(F,".prettierrc");if(!s["default"].existsSync(e)){if(s["default"].existsSync(require.resolve("@umijs/fabric/dist/prettier"))){var t=require("@umijs/fabric/dist/prettier");return t}return{}}try{return JSON.parse(s["default"].readFileSync(e,B))||{}}catch(n){return _(n.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}},G=function(){var e=u["default"].join(F,"project.config.json");if(!s["default"].existsSync(e))return{};try{return JSON.parse(s["default"].readFileSync(e,B))||{}}catch(t){return _(t.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}},H=function(){var e=u["default"].join(F,"package.json");if(!s["default"].existsSync(e))return{};try{return JSON.parse(s["default"].readFileSync(e,B))||{}}catch(t){return _(t.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}},V=function(){return s["default"].existsSync(u["default"].join(F,"project.config.json"))},Y=function(){var e=u["default"].join(F,"project.config.json");if(s["default"].existsSync(e)){var t=require(e);return t.appid}return""},z=function(){return s["default"].existsSync(u["default"].join(F,"project.tt.json"))&&0===Y().indexOf("tt")},X=function(){return 0===Y().indexOf("20")},Z=function(){var e=U(),t=V()?require.resolve("@baic/eslint-config-yolk-miniprogram"):require.resolve("@baic/eslint-config-yolk"),n=y["default"].sync("*.eslintrc*",{cwd:F,dot:!0}),r=n[0];return!1===e.strict&&r&&s["default"].existsSync(r)?r:t},ee=function(){var e=y["default"].sync("*.stylelintrc*",{cwd:F,dot:!0}),t=e[0];return t},te=function(){var e=u["default"].join(F,".git/"),t=u["default"].join(F,".git/hooks"),n=u["default"].join(t,"pre-commit"),r=s["default"].existsSync(e),a=s["default"].existsSync(n),i=a&&s["default"].readFileSync(n,"utf8").includes(E);if(r&&(!a||!i)){h["default"].sync(t),s["default"].writeFileSync(n,["#!/usr/bin/env bash","npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",E].join(l["default"].EOL),"utf8");try{s["default"].chmodSync(n,"777")}catch(o){_("chmod ".concat(n," failed: ").concat(o.message))}L("Create pre-commit hook")}},ne=function(){var e=U(),t=!1!==e.strict,n=e.eslintIgnore,a=e.stylelintIgnore;q().then((function(e){var i=new Promise((function(n,i){var o=ee();if(o){var l=e.map((function(e){return e.filename})).filter((function(e){return/^([s\u017F]rc|te[s\u017F]t[s\u017F])/i.test(e)})).filter((function(e){return/\.(le|[s\u017F]a|[s\u017F]c|c)[s\u017F]{2}$/i.test(e)})).filter((function(e){return R.every((function(t){return!(0,g["default"])(e,t,{matchBase:!0})}))})).filter((function(e){return"string"===typeof a?!(0,g["default"])(e,a,{matchBase:!0}):a instanceof RegExp?!a.test(e):!Array.isArray(a)||a.every((function(t){return"string"===typeof t?!(0,g["default"])(e,t,{matchBase:!0}):!(t instanceof RegExp)||!t.test(e)}))})).map((function(e){var t=u["default"].join(F,e);return s["default"].existsSync(t)?t:null})).filter((function(e){return!!e}));if(l.forEach((function(e){if(e&&s["default"].existsSync(e)){var t=u["default"].extname(e).replace(/^\./,""),n=s["default"].readFileSync(e,"utf8"),r=(0,j.format)(n,P({parser:D[t]},W()));s["default"].writeFileSync(e,r,"utf8")}})),L("style prettier success!"),l.length>=I){var f=[];(0,c["default"])(l,20).forEach((function(e){f.push(new Promise((function(n,a){C({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",o].concat((0,r["default"])(e)),complete:n,close:a,exit:!1})})))}));var d=process.getMaxListeners(),p=(0,c["default"])(f,d?d/2:2),m=0,y=function e(){m<p.length?Promise.all(p[m]).then((function(){m++,e()}))["catch"](i):n()};y()}else l.length&&C({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",o].concat((0,r["default"])(l)),complete:n,close:i,exit:!1})}else n()})),o=function(){var a=e.map((function(e){return e.filename})).filter((function(e){return/^([s\u017F]rc|te[s\u017F]t[s\u017F])/i.test(e)})).filter((function(e){return/\.([jt\|][s\u017F]x?)$/i.test(e)})).map((function(e){var t=u["default"].join(F,e);return s["default"].existsSync(t)?t:null})).filter((function(e){return!!e}));if(a.length){a.forEach((function(e){if(e&&s["default"].existsSync(e)){var t=u["default"].extname(e).replace(/^\./,""),n=s["default"].readFileSync(e,"utf8"),r=(0,j.format)(n,P({parser:D[t]},W()));s["default"].writeFileSync(e,r,"utf8")}})),L("script prettier success!");var i=Z();if(i){var o=a.filter((function(e){return R.every((function(t){return!(0,g["default"])(e,t,{matchBase:!0})}))})).filter((function(e){return"string"===typeof n?!(0,g["default"])(e,n,{matchBase:!0}):n instanceof RegExp?!n.test(e):!Array.isArray(n)||n.every((function(t){return"string"===typeof t?!(0,g["default"])(e,t,{matchBase:!0}):!(t instanceof RegExp)||!t.test(e)}))}));if(t&&(T("git commit\u7981\u6b62eslint\u7684ignore\u65b9\u5f0f(eslint-disable\u3001.eslintrc*\u3001ignore\u7b49)\u3002"),n&&T("\u901a\u8fc7yolkrc\u914d\u7f6eeslintIgnore\uff1a".concat(n,"\u3002"))),o.length>=I){var l=[];(0,c["default"])(o,20).forEach((function(e){l.push(new Promise((function(n){C({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",i].concat((0,r["default"])(e)),complete:n,exit:!1})})))}));var f=process.getMaxListeners(),d=(0,c["default"])(l,f?f/2:2),p=0,m=function e(){p<d.length?Promise.all(d[p]).then((function(){p++,e()})):M()};m()}else o.length&&C({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",i].concat((0,r["default"])(o))})}else T("\u6ca1\u6709eslint\u914d\u7f6e\u6587\u4ef6")}else M()};T("\u8981\u6c42\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),i.then(o)}))},re=function(e){var t=e.mProject,n=e.mPrivateKeyPath,r=e.mVersion,a=e.mDesc,i=e.mRobot,o=e.mQrcodeFormat,c=e.mQrcodeOutputDest,l=e.mPagePath,f=e.mSearchQuery,d=s["default"].existsSync(u["default"].join(F,".git"))?(0,p.execSync)("git log -1 --pretty=format:%H").toString():"",m=G(),y=m.appid,g=t||u["default"].join(F,"dist"),v=n||u["default"].join(F,"private.".concat(y,".key"));if(s["default"].existsSync(g)){if(s["default"].existsSync(v)){var h=H(),b=r||h.version||m.version||"1.0.0",j=a||h.description||m.description,k="version: ".concat(b,";").concat(d?" commit: ".concat(d,";"):"").concat(j?" description: ".concat(j,";"):"");d&&N("commit: ".concat(d)),N("dist: ".concat(g)),N("key: ".concat(v)),N("appid: ".concat(y)),N("version: ".concat(b)),N("desc: ".concat(k));var w=new S.Project({appid:y,type:"miniProgram",projectPath:g,privateKeyPath:v,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:y,options:{project:w,version:b,desc:k,setting:m.setting,robot:i,qrcodeFormat:o,qrcodeOutputDest:c,pagePath:l,searchQuery:f}}}throw Error("\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(".concat(v,")"))}throw Error("\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(".concat(g,")"))},ae=function(){N("yolk version: ".concat(k["default"].version)),N("node version: ".concat(process.version)),N("\u64cd\u4f5c\u7cfb\u7edf\u5e73\u53f0: ".concat(l["default"].platform())),N("\u64cd\u4f5c\u7cfb\u7edf: ".concat(l["default"].release())),N("\u7cfb\u7edf\u5185\u5b58\u603b\u91cf: ".concat(l["default"].totalmem()/1024/1024,"MB")),N("\u64cd\u4f5c\u7cfb\u7edf\u540d\u79f0: ".concat(l["default"].type())),N("\u5185\u6838\u7248\u672c: ".concat(l["default"].version())),te(),process.argv.length>2?f["default"].version(k["default"].version).usage("[command] [options]").option("--clone","\u901a\u8fc7git clone\u62c9\u53d6\u6a21\u7248").option("--template <template>","\u6a21\u7248\u540d\u79f0\u6216\u8005clone\u6a21\u5f0f\u7684git\u5730\u5740").option("--docs","\u542f\u52a8\u6587\u6863\u6a21\u5f0f").option("--mProject <project>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u5de5\u7a0b\u76ee\u5f55").option("--mPrivateKeyPath <privateKeyPath>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20key\u6587\u4ef6").option("--mVersion <version>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u7248\u672c\u53f7").option("--mDesc <desc>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u63cf\u8ff0").option("--mRobot <robot>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20ci\u673a\u5668\u4eba1~30").option("--mQrcodeFormat <qrcodeFormat>",'\u5c0f\u7a0b\u5e8f\u9884\u89c8\u8fd4\u56de\u4e8c\u7ef4\u7801\u6587\u4ef6\u7684\u683c\u5f0f "image" \u6216 "base64"\uff0c \u9ed8\u8ba4\u503c "terminal" \u4f9b\u8c03\u8bd5\u7528').option("--mQrcodeOutputDest <qrcodeOutputDest>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u4e8c\u7ef4\u7801\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84").option("--mPagePath <pagePath>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84").option("--mSearchQuery <searchQuery>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84\u542f\u52a8\u53c2\u6570").action((function(e,t){var r=(0,n["default"])(t),a=r[0],c=r.slice(1),l=e.clone,f=e.template,d=e.docs;if(a)switch(a){case"init":if(L("yolk ".concat(a," \u5f00\u59cb")),l)if(f){var p=".yolk",m=u["default"].join(F,p);s["default"].existsSync(m)&&(0,b["default"])(m,(function(){L("\u7f13\u5b58\u5220\u9664 success! ".concat(m))})),C({command:"git",args:["clone","-b","master","--depth","1",f,p].concat(c)}),J(F,m)}else _("--clone \u6a21\u5f0f\u5fc5\u987b\u6709--template");else $(F);break;case"start":V()?z()?C({command:"taro",args:["build","--type","tt","--watch"].concat(c)}):X()?C({command:"taro",args:["build","--type","alipay","--watch"].concat(c)}):C({command:"taro",args:["build","--type","weapp","--watch"].concat(c)}):C(d?{command:"dumi",args:["dev"].concat(c)}:{command:"umi",args:["dev"].concat(c)});break;case"build":V()?z()?C({command:"taro",args:["build","--type","tt"].concat(c)}):X()?C({command:"taro",args:["build","--type","alipay"].concat(c)}):C({command:"taro",args:["build","--type","weapp"].concat(c)}):C(d?{command:"dumi",args:["build"].concat(c)}:{command:"umi",args:["build"].concat(c)});break;case"pre-commit":ne();break;case"test":C({command:"umi-test",args:["--no-cache","--update-snapshot","--runInBand","--detectOpenHandles"].concat(c)});break;case"miniapp-upload":case"miniprogram-upload":if(V())if(z());else if(X());else{var y=re(e),g=y.appid,v=y.options;N("".concat(g,"\u4e0a\u4f20\u5f00\u59cb")),S.upload(P(P({},(0,o["default"])(v,["project","version","desc","setting","robot"])),{},{onProgressUpdate:function(e){if((0,i["default"])(e))N("task: ".concat(e));else{var t=e.status,n=e.message;N("task(".concat(t,"): ").concat(n))}}})).then((function(){L("".concat(g,"\u4e0a\u4f20\u5b8c\u6210"))}))}break;case"miniapp-preview":case"miniprogram-preview":if(V())if(z());else if(X());else{var h=re(e),j=h.appid,k=h.options;N("".concat(j,"\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb")),S.preview(P(P({},(0,o["default"])(k,["project","version","desc","setting","robot","qrcodeFormat","qrcodeOutputDest","pagePath","searchQuery"])),{},{onProgressUpdate:function(e){if((0,i["default"])(e))N("task: ".concat(e));else{var t=e.status,n=e.message;N("task(".concat(t,"): ").concat(n))}}})).then((function(){L("".concat(j,"\u4e0a\u4f20\u9884\u89c8\u5b8c\u6210"))}))}break;default:K()}})).parse(process.argv):K()};ae();
|
package/package.json
CHANGED
|
@@ -1,41 +1,45 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baic/yolk-cli",
|
|
3
|
-
"version": "2.0.1-alpha.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
"pub": "npm publish",
|
|
7
|
-
"start": "node ./bin start"
|
|
8
|
-
},
|
|
3
|
+
"version": "2.0.1-alpha.12",
|
|
4
|
+
"author": "Baic <303394539@qq.com>",
|
|
5
|
+
"license": "MIT",
|
|
9
6
|
"bin": {
|
|
10
|
-
"yolk": "
|
|
7
|
+
"yolk": "lib/index.js"
|
|
11
8
|
},
|
|
9
|
+
"main": "lib/index.js",
|
|
12
10
|
"files": [
|
|
13
|
-
"
|
|
11
|
+
"lib",
|
|
14
12
|
"templates"
|
|
15
13
|
],
|
|
16
|
-
"author": "Baic",
|
|
17
14
|
"repository": {
|
|
18
15
|
"type": "git",
|
|
19
|
-
"url": "https://github.com/303394539/yolk"
|
|
16
|
+
"url": "git+https://github.com/303394539/yolk.git"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
20
20
|
},
|
|
21
|
-
"license": "MIT",
|
|
22
21
|
"dependencies": {
|
|
22
|
+
"@babel/runtime": "~7.17.9",
|
|
23
23
|
"@types/glob": "~7.2.0",
|
|
24
|
-
"@types/inquirer": "~8.1
|
|
25
|
-
"@types/lodash": "
|
|
24
|
+
"@types/inquirer": "~8.2.1",
|
|
25
|
+
"@types/lodash": "4.x",
|
|
26
26
|
"@types/mkdirp": "~1.0.2",
|
|
27
27
|
"@types/mustache": "~4.1.2",
|
|
28
|
+
"@types/prettier": "~2.6.0",
|
|
28
29
|
"@types/rimraf": "~3.0.2",
|
|
29
30
|
"commander": "6.x",
|
|
30
|
-
"glob": "~
|
|
31
|
-
"inquirer": "~8.2.
|
|
32
|
-
"lodash": "
|
|
33
|
-
"miniprogram-ci": "~1.
|
|
31
|
+
"glob": "~8.0.1",
|
|
32
|
+
"inquirer": "~8.2.2",
|
|
33
|
+
"lodash": "4.x",
|
|
34
|
+
"miniprogram-ci": "~1.8.18",
|
|
34
35
|
"mkdirp": "~1.0.4",
|
|
35
36
|
"mustache": "~4.2.0",
|
|
36
|
-
"
|
|
37
|
-
"prettier": "~2.5.1",
|
|
37
|
+
"prettier": "~2.6.2",
|
|
38
38
|
"rimraf": "~3.0.2",
|
|
39
|
-
"staged-git-files": "~1.
|
|
40
|
-
}
|
|
39
|
+
"staged-git-files": "~1.3.0"
|
|
40
|
+
},
|
|
41
|
+
"publishConfig": {
|
|
42
|
+
"access": "public"
|
|
43
|
+
},
|
|
44
|
+
"gitHead": "d0334097db0859afbf6e19f9cb05ee6e1aac5668"
|
|
41
45
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
Install dependencies,
|
|
6
6
|
|
|
7
7
|
{{ #dependenciesInstallType }}
|
|
8
|
+
|
|
8
9
|
```bash
|
|
9
10
|
$ {{ dependenciesInstallType }} install
|
|
10
11
|
```
|
|
12
|
+
|
|
11
13
|
{{ /dependenciesInstallType }}
|
|
12
14
|
{{ ^dependenciesInstallType }}
|
|
15
|
+
|
|
13
16
|
```bash
|
|
14
17
|
$ yarn install
|
|
15
18
|
```
|
|
19
|
+
|
|
16
20
|
{{ /dependenciesInstallType }}
|
|
17
21
|
|
|
18
22
|
Start the dev server,
|
|
@@ -27,4 +31,4 @@ Build,
|
|
|
27
31
|
$ npm run build
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
[查阅文档](https://303394539.github.io/yolk-docs/)
|
|
34
|
+
[查阅文档](https://303394539.github.io/yolk-docs/)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
declare module '*.png';
|
|
2
|
+
declare module '*.gif';
|
|
3
|
+
declare module '*.jpg';
|
|
4
|
+
declare module '*.jpeg';
|
|
5
|
+
declare module '*.svg' {
|
|
6
|
+
export function ReactComponent(
|
|
7
|
+
props: React.SVGProps<SVGSVGElement>,
|
|
8
|
+
): React.ReactElement;
|
|
9
|
+
const url: string;
|
|
10
|
+
export default url;
|
|
11
|
+
}
|
|
12
|
+
declare module '*.css';
|
|
13
|
+
declare module '*.less';
|
|
14
|
+
declare module '*.scss';
|
|
15
|
+
declare module '*.sass';
|
|
16
|
+
declare module '*.styl';
|
|
17
|
+
|
|
18
|
+
// @ts-ignore
|
|
19
|
+
declare const process: NodeJS.Process & {
|
|
20
|
+
env: {
|
|
21
|
+
TARO_ENV:
|
|
22
|
+
| 'weapp'
|
|
23
|
+
| 'swan'
|
|
24
|
+
| 'alipay'
|
|
25
|
+
| 'h5'
|
|
26
|
+
| 'rn'
|
|
27
|
+
| 'tt'
|
|
28
|
+
| 'quickapp'
|
|
29
|
+
| 'qq'
|
|
30
|
+
| 'jd';
|
|
31
|
+
[key: string]: any;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"miniprogramRoot": "dist/",
|
|
3
3
|
"projectname": "{{ projectName }}",
|
|
4
|
-
"description": "",
|
|
4
|
+
"description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
|
|
5
5
|
"appid": "touristappid",
|
|
6
6
|
"setting": {
|
|
7
7
|
"urlCheck": true,
|
|
@@ -36,11 +36,26 @@
|
|
|
36
36
|
"userConfirmedBundleSwitch": false,
|
|
37
37
|
"packNpmManually": false,
|
|
38
38
|
"packNpmRelationList": [],
|
|
39
|
-
"minifyWXSS": true
|
|
39
|
+
"minifyWXSS": true,
|
|
40
|
+
"lazyloadPlaceholderEnable": false,
|
|
41
|
+
"useStaticServer": true,
|
|
42
|
+
"showES6CompileOption": false,
|
|
43
|
+
"disableUseStrict": false,
|
|
44
|
+
"useCompilerPlugins": false,
|
|
45
|
+
"minifyWXML": true
|
|
40
46
|
},
|
|
41
47
|
"compileType": "miniprogram",
|
|
42
48
|
"simulatorType": "wechat",
|
|
43
49
|
"simulatorPluginLibVersion": {},
|
|
44
50
|
"libVersion": "2.13.0",
|
|
45
|
-
"condition": {}
|
|
51
|
+
"condition": {},
|
|
52
|
+
"srcMiniprogramRoot": "dist/",
|
|
53
|
+
"packOptions": {
|
|
54
|
+
"ignore": [],
|
|
55
|
+
"include": []
|
|
56
|
+
},
|
|
57
|
+
"editorSetting": {
|
|
58
|
+
"tabIndent": "insertSpaces",
|
|
59
|
+
"tabSize": 2
|
|
60
|
+
}
|
|
46
61
|
}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Provider } from '@baic/yolk-taro-base';
|
|
4
|
+
|
|
5
|
+
import { Provider as UIProvider } from '@baic/yolk-miniprogram';
|
|
6
|
+
|
|
7
|
+
import request from '@/common/request';
|
|
8
|
+
|
|
9
|
+
import './app.scss';
|
|
10
|
+
|
|
11
|
+
interface Props {
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export default ({ children }: Props) => (
|
|
16
|
+
<Provider request={request}>
|
|
17
|
+
<UIProvider inputMaxLength={40}>{children}</UIProvider>
|
|
18
|
+
</Provider>
|
|
19
|
+
);
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const REQUEST_HOST = '';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { View } from '@tarojs/components';
|
|
3
|
+
import { Util } from '@baic/yolk';
|
|
4
|
+
import { usePreload } from '@baic/yolk-miniprogram';
|
|
5
|
+
export default () => {
|
|
6
|
+
const [wrap] = usePreload(async () => {
|
|
7
|
+
await Util.delay(1000);
|
|
8
|
+
});
|
|
9
|
+
return wrap(<View>页面加载完成显示出来了</View>);
|
|
10
|
+
};
|
package/templates/{miniapp/base/src/pages/index → miniprogram/src/pages/demo}/index.module.scss
RENAMED
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { AtTabs, AtTabsPane } from 'taro-ui';
|
|
4
|
+
|
|
5
|
+
import usePrload from './examples/usePreload';
|
|
6
|
+
import Input from './examples/Input';
|
|
7
|
+
import NumberInput from './examples/NumberInput';
|
|
8
|
+
import MobileInput from './examples/MobileInput';
|
|
9
|
+
import MoneyInput from './examples/MoneyInput';
|
|
10
|
+
import Textarea from './examples/Textarea';
|
|
11
|
+
import TimerButton from './examples/TimerButton';
|
|
12
|
+
|
|
13
|
+
const tabs: Record<string, React.FunctionComponent> = {
|
|
14
|
+
usePrload,
|
|
15
|
+
Input,
|
|
16
|
+
NumberInput,
|
|
17
|
+
MobileInput,
|
|
18
|
+
MoneyInput,
|
|
19
|
+
Textarea,
|
|
20
|
+
TimerButton,
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default () => {
|
|
24
|
+
const [current, setCurrent] = React.useState(0);
|
|
25
|
+
const onClickHandler = React.useCallback((i: number) => setCurrent(i), []);
|
|
26
|
+
const keys = Object.keys(tabs);
|
|
27
|
+
return (
|
|
28
|
+
<AtTabs
|
|
29
|
+
scroll
|
|
30
|
+
current={current}
|
|
31
|
+
onClick={onClickHandler}
|
|
32
|
+
tabList={keys.map((key) => ({ title: key }))}
|
|
33
|
+
>
|
|
34
|
+
{keys.map((key, index) => {
|
|
35
|
+
const tab = tabs[key];
|
|
36
|
+
return (
|
|
37
|
+
<AtTabsPane current={current} index={index}>
|
|
38
|
+
{React.createElement(tab)}
|
|
39
|
+
</AtTabsPane>
|
|
40
|
+
);
|
|
41
|
+
})}
|
|
42
|
+
</AtTabs>
|
|
43
|
+
);
|
|
44
|
+
};
|
|
File without changes
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
1
|
import { View } from '@tarojs/components';
|
|
4
2
|
|
|
5
3
|
import style from './index.module.scss';
|
|
6
4
|
|
|
7
|
-
export default () => <View className={style.page}>Hello world</View>;
|
|
5
|
+
export default () => <View className={style.page}>Hello world</View>;
|
|
File without changes
|
|
@@ -18,17 +18,11 @@
|
|
|
18
18
|
"jsx": "react",
|
|
19
19
|
"allowJs": true,
|
|
20
20
|
"resolveJsonModule": true,
|
|
21
|
-
"typeRoots": [
|
|
22
|
-
"node_modules/@types",
|
|
23
|
-
"global.d.ts"
|
|
24
|
-
],
|
|
21
|
+
"typeRoots": ["node_modules/@types", "global.d.ts"],
|
|
25
22
|
"paths": {
|
|
26
23
|
"@/*": ["src/*"]
|
|
27
|
-
}
|
|
24
|
+
}
|
|
28
25
|
},
|
|
29
|
-
"exclude": [
|
|
30
|
-
"node_modules",
|
|
31
|
-
"dist"
|
|
32
|
-
],
|
|
26
|
+
"exclude": ["node_modules", "dist"],
|
|
33
27
|
"compileOnSave": false
|
|
34
28
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
#
|
|
1
|
+
# mobile
|
|
2
2
|
|
|
3
3
|
## Getting Started
|
|
4
4
|
|
|
5
5
|
Install dependencies,
|
|
6
6
|
|
|
7
7
|
{{ #dependenciesInstallType }}
|
|
8
|
+
|
|
8
9
|
```bash
|
|
9
10
|
$ {{ dependenciesInstallType }} install
|
|
10
11
|
```
|
|
12
|
+
|
|
11
13
|
{{ /dependenciesInstallType }}
|
|
12
14
|
{{ ^dependenciesInstallType }}
|
|
15
|
+
|
|
13
16
|
```bash
|
|
14
17
|
$ yarn install
|
|
15
18
|
```
|
|
19
|
+
|
|
16
20
|
{{ /dependenciesInstallType }}
|
|
17
21
|
|
|
18
22
|
Start the dev server,
|
|
@@ -27,4 +31,4 @@ Build,
|
|
|
27
31
|
$ npm run build
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
[查阅文档](https://303394539.github.io/yolk-docs/)
|
|
34
|
+
[查阅文档](https://303394539.github.io/yolk-docs/)
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
"name": "{{ projectName }}",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "yolk start",
|
|
6
|
-
"build": "yolk build"
|
|
7
|
-
"test": "yolk test"
|
|
6
|
+
"build": "yolk build"
|
|
8
7
|
},
|
|
9
8
|
"dependencies": {
|
|
10
|
-
"@baic/preset-yolk-
|
|
9
|
+
"@baic/preset-yolk-mobile": "~2.0.1-alpha.10"
|
|
11
10
|
}
|
|
12
11
|
}
|
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Provider } from '@baic/yolk-browser-base';
|
|
4
|
+
|
|
5
|
+
import { Provider as WebProvider } from '@baic/yolk-mobile';
|
|
6
|
+
|
|
7
|
+
import request from '@/common/request';
|
|
8
|
+
|
|
9
|
+
import '@baic/yolk-mobile/lib/style/index.less';
|
|
10
|
+
|
|
11
|
+
export function rootContainer(container: React.ReactNode) {
|
|
12
|
+
return (
|
|
13
|
+
<Provider request={request}>
|
|
14
|
+
<WebProvider
|
|
15
|
+
iconfontScriptUrl={[
|
|
16
|
+
'//at.alicdn.com/t/font_1788044_0dwu4guekcwr.js',
|
|
17
|
+
'//at.alicdn.com/t/font_1788592_a5xf2bdic3u.js',
|
|
18
|
+
]}
|
|
19
|
+
>
|
|
20
|
+
{container}
|
|
21
|
+
</WebProvider>
|
|
22
|
+
</Provider>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
File without changes
|