@baic/yolk-cli 2.1.0-alpha.21 → 2.1.0-alpha.211

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.
Files changed (515) hide show
  1. package/LICENSE +1 -1
  2. package/compiled/commander/index.d.ts +898 -0
  3. package/compiled/commander/index.js +1 -0
  4. package/compiled/commander/package.json +1 -0
  5. package/compiled/mustache/index.d.ts +431 -0
  6. package/compiled/mustache/index.js +5 -0
  7. package/compiled/mustache/package.json +1 -0
  8. package/compiled/v8-compile-cache/index.js +1 -0
  9. package/compiled/v8-compile-cache/package.json +1 -0
  10. package/es/.lintstagedrc.js +67 -0
  11. package/es/.prettierrc.js +24 -0
  12. package/es/_util.d.ts +26 -0
  13. package/es/_util.js +1 -0
  14. package/es/index.d.ts +0 -1
  15. package/es/index.js +1 -1
  16. package/es/yolk.js +1 -1
  17. package/lib/.lintstagedrc.js +67 -0
  18. package/lib/.prettierrc.js +24 -0
  19. package/lib/_util.d.ts +26 -0
  20. package/lib/_util.js +1 -0
  21. package/lib/index.d.ts +0 -1
  22. package/lib/index.js +1 -1
  23. package/lib/yolk.js +1 -1
  24. package/package.json +43 -24
  25. package/templates/miniprogram/.eslintrc.js +7 -0
  26. package/templates/miniprogram/.gitignore.tpl +5 -1
  27. package/templates/miniprogram/.prettierignore +5 -1
  28. package/templates/miniprogram/.prettierrc.js +1 -0
  29. package/templates/miniprogram/LICENSE +1 -1
  30. package/templates/miniprogram/global.d.ts +1 -33
  31. package/templates/miniprogram/project.config.json.tpl +5 -3
  32. package/templates/miniprogram/src/app.config.ts +1 -1
  33. package/templates/miniprogram/src/app.scss +0 -1
  34. package/templates/miniprogram/src/app.tsx +4 -6
  35. package/templates/miniprogram/src/pages/demo/examples/Input.tsx +11 -3
  36. package/templates/miniprogram/src/pages/demo/examples/MobileInput.tsx +0 -1
  37. package/templates/miniprogram/src/pages/demo/examples/MoneyInput.tsx +0 -1
  38. package/templates/miniprogram/src/pages/demo/examples/NumberInput.tsx +0 -1
  39. package/templates/miniprogram/src/pages/demo/examples/Textarea.tsx +12 -3
  40. package/templates/miniprogram/src/pages/demo/examples/TimerButton.tsx +0 -1
  41. package/templates/miniprogram/src/pages/demo/examples/usePreload.tsx +0 -1
  42. package/templates/miniprogram/src/pages/demo/index.config.ts +1 -1
  43. package/templates/miniprogram/src/pages/demo/index.tsx +6 -5
  44. package/templates/miniprogram/src/pages/index/index.config.ts +1 -1
  45. package/templates/miniprogram/src/pages/index/index.tsx +1 -1
  46. package/templates/miniprogram/src/types/user.d.ts +4 -2
  47. package/templates/miniprogram/tsconfig.json +2 -19
  48. package/templates/umi-mobile/.eslintrc.js +7 -0
  49. package/templates/umi-mobile/.prettierignore +6 -2
  50. package/templates/umi-mobile/.prettierrc.js +1 -0
  51. package/templates/umi-mobile/.umirc.ts.tpl +0 -1
  52. package/templates/umi-mobile/LICENSE +1 -1
  53. package/templates/umi-mobile/src/app.tsx +2 -2
  54. package/templates/umi-mobile/src/pages/404.tsx +0 -1
  55. package/templates/umi-mobile/src/pages/demo/examples/BarCode.tsx +0 -1
  56. package/templates/umi-mobile/src/pages/demo/examples/Iconfont.tsx +1 -2
  57. package/templates/umi-mobile/src/pages/demo/examples/Input.tsx +1 -3
  58. package/templates/umi-mobile/src/pages/demo/examples/List/1.tsx +1 -2
  59. package/templates/umi-mobile/src/pages/demo/examples/List/2.tsx +1 -1
  60. package/templates/umi-mobile/src/pages/demo/examples/List/3.tsx +1 -1
  61. package/templates/umi-mobile/src/pages/demo/examples/List/4.tsx +9 -10
  62. package/templates/umi-mobile/src/pages/demo/examples/Loading.tsx +0 -1
  63. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/1.tsx +1 -3
  64. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/2.tsx +1 -3
  65. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/3.tsx +1 -3
  66. package/templates/umi-mobile/src/pages/demo/examples/NumberInput/4.tsx +1 -3
  67. package/templates/umi-mobile/src/pages/demo/examples/PagingList/1.tsx +1 -2
  68. package/templates/umi-mobile/src/pages/demo/examples/QrCode.tsx +0 -1
  69. package/templates/umi-mobile/src/pages/demo/examples/Required.tsx +0 -1
  70. package/templates/umi-mobile/src/pages/demo/examples/TimerButton.tsx +0 -1
  71. package/templates/umi-mobile/src/pages/demo/examples/usePreload.tsx +1 -1
  72. package/templates/umi-mobile/src/pages/demo/index.tsx +10 -10
  73. package/templates/umi-mobile/src/pages/index.tsx +0 -2
  74. package/templates/umi-mobile/src/types/user.d.ts +2 -2
  75. package/templates/umi-mobile-h5+app/.eslintrc.js +7 -0
  76. package/templates/umi-mobile-h5+app/.prettierignore +6 -2
  77. package/templates/umi-mobile-h5+app/.prettierrc.js +1 -0
  78. package/templates/umi-mobile-h5+app/.umirc.ts.tpl +0 -1
  79. package/templates/umi-mobile-h5+app/LICENSE +1 -1
  80. package/templates/umi-mobile-h5+app/src/pages/404.tsx +0 -1
  81. package/templates/umi-mobile-h5+app/src/pages/demo/examples/Input.tsx +1 -2
  82. package/templates/umi-mobile-h5+app/src/pages/demo/examples/List/4.tsx +2 -2
  83. package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/1.tsx +1 -2
  84. package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/2.tsx +1 -2
  85. package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/3.tsx +1 -2
  86. package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/4.tsx +1 -2
  87. package/templates/umi-mobile-h5+app/src/pages/demo/index.tsx +8 -7
  88. package/templates/umi-mobile-h5+app/src/pages/index.tsx +0 -2
  89. package/templates/umi-mobile-h5+app/src/types/user.d.ts +2 -2
  90. package/templates/umi-mobile-native/.eslintrc.js +7 -0
  91. package/templates/umi-mobile-native/.prettierignore +6 -2
  92. package/templates/umi-mobile-native/.prettierrc.js +1 -0
  93. package/templates/umi-mobile-native/.umirc.ts.tpl +0 -1
  94. package/templates/umi-mobile-native/LICENSE +1 -1
  95. package/templates/umi-mobile-native/android/app/build.gradle +19 -4
  96. package/templates/umi-mobile-native/android/app/libs/Bluetooth-release.aar +0 -0
  97. package/templates/umi-mobile-native/android/gradle.properties +1 -1
  98. package/templates/umi-mobile-native/src/common/Xprinter.ts +4 -4
  99. package/templates/umi-mobile-native/src/common/bluetooth.ts +8 -8
  100. package/templates/umi-mobile-native/src/common/bridge.ts +6 -6
  101. package/templates/umi-mobile-native/src/pages/404.tsx +0 -1
  102. package/templates/umi-mobile-native/src/pages/demo/examples/Input.tsx +1 -2
  103. package/templates/umi-mobile-native/src/pages/demo/examples/List/4.tsx +2 -2
  104. package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/1.tsx +1 -2
  105. package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/2.tsx +1 -2
  106. package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/3.tsx +1 -2
  107. package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/4.tsx +1 -2
  108. package/templates/umi-mobile-native/src/pages/demo/index.tsx +8 -7
  109. package/templates/umi-mobile-native/src/types/user.d.ts +2 -2
  110. package/templates/umi-web/.eslintrc.js +7 -0
  111. package/templates/umi-web/.prettierignore +6 -2
  112. package/templates/umi-web/.prettierrc.js +1 -0
  113. package/templates/umi-web/.umirc.ts.tpl +0 -1
  114. package/templates/umi-web/LICENSE +1 -1
  115. package/templates/umi-web/src/pages/404.tsx +2 -3
  116. package/templates/umi-web/src/pages/demo/examples/BankInput.tsx +1 -2
  117. package/templates/umi-web/src/pages/demo/examples/Grid/5.tsx +1 -2
  118. package/templates/umi-web/src/pages/demo/examples/Input/2.tsx +2 -1
  119. package/templates/umi-web/src/pages/demo/examples/RangeNumber/2.tsx +1 -2
  120. package/templates/umi-web/src/pages/demo/examples/SearchLayout.tsx +2 -2
  121. package/templates/umi-web/src/pages/demo/index.tsx +11 -9
  122. package/templates/umi-web/src/pages/index.tsx +0 -2
  123. package/templates/umi-web/src/types/user.d.ts +2 -2
  124. package/templates/umi-web-screen/.eslintrc.js +7 -0
  125. package/templates/umi-web-screen/.prettierignore +6 -2
  126. package/templates/umi-web-screen/.prettierrc.js +1 -0
  127. package/templates/umi-web-screen/.umirc.ts.tpl +0 -1
  128. package/templates/umi-web-screen/LICENSE +1 -1
  129. package/templates/umi-web-screen/src/components/resize-container/index.tsx +18 -18
  130. package/templates/umi-web-screen/src/layouts/controller/index.tsx +5 -9
  131. package/templates/umi-web-screen/src/pages/404.tsx +2 -3
  132. package/templates/umi-web-screen/src/pages/index.tsx +0 -2
  133. package/templates/umi-web-screen/src/pages/template/components/charts/demo-line/index.tsx +2 -3
  134. package/templates/umi-web-screen/src/pages/template/controller/index.tsx +11 -12
  135. package/templates/umi-web-screen/src/types/user.d.ts +2 -2
  136. package/templates/ice-mobile/.eslintrc +0 -6
  137. package/templates/ice-mobile/.gitignore.tpl +0 -34
  138. package/templates/ice-mobile/.icerc.ts +0 -3
  139. package/templates/ice-mobile/.npmrc.tpl +0 -2
  140. package/templates/ice-mobile/.prettierignore +0 -9
  141. package/templates/ice-mobile/.prettierrc +0 -11
  142. package/templates/ice-mobile/.stylelintrc +0 -3
  143. package/templates/ice-mobile/README.md.tpl +0 -34
  144. package/templates/ice-mobile/package.json.tpl +0 -16
  145. package/templates/ice-mobile/public/favicon.ico +0 -0
  146. package/templates/ice-mobile/public/index.html +0 -15
  147. package/templates/ice-mobile/src/app.tsx +0 -5
  148. package/templates/ice-mobile/src/common/request.ts +0 -3
  149. package/templates/ice-mobile/src/common/util.ts +0 -7
  150. package/templates/ice-mobile/src/components/index.ts +0 -0
  151. package/templates/ice-mobile/src/global.less +0 -3
  152. package/templates/ice-mobile/src/layouts/index.tsx +0 -5
  153. package/templates/ice-mobile/src/pages/404.tsx +0 -10
  154. package/templates/ice-mobile/src/pages/demo/examples/BarCode.tsx +0 -4
  155. package/templates/ice-mobile/src/pages/demo/examples/Iconfont.tsx +0 -18
  156. package/templates/ice-mobile/src/pages/demo/examples/Input.tsx +0 -17
  157. package/templates/ice-mobile/src/pages/demo/examples/List/1.tsx +0 -12
  158. package/templates/ice-mobile/src/pages/demo/examples/List/2.tsx +0 -29
  159. package/templates/ice-mobile/src/pages/demo/examples/List/3.tsx +0 -29
  160. package/templates/ice-mobile/src/pages/demo/examples/List/4.tsx +0 -55
  161. package/templates/ice-mobile/src/pages/demo/examples/List/mock.ts +0 -30
  162. package/templates/ice-mobile/src/pages/demo/examples/Loading.tsx +0 -12
  163. package/templates/ice-mobile/src/pages/demo/examples/NumberInput/1.tsx +0 -17
  164. package/templates/ice-mobile/src/pages/demo/examples/NumberInput/2.tsx +0 -17
  165. package/templates/ice-mobile/src/pages/demo/examples/NumberInput/3.tsx +0 -17
  166. package/templates/ice-mobile/src/pages/demo/examples/NumberInput/4.tsx +0 -17
  167. package/templates/ice-mobile/src/pages/demo/examples/PagingList/1.tsx +0 -6
  168. package/templates/ice-mobile/src/pages/demo/examples/QrCode.tsx +0 -4
  169. package/templates/ice-mobile/src/pages/demo/examples/Required.tsx +0 -4
  170. package/templates/ice-mobile/src/pages/demo/examples/TimerButton.tsx +0 -4
  171. package/templates/ice-mobile/src/pages/demo/examples/usePreload.tsx +0 -9
  172. package/templates/ice-mobile/src/pages/demo/index.tsx +0 -87
  173. package/templates/ice-mobile/src/pages/index.tsx +0 -3
  174. package/templates/ice-mobile/src/routes.ts +0 -29
  175. package/templates/ice-mobile/src/types/user.d.ts +0 -3
  176. package/templates/ice-mobile/tsconfig.json +0 -3
  177. package/templates/ice-mobile/typings.d.ts +0 -1
  178. package/templates/ice-mobile-h5+app/.eslintrc +0 -6
  179. package/templates/ice-mobile-h5+app/.gitignore.tpl +0 -34
  180. package/templates/ice-mobile-h5+app/.icerc.ts +0 -6
  181. package/templates/ice-mobile-h5+app/.npmrc.tpl +0 -2
  182. package/templates/ice-mobile-h5+app/.prettierignore +0 -9
  183. package/templates/ice-mobile-h5+app/.prettierrc +0 -11
  184. package/templates/ice-mobile-h5+app/.stylelintrc +0 -3
  185. package/templates/ice-mobile-h5+app/README.md.tpl +0 -34
  186. package/templates/ice-mobile-h5+app/h5+app/manifest.json +0 -87
  187. package/templates/ice-mobile-h5+app/package.json.tpl +0 -16
  188. package/templates/ice-mobile-h5+app/public/favicon.ico +0 -0
  189. package/templates/ice-mobile-h5+app/public/index.html +0 -15
  190. package/templates/ice-mobile-h5+app/src/app.tsx +0 -5
  191. package/templates/ice-mobile-h5+app/src/common/request.ts +0 -3
  192. package/templates/ice-mobile-h5+app/src/common/util.ts +0 -7
  193. package/templates/ice-mobile-h5+app/src/components/index.ts +0 -0
  194. package/templates/ice-mobile-h5+app/src/global.less +0 -3
  195. package/templates/ice-mobile-h5+app/src/layouts/index.tsx +0 -5
  196. package/templates/ice-mobile-h5+app/src/pages/404.tsx +0 -10
  197. package/templates/ice-mobile-h5+app/src/pages/demo/examples/BarCode.tsx +0 -4
  198. package/templates/ice-mobile-h5+app/src/pages/demo/examples/Iconfont.tsx +0 -18
  199. package/templates/ice-mobile-h5+app/src/pages/demo/examples/Input.tsx +0 -17
  200. package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/1.tsx +0 -12
  201. package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/2.tsx +0 -29
  202. package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/3.tsx +0 -29
  203. package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/4.tsx +0 -55
  204. package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/mock.ts +0 -30
  205. package/templates/ice-mobile-h5+app/src/pages/demo/examples/Loading.tsx +0 -12
  206. package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/1.tsx +0 -17
  207. package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/2.tsx +0 -17
  208. package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/3.tsx +0 -17
  209. package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/4.tsx +0 -17
  210. package/templates/ice-mobile-h5+app/src/pages/demo/examples/PagingList/1.tsx +0 -6
  211. package/templates/ice-mobile-h5+app/src/pages/demo/examples/QrCode.tsx +0 -4
  212. package/templates/ice-mobile-h5+app/src/pages/demo/examples/Required.tsx +0 -4
  213. package/templates/ice-mobile-h5+app/src/pages/demo/examples/TimerButton.tsx +0 -4
  214. package/templates/ice-mobile-h5+app/src/pages/demo/examples/usePreload.tsx +0 -9
  215. package/templates/ice-mobile-h5+app/src/pages/demo/index.tsx +0 -87
  216. package/templates/ice-mobile-h5+app/src/pages/index.tsx +0 -3
  217. package/templates/ice-mobile-h5+app/src/routes.ts +0 -29
  218. package/templates/ice-mobile-h5+app/src/types/user.d.ts +0 -3
  219. package/templates/ice-mobile-h5+app/tsconfig.json +0 -3
  220. package/templates/ice-mobile-h5+app/typings.d.ts +0 -1
  221. package/templates/ice-mobile-native/.eslintrc +0 -6
  222. package/templates/ice-mobile-native/.gitignore.tpl +0 -39
  223. package/templates/ice-mobile-native/.icerc.ts +0 -8
  224. package/templates/ice-mobile-native/.npmrc.tpl +0 -2
  225. package/templates/ice-mobile-native/.prettierignore +0 -9
  226. package/templates/ice-mobile-native/.prettierrc +0 -11
  227. package/templates/ice-mobile-native/.stylelintrc +0 -3
  228. package/templates/ice-mobile-native/README.md.tpl +0 -34
  229. package/templates/ice-mobile-native/android/app/6209ba977ffec7d62675a4e254ebc209.keystore +0 -0
  230. package/templates/ice-mobile-native/android/app/build.gradle +0 -66
  231. package/templates/ice-mobile-native/android/app/libs/Bluetooth-release.aar +0 -0
  232. package/templates/ice-mobile-native/android/app/libs/PosPrinterSDK.jar +0 -0
  233. package/templates/ice-mobile-native/android/app/libs/android-gif-drawable-release@1.2.23.aar +0 -0
  234. package/templates/ice-mobile-native/android/app/libs/lib.5plus.base-release.aar +0 -0
  235. package/templates/ice-mobile-native/android/app/libs/oaid_sdk_1.0.25.aar +0 -0
  236. package/templates/ice-mobile-native/android/app/libs/webview-x5-release.aar +0 -0
  237. package/templates/ice-mobile-native/android/app/proguard-rules.pro +0 -303
  238. package/templates/ice-mobile-native/android/app/src/main/AndroidManifest.xml +0 -98
  239. package/templates/ice-mobile-native/android/app/src/main/assets/apps/H5ECA1DEE/www/manifest.json +0 -89
  240. package/templates/ice-mobile-native/android/app/src/main/assets/data/dcloud_control.xml +0 -6
  241. package/templates/ice-mobile-native/android/app/src/main/assets/data/dcloud_error.html +0 -92
  242. package/templates/ice-mobile-native/android/app/src/main/assets/data/dcloud_properties.xml +0 -19
  243. package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/JSBridge/FunctionCreator.java +0 -119
  244. package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/MPandoraEntryActivity.java +0 -17
  245. package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/Xprinter/FunctionFactory/Creator.java +0 -17
  246. package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/Xprinter/FunctionFactory/Error.java +0 -26
  247. package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/Xprinter/JSPlugin.java +0 -265
  248. package/templates/ice-mobile-native/android/app/src/main/res/drawable/icon.png +0 -0
  249. package/templates/ice-mobile-native/android/app/src/main/res/values/colors.xml +0 -5
  250. package/templates/ice-mobile-native/android/app/src/main/res/values/strings.xml +0 -3
  251. package/templates/ice-mobile-native/android/build.gradle +0 -9
  252. package/templates/ice-mobile-native/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  253. package/templates/ice-mobile-native/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  254. package/templates/ice-mobile-native/android/gradle.properties +0 -22
  255. package/templates/ice-mobile-native/android/gradlew +0 -185
  256. package/templates/ice-mobile-native/android/gradlew.bat +0 -89
  257. package/templates/ice-mobile-native/android/settings.gradle +0 -16
  258. package/templates/ice-mobile-native/ios/HBuilder/HBuilder.entitlements +0 -5
  259. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/1024x1024.png +0 -0
  260. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/120x120-1.png +0 -0
  261. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/120x120.png +0 -0
  262. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/180x180.png +0 -0
  263. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/40x40.png +0 -0
  264. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/58x58.png +0 -0
  265. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/60x60.png +0 -0
  266. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/80x80.png +0 -0
  267. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/87x87.png +0 -0
  268. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/Contents.json +0 -62
  269. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/Contents.json +0 -6
  270. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/Image.imageset/Contents.json +0 -20
  271. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/120x120.png +0 -0
  272. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/180x180.png +0 -0
  273. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/60x60.png +0 -0
  274. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/Contents.json +0 -26
  275. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/control_brightness.imageset/Contents.json +0 -21
  276. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/control_brightness.imageset/brightness@2x.png +0 -0
  277. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exitfullscreen.imageset/Contents.json +0 -22
  278. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exitfullscreen.imageset/shrinkscreen@2x.png +0 -0
  279. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exitfullscreen.imageset/shrinkscreen@3x.png +0 -0
  280. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exposure_slider_max.imageset/Contents.json +0 -22
  281. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exposure_slider_max.imageset//346/233/235/345/205/211-1.png +0 -0
  282. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exposure_slider_max.imageset//346/233/235/345/205/211.png +0 -0
  283. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_border.imageset/Contents.json +0 -22
  284. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_border.imageset//345/257/271/347/204/246/346/241/206-1.png +0 -0
  285. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_border.imageset//345/257/271/347/204/246/346/241/206.png +0 -0
  286. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_slider_line.imageset/Contents.json +0 -21
  287. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_slider_line.imageset//345/257/271/347/204/246/347/272/277.png +0 -0
  288. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_slider_thumb.imageset/Contents.json +0 -22
  289. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_slider_thumb.imageset//345/257/271/347/204/246/345/272/225-1.png +0 -0
  290. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_slider_thumb.imageset//345/257/271/347/204/246/345/272/225.png +0 -0
  291. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/full-screen.imageset/Contents.json +0 -22
  292. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/full-screen.imageset/fullscreen@2x.png +0 -0
  293. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/full-screen.imageset/fullscreen@3x.png +0 -0
  294. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/Contents.json +0 -23
  295. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/play.png +0 -0
  296. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/play@2x.png +0 -0
  297. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/play@3x.png +0 -0
  298. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/Contents.json +0 -23
  299. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/player_back.png +0 -0
  300. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/player_back@2x.png +0 -0
  301. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/player_back@3x.png +0 -0
  302. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/Contents.json +0 -23
  303. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/play.png +0 -0
  304. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/play@2x.png +0 -0
  305. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/play@3x.png +0 -0
  306. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/Contents.json +0 -23
  307. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/player-stop.png +0 -0
  308. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/player-stop@2x.png +0 -0
  309. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/player-stop@3x.png +0 -0
  310. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteoff.imageset/Contents.json +0 -22
  311. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteoff.imageset/video_ic_muteoff@2x.png +0 -0
  312. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteoff.imageset/video_ic_muteoff@3x.png +0 -0
  313. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteon.imageset/Contents.json +0 -22
  314. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteon.imageset/video_ic_muteon@2x.png +0 -0
  315. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteon.imageset/video_ic_muteon@3x.png +0 -0
  316. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_volume.imageset/Contents.json +0 -22
  317. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_volume.imageset/video_volume@2x.png +0 -0
  318. package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_volume.imageset/video_volume@3x.png +0 -0
  319. package/templates/ice-mobile-native/ios/HBuilder-Hello/120x120.png +0 -0
  320. package/templates/ice-mobile-native/ios/HBuilder-Hello/180x180.png +0 -0
  321. package/templates/ice-mobile-native/ios/HBuilder-Hello/AppDelegate.h +0 -16
  322. package/templates/ice-mobile-native/ios/HBuilder-Hello/AppDelegate.m +0 -225
  323. package/templates/ice-mobile-native/ios/HBuilder-Hello/Base.lproj/LaunchScreen.storyboard +0 -65
  324. package/templates/ice-mobile-native/ios/HBuilder-Hello/English.lproj/Localizable.strings +0 -13
  325. package/templates/ice-mobile-native/ios/HBuilder-Hello/HBuilder-Hello-Info.plist +0 -486
  326. package/templates/ice-mobile-native/ios/HBuilder-Hello/HBuilder-Hello-Prefix.pch +0 -16
  327. package/templates/ice-mobile-native/ios/HBuilder-Hello/LaunchScreen.storyboard +0 -67
  328. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/manifest.json +0 -79
  329. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/1024x1024.png +0 -0
  330. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/120x120.png +0 -0
  331. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/144x144.png +0 -0
  332. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/152x152.png +0 -0
  333. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/167x167.png +0 -0
  334. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/180x180.png +0 -0
  335. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/192x192.png +0 -0
  336. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/20x20.png +0 -0
  337. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/29x29.png +0 -0
  338. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/40x40.png +0 -0
  339. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/58x58.png +0 -0
  340. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/60x60.png +0 -0
  341. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/72x72.png +0 -0
  342. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/76x76.png +0 -0
  343. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/80x80.png +0 -0
  344. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/87x87.png +0 -0
  345. package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/96x96.png +0 -0
  346. package/templates/ice-mobile-native/ios/HBuilder-Hello/ViewController.h +0 -19
  347. package/templates/ice-mobile-native/ios/HBuilder-Hello/ViewController.m +0 -161
  348. package/templates/ice-mobile-native/ios/HBuilder-Hello/Xprinter.h +0 -19
  349. package/templates/ice-mobile-native/ios/HBuilder-Hello/Xprinter.m +0 -235
  350. package/templates/ice-mobile-native/ios/HBuilder-Hello/control.xml +0 -107
  351. package/templates/ice-mobile-native/ios/HBuilder-Hello/en.lproj/InfoPlist.strings +0 -4
  352. package/templates/ice-mobile-native/ios/HBuilder-Hello/en.lproj/Localizable.strings +0 -12
  353. package/templates/ice-mobile-native/ios/HBuilder-Hello/main.m +0 -18
  354. package/templates/ice-mobile-native/ios/HBuilder-Hello/zh-Hans.lproj/InfoPlist.strings +0 -4
  355. package/templates/ice-mobile-native/ios/HBuilder-Hello/zh-Hans.lproj/LaunchScreen.strings +0 -3
  356. package/templates/ice-mobile-native/ios/HBuilder-Hello/zh-Hans.lproj/Localizable.strings +0 -13
  357. package/templates/ice-mobile-native/ios/HBuilder-Hello.xcodeproj/project.pbxproj +0 -1607
  358. package/templates/ice-mobile-native/package.json.tpl +0 -16
  359. package/templates/ice-mobile-native/public/favicon.ico +0 -0
  360. package/templates/ice-mobile-native/public/index.html +0 -15
  361. package/templates/ice-mobile-native/src/app.tsx +0 -5
  362. package/templates/ice-mobile-native/src/common/Xprinter.ts +0 -58
  363. package/templates/ice-mobile-native/src/common/bluetooth.ts +0 -354
  364. package/templates/ice-mobile-native/src/common/bridge.ts +0 -59
  365. package/templates/ice-mobile-native/src/common/request.ts +0 -3
  366. package/templates/ice-mobile-native/src/common/util.ts +0 -7
  367. package/templates/ice-mobile-native/src/components/index.ts +0 -0
  368. package/templates/ice-mobile-native/src/global.less +0 -3
  369. package/templates/ice-mobile-native/src/layouts/index.tsx +0 -5
  370. package/templates/ice-mobile-native/src/pages/404.tsx +0 -10
  371. package/templates/ice-mobile-native/src/pages/demo/examples/BarCode.tsx +0 -4
  372. package/templates/ice-mobile-native/src/pages/demo/examples/Iconfont.tsx +0 -18
  373. package/templates/ice-mobile-native/src/pages/demo/examples/Input.tsx +0 -17
  374. package/templates/ice-mobile-native/src/pages/demo/examples/List/1.tsx +0 -12
  375. package/templates/ice-mobile-native/src/pages/demo/examples/List/2.tsx +0 -29
  376. package/templates/ice-mobile-native/src/pages/demo/examples/List/3.tsx +0 -29
  377. package/templates/ice-mobile-native/src/pages/demo/examples/List/4.tsx +0 -55
  378. package/templates/ice-mobile-native/src/pages/demo/examples/List/mock.ts +0 -30
  379. package/templates/ice-mobile-native/src/pages/demo/examples/Loading.tsx +0 -12
  380. package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/1.tsx +0 -17
  381. package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/2.tsx +0 -17
  382. package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/3.tsx +0 -17
  383. package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/4.tsx +0 -17
  384. package/templates/ice-mobile-native/src/pages/demo/examples/PagingList/1.tsx +0 -6
  385. package/templates/ice-mobile-native/src/pages/demo/examples/QrCode.tsx +0 -4
  386. package/templates/ice-mobile-native/src/pages/demo/examples/Required.tsx +0 -4
  387. package/templates/ice-mobile-native/src/pages/demo/examples/TimerButton.tsx +0 -4
  388. package/templates/ice-mobile-native/src/pages/demo/examples/Xprinter/index.tsx +0 -64
  389. package/templates/ice-mobile-native/src/pages/demo/examples/Xprinter/style.less +0 -16
  390. package/templates/ice-mobile-native/src/pages/demo/examples/usePreload.tsx +0 -9
  391. package/templates/ice-mobile-native/src/pages/demo/index.tsx +0 -89
  392. package/templates/ice-mobile-native/src/pages/index.tsx +0 -3
  393. package/templates/ice-mobile-native/src/routes.ts +0 -29
  394. package/templates/ice-mobile-native/src/types/user.d.ts +0 -3
  395. package/templates/ice-mobile-native/tsconfig.json +0 -3
  396. package/templates/ice-mobile-native/typings.d.ts +0 -1
  397. package/templates/ice-web/.eslintrc +0 -6
  398. package/templates/ice-web/.gitignore.tpl +0 -34
  399. package/templates/ice-web/.icerc.ts +0 -3
  400. package/templates/ice-web/.npmrc.tpl +0 -2
  401. package/templates/ice-web/.prettierignore +0 -9
  402. package/templates/ice-web/.prettierrc +0 -11
  403. package/templates/ice-web/.stylelintrc +0 -3
  404. package/templates/ice-web/README.md.tpl +0 -34
  405. package/templates/ice-web/package.json.tpl +0 -16
  406. package/templates/ice-web/public/favicon.ico +0 -0
  407. package/templates/ice-web/public/index.html +0 -15
  408. package/templates/ice-web/src/app.tsx +0 -5
  409. package/templates/ice-web/src/common/request.ts +0 -3
  410. package/templates/ice-web/src/common/util.ts +0 -7
  411. package/templates/ice-web/src/components/index.ts +0 -0
  412. package/templates/ice-web/src/global.less +0 -5
  413. package/templates/ice-web/src/layouts/index.tsx +0 -5
  414. package/templates/ice-web/src/pages/404.tsx +0 -17
  415. package/templates/ice-web/src/pages/demo/examples/BankInput.tsx +0 -13
  416. package/templates/ice-web/src/pages/demo/examples/BarCode.tsx +0 -4
  417. package/templates/ice-web/src/pages/demo/examples/Collapse.tsx +0 -4
  418. package/templates/ice-web/src/pages/demo/examples/DatePicker.tsx +0 -4
  419. package/templates/ice-web/src/pages/demo/examples/Flex.tsx +0 -10
  420. package/templates/ice-web/src/pages/demo/examples/Grid/1.tsx +0 -25
  421. package/templates/ice-web/src/pages/demo/examples/Grid/2.tsx +0 -26
  422. package/templates/ice-web/src/pages/demo/examples/Grid/3.tsx +0 -37
  423. package/templates/ice-web/src/pages/demo/examples/Grid/4.tsx +0 -43
  424. package/templates/ice-web/src/pages/demo/examples/Grid/5.tsx +0 -36
  425. package/templates/ice-web/src/pages/demo/examples/Grid/6.tsx +0 -28
  426. package/templates/ice-web/src/pages/demo/examples/Iconfont.tsx +0 -18
  427. package/templates/ice-web/src/pages/demo/examples/ImagePreview.tsx +0 -20
  428. package/templates/ice-web/src/pages/demo/examples/Input/1.tsx +0 -4
  429. package/templates/ice-web/src/pages/demo/examples/Input/2.tsx +0 -80
  430. package/templates/ice-web/src/pages/demo/examples/LinkButton/1.tsx +0 -4
  431. package/templates/ice-web/src/pages/demo/examples/LinkButton/2.tsx +0 -9
  432. package/templates/ice-web/src/pages/demo/examples/LinkButton/3.tsx +0 -12
  433. package/templates/ice-web/src/pages/demo/examples/Loading.tsx +0 -12
  434. package/templates/ice-web/src/pages/demo/examples/MobileInput.tsx +0 -4
  435. package/templates/ice-web/src/pages/demo/examples/NumberInput.tsx +0 -4
  436. package/templates/ice-web/src/pages/demo/examples/PagingTable.tsx +0 -21
  437. package/templates/ice-web/src/pages/demo/examples/QrCode.tsx +0 -4
  438. package/templates/ice-web/src/pages/demo/examples/RangeNumber/1.tsx +0 -4
  439. package/templates/ice-web/src/pages/demo/examples/RangeNumber/2.tsx +0 -15
  440. package/templates/ice-web/src/pages/demo/examples/Required.tsx +0 -4
  441. package/templates/ice-web/src/pages/demo/examples/SearchLayout.tsx +0 -46
  442. package/templates/ice-web/src/pages/demo/examples/Table/1.tsx +0 -64
  443. package/templates/ice-web/src/pages/demo/examples/Table/2.tsx +0 -29
  444. package/templates/ice-web/src/pages/demo/examples/Table/3.tsx +0 -39
  445. package/templates/ice-web/src/pages/demo/examples/Table/4.tsx +0 -42
  446. package/templates/ice-web/src/pages/demo/examples/TimerButton.tsx +0 -4
  447. package/templates/ice-web/src/pages/demo/examples/Title/1.tsx +0 -4
  448. package/templates/ice-web/src/pages/demo/examples/Title/2.tsx +0 -5
  449. package/templates/ice-web/src/pages/demo/examples/WaterMark.tsx +0 -8
  450. package/templates/ice-web/src/pages/demo/examples/Wrapper.tsx +0 -40
  451. package/templates/ice-web/src/pages/demo/examples/usePreload.tsx +0 -9
  452. package/templates/ice-web/src/pages/demo/index.tsx +0 -135
  453. package/templates/ice-web/src/pages/index.tsx +0 -3
  454. package/templates/ice-web/src/routes.ts +0 -29
  455. package/templates/ice-web/src/types/user.d.ts +0 -3
  456. package/templates/ice-web/tsconfig.json +0 -3
  457. package/templates/ice-web/typings.d.ts +0 -1
  458. package/templates/ice-web-screen/.eslintrc +0 -6
  459. package/templates/ice-web-screen/.gitignore.tpl +0 -34
  460. package/templates/ice-web-screen/.icerc.ts +0 -3
  461. package/templates/ice-web-screen/.npmrc.tpl +0 -2
  462. package/templates/ice-web-screen/.prettierignore +0 -9
  463. package/templates/ice-web-screen/.prettierrc +0 -11
  464. package/templates/ice-web-screen/.stylelintrc +0 -3
  465. package/templates/ice-web-screen/README.md.tpl +0 -34
  466. package/templates/ice-web-screen/package.json.tpl +0 -17
  467. package/templates/ice-web-screen/public/favicon.ico +0 -0
  468. package/templates/ice-web-screen/public/index.html +0 -15
  469. package/templates/ice-web-screen/src/app.tsx +0 -5
  470. package/templates/ice-web-screen/src/common/request.ts +0 -3
  471. package/templates/ice-web-screen/src/common/util.ts +0 -15
  472. package/templates/ice-web-screen/src/components/index.ts +0 -1
  473. package/templates/ice-web-screen/src/components/resize-container/index.tsx +0 -95
  474. package/templates/ice-web-screen/src/components/resize-container/style.module.less +0 -3
  475. package/templates/ice-web-screen/src/constants.ts +0 -7
  476. package/templates/ice-web-screen/src/global.less +0 -31
  477. package/templates/ice-web-screen/src/hooks/use-size.ts +0 -18
  478. package/templates/ice-web-screen/src/layouts/16_9/fixed.less +0 -18
  479. package/templates/ice-web-screen/src/layouts/16_9/index.tsx +0 -34
  480. package/templates/ice-web-screen/src/layouts/16_9/style.module.less +0 -19
  481. package/templates/ice-web-screen/src/layouts/components/index.ts +0 -0
  482. package/templates/ice-web-screen/src/layouts/controller/index.tsx +0 -79
  483. package/templates/ice-web-screen/src/layouts/index.tsx +0 -11
  484. package/templates/ice-web-screen/src/pages/404.tsx +0 -17
  485. package/templates/ice-web-screen/src/pages/index.tsx +0 -3
  486. package/templates/ice-web-screen/src/pages/template/16_9/index.tsx +0 -13
  487. package/templates/ice-web-screen/src/pages/template/16_9/style.module.less +0 -7
  488. package/templates/ice-web-screen/src/pages/template/components/charts/demo-line/index.tsx +0 -274
  489. package/templates/ice-web-screen/src/pages/template/components/charts/index.ts +0 -1
  490. package/templates/ice-web-screen/src/pages/template/components/index.ts +0 -1
  491. package/templates/ice-web-screen/src/pages/template/controller/index.tsx +0 -85
  492. package/templates/ice-web-screen/src/pages/template/index.tsx +0 -15
  493. package/templates/ice-web-screen/src/pages/template/style.module.less +0 -3
  494. package/templates/ice-web-screen/src/routes.ts +0 -29
  495. package/templates/ice-web-screen/src/styles/vars.less +0 -5
  496. package/templates/ice-web-screen/src/types/user.d.ts +0 -3
  497. package/templates/ice-web-screen/tsconfig.json +0 -3
  498. package/templates/ice-web-screen/typings.d.ts +0 -1
  499. package/templates/miniprogram/.editorconfig +0 -12
  500. package/templates/miniprogram/.eslintrc +0 -6
  501. package/templates/miniprogram/.prettierrc +0 -12
  502. package/templates/miniprogram/src/pages/demo/index.module.scss.d.ts +0 -5
  503. package/templates/miniprogram/src/pages/index/index.module.scss.d.ts +0 -5
  504. package/templates/umi-mobile/.eslintrc +0 -6
  505. package/templates/umi-mobile/.prettierrc +0 -11
  506. package/templates/umi-mobile-h5+app/.eslintrc +0 -6
  507. package/templates/umi-mobile-h5+app/.prettierrc +0 -11
  508. package/templates/umi-mobile-native/.eslintrc +0 -6
  509. package/templates/umi-mobile-native/.prettierrc +0 -11
  510. package/templates/umi-web/.eslintrc +0 -6
  511. package/templates/umi-web/.prettierrc +0 -11
  512. package/templates/umi-web-screen/.eslintrc +0 -6
  513. package/templates/umi-web-screen/.prettierrc +0 -11
  514. /package/templates/miniprogram/src/pages/demo/{index.module.scss → style.scss} +0 -0
  515. /package/templates/miniprogram/src/pages/index/{index.module.scss → style.scss} +0 -0
