@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/bin/index.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
#! /usr/bin/env node
|
|
2
|
-
"use strict";function _typeof(e){return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},_typeof(e)}var _isString2=_interopRequireDefault(require("lodash/isString")),_pick2=_interopRequireDefault(require("lodash/pick")),_chunk2=_interopRequireDefault(require("lodash/chunk")),_fs=_interopRequireDefault(require("fs")),_path=_interopRequireDefault(require("path")),_os=_interopRequireDefault(require("os")),_commander=_interopRequireDefault(require("commander")),_inquirer=_interopRequireDefault(require("inquirer")),_child_process=require("child_process"),_ora=_interopRequireDefault(require("ora")),_glob=_interopRequireDefault(require("glob")),_minimatch=_interopRequireDefault(require("minimatch")),_mustache=_interopRequireDefault(require("mustache")),_mkdirp=_interopRequireDefault(require("mkdirp")),_rimraf=_interopRequireDefault(require("rimraf")),_prettier=require("prettier"),miniProgramCi=_interopRequireWildcard(require("miniprogram-ci")),_package=_interopRequireDefault(require("../package.json"));function _getRequireWildcardCache(e){if("function"!==typeof WeakMap)return null;var t=new WeakMap,r=new WeakMap;return(_getRequireWildcardCache=function(e){return e?r:t})(e)}function _interopRequireWildcard(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==_typeof(e)&&"function"!==typeof e)return{default:e};var r=_getRequireWildcardCache(t);if(r&&r.has(e))return r.get(e);var n={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var i in e)if("default"!==i&&Object.prototype.hasOwnProperty.call(e,i)){var o=a?Object.getOwnPropertyDescriptor(e,i):null;o&&(o.get||o.set)?Object.defineProperty(n,i,o):n[i]=e[i]}return n["default"]=e,r&&r.set(e,n),n}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _toArray(e){return _arrayWithHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _arrayWithHoles(e){if(Array.isArray(e))return e}function ownKeys(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function _objectSpread(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ownKeys(Object(r),!0).forEach((function(t){_defineProperty(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ownKeys(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function _defineProperty(e,t,r){return t in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,t){if(e){if("string"===typeof e)return _arrayLikeToArray(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?_arrayLikeToArray(e,t):void 0}}function _iterableToArray(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var sgf=require("staged-git-files"),cwd=process.cwd(),HOOK_MARK="##### CREATED BY YOLK #####",PRETTIER_PARSER={ts:"typescript",tsx:"typescript"},ENCODING="utf-8",MAX_FILE_COUNT=60,spinner=(0,_ora["default"])(),warn=function(e){return e&&spinner.warn(Buffer.from(e,ENCODING).toString())},fail=function(e){return e&&spinner.fail(Buffer.from(e,ENCODING).toString())},succeed=function(e){return e&&spinner.succeed(Buffer.from(e,ENCODING).toString())},info=function(e){return e&&spinner.info(Buffer.from(e,ENCODING).toString())},getCommand=function(e){return"win32"===process.platform?"".concat(e,".cmd"):e},completeExit=function(){succeed("yolk complete!"),process.exit(0)},breakExit=function(){warn("yolk break!"),process.exit(0)},execCommand=function(e){var t=e.command,r=e.args,n=e.complete,a=e.close,i=e.exit,o=void 0===i||i,c=(0,_child_process.spawn)(getCommand(t),r||[],{stdio:"inherit"}).on("close",(function(e){e?(a&&a(),fail("yolk close!"),process.exit(e)):(n&&n(),o&&completeExit())}));process.on("SIGINT",(function(){_commander["default"].runningCommand&&_commander["default"].runningCommand.kill("SIGKILL"),c.kill(),breakExit()}))},createTemplate=function(e,t,r){_inquirer["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:"miniapp"}]},{type:"input",name:"projectName",message:"\u9879\u76ee\u540d\u79f0",default:_path["default"].basename(_path["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(n){var a={projectName:n.projectName,mobile:"mobile"===n.type,dependenciesInstallType:n.dependenciesInstallType};t||(t=_path["default"].join(__dirname,"../templates/".concat(n.type,"/").concat(t||"base"))),succeed("\u590d\u5236\u6a21\u7248 ".concat(_path["default"].basename(t)));var i=_glob["default"].sync("**/*",{cwd:t,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(i.forEach((function(r){if(t){var n=_path["default"].join(t,r);if(!_fs["default"].statSync(n).isDirectory())if(r.endsWith(".tpl")){var i=_fs["default"].readFileSync(n,ENCODING),o=_path["default"].join(e,r.replace(/\.tpl$/,"")),c=_mustache["default"].render(i,a);_mkdirp["default"].sync(_path["default"].dirname(o)),succeed("\u521b\u5efa ".concat(_path["default"].relative(e,o))),_fs["default"].writeFileSync(o,c,ENCODING)}else{succeed("\u521b\u5efa ".concat(r));var s=_path["default"].join(e,r);_mkdirp["default"].sync(_path["default"].dirname(s)),_fs["default"].copyFileSync(n,s)}}})),succeed("\u590d\u5236\u6a21\u7248 success!"),r&&_fs["default"].existsSync(t)&&(0,_rimraf["default"])(t,(function(){succeed("\u7f13\u5b58\u5220\u9664 success! ".concat(_path["default"].basename(t||"")))})),n.dependenciesInstallType)switch(succeed("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),n.dependenciesInstallType){case"npm":execCommand({command:"npm",args:["install"]});break;case"yarn":default:execCommand({command:"yarn",args:["install"]});break}succeed("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},createGitTemplate=function(e,t){return createTemplate(e,t,!0)},getYolkConfig=function(){var e=_glob["default"].sync("*.yolkrc*",{cwd:cwd,dot:!0});if(!e.length)return{};var t=_path["default"].join(cwd,e[0]);if(!_fs["default"].existsSync(t))return{};try{return JSON.parse(_fs["default"].readFileSync(t,ENCODING))||{}}catch(r){return fail(r.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}},getPrettierConfig=function(){var e=_path["default"].join(cwd,".prettierrc");if(!_fs["default"].existsSync(e)){if(_fs["default"].existsSync(require.resolve("@umijs/fabric/dist/prettier"))){var t=require("@umijs/fabric/dist/prettier");return t}return{}}try{return JSON.parse(_fs["default"].readFileSync(e,ENCODING))||{}}catch(r){return fail(r.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}},getProjectConfigJSON=function(){var e=_path["default"].join(cwd,"project.config.json");if(!_fs["default"].existsSync(e))return{};try{return JSON.parse(_fs["default"].readFileSync(e,ENCODING))||{}}catch(t){return fail(t.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}},getPackageJSON=function(){var e=_path["default"].join(cwd,"package.json");if(!_fs["default"].existsSync(e))return{};try{return JSON.parse(_fs["default"].readFileSync(e,ENCODING))||{}}catch(t){return fail(t.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}},isMiniapp=function(){return _fs["default"].existsSync(_path["default"].join(cwd,"project.config.json"))},getAppid=function(){var e=_path["default"].join(cwd,"project.config.json");if(_fs["default"].existsSync(e)){var t=require(e);return t.appid}return""},isWX=function(){return 0===getAppid().indexOf("wx")},isTT=function(){return _fs["default"].existsSync(_path["default"].join(cwd,"project.tt.json"))&&0===getAppid().indexOf("tt")},isAlipay=function(){return 0===getAppid().indexOf("20")},getEsLintConfigPath=function(){var e=getYolkConfig(),t=isMiniapp()?require.resolve("@baic/eslint-config-yolk-miniapp"):require.resolve("@baic/eslint-config-yolk"),r=_glob["default"].sync("*.eslintrc*",{cwd:cwd,dot:!0}),n=r[0];return!1===e.strict&&n&&_fs["default"].existsSync(n)?n:t},getStyleLintConfigPath=function(){var e=_glob["default"].sync("*.stylelintrc*",{cwd:cwd,dot:!0}),t=e[0];return t},initPreCommit=function(){var e=_path["default"].join(cwd,".git/"),t=_path["default"].join(cwd,".git/hooks"),r=_path["default"].join(t,"pre-commit"),n=_fs["default"].existsSync(e),a=_fs["default"].existsSync(r),i=a&&_fs["default"].readFileSync(r,"utf8").includes(HOOK_MARK);if(n&&(!a||!i)){_mkdirp["default"].sync(t),_fs["default"].writeFileSync(r,["#!/usr/bin/env bash","npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",HOOK_MARK].join(_os["default"].EOL),"utf8");try{_fs["default"].chmodSync(r,"777")}catch(o){fail("chmod ".concat(r," failed: ").concat(o.message))}succeed("Create pre-commit hook")}},preCommit=function(){var e=getYolkConfig(),t=!1!==e.strict,r=e.eslintIgnore,n=e.stylelintIgnore;sgf().then((function(e){var a=new Promise((function(r,a){var i=getStyleLintConfigPath();if(i){var o=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"string"===typeof n?!(0,_minimatch["default"])(e,n,{matchBase:!0}):n instanceof RegExp?!n.test(e):!Array.isArray(n)||n.every((function(t){return"string"===typeof t?!(0,_minimatch["default"])(e,t,{matchBase:!0}):t instanceof RegExp&&!t.test(e)}))})).map((function(e){var t=_path["default"].join(cwd,e);return _fs["default"].existsSync(t)?t:null})).filter((function(e){return!!e}));if(o.length>=MAX_FILE_COUNT){var c=[];(0,_chunk2["default"])(o,20).forEach((function(e){c.push(new Promise((function(r,n){execCommand({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",i].concat(_toConsumableArray(e)),complete:r,close:n,exit:!1})})))}));var s=process.getMaxListeners(),u=(0,_chunk2["default"])(c,s?s/2:2),l=0,f=function e(){l<u.length?Promise.all(u[l]).then((function(){l++,e()}))["catch"](a):r()};f()}else o.length&&execCommand({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",i].concat(_toConsumableArray(o)),complete:r,close:a,exit:!1})}else r()})),i=function(){var n=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=_path["default"].join(cwd,e);return _fs["default"].existsSync(t)?t:null})).filter((function(e){return!!e}));if(n.length){n.forEach((function(e){if(e&&_fs["default"].existsSync(e)){var t=_path["default"].extname(e).replace(/^\./,""),r=_fs["default"].readFileSync(e,"utf8"),n=(0,_prettier.format)(r,_objectSpread({parser:PRETTIER_PARSER[t]},getPrettierConfig()));_fs["default"].writeFileSync(e,n,"utf8")}})),succeed("\u683c\u5f0f\u5316 success!");var a=getEsLintConfigPath();if(a){var i=n.filter((function(e){return"string"===typeof r?!(0,_minimatch["default"])(e,r,{matchBase:!0}):r instanceof RegExp?!r.test(e):!Array.isArray(r)||r.every((function(t){return"string"===typeof t?!(0,_minimatch["default"])(e,t,{matchBase:!0}):t instanceof RegExp&&!t.test(e)}))}));if(t&&(warn("git commit\u7981\u6b62eslint\u7684ignore\u65b9\u5f0f(eslint-disable\u3001.eslintrc*\u3001ignore\u7b49)\u3002"),r&&warn("\u901a\u8fc7yolkrc\u914d\u7f6eeslintIgnore\uff1a".concat(r,"\u3002"))),i.length>=MAX_FILE_COUNT){var o=[];(0,_chunk2["default"])(i,20).forEach((function(e){o.push(new Promise((function(r){execCommand({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",a].concat(_toConsumableArray(e)),complete:r,exit:!1})})))}));var c=process.getMaxListeners(),s=(0,_chunk2["default"])(o,c?c/2:2),u=0,l=function e(){u<s.length?Promise.all(s[u]).then((function(){u++,e()})):completeExit()};l()}else i.length&&execCommand({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",a].concat(_toConsumableArray(i))})}else warn("\u6ca1\u6709eslint\u914d\u7f6e\u6587\u4ef6")}else completeExit()};warn("\u8981\u6c42\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),a.then(i)}))},getMiniProgramCi=function(e){var t=e.mProject,r=e.mPrivateKeyPath,n=e.mVersion,a=e.mDesc,i=e.mRobot,o=e.mQrcodeFormat,c=e.mQrcodeOutputDest,s=e.mPagePath,u=e.mSearchQuery,l=_fs["default"].existsSync(_path["default"].join(cwd,".git"))?(0,_child_process.execSync)("git log -1 --pretty=format:%H").toString():"",f=getProjectConfigJSON(),p=f.appid,d=t||_path["default"].join(cwd,"dist"),m=r||_path["default"].join(cwd,"private.".concat(p,".key"));if(_fs["default"].existsSync(d)){if(_fs["default"].existsSync(m)){var y=getPackageJSON(),_=n||y.version||f.version||"1.0.0",g=a||y.description||f.description,h="version: ".concat(_,";").concat(l?" commit: ".concat(l,";"):"").concat(g?" description: ".concat(g,";"):"");l&&info("commit: ".concat(l)),info("dist: ".concat(d)),info("key: ".concat(m)),info("appid: ".concat(p)),info("version: ".concat(_)),info("desc: ".concat(h));var b=new miniProgramCi.Project({appid:p,type:"miniProgram",projectPath:d,privateKeyPath:m,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{miniProgramCi:miniProgramCi,appid:p,options:{project:b,version:_,desc:h,setting:f.setting,robot:i,qrcodeFormat:o,qrcodeOutputDest:c,pagePath:s,searchQuery:u}}}throw Error("\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(".concat(m,")"))}throw Error("\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(".concat(d,")"))},install=function(){info("node version: ".concat(process.version)),initPreCommit(),process.argv.length>2?_commander["default"].version(_package["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=_toArray(t),n=r[0],a=r.slice(1),i=e.clone,o=e.template,c=e.docs;if(n)switch(n){case"init":if(succeed("yolk ".concat(n," \u5f00\u59cb")),i)if(o){var s=".yolk",u=_path["default"].join(cwd,s);_fs["default"].existsSync(u)&&(0,_rimraf["default"])(u,(function(){succeed("\u7f13\u5b58\u5220\u9664 success! ".concat(u))})),execCommand({command:"git",args:["clone","-b","master","--depth","1",o,s].concat(a)}),createGitTemplate(cwd,u)}else fail("--clone \u6a21\u5f0f\u5fc5\u987b\u6709--template");else createTemplate(cwd);break;case"start":isMiniapp()?isTT()?execCommand({command:"taro",args:["build","--type","tt","--watch"].concat(a)}):isAlipay()?execCommand({command:"taro",args:["build","--type","alipay","--watch"].concat(a)}):execCommand({command:"taro",args:["build","--type","weapp","--watch"].concat(a)}):execCommand(c?{command:"dumi",args:["dev"].concat(a)}:{command:"umi",args:["dev"].concat(a)});break;case"build":isMiniapp()?isTT()?execCommand({command:"taro",args:["build","--type","tt"].concat(a)}):isAlipay()?execCommand({command:"taro",args:["build","--type","alipay"].concat(a)}):execCommand({command:"taro",args:["build","--type","weapp"].concat(a)}):execCommand(c?{command:"dumi",args:["build"].concat(a)}:{command:"umi",args:["build"].concat(a)});break;case"pre-commit":preCommit();break;case"test":execCommand({command:"umi-test",args:["--no-cache","--update-snapshot","--runInBand","--detectOpenHandles"].concat(a)});break;case"miniapp-upload":if(isMiniapp())if(isTT());else if(isAlipay());else{var l=getMiniProgramCi(e),f=l.miniProgramCi,p=l.appid,d=l.options;info("".concat(p,"\u4e0a\u4f20\u5f00\u59cb")),f.upload(_objectSpread(_objectSpread({},(0,_pick2["default"])(d,["project","version","desc","setting","robot"])),{},{onProgressUpdate:function(e){if((0,_isString2["default"])(e))info("task: ".concat(e));else{var t=e.status,r=e.message;info("task(".concat(t,"): ").concat(r))}}})).then((function(){succeed("".concat(p,"\u4e0a\u4f20\u5b8c\u6210"))}))}break;case"miniapp-preview":if(isMiniapp())if(isTT());else if(isAlipay());else{var m=getMiniProgramCi(e),y=m.miniProgramCi,_=m.appid,g=m.options;info("".concat(_,"\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb")),y.preview(_objectSpread(_objectSpread({},(0,_pick2["default"])(g,["project","version","desc","setting","robot","qrcodeFormat","qrcodeOutputDest","pagePath","searchQuery"])),{},{onProgressUpdate:function(e){if((0,_isString2["default"])(e))info("task: ".concat(e));else{var t=e.status,r=e.message;info("task(".concat(t,"): ").concat(r))}}})).then((function(){succeed("".concat(_,"\u4e0a\u4f20\u9884\u89c8\u5b8c\u6210"))}))}break;default:breakExit()}})).parse(process.argv):breakExit()};install();
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
/node_modules
|
|
5
|
-
/.pnp
|
|
6
|
-
.pnp.js
|
|
7
|
-
.prettierrc.js
|
|
8
|
-
|
|
9
|
-
# testing
|
|
10
|
-
/coverage
|
|
11
|
-
|
|
12
|
-
# production
|
|
13
|
-
/build
|
|
14
|
-
dist/
|
|
15
|
-
|
|
16
|
-
# misc
|
|
17
|
-
.DS_Store
|
|
18
|
-
.env.local
|
|
19
|
-
.env.development.local
|
|
20
|
-
.env.test.local
|
|
21
|
-
.env.production.local
|
|
22
|
-
|
|
23
|
-
# temp
|
|
24
|
-
.temp/
|
|
25
|
-
.rn_temp/
|
|
26
|
-
deploy_versions/
|
|
27
|
-
|
|
28
|
-
npm-debug.log*
|
|
29
|
-
yarn-debug.log*
|
|
30
|
-
yarn-error.log*
|
|
31
|
-
.history/
|
|
32
|
-
package-lock.json
|
|
33
|
-
yarn.lock
|
|
34
|
-
*less.d.ts*
|
|
35
|
-
*scss.d.ts*
|
|
36
|
-
.eslintcache
|
|
37
|
-
.vscode
|
|
38
|
-
project.private.config.json
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
declare module "*.png";
|
|
2
|
-
declare module "*.gif";
|
|
3
|
-
declare module "*.jpg";
|
|
4
|
-
declare module "*.jpeg";
|
|
5
|
-
declare module "*.svg";
|
|
6
|
-
declare module "*.css";
|
|
7
|
-
declare module "*.less";
|
|
8
|
-
declare module "*.scss";
|
|
9
|
-
declare module "*.sass";
|
|
10
|
-
declare module "*.styl";
|
|
11
|
-
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
declare const process: {
|
|
14
|
-
env: {
|
|
15
|
-
TARO_ENV: 'weapp' | 'swan' | 'alipay' | 'h5' | 'rn' | 'tt' | 'quickapp' | 'qq' | 'jd';
|
|
16
|
-
[key: string]: any;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Provider as ReduxProvider } from 'react-redux';
|
|
3
|
-
|
|
4
|
-
import { Provider } from '@baic/yolk-miniapp';
|
|
5
|
-
|
|
6
|
-
import { Provider as UIProvider } from '@baic/yolk-miniapp-ui';
|
|
7
|
-
|
|
8
|
-
import request from '@/common/request';
|
|
9
|
-
|
|
10
|
-
import configStore from './store';
|
|
11
|
-
|
|
12
|
-
import './app.scss';
|
|
13
|
-
|
|
14
|
-
const store = configStore();
|
|
15
|
-
|
|
16
|
-
interface Props {
|
|
17
|
-
children: React.ReactNode;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export default ({ children }: Props) => (
|
|
21
|
-
<Provider request={request}>
|
|
22
|
-
<UIProvider inputMaxLength={40}>
|
|
23
|
-
<ReduxProvider store={store}>{children}</ReduxProvider>
|
|
24
|
-
</UIProvider>
|
|
25
|
-
</Provider>
|
|
26
|
-
);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const REQUEST_HOST = '';
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { createStore, combineReducers, applyMiddleware, compose } from 'redux';
|
|
2
|
-
import thunkMiddleware from 'redux-thunk';
|
|
3
|
-
|
|
4
|
-
declare global {
|
|
5
|
-
interface Window {
|
|
6
|
-
__REDUX_DEVTOOLS_EXTENSION_COMPOSE__: (obj: any) => Function;
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const composeEnhancers =
|
|
11
|
-
typeof window === 'object' && window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
|
|
12
|
-
? window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
|
|
13
|
-
// Specify extension’s options like name, actionsBlacklist, actionsCreators, serialize...
|
|
14
|
-
})
|
|
15
|
-
: compose;
|
|
16
|
-
|
|
17
|
-
const middlewares = [thunkMiddleware];
|
|
18
|
-
|
|
19
|
-
if (
|
|
20
|
-
process.env.NODE_ENV === 'development' &&
|
|
21
|
-
process.env.TARO_ENV !== 'quickapp'
|
|
22
|
-
) {
|
|
23
|
-
middlewares.push(require('redux-logger').createLogger());
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const enhancer = composeEnhancers(
|
|
27
|
-
applyMiddleware(...middlewares),
|
|
28
|
-
// other store enhancers if any
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
export default function configStore() {
|
|
32
|
-
const store = createStore(combineReducers({}), enhancer);
|
|
33
|
-
return store;
|
|
34
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
/node_modules
|
|
5
|
-
/npm-debug.log*
|
|
6
|
-
/yarn-error.log
|
|
7
|
-
/yarn.lock
|
|
8
|
-
/package-lock.json
|
|
9
|
-
|
|
10
|
-
# production
|
|
11
|
-
/dist
|
|
12
|
-
/build
|
|
13
|
-
|
|
14
|
-
# misc
|
|
15
|
-
.DS_Store
|
|
16
|
-
|
|
17
|
-
# umi
|
|
18
|
-
/src/.umi
|
|
19
|
-
/src/.umi-production
|
|
20
|
-
/src/.umi-test
|
|
21
|
-
/.env.local
|
|
22
|
-
coverage
|
|
23
|
-
.eslintcache
|
|
24
|
-
*less.d.ts*
|
|
25
|
-
*scss.d.ts*
|
|
26
|
-
.mfsu*
|
|
27
|
-
|
|
28
|
-
# ide
|
|
29
|
-
.vscode
|
|
30
|
-
|
|
31
|
-
# h5+app
|
|
32
|
-
/h5+app/unpackage/cache
|
|
33
|
-
/h5+app/unpackage/release
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`pages Demo 1`] = `
|
|
4
|
-
Object {
|
|
5
|
-
"asFragment": [Function],
|
|
6
|
-
"baseElement": <body>
|
|
7
|
-
<div>
|
|
8
|
-
<div
|
|
9
|
-
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; display: flex; align-items: center; justify-content: center; padding: 10px;"
|
|
10
|
-
>
|
|
11
|
-
<div
|
|
12
|
-
class="am-activity-indicator am-activity-indicator-sm"
|
|
13
|
-
>
|
|
14
|
-
<span
|
|
15
|
-
aria-label="loading"
|
|
16
|
-
class="am-activity-indicator-spinner"
|
|
17
|
-
/>
|
|
18
|
-
</div>
|
|
19
|
-
</div>
|
|
20
|
-
</div>
|
|
21
|
-
</body>,
|
|
22
|
-
"container": <div>
|
|
23
|
-
<div
|
|
24
|
-
style="position: absolute; left: 0px; top: 0px; right: 0px; bottom: 0px; display: flex; align-items: center; justify-content: center; padding: 10px;"
|
|
25
|
-
>
|
|
26
|
-
<div
|
|
27
|
-
class="am-activity-indicator am-activity-indicator-sm"
|
|
28
|
-
>
|
|
29
|
-
<span
|
|
30
|
-
aria-label="loading"
|
|
31
|
-
class="am-activity-indicator-spinner"
|
|
32
|
-
/>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>,
|
|
36
|
-
"debug": [Function],
|
|
37
|
-
"findAllByAltText": [Function],
|
|
38
|
-
"findAllByDisplayValue": [Function],
|
|
39
|
-
"findAllByLabelText": [Function],
|
|
40
|
-
"findAllByPlaceholderText": [Function],
|
|
41
|
-
"findAllByRole": [Function],
|
|
42
|
-
"findAllByTestId": [Function],
|
|
43
|
-
"findAllByText": [Function],
|
|
44
|
-
"findAllByTitle": [Function],
|
|
45
|
-
"findByAltText": [Function],
|
|
46
|
-
"findByDisplayValue": [Function],
|
|
47
|
-
"findByLabelText": [Function],
|
|
48
|
-
"findByPlaceholderText": [Function],
|
|
49
|
-
"findByRole": [Function],
|
|
50
|
-
"findByTestId": [Function],
|
|
51
|
-
"findByText": [Function],
|
|
52
|
-
"findByTitle": [Function],
|
|
53
|
-
"getAllByAltText": [Function],
|
|
54
|
-
"getAllByDisplayValue": [Function],
|
|
55
|
-
"getAllByLabelText": [Function],
|
|
56
|
-
"getAllByPlaceholderText": [Function],
|
|
57
|
-
"getAllByRole": [Function],
|
|
58
|
-
"getAllByTestId": [Function],
|
|
59
|
-
"getAllByText": [Function],
|
|
60
|
-
"getAllByTitle": [Function],
|
|
61
|
-
"getByAltText": [Function],
|
|
62
|
-
"getByDisplayValue": [Function],
|
|
63
|
-
"getByLabelText": [Function],
|
|
64
|
-
"getByPlaceholderText": [Function],
|
|
65
|
-
"getByRole": [Function],
|
|
66
|
-
"getByTestId": [Function],
|
|
67
|
-
"getByText": [Function],
|
|
68
|
-
"getByTitle": [Function],
|
|
69
|
-
"queryAllByAltText": [Function],
|
|
70
|
-
"queryAllByDisplayValue": [Function],
|
|
71
|
-
"queryAllByLabelText": [Function],
|
|
72
|
-
"queryAllByPlaceholderText": [Function],
|
|
73
|
-
"queryAllByRole": [Function],
|
|
74
|
-
"queryAllByTestId": [Function],
|
|
75
|
-
"queryAllByText": [Function],
|
|
76
|
-
"queryAllByTitle": [Function],
|
|
77
|
-
"queryByAltText": [Function],
|
|
78
|
-
"queryByDisplayValue": [Function],
|
|
79
|
-
"queryByLabelText": [Function],
|
|
80
|
-
"queryByPlaceholderText": [Function],
|
|
81
|
-
"queryByRole": [Function],
|
|
82
|
-
"queryByTestId": [Function],
|
|
83
|
-
"queryByText": [Function],
|
|
84
|
-
"queryByTitle": [Function],
|
|
85
|
-
"rerender": [Function],
|
|
86
|
-
"unmount": [Function],
|
|
87
|
-
}
|
|
88
|
-
`;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
import Index from '../src/pages/index';
|
|
5
|
-
|
|
6
|
-
describe('pages', () => {
|
|
7
|
-
it('Demo', async () => {
|
|
8
|
-
const wrapper = render(<Index />);
|
|
9
|
-
expect(wrapper).toMatchSnapshot();
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Provider } from '@baic/yolk';
|
|
4
|
-
|
|
5
|
-
import { Provider as MobileProvider } from '@baic/yolk-mobile';
|
|
6
|
-
|
|
7
|
-
import { Provider as MobileUIProvider } from '@baic/yolk-mobile-ui';
|
|
8
|
-
|
|
9
|
-
import { Provider as ReactReduxProvider } from 'react-redux';
|
|
10
|
-
|
|
11
|
-
import request from '@/common/request';
|
|
12
|
-
|
|
13
|
-
import store from './store';
|
|
14
|
-
|
|
15
|
-
import '@baic/yolk-mobile-ui/lib/style/index.less';
|
|
16
|
-
|
|
17
|
-
export function rootContainer(container: React.ReactNode) {
|
|
18
|
-
return (
|
|
19
|
-
<Provider request={request}>
|
|
20
|
-
<ReactReduxProvider store={store}>
|
|
21
|
-
<MobileProvider>
|
|
22
|
-
<MobileUIProvider inputMaxLength={40}>{container}</MobileUIProvider>
|
|
23
|
-
</MobileProvider>
|
|
24
|
-
</ReactReduxProvider>
|
|
25
|
-
</Provider>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
.component-layout {
|
|
2
|
-
position: fixed;
|
|
3
|
-
top: 0;
|
|
4
|
-
right: 0;
|
|
5
|
-
bottom: 0;
|
|
6
|
-
left: 0;
|
|
7
|
-
display: flex;
|
|
8
|
-
flex-direction: column;
|
|
9
|
-
.component-layout-scroller {
|
|
10
|
-
position: relative;
|
|
11
|
-
flex: 1;
|
|
12
|
-
overflow-y: auto;
|
|
13
|
-
&.has-footer {
|
|
14
|
-
margin-bottom: 20px;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
.component-layout-header {
|
|
18
|
-
z-index: 1000;
|
|
19
|
-
box-shadow: 0 5px 10px #efefef;
|
|
20
|
-
.am-navbar-left {
|
|
21
|
-
color: #000;
|
|
22
|
-
}
|
|
23
|
-
.am-navbar-title {
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
.ellipsis {
|
|
26
|
-
overflow: hidden;
|
|
27
|
-
white-space: nowrap;
|
|
28
|
-
text-overflow: ellipsis;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
.component-layout-footer {
|
|
33
|
-
z-index: 1000;
|
|
34
|
-
display: flex;
|
|
35
|
-
height: 45px;
|
|
36
|
-
background-color: #fff;
|
|
37
|
-
box-shadow: 0 -5px 10px #efefef;
|
|
38
|
-
.component-layout-footer-item {
|
|
39
|
-
position: relative;
|
|
40
|
-
flex: 1;
|
|
41
|
-
color: #000;
|
|
42
|
-
font-size: 14px;
|
|
43
|
-
.btn {
|
|
44
|
-
position: absolute;
|
|
45
|
-
display: flex;
|
|
46
|
-
align-items: center;
|
|
47
|
-
justify-content: center;
|
|
48
|
-
height: 45px;
|
|
49
|
-
.anticon {
|
|
50
|
-
font-size: 20px;
|
|
51
|
-
}
|
|
52
|
-
.name {
|
|
53
|
-
margin-left: 10px;
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
&.selected {
|
|
57
|
-
pointer-events: none;
|
|
58
|
-
.btn {
|
|
59
|
-
flex-direction: column;
|
|
60
|
-
height: 60px;
|
|
61
|
-
padding: 0 24px;
|
|
62
|
-
background-color: #fb8346;
|
|
63
|
-
border-top-left-radius: 10px;
|
|
64
|
-
border-top-right-radius: 10px;
|
|
65
|
-
box-shadow: 0 0 5px #fb8346;
|
|
66
|
-
.anticon {
|
|
67
|
-
color: #fff;
|
|
68
|
-
}
|
|
69
|
-
.name {
|
|
70
|
-
margin-top: 4px;
|
|
71
|
-
margin-left: 0;
|
|
72
|
-
color: #fff;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
&:first-child {
|
|
77
|
-
&::before {
|
|
78
|
-
width: 0;
|
|
79
|
-
}
|
|
80
|
-
.btn {
|
|
81
|
-
right: 50px;
|
|
82
|
-
bottom: 0;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
&:last-child {
|
|
86
|
-
.btn {
|
|
87
|
-
bottom: 0;
|
|
88
|
-
left: 50px;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
&::before {
|
|
92
|
-
position: absolute;
|
|
93
|
-
top: 25%;
|
|
94
|
-
bottom: 25%;
|
|
95
|
-
left: 0;
|
|
96
|
-
width: 2px;
|
|
97
|
-
background-color: #d9d9d9;
|
|
98
|
-
box-shadow: 0 0 10px #efefef;
|
|
99
|
-
content: '';
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { IRouteComponentProps } from 'umi';
|
|
3
|
-
import classnames from 'classnames';
|
|
4
|
-
|
|
5
|
-
import { NavBar, Icon } from 'antd-mobile';
|
|
6
|
-
|
|
7
|
-
import style from './index.less';
|
|
8
|
-
|
|
9
|
-
export default ({
|
|
10
|
-
children,
|
|
11
|
-
location,
|
|
12
|
-
route,
|
|
13
|
-
history,
|
|
14
|
-
match,
|
|
15
|
-
}: IRouteComponentProps) => {
|
|
16
|
-
console.log(
|
|
17
|
-
{
|
|
18
|
-
children,
|
|
19
|
-
location,
|
|
20
|
-
route,
|
|
21
|
-
history,
|
|
22
|
-
match,
|
|
23
|
-
},
|
|
24
|
-
);
|
|
25
|
-
return (
|
|
26
|
-
<div className={style.componentLayout}>
|
|
27
|
-
<NavBar
|
|
28
|
-
className={style.componentLayoutHeader}
|
|
29
|
-
mode="light"
|
|
30
|
-
icon={<Icon type="left" />}
|
|
31
|
-
leftContent="返回"
|
|
32
|
-
/>
|
|
33
|
-
<div className={style.componentLayoutScroller}>{children}</div>
|
|
34
|
-
<div className={style.componentLayoutFooter}>
|
|
35
|
-
<div className={classnames(style.componentLayoutFooterItem, style.selected)}>
|
|
36
|
-
<div className={style.btn}>
|
|
37
|
-
<div className={style.name}>主 页</div>
|
|
38
|
-
</div>
|
|
39
|
-
</div>
|
|
40
|
-
<div className={style.componentLayoutFooterItem}>
|
|
41
|
-
<div className={style.btn}>
|
|
42
|
-
<div className={style.name}>我 的</div>
|
|
43
|
-
</div>
|
|
44
|
-
</div>
|
|
45
|
-
</div>
|
|
46
|
-
</div>
|
|
47
|
-
);
|
|
48
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Result, Icon } from 'antd-mobile';
|
|
3
|
-
|
|
4
|
-
export default () => (
|
|
5
|
-
<Result
|
|
6
|
-
img={
|
|
7
|
-
<Icon type="cross-circle-o" className="spe" style={{ fill: '#F13642' }} />
|
|
8
|
-
}
|
|
9
|
-
title="404"
|
|
10
|
-
message="对不起,您访问的页面不存在。"
|
|
11
|
-
/>
|
|
12
|
-
);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { createStore, combineReducers, applyMiddleware } from 'redux';
|
|
2
|
-
|
|
3
|
-
import thunk from 'redux-thunk';
|
|
4
|
-
import { createLogger } from 'redux-logger';
|
|
5
|
-
|
|
6
|
-
const filterLogerAction: string[] = [];
|
|
7
|
-
|
|
8
|
-
const logger = createLogger({
|
|
9
|
-
predicate: (_, action) =>
|
|
10
|
-
action && !filterLogerAction.some((item) => item === action.type),
|
|
11
|
-
});
|
|
12
|
-
const middleware =
|
|
13
|
-
process.env.NODE_ENV !== 'production' ? [thunk, logger] : [thunk];
|
|
14
|
-
|
|
15
|
-
const store = createStore(combineReducers({}), applyMiddleware(...middleware));
|
|
16
|
-
|
|
17
|
-
export default store;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
|
|
2
|
-
|
|
3
|
-
# dependencies
|
|
4
|
-
/node_modules
|
|
5
|
-
/npm-debug.log*
|
|
6
|
-
/yarn-error.log
|
|
7
|
-
/yarn.lock
|
|
8
|
-
/package-lock.json
|
|
9
|
-
|
|
10
|
-
# production
|
|
11
|
-
/dist
|
|
12
|
-
/build
|
|
13
|
-
|
|
14
|
-
# misc
|
|
15
|
-
.DS_Store
|
|
16
|
-
|
|
17
|
-
# umi
|
|
18
|
-
/src/.umi
|
|
19
|
-
/src/.umi-production
|
|
20
|
-
/src/.umi-test
|
|
21
|
-
/.env.local
|
|
22
|
-
coverage
|
|
23
|
-
.eslintcache
|
|
24
|
-
*less.d.ts*
|
|
25
|
-
*scss.d.ts*
|
|
26
|
-
.mfsu*
|
|
27
|
-
|
|
28
|
-
# ide
|
|
29
|
-
.vscode
|
|
30
|
-
|
|
31
|
-
# h5+app
|
|
32
|
-
/h5+app/unpackage/cache
|
|
33
|
-
/h5+app/unpackage/release
|