package/es/_util.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ export type YolkConfig = {
2
+ strict?: boolean;
3
+ eslintIgnore?: string | string[] | RegExp | RegExp[];
4
+ stylelintIgnore?: string | string[] | RegExp | RegExp[];
5
+ };
6
+ export declare const ENCODING = "utf-8";
7
+ export declare const warn: (text?: string) => void | "" | undefined;
8
+ export declare const error: (text?: string) => void | "" | undefined;
9
+ export declare const ready: (text?: string) => void | "" | undefined;
10
+ export declare const info: (text?: string) => void | "" | undefined;
11
+ export declare const rimrafSync: (path: string) => boolean;
12
+ export declare const completeExit: () => never;
13
+ export declare const breakExit: () => never;
14
+ export declare const execCommand: ({ command, args, complete, close, exit, }: {
15
+ command: string;
16
+ args?: string[];
17
+ complete?: () => void;
18
+ close?: () => void;
19
+ exit?: boolean;
20
+ }) => void;
21
+ export declare const getYolkConfig: () => YolkConfig;
22
+ export declare const getPrettierConfig: () => any;
23
+ export declare const getProjectConfigJSON: () => any;
24
+ export declare const getPackageJSON: () => any;
25
+ export declare const getEsLintConfigPath: () => string;
26
+ export declare const getStyleLintConfigPath: () => string;
package/es/_util.js ADDED
@@ -0,0 +1 @@
1
+ import{spawn as r}from"child_process";import e from"fs";import t from"path";import{rimrafSync as o,windowsSync as n}from"@baic/yolk-prebundle/compiled/rimraf";import i from"chalk";import{globSync as c}from"glob";import{program as a}from"../compiled/commander";var s=process.cwd(),f=console;export var ENCODING="utf-8";export var warn=function(r){return r&&f.log(i.yellow("warn -"),r)};export var error=function(r){return r&&f.log(i.red("error -"),r)};export var ready=function(r){return r&&f.log(i.green("ready -"),r)};export var info=function(r){return r&&f.log(i.blue("info -"),r)};var l=function(){return"win32"===process.platform},p=function(r){return l()?"".concat(r,".cmd"):r};export var rimrafSync=function(r){return l()?n(r):o(r)};export var completeExit=function(){ready("yolk complete!"),process.exit(0)};export var breakExit=function(){warn("yolk break!"),process.exit(0)};export var execCommand=function(e){var t=e.command,o=e.args,n=e.complete,i=e.close,c=e.exit,s=void 0===c||c,f=r(p(t),o||[],{stdio:"inherit"}).on("close",(function(r){r?(i&&i(),error("yolk close!"),process.exit(r)):(n&&n(),s&&completeExit())}));process.on("SIGINT",(function(){a.exitOverride(),f.kill(),breakExit()}))};export var getYolkConfig=function(){var r=c("*.yolkrc*",{cwd:s,dot:!0});if(!r.length)return{};var o=t.join(s,r[0]);if(!e.existsSync(o))return{};try{return JSON.parse(e.readFileSync(o,ENCODING))||{}}catch(error){return error(error.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}};export var getPrettierConfig=function(){var r=t.join(s,".prettierrc");if(e.existsSync(r))try{return JSON.parse(e.readFileSync(r,ENCODING))||{}}catch(error){return error(error.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return require("./.prettierrc")};export var getProjectConfigJSON=function(){var r=t.join(s,"project.config.json");if(!e.existsSync(r))return{};try{return JSON.parse(e.readFileSync(r,ENCODING))||{}}catch(error){return error(error.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}};export var getPackageJSON=function(){var r=t.join(s,"package.json");if(!e.existsSync(r))return{};try{return JSON.parse(e.readFileSync(r,ENCODING))||{}}catch(error){return error(error.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}};export var getEsLintConfigPath=function(){var r=getYolkConfig(),t="";try{t=require.resolve("@baic/eslint-config-yolk")}catch(error){}var o=c("*.eslintrc*",{cwd:s,dot:!0}),n=o[0];return!1===r.strict&&n&&e.existsSync(n)?n:e.existsSync(t)?t:n};export var getStyleLintConfigPath=function(){var r=getYolkConfig(),t="";try{t=require.resolve("@baic/stylelint-config-yolk")}catch(error){}var o=c("*.stylelintrc*",{cwd:s,dot:!0}),n=o[0];return!1===r.strict&&n&&e.existsSync(n)?n:e.existsSync(t)?t:n};
package/es/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  #! /usr/bin/env node
2
- import './yolk';
package/es/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- import"./yolk";
2
+ require("../compiled/v8-compile-cache"),require("./yolk");
package/es/yolk.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- import e from"@babel/runtime/helpers/toArray";import t from"@babel/runtime/helpers/defineProperty";import s from"lodash/isString";import o from"lodash/pick";import r from"lodash/floor";import i from"lodash/chunk";function n(e,t){var s=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),s.push.apply(s,o)}return s}function c(e){for(var s=1;s<arguments.length;s++){var o=null!=arguments[s]?arguments[s]:{};s%2?n(Object(o),!0).forEach((function(s){t(e,s,o[s])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(o)):n(Object(o)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(o,t))}))}return e}import{execSync as a,spawn as m}from"child_process";import l from"commander";import p from"fs";import d from"glob";import u from"inquirer";import f from"minimatch";import*as y from"miniprogram-ci";import g from"mkdirp";import h from"mustache";import b from"ora";import j from"os";import S from"path";import{format as v}from"prettier";import x from"rimraf";import k from"../package.json";const w=require("staged-git-files"),$=process.cwd(),P="##### CREATED BY YOLK #####",O={ts:"typescript",tsx:"typescript",less:"less",sass:"scss",scss:"scss",css:"css"},F="utf-8",E=60,B=["**/node_modules/**","**/.umi/**","**/.umi-production/**","**/.ice/**","**/build/**","**/dist/**","**/lib/**","**/es/**","**/public/**","**/assets/**","**/h5+app/**","**/android/**","**/ios/**","**/mock/**","**/yolk*/**"],D=b(),I=e=>e&&D.warn(Buffer.from(e,F).toString()),q=e=>e&&D.fail(Buffer.from(e,F).toString()),Q=e=>e&&D.succeed(Buffer.from(e,F).toString()),N=e=>e&&D.info(Buffer.from(e,F).toString()),R=e=>"win32"===process.platform?`${e}.cmd`:e,T=()=>{Q("yolk complete!"),process.exit(0)},_=()=>{I("yolk break!"),process.exit(0)},L=({command:e,args:t,complete:s,close:o,exit:r=!0})=>{const i=m(R(e),t||[],{stdio:"inherit"}).on("close",(e=>{e?(o&&o(),q("yolk close!"),process.exit(e)):(s&&s(),r&&T())}));process.on("SIGINT",(()=>{l.runningCommand&&l.runningCommand.kill("SIGKILL"),i.kill(),_()}))},A=(e,t,s)=>{u.prompt([{type:"list",name:"type",message:"\u9009\u62e9\u6a21\u7248",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"web template(ice framework)",value:"ice-web"},{name:"web big screen template(ice framework)",value:"ice-web-screen"},{name:"mobile template(ice framework)",value:"ice-mobile"},{name:"mobile HBuilderX h5+app template(ice framework)",value:"ice-mobile-h5+app"},{name:"mobile native template(ice framework)",value:"ice-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"\u9879\u76ee\u540d\u79f0",default:S.basename(S.basename(process.cwd()))},{type:"list",name:"dependenciesInstallType",message:"\u9009\u62e9\u4f9d\u8d56\u5b89\u88c5\u65b9\u5f0f",default:"default",choices:[{name:"\u9ed8\u8ba4\u5b89\u88c5",value:"default"},{name:"\u8df3\u8fc7\u5b89\u88c5",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then((o=>{const r={projectName:o.projectName,dependenciesInstallType:o.dependenciesInstallType,yolkVersion:k.version};t||(t=S.join(__dirname,`../templates/${o.type}`)),Q(`\u590d\u5236\u6a21\u7248 ${S.basename(t)}`);const i=d.sync("**/*",{cwd:t,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(i.forEach((s=>{if(!t)return;const o=S.join(t,s);if(!p.statSync(o).isDirectory())if(s.endsWith(".tpl")){const t=p.readFileSync(o,F),i=S.join(e,s.replace(/\.tpl$/u,"")),n=h.render(t,r);g.sync(S.dirname(i)),Q(`\u521b\u5efa ${S.relative(e,i)}`),p.writeFileSync(i,n,F)}else{Q(`\u521b\u5efa ${s}`);const t=S.join(e,s);g.sync(S.dirname(t)),p.copyFileSync(o,t)}})),Q("\u590d\u5236\u6a21\u7248 success!"),s&&p.existsSync(t)&&x(t,(()=>{Q(`\u7f13\u5b58\u5220\u9664 success! ${S.basename(t||"")}`)})),o.dependenciesInstallType)switch(Q("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),o.dependenciesInstallType){case"default":case"pnpm":L({command:"pnpm",args:["install"]});break;case"yarn":L({command:"yarn",args:["install"]});break;case"npm":L({command:"npm",args:["install"]});break;default:}Q("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},K=(e,t)=>A(e,t,!0),C=()=>{const e=d.sync("*.yolkrc*",{cwd:$,dot:!0});if(!e.length)return{};const t=S.join($,e[0]);if(!p.existsSync(t))return{};try{return JSON.parse(p.readFileSync(t,F))||{}}catch(s){return q(s.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}},J=()=>{const e=S.join($,".prettierrc");if(p.existsSync(e))try{return JSON.parse(p.readFileSync(e,F))||{}}catch(t){return q(t.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return{singleQuote:!0,trailingComma:"all",printWidth:80,overrides:[{files:".prettierrc",options:{parser:"json"}}]}},H=()=>{const e=S.join($,"project.config.json");if(!p.existsSync(e))return{};try{return JSON.parse(p.readFileSync(e,F))||{}}catch(t){return q(t.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}},M=()=>{const e=S.join($,"package.json");if(!p.existsSync(e))return{};try{return JSON.parse(p.readFileSync(e,F))||{}}catch(t){return q(t.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}},U=()=>p.existsSync(S.join($,"project.config.json")),V=()=>p.existsSync(S.join($,".icerc.ts"))||p.existsSync(S.join($,".icerc.js"))||p.existsSync(S.join($,".ice.ts"))||p.existsSync(S.join($,".ice.js")),G=()=>{let e=p.existsSync(S.join($,"node_modules/.bin/max"));if(!e)try{e=p.existsSync(require.resolve("@umijs/max"))}catch(t){}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/u.test(a("umi -v").toString())}catch(t){}if(!e){const s=S.join($,"node_modules","umi","package.json");if(p.existsSync(s))try{const t=JSON.parse(p.readFileSync(s,F))||{};e=t.version&&+t.version.split(".")[0]>3}catch(t){}}return e},W=()=>p.existsSync(S.join($,".icerc.ts"))?".icerc.ts":p.existsSync(S.join($,".icerc.js"))?".icerc.js":p.existsSync(S.join($,".ice.ts"))?".ice.ts":".ice.js",X=()=>{const e=S.join($,"project.config.json");if(p.existsSync(e)){const t=require(e);return t.appid}return""},Y=()=>p.existsSync(S.join($,"project.tt.json"))&&0===X().indexOf("tt"),z=()=>0===X().indexOf("20"),Z=()=>{const e=C();let t="";try{t=U()?require.resolve("@baic/eslint-config-yolk-miniprogram"):require.resolve("@baic/eslint-config-yolk")}catch(r){}const s=d.sync("*.eslintrc*",{cwd:$,dot:!0}),o=s[0];return!1===e.strict&&o&&p.existsSync(o)?o:t},ee=()=>{const e=d.sync("*.stylelintrc*",{cwd:$,dot:!0}),t=e[0];return t},te=()=>{const e=S.join($,".git/"),t=S.join($,".git/hooks"),s=S.join(t,"pre-commit"),o=p.existsSync(e),r=p.existsSync(s),i=r&&p.readFileSync(s,"utf8").includes(P);if(o&&(!r||!i)){g.sync(t),p.writeFileSync(s,["#!/usr/bin/env bash","npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",P].join(j.EOL),"utf8");try{p.chmodSync(s,"777")}catch(n){q(`chmod ${s} failed: ${n.message}`)}Q("Create pre-commit hook")}},se=()=>{const e=C(),t=!1!==e.strict,s=e.eslintIgnore,o=e.stylelintIgnore;w().then((e=>{const r=new Promise(((s,r)=>{const n=ee();if(n){const a=e.map((e=>e.filename)).filter((e=>/^(src|tests)/iu.test(e))).filter((e=>/\.(le|sa|sc|c)s{2}$/iu.test(e))).filter((e=>B.every((t=>!f(e,t,{matchBase:!0}))))).filter((e=>"string"===typeof o?!f(e,o,{matchBase:!0}):o instanceof RegExp?!o.test(e):!Array.isArray(o)||o.every((t=>"string"===typeof t?!f(e,t,{matchBase:!0}):!(t instanceof RegExp)||!t.test(e))))).map((e=>{const t=S.join($,e);return p.existsSync(t)?t:null})).filter((e=>!!e));if(a.forEach((e=>{if(e&&p.existsSync(e)){const t=S.extname(e).replace(/^\./u,""),s=p.readFileSync(e,"utf8"),o=v(s,c({parser:O[t]},J()));p.writeFileSync(e,o,"utf8")}})),Q("style prettier success!"),a.length>=E){const e=[];i(a,20).forEach((s=>{e.push(new Promise(((e,o)=>{L({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",n,...s],complete:e,close:o,exit:!1})})))}));const o=process.getMaxListeners(),c=i(e,o?o/2:2);let m=0;const l=()=>{m<c.length?Promise.all(c[m]).then((()=>{m++,l()})).catch(r):s()};l()}else a.length&&L({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",n,...a],complete:s,close:r,exit:!1})}else s()})),n=()=>{const o=e.map((e=>e.filename)).filter((e=>/^(src|tests)/iu.test(e))).filter((e=>/\.([t|j]sx?)$/iu.test(e))).map((e=>{const t=S.join($,e);return p.existsSync(t)?t:null})).filter((e=>!!e));if(o.length){o.forEach((e=>{if(e&&p.existsSync(e)){const t=S.extname(e).replace(/^\./u,""),s=p.readFileSync(e,"utf8"),o=v(s,c({parser:O[t]},J()));p.writeFileSync(e,o,"utf8")}})),Q("script prettier success!");const e=Z();if(e){const r=o.filter((e=>B.every((t=>!f(e,t,{matchBase:!0}))))).filter((e=>"string"===typeof s?!f(e,s,{matchBase:!0}):s instanceof RegExp?!s.test(e):!Array.isArray(s)||s.every((t=>"string"===typeof t?!f(e,t,{matchBase:!0}):!(t instanceof RegExp)||!t.test(e)))));if(t&&(I("git commit\u7981\u6b62eslint\u7684ignore\u65b9\u5f0f(eslint-disable\u3001.eslintrc*\u3001ignore\u7b49)\u3002"),s&&I(`\u901a\u8fc7yolkrc\u914d\u7f6eeslintIgnore\uff1a${s}\u3002`)),r.length>=E){const s=[];i(r,20).forEach((o=>{s.push(new Promise((s=>{L({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",e,...o],complete:s,exit:!1})})))}));const o=process.getMaxListeners(),n=i(s,o?o/2:2);let c=0;const a=()=>{c<n.length?Promise.all(n[c]).then((()=>{c++,a()})):T()};a()}else r.length&&L({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",e,...r]})}else I("\u6ca1\u6709eslint\u914d\u7f6e\u6587\u4ef6")}else T()};I("\u8981\u6c42\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),r.then(n)}))},oe=({mProject:e,mPrivateKeyPath:t,mVersion:s,mDesc:o,mRobot:r,mQrcodeFormat:i,mQrcodeOutputDest:n,mPagePath:c,mSearchQuery:m})=>{const l=p.existsSync(S.join($,".git"))?a("git log -1 --pretty=format:%H").toString():"",d=H(),u=d.appid,f=e||S.join($,"dist"),g=t||S.join($,`private.${u}.key`);if(p.existsSync(f)){if(p.existsSync(g)){const e=M(),t=s||e.version||d.version||"1.0.0",a=o||e.description||d.description,p=`version: ${t};${l?` commit: ${l};`:""}${a?` description: ${a};`:""}`;l&&N(`commit: ${l}`),N(`dist: ${f}`),N(`key: ${g}`),N(`appid: ${u}`),N(`version: ${t}`),N(`desc: ${p}`);const h=new y.Project({appid:u,type:"miniProgram",projectPath:f,privateKeyPath:g,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:u,options:{project:h,version:t,desc:p,setting:d.setting,robot:r,qrcodeFormat:i,qrcodeOutputDest:n,pagePath:c,searchQuery:m}}}throw Error(`\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(${g})`)}throw Error(`\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(${f})`)},re=()=>{te(),process.argv.length>2?l.version(k.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(((t,i)=>{const n=e(i),a=n[0],m=n.slice(1),l=t.clone,d=t.template,u=t.docs;if(a)switch(N(`yolk version: ${k.version}`),N(`node version: ${process.version}`),N(`platform: ${j.platform()}`),N(`memory: ${r(j.freemem()/1024/1024)} MB(${r(j.totalmem()/1024/1024)} MB)`),a){case"init":if(Q(`yolk ${a} \u5f00\u59cb`),l)if(d){const e=".yolk",t=S.join($,e);p.existsSync(t)&&x(t,(()=>{Q(`\u7f13\u5b58\u5220\u9664 success! ${t}`)})),L({command:"git",args:["clone","-b","master","--depth","1",d,e].concat(m)}),K($,t)}else q("--clone \u6a21\u5f0f\u5fc5\u987b\u6709--template");else A($);break;case"start":U()?Y()?L({command:"taro",args:["build","--type","tt","--watch"].concat(m)}):z()?L({command:"taro",args:["build","--type","alipay","--watch"].concat(m)}):L({command:"taro",args:["build","--type","weapp","--watch"].concat(m)}):u?L({command:"dumi",args:["dev"].concat(m)}):V()?L({command:"icejs",args:["start","--config",W()].concat(m)}):G()?L({command:"max",args:["dev"].concat(m)}):L({command:"umi",args:["dev"].concat(m)});break;case"build":U()?Y()?L({command:"taro",args:["build","--type","tt"].concat(m)}):z()?L({command:"taro",args:["build","--type","alipay"].concat(m)}):L({command:"taro",args:["build","--type","weapp"].concat(m)}):u?L({command:"dumi",args:["build"].concat(m)}):V()?L({command:"icejs",args:["build","--config",W()].concat(m)}):G()?L({command:"max",args:["build"].concat(m)}):L({command:"umi",args:["build"].concat(m)});break;case"pre-commit":se();break;case"test":L({command:"umi-test",args:["--no-cache","--update-snapshot","--runInBand","--detectOpenHandles"].concat(m)});break;case"miniapp-upload":case"miniprogram-upload":if(U())if(Y());else if(z());else{const e=oe(t),r=e.appid,i=e.options;N(`${r}\u4e0a\u4f20\u5f00\u59cb`),y.upload(c(c({},o(i,["project","version","desc","setting","robot"])),{},{onProgressUpdate:e=>{if(s(e))N(`task: ${e}`);else{const t=e.status,s=e.message;N(`task(${t}): ${s}`)}}})).then((()=>{Q(`${r}\u4e0a\u4f20\u5b8c\u6210`)}))}break;case"miniapp-preview":case"miniprogram-preview":if(U())if(Y());else if(z());else{const e=oe(t),r=e.appid,i=e.options;N(`${r}\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb`),y.preview(c(c({},o(i,["project","version","desc","setting","robot","qrcodeFormat","qrcodeOutputDest","pagePath","searchQuery"])),{},{onProgressUpdate:e=>{if(s(e))N(`task: ${e}`);else{const t=e.status,s=e.message;N(`task(${t}): ${s}`)}}})).then((()=>{Q(`${r}\u4e0a\u4f20\u9884\u89c8\u5b8c\u6210`)}))}break;default:_()}})).parse(process.argv):_()};re();
2
+ import e from"@babel/runtime/helpers/slicedToArray";import t from"@babel/runtime/helpers/defineProperty";import o from"@babel/runtime/helpers/asyncToGenerator";import r from"lodash/isString";import n from"lodash/floor";function a(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,r)}return o}function c(e){for(var o=1;o<arguments.length;o++){var r=null!=arguments[o]?arguments[o]:{};o%2?a(Object(r),!0).forEach((function(o){t(e,o,r[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}import i from"@babel/runtime/regenerator";import{execSync as m}from"child_process";import{chmodSync as s,copyFileSync as p,existsSync as u,readFileSync as l,statSync as d,writeFileSync as f}from"fs";import g from"os";import{basename as v,dirname as y,join as h,relative as F}from"path";import{globSync as b}from"glob";import D from"inquirer";import*as j from"miniprogram-ci";import{mkdirpSync as k}from"mkdirp";import{program as w}from"../compiled/commander";import O from"../compiled/mustache";import P from"../package.json";import{breakExit as x,ENCODING as E,error as S,execCommand as B,getPackageJSON as _,getProjectConfigJSON as q,getYolkConfig as C,info as I,ready as Q,rimrafSync as T,warn as A}from"./_util";var R=process.cwd(),L="##### CREATED BY YOLK #####",N=function(e,t,o){D.prompt([{type:"list",name:"type",message:"\u9009\u62e9\u6a21\u7248",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"\u9879\u76ee\u540d\u79f0",default:v(v(process.cwd()))},{type:"list",name:"dependenciesInstallType",message:"\u9009\u62e9\u4f9d\u8d56\u5b89\u88c5\u65b9\u5f0f(\u9ed8\u8ba4\uff1apnpm\uff0c\u63a8\u8350\uff1apnpm)",default:"default",choices:[{name:"\u9ed8\u8ba4\u5b89\u88c5",value:"default"},{name:"\u8df3\u8fc7\u5b89\u88c5",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then((function(r){var n=r.type,a=r.projectName,c=r.dependenciesInstallType,i={projectName:a,dependenciesInstallType:"default"===c?"pnpm":c,yolkVersion:P.version},m=t||h(__dirname,"../templates/".concat(n));Q("\u590d\u5236\u6a21\u7248 ".concat(v(m)));var s=b("**/*",{cwd:m,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(s.forEach((function(t){if(m){var o=h(m,t);if(!d(o).isDirectory())if(t.endsWith(".tpl")){var r=l(o,E),n=h(e,t.replace(/\.tpl$/,"")),a=O.render(r,i);k(y(n)),Q("\u521b\u5efa ".concat(F(e,n))),f(n,a,E)}else{Q("\u521b\u5efa ".concat(t));var c=h(e,t);k(y(c)),p(o,c)}}})),Q("\u590d\u5236\u6a21\u7248 success!"),o&&u(m)&&T(m)&&Q("\u7f13\u5b58\u5220\u9664 success! ".concat(v(m||""))),c)switch(Q("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),c){case"default":case"pnpm":B({command:"pnpm",args:["install"]});break;case"yarn":B({command:"yarn",args:["install"]});break;case"npm":B({command:"npm",args:["install"]});break;default:}Q("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},K=function(e,t){return N(e,t,!0)},U=function(){return u(h(R,"project.config.json"))},W=function(){var e=u(h(R,"node_modules/.bin/max"));if(!e)try{e=u(require.resolve("@umijs/max"))}catch(r){}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/.test(m("umi -v").toString())}catch(r){}if(!e){var t=h(R,"node_modules","umi","package.json");if(u(t))try{var o=JSON.parse(l(t,E))||{};e=o.version&&+o.version.split(".")[0]>3}catch(r){}}return e},$=function(){var e=h(R,"project.config.json");if(u(e)){var t=require(e);return t.appid}return""},V=function(){return u(h(R,"project.tt.json"))&&0===$().indexOf("tt")},G=function(){return 0===$().indexOf("20")},J=function(){var e=h(R,".git/"),t=h(R,".git/hooks"),o=h(t,"pre-commit"),r=u(e),n=u(o),a=n&&l(o,E).includes(L);if(r)if(n){if(!a){try{s(o,"777")}catch(i){S("chmod ".concat(o," failed: ").concat(i.message))}var c=l(o).toString();f(o,[c,c.includes("#!/")?"":"#!/bin/sh",L,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",L].join(g.EOL),E),Q("write pre-commit hook")}}else{k(t),f(o,["#!/bin/sh",L,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",L].join(g.EOL),E),Q("create pre-commit hook");try{s(o,"777")}catch(i){S("chmod ".concat(o," failed: ").concat(i.message))}Q("write pre-commit hook")}},M=function(){var e=o(i.mark((function e(){var t,o,r,n;return i.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t=C(),o=!1!==t.strict,r=t.eslintIgnore,n=t.stylelintIgnore,A("\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),o&&(A("git commit \u7981\u6b62 lint \u7684 ignore \u884c\u4e3a"),n&&A("\u901a\u8fc7 .yolkrc \u914d\u7f6e stylelintIgnore: ".concat(n,"\u3002")),r&&A("\u901a\u8fc7 .yolkrc \u914d\u7f6e eslintIgnore: ".concat(r,"\u3002"))),B({command:"lint-staged",args:["-c",require.resolve("./.lintstagedrc")]});case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),X=function(e){var t=e.mAppid,o=e.mProject,r=e.mPrivateKeyPath,n=e.mVersion,a=e.mDesc,i=e.mRobot,s=e.mQrcodeFormat,p=e.mQrcodeOutputDest,l=e.mPagePath,d=e.mSearchQuery,f=u(h(R,".git"))?m("git log -1 --pretty=format:%H").toString():"",g=q(),v=t||g.appid,y=o||h(R,"dist"),F=r||h(R,"private.".concat(v,".key"));if(u(y)){if(u(F)){var b=_(),D=n||b.version||g.version||"1.0.0",k=a||b.description||g.description,w="".concat(f?" commit: ".concat(f,";"):"").concat(k?" description: ".concat(k,";"):"");f&&I("commit: ".concat(f)),I("dist: ".concat(y)),I("key: ".concat(F)),I("appid: ".concat(v)),I("version: ".concat(D)),I("desc: ".concat(w));var O=new j.Project({appid:v,type:"miniProgram",projectPath:y,privateKeyPath:F,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:v,options:{project:O,version:D,desc:w,setting:c(c({},g.setting),{},{es6:!1,es7:!1,minifyJS:!1,minifyWXML:!1,minifyWXSS:!1,minify:!1}),robot:i,qrcodeFormat:s,qrcodeOutputDest:p,pagePath:l,searchQuery:d}}}throw Error("\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(".concat(F,")"))}throw Error("\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(".concat(y,")"))},Y=function(){var e="";try{e=m("npm view ".concat(P.name," version"),{timeout:3e3}).toString().replace(/\n/g,"")}catch(t){}I("yolk version: ".concat(P.version).concat(e&&e!==P.version?"(last\uff1a".concat(e,")"):"")),I("node version: ".concat(process.version)),I("platform: ".concat(g.platform())),I("memory: ".concat(n(g.freemem()/1024/1024)," MB(").concat(n(g.totalmem()/1024/1024)," MB)"))},H=function(e){return e.option("--appid, --mAppid <appid>","\u5c0f\u7a0b\u5e8fappid").option("--project, --mProject <project>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u5de5\u7a0b\u76ee\u5f55").option("--privateKeyPath, --mPrivateKeyPath <privateKeyPath>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20key\u6587\u4ef6\uff0c\u9ed8\u8ba4\uff1a{\u5f53\u524d\u76ee\u5f55}/private.{appid}.key").option("--version, --mVersion <version>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u7248\u672c\u53f7").option("--desc, --mDesc <desc>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u63cf\u8ff0").option("--robot, --mRobot <robot>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20ci\u673a\u5668\u4eba1~30").option("--qrcodeFormat, --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("--qrcodeOutputDest, --mQrcodeOutputDest <qrcodeOutputDest>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u4e8c\u7ef4\u7801\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84").option("--pagePath, --mPagePath <pagePath>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84").option("--searchQuery, --mSearchQuery <searchQuery>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84\u542f\u52a8\u53c2\u6570")},z=/([0-9A-Z_a-z\u017F\u212A]+)=('((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)'|"((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*)"|((?:[\0-\t\x0B\f\x0E-\u2027\u202A-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])*))/gi,Z=function(t){process.env.DID_YOU_KNOW="none",process.env.VITE_CJS_IGNORE_WARNING="true";var o=[];return null===t||void 0===t||t.forEach((function(t){if(z.test(t)){var r=t.split("="),n=e(r,2),a=n[0],c=n[1];process.env[a]=c,I("\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff1a".concat(a,"=").concat(c))}else o.push(t)})),o},ee=function(){J(),process.argv.length>2?(w.version(P.version,"-v,--version","\u8f93\u51fa\u7248\u672c\u53f7").usage("[command] [options]"),w.command("init").description("\u521d\u59cb\u5316\u9879\u76ee").option("--clone <template>","\u5982\u679c\u9700\u8981\uff0c\u53ef\u901a\u8fc7git clone\u62c9\u53d6\u6a21\u7248\uff0c\u9ed8\u8ba4\u53d6cli\u9ed8\u8ba4\u6a21\u7248").action((function(e,t){var o=e.clone,r=t.args;if(Y(),Q("yolk init \u5f00\u59cb"),o){var n=".yolk",a=h(R,n);u(a)&&T(a)&&Q("\u7f13\u5b58\u5220\u9664 success! ".concat(a)),B({command:"git",args:["clone","-b","master","--depth","1",o,n].concat(r)}),K(R,a)}else N(R)})),w.command("start").description("\u542f\u52a8\u9879\u76ee").option("--docs","\u6587\u6863\u6a21\u5f0f").action((function(e,t){var o=e.docs,r=t.args;Y();var n=Z(r);U()?V()?B({command:"taro",args:["build","--type","tt","--watch"].concat(n)}):G()?B({command:"taro",args:["build","--type","alipay","--watch"].concat(n)}):B({command:"taro",args:["build","--type","weapp","--watch"].concat(n)}):o?B({command:"dumi",args:["dev"].concat(n)}):W()?B({command:"max",args:["dev"].concat(n)}):B({command:"umi",args:["dev"].concat(n)})})),w.command("build").description("\u7f16\u8bd1\u9879\u76ee").option("--docs","\u6587\u6863\u6a21\u5f0f").action((function(e,t){var o=e.docs,r=t.args;Y();var n=Z(r);U()?V()?B({command:"taro",args:["build","--type","tt"].concat(n)}):G()?B({command:"taro",args:["build","--type","alipay"].concat(n)}):B({command:"taro",args:["build","--type","weapp"].concat(n)}):o?B({command:"dumi",args:["build"].concat(n)}):W()?B({command:"max",args:["setup"].concat(n),complete:function(){return B({command:"max",args:["build"].concat(n)})},exit:!1}):B({command:"umi",args:["build"].concat(n)})})),w.command("pre-commit").description("\u6267\u884ccommit hook").action(M),H(w.command("miniprogram-upload").description("\u4f7f\u7528 miniprogram-ci \u4e0a\u4f20\u5c0f\u7a0b\u5e8f")).action((function(e){if(U())if(V());else if(G());else{var t=X(e),o=t.appid,n=t.options,a=n.project,c=n.version,i=n.desc,m=n.setting,s=n.robot;I("".concat(o," \u4e0a\u4f20\u5f00\u59cb")),j.upload({project:a,version:c,desc:i,setting:m,robot:s,onProgressUpdate:function(e){if(r(e))I("task: ".concat(e));else{var t=e.status,o=e.message;I("task(".concat(t,"): ").concat(o))}}}).then((function(){Q("".concat(o," \u4e0a\u4f20\u5b8c\u6210"))}))}else S("\u975e\u5c0f\u7a0b\u5e8f\u9879\u76ee\u76ee\u5f55")})),H(w.command("miniprogram-preview").description("\u4f7f\u7528 miniprogram-ci \u9884\u89c8\u5c0f\u7a0b\u5e8f")).action((function(e){if(U())if(V());else if(G());else{var t=X(e),o=t.appid,n=t.options,a=n.project,c=n.version,i=n.desc,m=n.setting,s=n.robot,p=n.qrcodeFormat,u=n.qrcodeOutputDest,l=n.pagePath,d=n.searchQuery;I("".concat(o," \u4e0a\u4f20\u9884\u89c8\u5f00\u59cb")),j.preview({project:a,version:c,desc:i,setting:m,robot:s,qrcodeFormat:p,qrcodeOutputDest:u,pagePath:l,searchQuery:d,onProgressUpdate:function(e){if(r(e))I("task: ".concat(e));else{var t=e.status,o=e.message;I("task(".concat(t,"): ").concat(o))}}}).then((function(){Q("".concat(o," \u4e0a\u4f20\u9884\u89c8\u5b8c\u6210"))}))}else S("\u975e\u5c0f\u7a0b\u5e8f\u9879\u76ee\u76ee\u5f55")})),w.parse(process.argv)):x()};ee();
@@ -0,0 +1,67 @@
1
+ const { join } = require('path');
2
+
3
+ const {
4
+ getYolkConfig,
5
+ getEsLintConfigPath,
6
+ getStyleLintConfigPath,
7
+ } = require('./_util');
8
+
9
+ const defaultIgnore = [
10
+ '**/node_modules/**',
11
+ '**/build/**',
12
+ '**/dist/**',
13
+ '**/lib/**',
14
+ '**/es/**',
15
+ '**/mock/**',
16
+ '**/test/**',
17
+ '**/public/**',
18
+ '**/assets/**',
19
+ '**/.umi/**',
20
+ '**/.umi-production/**',
21
+ '**/h5+app/**',
22
+ '**/*uni*/**',
23
+ '**/android/**',
24
+ '**/ios/**',
25
+ '**/*.ignore/**',
26
+ ];
27
+
28
+ const yolkConfig = getYolkConfig();
29
+ const isStrict = yolkConfig.strict !== false;
30
+
31
+ const prettierCLI =
32
+ 'prettier --write --cache --cache-strategy=content --loglevel=error';
33
+ const eslintCLI = `eslint --fix ${
34
+ isStrict ? '--no-inline-config' : ''
35
+ } --no-error-on-unmatched-pattern --cache --cache-strategy=content --cache-location=${join(
36
+ process.cwd(),
37
+ 'node_modules',
38
+ '.cache',
39
+ '.eslintcache',
40
+ )} --config ${getEsLintConfigPath()} ${defaultIgnore
41
+ .map((i) => `--ignore-pattern ${i}`)
42
+ .join(' ')}`;
43
+ const stylelintCLI = `stylelint --fix ${
44
+ isStrict ? '--ignore-disables' : ''
45
+ } --allow-empty-input --cache --cache-strategy=content --cache-location=${join(
46
+ process.cwd(),
47
+ 'node_modules',
48
+ '.cache',
49
+ '.stylelintcache',
50
+ )} --config ${getStyleLintConfigPath()} ${defaultIgnore
51
+ .map((i) => `--ignore-pattern ${i}`)
52
+ .join(' ')}`;
53
+
54
+ const config = {
55
+ '*.{md,json}': [prettierCLI],
56
+ // '*.{png,jpeg,jpg,gif,svg}': ['imagemin-lint-staged'],
57
+ '*.css': [prettierCLI, `${stylelintCLI} --custom-syntax postcss`],
58
+ '*.less': [prettierCLI, `${stylelintCLI} --custom-syntax postcss-less`],
59
+ '*.{sass,scss}': [
60
+ prettierCLI,
61
+ `${stylelintCLI} --custom-syntax postcss-scss`,
62
+ ],
63
+ '*.{js,jsx}': [prettierCLI, eslintCLI],
64
+ '*.{ts,tsx}': [`${prettierCLI} --parser=typescript`, eslintCLI],
65
+ };
66
+
67
+ module.exports = config;
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @deprecated 请使用 @baic/prettier-config-yolk
3
+ */
4
+ console.warn('* 注意:.prettierrc 中 @baic/yolk-cli/lib/.prettierrc 即将废弃,请更换 @baic/prettier-config-yolk');
5
+ module.exports = {
6
+ bracketSpacing: true,
7
+ overrides: [
8
+ {
9
+ files: '.prettierrc',
10
+ options: {
11
+ parser: 'json',
12
+ },
13
+ },
14
+ ],
15
+ plugins: [
16
+ // 'prettier-plugin-organize-imports',
17
+ // 'prettier-plugin-packagejson'
18
+ ],
19
+ printWidth: 80,
20
+ proseWrap: 'never',
21
+ singleQuote: true,
22
+ tabWidth: 2,
23
+ trailingComma: 'all',
24
+ };
package/lib/_util.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ export type YolkConfig = {
2
+ strict?: boolean;
3
+ eslintIgnore?: string | string[] | RegExp | RegExp[];
4
+ stylelintIgnore?: string | string[] | RegExp | RegExp[];
5
+ };
6
+ export declare const ENCODING = "utf-8";
7
+ export declare const warn: (text?: string) => void | "" | undefined;
8
+ export declare const error: (text?: string) => void | "" | undefined;
9
+ export declare const ready: (text?: string) => void | "" | undefined;
10
+ export declare const info: (text?: string) => void | "" | undefined;
11
+ export declare const rimrafSync: (path: string) => boolean;
12
+ export declare const completeExit: () => never;
13
+ export declare const breakExit: () => never;
14
+ export declare const execCommand: ({ command, args, complete, close, exit, }: {
15
+ command: string;
16
+ args?: string[];
17
+ complete?: () => void;
18
+ close?: () => void;
19
+ exit?: boolean;
20
+ }) => void;
21
+ export declare const getYolkConfig: () => YolkConfig;
22
+ export declare const getPrettierConfig: () => any;
23
+ export declare const getProjectConfigJSON: () => any;
24
+ export declare const getPackageJSON: () => any;
25
+ export declare const getEsLintConfigPath: () => string;
26
+ export declare const getStyleLintConfigPath: () => string;
package/lib/_util.js ADDED
@@ -0,0 +1 @@
1
+ var e=Object.create,r=Object.defineProperty,t=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,c=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var o in t)r(e,o,{get:t[o],enumerable:!0})},i=(e,c,l,i)=>{if(c&&"object"===typeof c||"function"===typeof c)for(let a of o(c))n.call(e,a)||a===l||r(e,a,{get:()=>c[a],enumerable:!(i=t(c,a))||i.enumerable});return e},a=(t,o,n)=>(n=null!=t?e(c(t)):{},i(!o&&t&&t.__esModule?n:r(n,"default",{value:t,enumerable:!0}),t)),s=e=>i(r({},"__esModule",{value:!0}),e),u={};l(u,{ENCODING:()=>O,breakExit:()=>C,completeExit:()=>v,error:()=>k,execCommand:()=>J,getEsLintConfigPath:()=>D,getPackageJSON:()=>I,getPrettierConfig:()=>E,getProjectConfigJSON:()=>F,getStyleLintConfigPath:()=>G,getYolkConfig:()=>_,info:()=>w,ready:()=>h,rimrafSync:()=>P,warn:()=>x}),module.exports=s(u);var f=require("child_process"),d=a(require("fs")),y=a(require("path")),g=require("@baic/yolk-prebundle/compiled/rimraf"),p=a(require("chalk")),m=require("glob"),S=require("../compiled/commander"),b=process.cwd(),j=console,O="utf-8",x=e=>e&&j.log(p.default.yellow("warn -"),e),k=e=>e&&j.log(p.default.red("error -"),e),h=e=>e&&j.log(p.default.green("ready -"),e),w=e=>e&&j.log(p.default.blue("info -"),e),q=()=>"win32"===process.platform,N=e=>q()?`${e}.cmd`:e,P=e=>q()?(0,g.windowsSync)(e):(0,g.rimrafSync)(e),v=()=>{h("yolk complete!"),process.exit(0)},C=()=>{x("yolk break!"),process.exit(0)},J=({command:e,args:r,complete:t,close:o,exit:c=!0})=>{const n=(0,f.spawn)(N(e),r||[],{stdio:"inherit"}).on("close",(e=>{e?(o&&o(),k("yolk close!"),process.exit(e)):(t&&t(),c&&v())}));process.on("SIGINT",(()=>{S.program.exitOverride(),n.kill(),C()}))},_=()=>{const e=(0,m.globSync)("*.yolkrc*",{cwd:b,dot:!0});if(!e.length)return{};const r=y.default.join(b,e[0]);if(!d.default.existsSync(r))return{};try{return JSON.parse(d.default.readFileSync(r,O))||{}}catch(t){return t(t.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}},E=()=>{const e=y.default.join(b,".prettierrc");if(d.default.existsSync(e))try{return JSON.parse(d.default.readFileSync(e,O))||{}}catch(r){return r(r.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return require("./.prettierrc")},F=()=>{const e=y.default.join(b,"project.config.json");if(!d.default.existsSync(e))return{};try{return JSON.parse(d.default.readFileSync(e,O))||{}}catch(r){return r(r.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}},I=()=>{const e=y.default.join(b,"package.json");if(!d.default.existsSync(e))return{};try{return JSON.parse(d.default.readFileSync(e,O))||{}}catch(r){return r(r.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}},D=()=>{const e=_();let r="";try{r=require.resolve("@baic/eslint-config-yolk")}catch(c){}const t=(0,m.globSync)("*.eslintrc*",{cwd:b,dot:!0}),o=t[0];return!1===e.strict&&o&&d.default.existsSync(o)?o:d.default.existsSync(r)?r:o},G=()=>{const e=_();let r="";try{r=require.resolve("@baic/stylelint-config-yolk")}catch(c){}const t=(0,m.globSync)("*.stylelintrc*",{cwd:b,dot:!0}),o=t[0];return!1===e.strict&&o&&d.default.existsSync(o)?o:d.default.existsSync(r)?r:o};
package/lib/index.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  #! /usr/bin/env node
2
- import './yolk';
package/lib/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- "use strict";require("./yolk");
2
+ require("../compiled/v8-compile-cache"),require("./yolk");
package/lib/yolk.js CHANGED
@@ -1,2 +1,2 @@
1
1
  #! /usr/bin/env node
2
- "use strict";var e=require("@babel/runtime/helpers/interopRequireDefault");function t(){const n=e(require("@babel/runtime/helpers/toArray"));return t=function(){return n},n}function n(){const t=e(require("@babel/runtime/helpers/defineProperty"));return n=function(){return t},t}function r(){const t=e(require("lodash/isString"));return r=function(){return t},t}function i(){const t=e(require("lodash/pick"));return i=function(){return t},t}function a(){const t=e(require("lodash/floor"));return a=function(){return t},t}function o(){const t=e(require("lodash/chunk"));return o=function(){return t},t}function s(){const e=require("child_process");return s=function(){return e},e}function c(){const t=e(require("commander"));return c=function(){return t},t}function u(){const t=e(require("fs"));return u=function(){return t},t}function l(){const t=e(require("glob"));return l=function(){return t},t}function f(){const t=e(require("inquirer"));return f=function(){return t},t}function d(){const t=e(require("minimatch"));return d=function(){return t},t}function m(){const e=k(require("miniprogram-ci"));return m=function(){return e},e}function p(){const t=e(require("mkdirp"));return p=function(){return t},t}function y(){const t=e(require("mustache"));return y=function(){return t},t}function g(){const t=e(require("ora"));return g=function(){return t},t}function h(){const t=e(require("os"));return h=function(){return t},t}function b(){const t=e(require("path"));return b=function(){return t},t}function j(){const e=require("prettier");return j=function(){return e},e}function v(){const t=e(require("rimraf"));return v=function(){return t},t}var S=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 k(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!==typeof e&&"function"!==typeof e)return{default:e};var n=w(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}return r.default=e,n&&n.set(e,r),r}function x(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 $(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?x(Object(r),!0).forEach((function(t){(0,n().default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):x(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}const O=require("staged-git-files"),P=process.cwd(),q="##### CREATED BY YOLK #####",F={ts:"typescript",tsx:"typescript",less:"less",sass:"scss",scss:"scss",css:"css"},E="utf-8",D=60,B=["**/node_modules/**","**/.umi/**","**/.umi-production/**","**/.ice/**","**/build/**","**/dist/**","**/lib/**","**/es/**","**/public/**","**/assets/**","**/h5+app/**","**/android/**","**/ios/**","**/mock/**","**/yolk*/**"],I=(0,g().default)(),_=e=>e&&I.warn(Buffer.from(e,E).toString()),Q=e=>e&&I.fail(Buffer.from(e,E).toString()),R=e=>e&&I.succeed(Buffer.from(e,E).toString()),N=e=>e&&I.info(Buffer.from(e,E).toString()),T=e=>"win32"===process.platform?`${e}.cmd`:e,L=()=>{R("yolk complete!"),process.exit(0)},M=()=>{_("yolk break!"),process.exit(0)},A=({command:e,args:t,complete:n,close:r,exit:i=!0})=>{const a=(0,s().spawn)(T(e),t||[],{stdio:"inherit"}).on("close",(e=>{e?(r&&r(),Q("yolk close!"),process.exit(e)):(n&&n(),i&&L())}));process.on("SIGINT",(()=>{c().default.runningCommand&&c().default.runningCommand.kill("SIGKILL"),a.kill(),M()}))},K=(e,t,n)=>{f().default.prompt([{type:"list",name:"type",message:"\u9009\u62e9\u6a21\u7248",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"web template(ice framework)",value:"ice-web"},{name:"web big screen template(ice framework)",value:"ice-web-screen"},{name:"mobile template(ice framework)",value:"ice-mobile"},{name:"mobile HBuilderX h5+app template(ice framework)",value:"ice-mobile-h5+app"},{name:"mobile native template(ice framework)",value:"ice-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"\u9879\u76ee\u540d\u79f0",default:b().default.basename(b().default.basename(process.cwd()))},{type:"list",name:"dependenciesInstallType",message:"\u9009\u62e9\u4f9d\u8d56\u5b89\u88c5\u65b9\u5f0f",default:"default",choices:[{name:"\u9ed8\u8ba4\u5b89\u88c5",value:"default"},{name:"\u8df3\u8fc7\u5b89\u88c5",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then((r=>{const i={projectName:r.projectName,dependenciesInstallType:r.dependenciesInstallType,yolkVersion:S.default.version};t||(t=b().default.join(__dirname,`../templates/${r.type}`)),R(`\u590d\u5236\u6a21\u7248 ${b().default.basename(t)}`);const a=l().default.sync("**/*",{cwd:t,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(a.forEach((n=>{if(!t)return;const r=b().default.join(t,n);if(!u().default.statSync(r).isDirectory())if(n.endsWith(".tpl")){const t=u().default.readFileSync(r,E),a=b().default.join(e,n.replace(/\.tpl$/u,"")),o=y().default.render(t,i);p().default.sync(b().default.dirname(a)),R(`\u521b\u5efa ${b().default.relative(e,a)}`),u().default.writeFileSync(a,o,E)}else{R(`\u521b\u5efa ${n}`);const t=b().default.join(e,n);p().default.sync(b().default.dirname(t)),u().default.copyFileSync(r,t)}})),R("\u590d\u5236\u6a21\u7248 success!"),n&&u().default.existsSync(t)&&(0,v().default)(t,(()=>{R(`\u7f13\u5b58\u5220\u9664 success! ${b().default.basename(t||"")}`)})),r.dependenciesInstallType)switch(R("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),r.dependenciesInstallType){case"default":case"pnpm":A({command:"pnpm",args:["install"]});break;case"yarn":A({command:"yarn",args:["install"]});break;case"npm":A({command:"npm",args:["install"]});break;default:}R("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},C=(e,t)=>K(e,t,!0),J=()=>{const e=l().default.sync("*.yolkrc*",{cwd:P,dot:!0});if(!e.length)return{};const t=b().default.join(P,e[0]);if(!u().default.existsSync(t))return{};try{return JSON.parse(u().default.readFileSync(t,E))||{}}catch(n){return Q(n.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}},W=()=>{const e=b().default.join(P,".prettierrc");if(u().default.existsSync(e))try{return JSON.parse(u().default.readFileSync(e,E))||{}}catch(t){return Q(t.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return{singleQuote:!0,trailingComma:"all",printWidth:80,overrides:[{files:".prettierrc",options:{parser:"json"}}]}},H=()=>{const e=b().default.join(P,"project.config.json");if(!u().default.existsSync(e))return{};try{return JSON.parse(u().default.readFileSync(e,E))||{}}catch(t){return Q(t.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}},U=()=>{const e=b().default.join(P,"package.json");if(!u().default.existsSync(e))return{};try{return JSON.parse(u().default.readFileSync(e,E))||{}}catch(t){return Q(t.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}},V=()=>u().default.existsSync(b().default.join(P,"project.config.json")),G=()=>u().default.existsSync(b().default.join(P,".icerc.ts"))||u().default.existsSync(b().default.join(P,".icerc.js"))||u().default.existsSync(b().default.join(P,".ice.ts"))||u().default.existsSync(b().default.join(P,".ice.js")),X=()=>{let e=u().default.existsSync(b().default.join(P,"node_modules/.bin/max"));if(!e)try{e=u().default.existsSync(require.resolve("@umijs/max"))}catch(t){}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/u.test((0,s().execSync)("umi -v").toString())}catch(t){}if(!e){const n=b().default.join(P,"node_modules","umi","package.json");if(u().default.existsSync(n))try{const t=JSON.parse(u().default.readFileSync(n,E))||{};e=t.version&&+t.version.split(".")[0]>3}catch(t){}}return e},Y=()=>u().default.existsSync(b().default.join(P,".icerc.ts"))?".icerc.ts":u().default.existsSync(b().default.join(P,".icerc.js"))?".icerc.js":u().default.existsSync(b().default.join(P,".ice.ts"))?".ice.ts":".ice.js",z=()=>{const e=b().default.join(P,"project.config.json");if(u().default.existsSync(e)){const t=require(e);return t.appid}return""},Z=()=>u().default.existsSync(b().default.join(P,"project.tt.json"))&&0===z().indexOf("tt"),ee=()=>0===z().indexOf("20"),te=()=>{const e=J();let t="";try{t=V()?require.resolve("@baic/eslint-config-yolk-miniprogram"):require.resolve("@baic/eslint-config-yolk")}catch(i){}const n=l().default.sync("*.eslintrc*",{cwd:P,dot:!0}),r=n[0];return!1===e.strict&&r&&u().default.existsSync(r)?r:t},ne=()=>{const e=l().default.sync("*.stylelintrc*",{cwd:P,dot:!0}),t=e[0];return t},re=()=>{const e=b().default.join(P,".git/"),t=b().default.join(P,".git/hooks"),n=b().default.join(t,"pre-commit"),r=u().default.existsSync(e),i=u().default.existsSync(n),a=i&&u().default.readFileSync(n,"utf8").includes(q);if(r&&(!i||!a)){p().default.sync(t),u().default.writeFileSync(n,["#!/usr/bin/env bash","npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",q].join(h().default.EOL),"utf8");try{u().default.chmodSync(n,"777")}catch(o){Q(`chmod ${n} failed: ${o.message}`)}R("Create pre-commit hook")}},ie=()=>{const e=J(),t=!1!==e.strict,n=e.eslintIgnore,r=e.stylelintIgnore;O().then((e=>{const i=new Promise(((n,i)=>{const a=ne();if(a){const s=e.map((e=>e.filename)).filter((e=>/^(src|tests)/iu.test(e))).filter((e=>/\.(le|sa|sc|c)s{2}$/iu.test(e))).filter((e=>B.every((t=>!(0,d().default)(e,t,{matchBase:!0}))))).filter((e=>"string"===typeof r?!(0,d().default)(e,r,{matchBase:!0}):r instanceof RegExp?!r.test(e):!Array.isArray(r)||r.every((t=>"string"===typeof t?!(0,d().default)(e,t,{matchBase:!0}):!(t instanceof RegExp)||!t.test(e))))).map((e=>{const t=b().default.join(P,e);return u().default.existsSync(t)?t:null})).filter((e=>!!e));if(s.forEach((e=>{if(e&&u().default.existsSync(e)){const t=b().default.extname(e).replace(/^\./u,""),n=u().default.readFileSync(e,"utf8"),r=(0,j().format)(n,$({parser:F[t]},W()));u().default.writeFileSync(e,r,"utf8")}})),R("style prettier success!"),s.length>=D){const e=[];(0,o().default)(s,20).forEach((n=>{e.push(new Promise(((e,r)=>{A({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",a,...n],complete:e,close:r,exit:!1})})))}));const r=process.getMaxListeners(),c=(0,o().default)(e,r?r/2:2);let u=0;const l=()=>{u<c.length?Promise.all(c[u]).then((()=>{u++,l()})).catch(i):n()};l()}else s.length&&A({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",a,...s],complete:n,close:i,exit:!1})}else n()})),a=()=>{const r=e.map((e=>e.filename)).filter((e=>/^(src|tests)/iu.test(e))).filter((e=>/\.([t|j]sx?)$/iu.test(e))).map((e=>{const t=b().default.join(P,e);return u().default.existsSync(t)?t:null})).filter((e=>!!e));if(r.length){r.forEach((e=>{if(e&&u().default.existsSync(e)){const t=b().default.extname(e).replace(/^\./u,""),n=u().default.readFileSync(e,"utf8"),r=(0,j().format)(n,$({parser:F[t]},W()));u().default.writeFileSync(e,r,"utf8")}})),R("script prettier success!");const e=te();if(e){const i=r.filter((e=>B.every((t=>!(0,d().default)(e,t,{matchBase:!0}))))).filter((e=>"string"===typeof n?!(0,d().default)(e,n,{matchBase:!0}):n instanceof RegExp?!n.test(e):!Array.isArray(n)||n.every((t=>"string"===typeof t?!(0,d().default)(e,t,{matchBase:!0}):!(t instanceof RegExp)||!t.test(e)))));if(t&&(_("git commit\u7981\u6b62eslint\u7684ignore\u65b9\u5f0f(eslint-disable\u3001.eslintrc*\u3001ignore\u7b49)\u3002"),n&&_(`\u901a\u8fc7yolkrc\u914d\u7f6eeslintIgnore\uff1a${n}\u3002`)),i.length>=D){const n=[];(0,o().default)(i,20).forEach((r=>{n.push(new Promise((n=>{A({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",e,...r],complete:n,exit:!1})})))}));const r=process.getMaxListeners(),a=(0,o().default)(n,r?r/2:2);let s=0;const c=()=>{s<a.length?Promise.all(a[s]).then((()=>{s++,c()})):L()};c()}else i.length&&A({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",e,...i]})}else _("\u6ca1\u6709eslint\u914d\u7f6e\u6587\u4ef6")}else L()};_("\u8981\u6c42\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),i.then(a)}))},ae=({mProject:e,mPrivateKeyPath:t,mVersion:n,mDesc:r,mRobot:i,mQrcodeFormat:a,mQrcodeOutputDest:o,mPagePath:c,mSearchQuery:l})=>{const f=u().default.existsSync(b().default.join(P,".git"))?(0,s().execSync)("git log -1 --pretty=format:%H").toString():"",d=H(),p=d.appid,y=e||b().default.join(P,"dist"),g=t||b().default.join(P,`private.${p}.key`);if(u().default.existsSync(y)){if(u().default.existsSync(g)){const e=U(),t=n||e.version||d.version||"1.0.0",s=r||e.description||d.description,u=`version: ${t};${f?` commit: ${f};`:""}${s?` description: ${s};`:""}`;f&&N(`commit: ${f}`),N(`dist: ${y}`),N(`key: ${g}`),N(`appid: ${p}`),N(`version: ${t}`),N(`desc: ${u}`);const h=new(m().Project)({appid:p,type:"miniProgram",projectPath:y,privateKeyPath:g,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:p,options:{project:h,version:t,desc:u,setting:d.setting,robot:i,qrcodeFormat:a,qrcodeOutputDest:o,pagePath:c,searchQuery:l}}}throw Error(`\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(${g})`)}throw Error(`\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(${y})`)},oe=()=>{re(),process.argv.length>2?c().default.version(S.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(((e,n)=>{const o=(0,t().default)(n),s=o[0],c=o.slice(1),l=e.clone,f=e.template,d=e.docs;if(s)switch(N(`yolk version: ${S.default.version}`),N(`node version: ${process.version}`),N(`platform: ${h().default.platform()}`),N(`memory: ${(0,a().default)(h().default.freemem()/1024/1024)} MB(${(0,a().default)(h().default.totalmem()/1024/1024)} MB)`),s){case"init":if(R(`yolk ${s} \u5f00\u59cb`),l)if(f){const e=".yolk",t=b().default.join(P,e);u().default.existsSync(t)&&(0,v().default)(t,(()=>{R(`\u7f13\u5b58\u5220\u9664 success! ${t}`)})),A({command:"git",args:["clone","-b","master","--depth","1",f,e].concat(c)}),C(P,t)}else Q("--clone \u6a21\u5f0f\u5fc5\u987b\u6709--template");else K(P);break;case"start":V()?Z()?A({command:"taro",args:["build","--type","tt","--watch"].concat(c)}):ee()?A({command:"taro",args:["build","--type","alipay","--watch"].concat(c)}):A({command:"taro",args:["build","--type","weapp","--watch"].concat(c)}):d?A({command:"dumi",args:["dev"].concat(c)}):G()?A({command:"icejs",args:["start","--config",Y()].concat(c)}):X()?A({command:"max",args:["dev"].concat(c)}):A({command:"umi",args:["dev"].concat(c)});break;case"build":V()?Z()?A({command:"taro",args:["build","--type","tt"].concat(c)}):ee()?A({command:"taro",args:["build","--type","alipay"].concat(c)}):A({command:"taro",args:["build","--type","weapp"].concat(c)}):d?A({command:"dumi",args:["build"].concat(c)}):G()?A({command:"icejs",args:["build","--config",Y()].concat(c)}):X()?A({command:"max",args:["build"].concat(c)}):A({command:"umi",args:["build"].concat(c)});break;case"pre-commit":ie();break;case"test":A({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(ee());else{const t=ae(e),n=t.appid,a=t.options;N(`${n}\u4e0a\u4f20\u5f00\u59cb`),m().upload($($({},(0,i().default)(a,["project","version","desc","setting","robot"])),{},{onProgressUpdate:e=>{if((0,r().default)(e))N(`task: ${e}`);else{const t=e.status,n=e.message;N(`task(${t}): ${n}`)}}})).then((()=>{R(`${n}\u4e0a\u4f20\u5b8c\u6210`)}))}break;case"miniapp-preview":case"miniprogram-preview":if(V())if(Z());else if(ee());else{const t=ae(e),n=t.appid,a=t.options;N(`${n}\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb`),m().preview($($({},(0,i().default)(a,["project","version","desc","setting","robot","qrcodeFormat","qrcodeOutputDest","pagePath","searchQuery"])),{},{onProgressUpdate:e=>{if((0,r().default)(e))N(`task: ${e}`);else{const t=e.status,n=e.message;N(`task(${t}): ${n}`)}}})).then((()=>{R(`${n}\u4e0a\u4f20\u9884\u89c8\u5b8c\u6210`)}))}break;default:M()}})).parse(process.argv):M()};oe();
2
+ var e=Object.create,o=Object.defineProperty,t=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,n=Object.prototype.hasOwnProperty,a=(e,i,a,c)=>{if(i&&"object"===typeof i||"function"===typeof i)for(let s of r(i))n.call(e,s)||s===a||o(e,s,{get:()=>i[s],enumerable:!(c=t(i,s))||c.enumerable});return e},c=(t,r,n)=>(n=null!=t?e(i(t)):{},a(!r&&t&&t.__esModule?n:o(n,"default",{value:t,enumerable:!0}),t)),s=require("child_process"),m=require("fs"),p=c(require("os")),d=require("path"),l=require("lodash"),u=require("glob"),y=c(require("inquirer")),g=c(require("miniprogram-ci")),f=require("mkdirp"),h=require("../compiled/commander"),v=c(require("../compiled/mustache")),b=c(require("../package.json")),S=require("./_util"),x=process.cwd(),j="##### CREATED BY YOLK #####",$=(e,o,t)=>{y.default.prompt([{type:"list",name:"type",message:"\u9009\u62e9\u6a21\u7248",default:"web",choices:[{name:"web template(umi framework)",value:"umi-web"},{name:"web big screen template(umi framework)",value:"umi-web-screen"},{name:"mobile template(umi framework)",value:"umi-mobile"},{name:"mobile HBuilderX h5+app template(umi framework)",value:"umi-mobile-h5+app"},{name:"mobile native template(umi framework)",value:"umi-mobile-native"},{name:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"\u9879\u76ee\u540d\u79f0",default:(0,d.basename)((0,d.basename)(process.cwd()))},{type:"list",name:"dependenciesInstallType",message:"\u9009\u62e9\u4f9d\u8d56\u5b89\u88c5\u65b9\u5f0f(\u9ed8\u8ba4\uff1apnpm\uff0c\u63a8\u8350\uff1apnpm)",default:"default",choices:[{name:"\u9ed8\u8ba4\u5b89\u88c5",value:"default"},{name:"\u8df3\u8fc7\u5b89\u88c5",value:!1},{name:"pnpm install",value:"pnpm"},{name:"yarn install",value:"yarn"},{name:"npm install",value:"npm"}]}]).then((({type:r,projectName:i,dependenciesInstallType:n})=>{const a={projectName:i,dependenciesInstallType:"default"===n?"pnpm":n,yolkVersion:b.default.version},c=o||(0,d.join)(__dirname,`../templates/${r}`);(0,S.ready)(`\u590d\u5236\u6a21\u7248 ${(0,d.basename)(c)}`);const s=(0,u.globSync)("**/*",{cwd:c,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(s.forEach((o=>{if(!c)return;const t=(0,d.join)(c,o);if(!(0,m.statSync)(t).isDirectory())if(o.endsWith(".tpl")){const r=(0,m.readFileSync)(t,S.ENCODING),i=(0,d.join)(e,o.replace(/\.tpl$/,"")),n=v.default.render(r,a);(0,f.mkdirpSync)((0,d.dirname)(i)),(0,S.ready)(`\u521b\u5efa ${(0,d.relative)(e,i)}`),(0,m.writeFileSync)(i,n,S.ENCODING)}else{(0,S.ready)(`\u521b\u5efa ${o}`);const r=(0,d.join)(e,o);(0,f.mkdirpSync)((0,d.dirname)(r)),(0,m.copyFileSync)(t,r)}})),(0,S.ready)("\u590d\u5236\u6a21\u7248 success!"),t&&(0,m.existsSync)(c)&&(0,S.rimrafSync)(c)&&(0,S.ready)(`\u7f13\u5b58\u5220\u9664 success! ${(0,d.basename)(c||"")}`),n)switch((0,S.ready)("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),n){case"default":case"pnpm":(0,S.execCommand)({command:"pnpm",args:["install"]});break;case"yarn":(0,S.execCommand)({command:"yarn",args:["install"]});break;case"npm":(0,S.execCommand)({command:"npm",args:["install"]});break;default:}(0,S.ready)("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},k=(e,o)=>$(e,o,!0),w=()=>(0,m.existsSync)((0,d.join)(x,"project.config.json")),O=()=>{let e=(0,m.existsSync)((0,d.join)(x,"node_modules/.bin/max"));if(!e)try{e=(0,m.existsSync)(require.resolve("@umijs/max"))}catch(o){}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/.test((0,s.execSync)("umi -v").toString())}catch(o){}if(!e){const t=(0,d.join)(x,"node_modules","umi","package.json");if((0,m.existsSync)(t))try{const o=JSON.parse((0,m.readFileSync)(t,S.ENCODING))||{};e=o.version&&+o.version.split(".")[0]>3}catch(o){}}return e},P=()=>{const e=(0,d.join)(x,"project.config.json");if((0,m.existsSync)(e)){const o=require(e);return o.appid}return""},C=()=>(0,m.existsSync)((0,d.join)(x,"project.tt.json"))&&0===P().indexOf("tt"),q=()=>0===P().indexOf("20"),N=()=>{const e=(0,d.join)(x,".git/"),o=(0,d.join)(x,".git/hooks"),t=(0,d.join)(o,"pre-commit"),r=(0,m.existsSync)(e),i=(0,m.existsSync)(t),n=i&&(0,m.readFileSync)(t,S.ENCODING).includes(j);if(r)if(i){if(!n){try{(0,m.chmodSync)(t,"777")}catch(a){(0,S.error)(`chmod ${t} failed: ${a.message}`)}const e=(0,m.readFileSync)(t).toString();(0,m.writeFileSync)(t,[e,e.includes("#!/")?"":"#!/bin/sh",j,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",j].join(p.default.EOL),S.ENCODING),(0,S.ready)("write pre-commit hook")}}else{(0,f.mkdirpSync)(o),(0,m.writeFileSync)(t,["#!/bin/sh",j,"npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",j].join(p.default.EOL),S.ENCODING),(0,S.ready)("create pre-commit hook");try{(0,m.chmodSync)(t,"777")}catch(a){(0,S.error)(`chmod ${t} failed: ${a.message}`)}(0,S.ready)("write pre-commit hook")}},D=async()=>{const e=(0,S.getYolkConfig)(),o=!1!==e.strict,t=e.eslintIgnore,r=e.stylelintIgnore;(0,S.warn)("\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),o&&((0,S.warn)("git commit \u7981\u6b62 lint \u7684 ignore \u884c\u4e3a"),r&&(0,S.warn)(`\u901a\u8fc7 .yolkrc \u914d\u7f6e stylelintIgnore: ${r}\u3002`),t&&(0,S.warn)(`\u901a\u8fc7 .yolkrc \u914d\u7f6e eslintIgnore: ${t}\u3002`)),(0,S.execCommand)({command:"lint-staged",args:["-c",require.resolve("./.lintstagedrc")]})},E=({mAppid:e,mProject:o,mPrivateKeyPath:t,mVersion:r,mDesc:i,mRobot:n,mQrcodeFormat:a,mQrcodeOutputDest:c,mPagePath:p,mSearchQuery:l})=>{const u=(0,m.existsSync)((0,d.join)(x,".git"))?(0,s.execSync)("git log -1 --pretty=format:%H").toString():"",y=(0,S.getProjectConfigJSON)(),f=e||y.appid,h=o||(0,d.join)(x,"dist"),v=t||(0,d.join)(x,`private.${f}.key`);if((0,m.existsSync)(h)){if((0,m.existsSync)(v)){const e=(0,S.getPackageJSON)(),o=r||e.version||y.version||"1.0.0",t=i||e.description||y.description,s=`${u?` commit: ${u};`:""}${t?` description: ${t};`:""}`;u&&(0,S.info)(`commit: ${u}`),(0,S.info)(`dist: ${h}`),(0,S.info)(`key: ${v}`),(0,S.info)(`appid: ${f}`),(0,S.info)(`version: ${o}`),(0,S.info)(`desc: ${s}`);const m=new g.Project({appid:f,type:"miniProgram",projectPath:h,privateKeyPath:v,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:f,options:{project:m,version:o,desc:s,setting:{...y.setting,es6:!1,es7:!1,minifyJS:!1,minifyWXML:!1,minifyWXSS:!1,minify:!1},robot:n,qrcodeFormat:a,qrcodeOutputDest:c,pagePath:p,searchQuery:l}}}throw Error(`\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(${v})`)}throw Error(`\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(${h})`)},I=()=>{let e="";try{e=(0,s.execSync)(`npm view ${b.default.name} version`,{timeout:3e3}).toString().replace(/\n/g,"")}catch(o){}(0,S.info)(`yolk version: ${b.default.version}${e&&e!==b.default.version?`(last\uff1a${e})`:""}`),(0,S.info)(`node version: ${process.version}`),(0,S.info)(`platform: ${p.default.platform()}`),(0,S.info)(`memory: ${(0,l.floor)(p.default.freemem()/1024/1024)} MB(${(0,l.floor)(p.default.totalmem()/1024/1024)} MB)`)},_=e=>e.option("--appid, --mAppid <appid>","\u5c0f\u7a0b\u5e8fappid").option("--project, --mProject <project>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u5de5\u7a0b\u76ee\u5f55").option("--privateKeyPath, --mPrivateKeyPath <privateKeyPath>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20key\u6587\u4ef6\uff0c\u9ed8\u8ba4\uff1a{\u5f53\u524d\u76ee\u5f55}/private.{appid}.key").option("--version, --mVersion <version>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u7248\u672c\u53f7").option("--desc, --mDesc <desc>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u63cf\u8ff0").option("--robot, --mRobot <robot>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20ci\u673a\u5668\u4eba1~30").option("--qrcodeFormat, --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("--qrcodeOutputDest, --mQrcodeOutputDest <qrcodeOutputDest>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u4e8c\u7ef4\u7801\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84").option("--pagePath, --mPagePath <pagePath>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84").option("--searchQuery, --mSearchQuery <searchQuery>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84\u542f\u52a8\u53c2\u6570"),F=/(\w+)=('(.*)'|"(.*)"|(.*))/giu,Q=e=>{process.env.DID_YOU_KNOW="none",process.env.VITE_CJS_IGNORE_WARNING="true";const o=[];return null==e||e.forEach((e=>{if(F.test(e)){const[o,t]=e.split("=");process.env[o]=t,(0,S.info)(`\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff1a${o}=${t}`)}else o.push(e)})),o},R=()=>{N(),process.argv.length>2?(h.program.version(b.default.version,"-v,--version","\u8f93\u51fa\u7248\u672c\u53f7").usage("[command] [options]"),h.program.command("init").description("\u521d\u59cb\u5316\u9879\u76ee").option("--clone <template>","\u5982\u679c\u9700\u8981\uff0c\u53ef\u901a\u8fc7git clone\u62c9\u53d6\u6a21\u7248\uff0c\u9ed8\u8ba4\u53d6cli\u9ed8\u8ba4\u6a21\u7248").action((({clone:e},{args:o})=>{if(I(),(0,S.ready)("yolk init \u5f00\u59cb"),e){const t=".yolk",r=(0,d.join)(x,t);(0,m.existsSync)(r)&&(0,S.rimrafSync)(r)&&(0,S.ready)(`\u7f13\u5b58\u5220\u9664 success! ${r}`),(0,S.execCommand)({command:"git",args:["clone","-b","master","--depth","1",e,t].concat(o)}),k(x,r)}else $(x)})),h.program.command("start").description("\u542f\u52a8\u9879\u76ee").option("--docs","\u6587\u6863\u6a21\u5f0f").action((({docs:e},{args:o})=>{I();const t=Q(o);w()?C()?(0,S.execCommand)({command:"taro",args:["build","--type","tt","--watch"].concat(t)}):q()?(0,S.execCommand)({command:"taro",args:["build","--type","alipay","--watch"].concat(t)}):(0,S.execCommand)({command:"taro",args:["build","--type","weapp","--watch"].concat(t)}):e?(0,S.execCommand)({command:"dumi",args:["dev"].concat(t)}):O()?(0,S.execCommand)({command:"max",args:["dev"].concat(t)}):(0,S.execCommand)({command:"umi",args:["dev"].concat(t)})})),h.program.command("build").description("\u7f16\u8bd1\u9879\u76ee").option("--docs","\u6587\u6863\u6a21\u5f0f").action((({docs:e},{args:o})=>{I();const t=Q(o);w()?C()?(0,S.execCommand)({command:"taro",args:["build","--type","tt"].concat(t)}):q()?(0,S.execCommand)({command:"taro",args:["build","--type","alipay"].concat(t)}):(0,S.execCommand)({command:"taro",args:["build","--type","weapp"].concat(t)}):e?(0,S.execCommand)({command:"dumi",args:["build"].concat(t)}):O()?(0,S.execCommand)({command:"max",args:["setup"].concat(t),complete:()=>(0,S.execCommand)({command:"max",args:["build"].concat(t)}),exit:!1}):(0,S.execCommand)({command:"umi",args:["build"].concat(t)})})),h.program.command("pre-commit").description("\u6267\u884ccommit hook").action(D),_(h.program.command("miniprogram-upload").description("\u4f7f\u7528 miniprogram-ci \u4e0a\u4f20\u5c0f\u7a0b\u5e8f")).action((e=>{if(w())if(C());else if(q());else{const{appid:o,options:{project:t,version:r,desc:i,setting:n,robot:a}}=E(e);(0,S.info)(`${o} \u4e0a\u4f20\u5f00\u59cb`),g.upload({project:t,version:r,desc:i,setting:n,robot:a,onProgressUpdate:e=>{if((0,l.isString)(e))(0,S.info)(`task: ${e}`);else{const{status:o,message:t}=e;(0,S.info)(`task(${o}): ${t}`)}}}).then((()=>{(0,S.ready)(`${o} \u4e0a\u4f20\u5b8c\u6210`)}))}else(0,S.error)("\u975e\u5c0f\u7a0b\u5e8f\u9879\u76ee\u76ee\u5f55")})),_(h.program.command("miniprogram-preview").description("\u4f7f\u7528 miniprogram-ci \u9884\u89c8\u5c0f\u7a0b\u5e8f")).action((e=>{if(w())if(C());else if(q());else{const{appid:o,options:{project:t,version:r,desc:i,setting:n,robot:a,qrcodeFormat:c,qrcodeOutputDest:s,pagePath:m,searchQuery:p}}=E(e);(0,S.info)(`${o} \u4e0a\u4f20\u9884\u89c8\u5f00\u59cb`),g.preview({project:t,version:r,desc:i,setting:n,robot:a,qrcodeFormat:c,qrcodeOutputDest:s,pagePath:m,searchQuery:p,onProgressUpdate:e=>{if((0,l.isString)(e))(0,S.info)(`task: ${e}`);else{const{status:o,message:t}=e;(0,S.info)(`task(${o}): ${t}`)}}}).then((()=>{(0,S.ready)(`${o} \u4e0a\u4f20\u9884\u89c8\u5b8c\u6210`)}))}else(0,S.error)("\u975e\u5c0f\u7a0b\u5e8f\u9879\u76ee\u76ee\u5f55")})),h.program.parse(process.argv)):(0,S.breakExit)()};R();
package/package.json CHANGED
@@ -1,44 +1,63 @@
1
1
  {
2
2
  "name": "@baic/yolk-cli",
3
- "version": "2.1.0-alpha.21",
4
- "author": "Baic <303394539@qq.com>",
5
- "license": "MIT",
6
- "bin": {
7
- "yolk": "lib/index.js"
3
+ "version": "2.1.0-alpha.211",
4
+ "repository": {
5
+ "type": "git",
6
+ "url": "git+https://github.com/303394539/yolk.git"
8
7
  },
8
+ "license": "MIT",
9
+ "author": "Baic <303394539@qq.com>",
9
10
  "main": "lib/index.js",
10
11
  "module": "es/index.js",
11
12
  "typings": "lib/index.d.ts",
13
+ "bin": {
14
+ "yolk": "lib/index.js"
15
+ },
12
16
  "files": [
17
+ "compiled",
13
18
  "lib",
14
19
  "es",
15
20
  "templates"
16
21
  ],
17
- "repository": {
18
- "type": "git",
19
- "url": "git+https://github.com/303394539/yolk.git"
22
+ "scripts": {
23
+ "build": "father build",
24
+ "ncu": "ncu",
25
+ "prebundle": "father prebundle"
20
26
  },
21
27
  "dependencies": {
22
- "@types/glob": "~7.2.0",
23
- "@types/inquirer": "~8.2.1",
28
+ "@baic/yolk-prebundle": "^2.1.0-alpha.211",
29
+ "@democrance/imagemin-lint-staged": "~2.4.x",
30
+ "@types/inquirer": "8.x",
31
+ "@types/lint-staged": "~13.x",
24
32
  "@types/lodash": "~4.x",
25
- "@types/mkdirp": "~1.0.2",
26
- "@types/mustache": "~4.1.3",
27
- "@types/prettier": "~2.6.3",
28
- "@types/rimraf": "~3.0.2",
29
- "commander": "~6.x",
30
- "glob": "~8.0.3",
31
- "inquirer": "~8.x",
33
+ "chalk": "4.x",
34
+ "eslint": "8.x",
35
+ "glob": "~10.x",
36
+ "inquirer": "8.x",
37
+ "licia": "~1.39.x",
38
+ "lint-staged": "~15.x",
32
39
  "lodash": "~4.x",
33
- "miniprogram-ci": "~1.8.25",
34
- "mkdirp": "~1.0.4",
35
- "mustache": "~4.2.0",
36
- "prettier": "~2.x",
37
- "rimraf": "~3.0.2",
38
- "staged-git-files": "~1.3.0"
40
+ "miniprogram-ci": "~1.9.x",
41
+ "mkdirp": "~3.0.x",
42
+ "postcss": "~8.x",
43
+ "postcss-less": "~6.x",
44
+ "postcss-scss": "~4.x",
45
+ "prettier": "2.x",
46
+ "stylelint": "14.x"
47
+ },
48
+ "devDependencies": {
49
+ "@babel/runtime": "~7.x",
50
+ "@types/mustache": "~4.2.x",
51
+ "commander": "~12.x",
52
+ "mustache": "~4.2.x",
53
+ "rimraf": "~5.0.x",
54
+ "v8-compile-cache": "~2.4.x"
55
+ },
56
+ "engines": {
57
+ "node": ">=16"
39
58
  },
40
59
  "publishConfig": {
41
60
  "access": "public"
42
61
  },
43
- "gitHead": "0bd4f788020711fa1a4fe12f5f12a16d065695e7"
62
+ "gitHead": "bb26d73fefd1a5f54c96ffb65f576b8da39a1dba"
44
63
  }
@@ -0,0 +1,7 @@
1
+ module.exports = {
2
+ extends: '@baic/eslint-config-yolk',
3
+ parserOptions: {
4
+ project: './tsconfig.json',
5
+ tsconfigRootDir: __dirname,
6
+ },
7
+ };
@@ -25,6 +25,7 @@ dist/
25
25
  .env.production.local
26
26
 
27
27
  # temp
28
+ .swc/
28
29
  .temp/
29
30
  .rn_temp/
30
31
  deploy_versions/
@@ -34,4 +35,7 @@ deploy_versions/
34
35
  .eslintcache
35
36
  .stylelintcache
36
37
  .vscode
37
- project.private.config.json
38
+ project.private.config.json
39
+
40
+ # ide
41
+ .vscode
@@ -2,4 +2,8 @@
2
2
  **/*.svg
3
3
  **/*.ejs
4
4
  **/*.html
5
- package.json
5
+ package-lock.json
6
+ yarn.lock
7
+ yarn-debug.log
8
+ yarn-error.log
9
+ pnpm-lock.yaml
@@ -0,0 +1 @@
1
+ module.exports = require('@baic/prettier-config-yolk');
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2020 Baic
3
+ Copyright (c) 2024 Baic
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -1,33 +1 @@
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
+ import "@baic/yolk-taro/typings";
@@ -5,7 +5,7 @@
5
5
  "appid": "touristappid",
6
6
  "setting": {
7
7
  "urlCheck": true,
8
- "es6": true,
8
+ "es6": false,
9
9
  "enhance": false,
10
10
  "postcss": true,
11
11
  "preloadBackgroundData": false,
@@ -42,12 +42,14 @@
42
42
  "showES6CompileOption": false,
43
43
  "disableUseStrict": false,
44
44
  "useCompilerPlugins": false,
45
- "minifyWXML": true
45
+ "minifyWXML": true,
46
+ "condition": false,
47
+ "bigPackageSizeSupport": true
46
48
  },
47
49
  "compileType": "miniprogram",
48
50
  "simulatorType": "wechat",
49
51
  "simulatorPluginLibVersion": {},
50
- "libVersion": "2.13.0",
52
+ "libVersion": "2.32.0",
51
53
  "condition": {},
52
54
  "srcMiniprogramRoot": "dist/",
53
55
  "packOptions": {
@@ -1,4 +1,4 @@
1
- import { AppConfig } from '@tarojs/taro/types/index';
1
+ import { AppConfig } from '@tarojs/taro';
2
2
 
3
3
  export default {
4
4
  pages: ['pages/index/index', 'pages/demo/index'],
@@ -1,2 +1 @@
1
- @import "./theme.scss";
2
1
  @import "~taro-ui/dist/style/index.scss";
@@ -1,14 +1,12 @@
1
- import * as React from 'react';
1
+ import './app.scss';
2
+
3
+ import React, { PropsWithChildren } from 'react';
2
4
 
3
5
  import { Provider } from '@baic/yolk-miniprogram';
4
6
 
5
7
  import request from '@/common/request';
6
8
 
7
- import './app.scss';
8
-
9
- interface Props {
10
- children: React.ReactNode;
11
- }
9
+ type Props = PropsWithChildren<Record<string, unknown>>;
12
10
 
13
11
  export default ({ children }: Props) => (
14
12
  <Provider request={request} inputMaxLength={40}>
@@ -1,3 +1,11 @@
1
- import * as React from 'react';
2
- import { Input } from '@baic/yolk-miniprogram';
3
- export default () => <Input />;
1
+ import { Form, FormItem, Input, useForm } from '@baic/yolk-miniprogram';
2
+ export default () => {
3
+ const [form] = useForm();
4
+ return (
5
+ <Form form={form}>
6
+ <FormItem name="input" rules="required">
7
+ <Input />
8
+ </FormItem>
9
+ </Form>
10
+ );
11
+ };
@@ -1,3 +1,2 @@
1
- import * as React from 'react';
2
1
  import { MobileInput } from '@baic/yolk-miniprogram';
3
2
  export default () => <MobileInput />;
@@ -1,3 +1,2 @@
1
- import * as React from 'react';
2
1
  import { MoneyInput } from '@baic/yolk-miniprogram';
3
2
  export default () => <MoneyInput />;
@@ -1,3 +1,2 @@
1
- import * as React from 'react';
2
1
  import { NumberInput } from '@baic/yolk-miniprogram';
3
2
  export default () => <NumberInput />;