@baic/yolk-cli 2.1.0-alpha.14 → 2.1.0-alpha.141
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/compiled/commander/index.d.ts +430 -0
- package/compiled/commander/index.js +1970 -0
- package/compiled/commander/package.json +1 -0
- package/compiled/mustache/index.d.ts +423 -0
- package/compiled/mustache/index.js +828 -0
- package/compiled/mustache/package.json +1 -0
- package/es/.lintstagedrc.js +52 -0
- package/es/.prettierrc.js +15 -0
- package/es/_util.d.ts +26 -0
- package/es/_util.js +1 -0
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -1
- package/es/yolk.js +1 -1
- package/lib/.lintstagedrc.js +52 -0
- package/lib/.prettierrc.js +15 -0
- package/lib/_util.d.ts +26 -0
- package/lib/_util.js +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -1
- package/lib/yolk.js +1 -1
- package/package.json +34 -23
- package/templates/miniprogram/.eslintrc +1 -1
- package/templates/miniprogram/.gitignore.tpl +8 -6
- package/templates/miniprogram/.npmrc.tpl +2 -0
- package/templates/miniprogram/.prettierignore +5 -1
- package/templates/miniprogram/.prettierrc.js +1 -0
- package/templates/miniprogram/README.md.tpl +2 -2
- package/templates/miniprogram/global.d.ts +1 -33
- package/templates/miniprogram/package.json.tpl +5 -0
- package/templates/miniprogram/project.config.json.tpl +5 -3
- package/templates/miniprogram/src/app.config.ts +1 -1
- package/templates/miniprogram/src/app.scss +0 -1
- package/templates/miniprogram/src/app.tsx +4 -6
- package/templates/miniprogram/src/pages/demo/examples/Input.tsx +11 -3
- package/templates/miniprogram/src/pages/demo/examples/MobileInput.tsx +0 -1
- package/templates/miniprogram/src/pages/demo/examples/MoneyInput.tsx +0 -1
- package/templates/miniprogram/src/pages/demo/examples/NumberInput.tsx +0 -1
- package/templates/miniprogram/src/pages/demo/examples/Textarea.tsx +12 -3
- package/templates/miniprogram/src/pages/demo/examples/TimerButton.tsx +0 -1
- package/templates/miniprogram/src/pages/demo/examples/usePreload.tsx +0 -1
- package/templates/miniprogram/src/pages/demo/index.config.ts +1 -1
- package/templates/miniprogram/src/pages/demo/index.tsx +6 -5
- package/templates/miniprogram/src/pages/index/index.config.ts +1 -1
- package/templates/miniprogram/src/pages/index/index.tsx +1 -1
- package/templates/miniprogram/src/types/user.d.ts +4 -2
- package/templates/miniprogram/tsconfig.json +2 -19
- package/templates/umi-mobile/.eslintrc +1 -1
- package/templates/umi-mobile/.gitignore.tpl +3 -2
- package/templates/umi-mobile/.npmrc.tpl +2 -0
- package/templates/umi-mobile/.prettierignore +6 -2
- package/templates/umi-mobile/.prettierrc.js +1 -0
- package/templates/umi-mobile/.umirc.ts.tpl +2 -2
- package/templates/umi-mobile/README.md.tpl +2 -2
- package/templates/umi-mobile/package.json.tpl +5 -0
- package/templates/umi-mobile/src/app.tsx +2 -2
- package/templates/umi-mobile/src/pages/404.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/BarCode.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/Iconfont.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/Input.tsx +1 -3
- package/templates/umi-mobile/src/pages/demo/examples/List/1.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/List/2.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/3.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/examples/List/4.tsx +9 -10
- package/templates/umi-mobile/src/pages/demo/examples/Loading.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/1.tsx +1 -3
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/2.tsx +1 -3
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/3.tsx +1 -3
- package/templates/umi-mobile/src/pages/demo/examples/NumberInput/4.tsx +1 -3
- package/templates/umi-mobile/src/pages/demo/examples/PagingList/1.tsx +1 -2
- package/templates/umi-mobile/src/pages/demo/examples/QrCode.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/Required.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/TimerButton.tsx +0 -1
- package/templates/umi-mobile/src/pages/demo/examples/usePreload.tsx +1 -1
- package/templates/umi-mobile/src/pages/demo/index.tsx +10 -10
- package/templates/umi-mobile/src/pages/index.tsx +0 -2
- package/templates/umi-mobile/src/types/user.d.ts +2 -2
- package/templates/umi-mobile-h5+app/.eslintrc +1 -1
- package/templates/umi-mobile-h5+app/.gitignore.tpl +3 -2
- package/templates/umi-mobile-h5+app/.npmrc.tpl +2 -0
- package/templates/umi-mobile-h5+app/.prettierignore +6 -2
- package/templates/umi-mobile-h5+app/.prettierrc.js +1 -0
- package/templates/umi-mobile-h5+app/.umirc.ts.tpl +2 -2
- package/templates/umi-mobile-h5+app/README.md.tpl +2 -2
- package/templates/umi-mobile-h5+app/package.json.tpl +5 -0
- package/templates/umi-mobile-h5+app/src/pages/404.tsx +0 -1
- package/templates/umi-mobile-h5+app/src/pages/demo/examples/Input.tsx +1 -2
- package/templates/umi-mobile-h5+app/src/pages/demo/examples/List/4.tsx +2 -2
- package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/1.tsx +1 -2
- package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/2.tsx +1 -2
- package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/3.tsx +1 -2
- package/templates/umi-mobile-h5+app/src/pages/demo/examples/NumberInput/4.tsx +1 -2
- package/templates/umi-mobile-h5+app/src/pages/demo/index.tsx +8 -7
- package/templates/umi-mobile-h5+app/src/pages/index.tsx +0 -2
- package/templates/umi-mobile-h5+app/src/types/user.d.ts +2 -2
- package/templates/umi-mobile-native/.eslintrc +1 -1
- package/templates/umi-mobile-native/.gitignore.tpl +3 -2
- package/templates/umi-mobile-native/.npmrc.tpl +2 -0
- package/templates/umi-mobile-native/.prettierignore +6 -2
- package/templates/umi-mobile-native/.prettierrc.js +1 -0
- package/templates/umi-mobile-native/.umirc.ts.tpl +2 -2
- package/templates/umi-mobile-native/README.md.tpl +2 -2
- package/templates/umi-mobile-native/android/app/build.gradle +19 -4
- package/templates/umi-mobile-native/android/app/libs/Bluetooth-release.aar +0 -0
- package/templates/umi-mobile-native/android/gradle.properties +1 -1
- package/templates/umi-mobile-native/package.json.tpl +5 -0
- package/templates/umi-mobile-native/src/common/Xprinter.ts +4 -4
- package/templates/umi-mobile-native/src/common/bluetooth.ts +8 -8
- package/templates/umi-mobile-native/src/common/bridge.ts +6 -6
- package/templates/umi-mobile-native/src/pages/404.tsx +0 -1
- package/templates/umi-mobile-native/src/pages/demo/examples/Input.tsx +1 -2
- package/templates/umi-mobile-native/src/pages/demo/examples/List/4.tsx +2 -2
- package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/1.tsx +1 -2
- package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/2.tsx +1 -2
- package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/3.tsx +1 -2
- package/templates/umi-mobile-native/src/pages/demo/examples/NumberInput/4.tsx +1 -2
- package/templates/umi-mobile-native/src/pages/demo/index.tsx +8 -7
- package/templates/umi-mobile-native/src/types/user.d.ts +2 -2
- package/templates/umi-web/.eslintrc +1 -1
- package/templates/umi-web/.gitignore.tpl +3 -2
- package/templates/umi-web/.npmrc.tpl +2 -0
- package/templates/umi-web/.prettierignore +6 -2
- package/templates/umi-web/.prettierrc.js +1 -0
- package/templates/umi-web/.umirc.ts.tpl +1 -2
- package/templates/umi-web/README.md.tpl +1 -1
- package/templates/umi-web/package.json.tpl +5 -0
- package/templates/umi-web/src/pages/404.tsx +2 -3
- package/templates/umi-web/src/pages/demo/examples/BankInput.tsx +1 -2
- package/templates/umi-web/src/pages/demo/examples/Grid/5.tsx +1 -2
- package/templates/umi-web/src/pages/demo/examples/Input/2.tsx +2 -1
- package/templates/umi-web/src/pages/demo/examples/RangeNumber/2.tsx +1 -2
- package/templates/umi-web/src/pages/demo/examples/SearchLayout.tsx +2 -2
- package/templates/umi-web/src/pages/demo/index.tsx +11 -9
- package/templates/umi-web/src/pages/index.tsx +0 -2
- package/templates/umi-web/src/types/user.d.ts +2 -2
- package/templates/umi-web-screen/.eslintrc +1 -1
- package/templates/umi-web-screen/.gitignore.tpl +3 -2
- package/templates/umi-web-screen/.npmrc.tpl +2 -0
- package/templates/umi-web-screen/.prettierignore +6 -2
- package/templates/umi-web-screen/.prettierrc.js +1 -0
- package/templates/umi-web-screen/.umirc.ts.tpl +1 -2
- package/templates/umi-web-screen/README.md.tpl +1 -1
- package/templates/umi-web-screen/package.json.tpl +5 -0
- package/templates/umi-web-screen/src/components/resize-container/index.tsx +18 -18
- package/templates/umi-web-screen/src/layouts/controller/index.tsx +5 -9
- package/templates/umi-web-screen/src/pages/404.tsx +2 -3
- package/templates/umi-web-screen/src/pages/index.tsx +0 -2
- package/templates/umi-web-screen/src/pages/template/components/charts/demo-line/index.tsx +2 -3
- package/templates/umi-web-screen/src/pages/template/controller/index.tsx +11 -12
- package/templates/umi-web-screen/src/types/user.d.ts +2 -2
- package/es/yolk.d.ts +0 -2
- package/lib/yolk.d.ts +0 -2
- package/templates/ice-mobile/.eslintrc +0 -6
- package/templates/ice-mobile/.gitignore.tpl +0 -33
- package/templates/ice-mobile/.icerc.ts +0 -3
- package/templates/ice-mobile/.prettierignore +0 -9
- package/templates/ice-mobile/.prettierrc +0 -11
- package/templates/ice-mobile/.stylelintrc +0 -3
- package/templates/ice-mobile/README.md.tpl +0 -34
- package/templates/ice-mobile/package.json.tpl +0 -11
- package/templates/ice-mobile/public/favicon.ico +0 -0
- package/templates/ice-mobile/public/index.html +0 -15
- package/templates/ice-mobile/src/app.tsx +0 -5
- package/templates/ice-mobile/src/common/request.ts +0 -3
- package/templates/ice-mobile/src/common/util.ts +0 -7
- package/templates/ice-mobile/src/components/index.ts +0 -0
- package/templates/ice-mobile/src/global.less +0 -3
- package/templates/ice-mobile/src/layouts/index.tsx +0 -5
- package/templates/ice-mobile/src/pages/404.tsx +0 -10
- package/templates/ice-mobile/src/pages/demo/examples/BarCode.tsx +0 -4
- package/templates/ice-mobile/src/pages/demo/examples/Iconfont.tsx +0 -18
- package/templates/ice-mobile/src/pages/demo/examples/Input.tsx +0 -17
- package/templates/ice-mobile/src/pages/demo/examples/List/1.tsx +0 -12
- package/templates/ice-mobile/src/pages/demo/examples/List/2.tsx +0 -29
- package/templates/ice-mobile/src/pages/demo/examples/List/3.tsx +0 -29
- package/templates/ice-mobile/src/pages/demo/examples/List/4.tsx +0 -55
- package/templates/ice-mobile/src/pages/demo/examples/List/mock.ts +0 -30
- package/templates/ice-mobile/src/pages/demo/examples/Loading.tsx +0 -12
- package/templates/ice-mobile/src/pages/demo/examples/NumberInput/1.tsx +0 -17
- package/templates/ice-mobile/src/pages/demo/examples/NumberInput/2.tsx +0 -17
- package/templates/ice-mobile/src/pages/demo/examples/NumberInput/3.tsx +0 -17
- package/templates/ice-mobile/src/pages/demo/examples/NumberInput/4.tsx +0 -17
- package/templates/ice-mobile/src/pages/demo/examples/PagingList/1.tsx +0 -6
- package/templates/ice-mobile/src/pages/demo/examples/QrCode.tsx +0 -4
- package/templates/ice-mobile/src/pages/demo/examples/Required.tsx +0 -4
- package/templates/ice-mobile/src/pages/demo/examples/TimerButton.tsx +0 -4
- package/templates/ice-mobile/src/pages/demo/examples/usePreload.tsx +0 -9
- package/templates/ice-mobile/src/pages/demo/index.tsx +0 -87
- package/templates/ice-mobile/src/pages/index.tsx +0 -3
- package/templates/ice-mobile/src/routes.ts +0 -29
- package/templates/ice-mobile/src/types/user.d.ts +0 -3
- package/templates/ice-mobile/tsconfig.json +0 -3
- package/templates/ice-mobile/typings.d.ts +0 -1
- package/templates/ice-mobile-h5+app/.eslintrc +0 -6
- package/templates/ice-mobile-h5+app/.gitignore.tpl +0 -33
- package/templates/ice-mobile-h5+app/.icerc.ts +0 -5
- package/templates/ice-mobile-h5+app/.prettierignore +0 -9
- package/templates/ice-mobile-h5+app/.prettierrc +0 -11
- package/templates/ice-mobile-h5+app/.stylelintrc +0 -3
- package/templates/ice-mobile-h5+app/README.md.tpl +0 -34
- package/templates/ice-mobile-h5+app/h5+app/manifest.json +0 -87
- package/templates/ice-mobile-h5+app/package.json.tpl +0 -11
- package/templates/ice-mobile-h5+app/public/favicon.ico +0 -0
- package/templates/ice-mobile-h5+app/public/index.html +0 -15
- package/templates/ice-mobile-h5+app/src/app.tsx +0 -5
- package/templates/ice-mobile-h5+app/src/common/request.ts +0 -3
- package/templates/ice-mobile-h5+app/src/common/util.ts +0 -7
- package/templates/ice-mobile-h5+app/src/components/index.ts +0 -0
- package/templates/ice-mobile-h5+app/src/global.less +0 -3
- package/templates/ice-mobile-h5+app/src/layouts/index.tsx +0 -5
- package/templates/ice-mobile-h5+app/src/pages/404.tsx +0 -10
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/BarCode.tsx +0 -4
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/Iconfont.tsx +0 -18
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/Input.tsx +0 -17
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/1.tsx +0 -12
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/2.tsx +0 -29
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/3.tsx +0 -29
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/4.tsx +0 -55
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/List/mock.ts +0 -30
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/Loading.tsx +0 -12
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/1.tsx +0 -17
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/2.tsx +0 -17
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/3.tsx +0 -17
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/NumberInput/4.tsx +0 -17
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/PagingList/1.tsx +0 -6
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/QrCode.tsx +0 -4
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/Required.tsx +0 -4
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/TimerButton.tsx +0 -4
- package/templates/ice-mobile-h5+app/src/pages/demo/examples/usePreload.tsx +0 -9
- package/templates/ice-mobile-h5+app/src/pages/demo/index.tsx +0 -87
- package/templates/ice-mobile-h5+app/src/pages/index.tsx +0 -3
- package/templates/ice-mobile-h5+app/src/routes.ts +0 -29
- package/templates/ice-mobile-h5+app/src/types/user.d.ts +0 -3
- package/templates/ice-mobile-h5+app/tsconfig.json +0 -3
- package/templates/ice-mobile-h5+app/typings.d.ts +0 -1
- package/templates/ice-mobile-native/.eslintrc +0 -6
- package/templates/ice-mobile-native/.gitignore.tpl +0 -38
- package/templates/ice-mobile-native/.icerc.ts +0 -7
- package/templates/ice-mobile-native/.prettierignore +0 -9
- package/templates/ice-mobile-native/.prettierrc +0 -11
- package/templates/ice-mobile-native/.stylelintrc +0 -3
- package/templates/ice-mobile-native/README.md.tpl +0 -34
- package/templates/ice-mobile-native/android/app/6209ba977ffec7d62675a4e254ebc209.keystore +0 -0
- package/templates/ice-mobile-native/android/app/build.gradle +0 -66
- package/templates/ice-mobile-native/android/app/libs/Bluetooth-release.aar +0 -0
- package/templates/ice-mobile-native/android/app/libs/PosPrinterSDK.jar +0 -0
- package/templates/ice-mobile-native/android/app/libs/android-gif-drawable-release@1.2.23.aar +0 -0
- package/templates/ice-mobile-native/android/app/libs/lib.5plus.base-release.aar +0 -0
- package/templates/ice-mobile-native/android/app/libs/oaid_sdk_1.0.25.aar +0 -0
- package/templates/ice-mobile-native/android/app/libs/webview-x5-release.aar +0 -0
- package/templates/ice-mobile-native/android/app/proguard-rules.pro +0 -303
- package/templates/ice-mobile-native/android/app/src/main/AndroidManifest.xml +0 -98
- package/templates/ice-mobile-native/android/app/src/main/assets/apps/H5ECA1DEE/www/manifest.json +0 -89
- package/templates/ice-mobile-native/android/app/src/main/assets/data/dcloud_control.xml +0 -6
- package/templates/ice-mobile-native/android/app/src/main/assets/data/dcloud_error.html +0 -92
- package/templates/ice-mobile-native/android/app/src/main/assets/data/dcloud_properties.xml +0 -19
- package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/JSBridge/FunctionCreator.java +0 -119
- package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/MPandoraEntryActivity.java +0 -17
- package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/Xprinter/FunctionFactory/Creator.java +0 -17
- package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/Xprinter/FunctionFactory/Error.java +0 -26
- package/templates/ice-mobile-native/android/app/src/main/java/plus/H5ECA1DEE/Xprinter/JSPlugin.java +0 -265
- package/templates/ice-mobile-native/android/app/src/main/res/drawable/icon.png +0 -0
- package/templates/ice-mobile-native/android/app/src/main/res/values/colors.xml +0 -5
- package/templates/ice-mobile-native/android/app/src/main/res/values/strings.xml +0 -3
- package/templates/ice-mobile-native/android/build.gradle +0 -9
- package/templates/ice-mobile-native/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/templates/ice-mobile-native/android/gradle/wrapper/gradle-wrapper.properties +0 -6
- package/templates/ice-mobile-native/android/gradle.properties +0 -22
- package/templates/ice-mobile-native/android/gradlew +0 -185
- package/templates/ice-mobile-native/android/gradlew.bat +0 -89
- package/templates/ice-mobile-native/android/settings.gradle +0 -16
- package/templates/ice-mobile-native/ios/HBuilder/HBuilder.entitlements +0 -5
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/1024x1024.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/120x120-1.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/120x120.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/180x180.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/40x40.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/58x58.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/60x60.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/80x80.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/87x87.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/AppIcon.appiconset/Contents.json +0 -62
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/Contents.json +0 -6
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/Image.imageset/Contents.json +0 -20
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/120x120.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/180x180.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/60x60.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/app.imageset/Contents.json +0 -26
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/control_brightness.imageset/Contents.json +0 -21
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/control_brightness.imageset/brightness@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exitfullscreen.imageset/Contents.json +0 -22
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exitfullscreen.imageset/shrinkscreen@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exitfullscreen.imageset/shrinkscreen@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exposure_slider_max.imageset/Contents.json +0 -22
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exposure_slider_max.imageset//346/233/235/345/205/211-1.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/exposure_slider_max.imageset//346/233/235/345/205/211.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_border.imageset/Contents.json +0 -22
- 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
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_border.imageset//345/257/271/347/204/246/346/241/206.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_slider_line.imageset/Contents.json +0 -21
- 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
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/focus_slider_thumb.imageset/Contents.json +0 -22
- 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
- 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
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/full-screen.imageset/Contents.json +0 -22
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/full-screen.imageset/fullscreen@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/full-screen.imageset/fullscreen@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/Contents.json +0 -23
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/play.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/play@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/play.imageset/play@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/Contents.json +0 -23
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/player_back.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/player_back@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_back.imageset/player_back@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/Contents.json +0 -23
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/play.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/play@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_play.imageset/play@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/Contents.json +0 -23
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/player-stop.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/player-stop@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/player_stop.imageset/player-stop@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteoff.imageset/Contents.json +0 -22
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteoff.imageset/video_ic_muteoff@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteoff.imageset/video_ic_muteoff@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteon.imageset/Contents.json +0 -22
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteon.imageset/video_ic_muteon@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_ic_muteon.imageset/video_ic_muteon@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_volume.imageset/Contents.json +0 -22
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_volume.imageset/video_volume@2x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder/Images.xcassets/video_volume.imageset/video_volume@3x.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/120x120.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/180x180.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/AppDelegate.h +0 -16
- package/templates/ice-mobile-native/ios/HBuilder-Hello/AppDelegate.m +0 -225
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Base.lproj/LaunchScreen.storyboard +0 -65
- package/templates/ice-mobile-native/ios/HBuilder-Hello/English.lproj/Localizable.strings +0 -13
- package/templates/ice-mobile-native/ios/HBuilder-Hello/HBuilder-Hello-Info.plist +0 -486
- package/templates/ice-mobile-native/ios/HBuilder-Hello/HBuilder-Hello-Prefix.pch +0 -16
- package/templates/ice-mobile-native/ios/HBuilder-Hello/LaunchScreen.storyboard +0 -67
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/manifest.json +0 -79
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/1024x1024.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/120x120.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/144x144.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/152x152.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/167x167.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/180x180.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/192x192.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/20x20.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/29x29.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/40x40.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/58x58.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/60x60.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/72x72.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/76x76.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/80x80.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/87x87.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Pandora/apps/H5ECA1DEE/www/unpackage/res/icons/96x96.png +0 -0
- package/templates/ice-mobile-native/ios/HBuilder-Hello/ViewController.h +0 -19
- package/templates/ice-mobile-native/ios/HBuilder-Hello/ViewController.m +0 -161
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Xprinter.h +0 -19
- package/templates/ice-mobile-native/ios/HBuilder-Hello/Xprinter.m +0 -235
- package/templates/ice-mobile-native/ios/HBuilder-Hello/control.xml +0 -107
- package/templates/ice-mobile-native/ios/HBuilder-Hello/en.lproj/InfoPlist.strings +0 -4
- package/templates/ice-mobile-native/ios/HBuilder-Hello/en.lproj/Localizable.strings +0 -12
- package/templates/ice-mobile-native/ios/HBuilder-Hello/main.m +0 -18
- package/templates/ice-mobile-native/ios/HBuilder-Hello/zh-Hans.lproj/InfoPlist.strings +0 -4
- package/templates/ice-mobile-native/ios/HBuilder-Hello/zh-Hans.lproj/LaunchScreen.strings +0 -3
- package/templates/ice-mobile-native/ios/HBuilder-Hello/zh-Hans.lproj/Localizable.strings +0 -13
- package/templates/ice-mobile-native/ios/HBuilder-Hello.xcodeproj/project.pbxproj +0 -1607
- package/templates/ice-mobile-native/package.json.tpl +0 -11
- package/templates/ice-mobile-native/public/favicon.ico +0 -0
- package/templates/ice-mobile-native/public/index.html +0 -15
- package/templates/ice-mobile-native/src/app.tsx +0 -5
- package/templates/ice-mobile-native/src/common/Xprinter.ts +0 -58
- package/templates/ice-mobile-native/src/common/bluetooth.ts +0 -354
- package/templates/ice-mobile-native/src/common/bridge.ts +0 -59
- package/templates/ice-mobile-native/src/common/request.ts +0 -3
- package/templates/ice-mobile-native/src/common/util.ts +0 -7
- package/templates/ice-mobile-native/src/components/index.ts +0 -0
- package/templates/ice-mobile-native/src/global.less +0 -3
- package/templates/ice-mobile-native/src/layouts/index.tsx +0 -5
- package/templates/ice-mobile-native/src/pages/404.tsx +0 -10
- package/templates/ice-mobile-native/src/pages/demo/examples/BarCode.tsx +0 -4
- package/templates/ice-mobile-native/src/pages/demo/examples/Iconfont.tsx +0 -18
- package/templates/ice-mobile-native/src/pages/demo/examples/Input.tsx +0 -17
- package/templates/ice-mobile-native/src/pages/demo/examples/List/1.tsx +0 -12
- package/templates/ice-mobile-native/src/pages/demo/examples/List/2.tsx +0 -29
- package/templates/ice-mobile-native/src/pages/demo/examples/List/3.tsx +0 -29
- package/templates/ice-mobile-native/src/pages/demo/examples/List/4.tsx +0 -55
- package/templates/ice-mobile-native/src/pages/demo/examples/List/mock.ts +0 -30
- package/templates/ice-mobile-native/src/pages/demo/examples/Loading.tsx +0 -12
- package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/1.tsx +0 -17
- package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/2.tsx +0 -17
- package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/3.tsx +0 -17
- package/templates/ice-mobile-native/src/pages/demo/examples/NumberInput/4.tsx +0 -17
- package/templates/ice-mobile-native/src/pages/demo/examples/PagingList/1.tsx +0 -6
- package/templates/ice-mobile-native/src/pages/demo/examples/QrCode.tsx +0 -4
- package/templates/ice-mobile-native/src/pages/demo/examples/Required.tsx +0 -4
- package/templates/ice-mobile-native/src/pages/demo/examples/TimerButton.tsx +0 -4
- package/templates/ice-mobile-native/src/pages/demo/examples/Xprinter/index.tsx +0 -64
- package/templates/ice-mobile-native/src/pages/demo/examples/Xprinter/style.less +0 -16
- package/templates/ice-mobile-native/src/pages/demo/examples/usePreload.tsx +0 -9
- package/templates/ice-mobile-native/src/pages/demo/index.tsx +0 -89
- package/templates/ice-mobile-native/src/pages/index.tsx +0 -3
- package/templates/ice-mobile-native/src/routes.ts +0 -29
- package/templates/ice-mobile-native/src/types/user.d.ts +0 -3
- package/templates/ice-mobile-native/tsconfig.json +0 -3
- package/templates/ice-mobile-native/typings.d.ts +0 -1
- package/templates/ice-web/.eslintrc +0 -6
- package/templates/ice-web/.gitignore.tpl +0 -33
- package/templates/ice-web/.icerc.ts +0 -3
- package/templates/ice-web/.prettierignore +0 -9
- package/templates/ice-web/.prettierrc +0 -11
- package/templates/ice-web/.stylelintrc +0 -3
- package/templates/ice-web/README.md.tpl +0 -34
- package/templates/ice-web/package.json.tpl +0 -11
- package/templates/ice-web/public/favicon.ico +0 -0
- package/templates/ice-web/public/index.html +0 -15
- package/templates/ice-web/src/app.tsx +0 -5
- package/templates/ice-web/src/common/request.ts +0 -3
- package/templates/ice-web/src/common/util.ts +0 -7
- package/templates/ice-web/src/components/index.ts +0 -0
- package/templates/ice-web/src/global.less +0 -5
- package/templates/ice-web/src/layouts/index.tsx +0 -5
- package/templates/ice-web/src/pages/404.tsx +0 -17
- package/templates/ice-web/src/pages/demo/examples/BankInput.tsx +0 -13
- package/templates/ice-web/src/pages/demo/examples/BarCode.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/Collapse.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/DatePicker.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/Flex.tsx +0 -10
- package/templates/ice-web/src/pages/demo/examples/Grid/1.tsx +0 -25
- package/templates/ice-web/src/pages/demo/examples/Grid/2.tsx +0 -26
- package/templates/ice-web/src/pages/demo/examples/Grid/3.tsx +0 -37
- package/templates/ice-web/src/pages/demo/examples/Grid/4.tsx +0 -43
- package/templates/ice-web/src/pages/demo/examples/Grid/5.tsx +0 -36
- package/templates/ice-web/src/pages/demo/examples/Grid/6.tsx +0 -28
- package/templates/ice-web/src/pages/demo/examples/Iconfont.tsx +0 -18
- package/templates/ice-web/src/pages/demo/examples/ImagePreview.tsx +0 -20
- package/templates/ice-web/src/pages/demo/examples/Input/1.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/Input/2.tsx +0 -80
- package/templates/ice-web/src/pages/demo/examples/LinkButton/1.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/LinkButton/2.tsx +0 -9
- package/templates/ice-web/src/pages/demo/examples/LinkButton/3.tsx +0 -12
- package/templates/ice-web/src/pages/demo/examples/Loading.tsx +0 -12
- package/templates/ice-web/src/pages/demo/examples/MobileInput.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/NumberInput.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/PagingTable.tsx +0 -21
- package/templates/ice-web/src/pages/demo/examples/QrCode.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/RangeNumber/1.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/RangeNumber/2.tsx +0 -15
- package/templates/ice-web/src/pages/demo/examples/Required.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/SearchLayout.tsx +0 -46
- package/templates/ice-web/src/pages/demo/examples/Table/1.tsx +0 -64
- package/templates/ice-web/src/pages/demo/examples/Table/2.tsx +0 -29
- package/templates/ice-web/src/pages/demo/examples/Table/3.tsx +0 -39
- package/templates/ice-web/src/pages/demo/examples/Table/4.tsx +0 -42
- package/templates/ice-web/src/pages/demo/examples/TimerButton.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/Title/1.tsx +0 -4
- package/templates/ice-web/src/pages/demo/examples/Title/2.tsx +0 -5
- package/templates/ice-web/src/pages/demo/examples/WaterMark.tsx +0 -8
- package/templates/ice-web/src/pages/demo/examples/Wrapper.tsx +0 -40
- package/templates/ice-web/src/pages/demo/examples/usePreload.tsx +0 -9
- package/templates/ice-web/src/pages/demo/index.tsx +0 -135
- package/templates/ice-web/src/pages/index.tsx +0 -3
- package/templates/ice-web/src/routes.ts +0 -29
- package/templates/ice-web/src/types/user.d.ts +0 -3
- package/templates/ice-web/tsconfig.json +0 -3
- package/templates/ice-web/typings.d.ts +0 -1
- package/templates/ice-web-screen/.eslintrc +0 -6
- package/templates/ice-web-screen/.gitignore.tpl +0 -33
- package/templates/ice-web-screen/.icerc.ts +0 -3
- package/templates/ice-web-screen/.prettierignore +0 -9
- package/templates/ice-web-screen/.prettierrc +0 -11
- package/templates/ice-web-screen/.stylelintrc +0 -3
- package/templates/ice-web-screen/README.md.tpl +0 -34
- package/templates/ice-web-screen/package.json.tpl +0 -12
- package/templates/ice-web-screen/public/favicon.ico +0 -0
- package/templates/ice-web-screen/public/index.html +0 -15
- package/templates/ice-web-screen/src/app.tsx +0 -5
- package/templates/ice-web-screen/src/common/request.ts +0 -3
- package/templates/ice-web-screen/src/common/util.ts +0 -15
- package/templates/ice-web-screen/src/components/index.ts +0 -1
- package/templates/ice-web-screen/src/components/resize-container/index.tsx +0 -95
- package/templates/ice-web-screen/src/components/resize-container/style.module.less +0 -3
- package/templates/ice-web-screen/src/constants.ts +0 -7
- package/templates/ice-web-screen/src/global.less +0 -31
- package/templates/ice-web-screen/src/hooks/use-size.ts +0 -18
- package/templates/ice-web-screen/src/layouts/16_9/fixed.less +0 -18
- package/templates/ice-web-screen/src/layouts/16_9/index.tsx +0 -34
- package/templates/ice-web-screen/src/layouts/16_9/style.module.less +0 -19
- package/templates/ice-web-screen/src/layouts/components/index.ts +0 -0
- package/templates/ice-web-screen/src/layouts/controller/index.tsx +0 -79
- package/templates/ice-web-screen/src/layouts/index.tsx +0 -11
- package/templates/ice-web-screen/src/pages/404.tsx +0 -17
- package/templates/ice-web-screen/src/pages/index.tsx +0 -3
- package/templates/ice-web-screen/src/pages/template/16_9/index.tsx +0 -13
- package/templates/ice-web-screen/src/pages/template/16_9/style.module.less +0 -7
- package/templates/ice-web-screen/src/pages/template/components/charts/demo-line/index.tsx +0 -274
- package/templates/ice-web-screen/src/pages/template/components/charts/index.ts +0 -1
- package/templates/ice-web-screen/src/pages/template/components/index.ts +0 -1
- package/templates/ice-web-screen/src/pages/template/controller/index.tsx +0 -85
- package/templates/ice-web-screen/src/pages/template/index.tsx +0 -15
- package/templates/ice-web-screen/src/pages/template/style.module.less +0 -3
- package/templates/ice-web-screen/src/routes.ts +0 -29
- package/templates/ice-web-screen/src/styles/vars.less +0 -5
- package/templates/ice-web-screen/src/types/user.d.ts +0 -3
- package/templates/ice-web-screen/tsconfig.json +0 -3
- package/templates/ice-web-screen/typings.d.ts +0 -1
- package/templates/miniprogram/.editorconfig +0 -12
- package/templates/miniprogram/.prettierrc +0 -12
- package/templates/miniprogram/src/pages/demo/index.module.scss.d.ts +0 -5
- package/templates/miniprogram/src/pages/index/index.module.scss.d.ts +0 -5
- package/templates/umi-mobile/.prettierrc +0 -11
- package/templates/umi-mobile-h5+app/.prettierrc +0 -11
- package/templates/umi-mobile-native/.prettierrc +0 -11
- package/templates/umi-web/.prettierrc +0 -11
- package/templates/umi-web-screen/.prettierrc +0 -11
- /package/templates/miniprogram/src/pages/demo/{index.module.scss → style.scss} +0 -0
- /package/templates/miniprogram/src/pages/index/{index.module.scss → style.scss} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"name":"mustache","version":"4.2.0","author":"mustache.js Authors <http://github.com/janl/mustache.js>","license":"MIT","_lastModified":"2023-06-07T03:22:06.100Z"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const {
|
|
2
|
+
getYolkConfig,
|
|
3
|
+
getEsLintConfigPath,
|
|
4
|
+
getStyleLintConfigPath,
|
|
5
|
+
} = require('./_util');
|
|
6
|
+
|
|
7
|
+
const defaultIgnore = [
|
|
8
|
+
'**/node_modules/**',
|
|
9
|
+
'**/build/**',
|
|
10
|
+
'**/dist/**',
|
|
11
|
+
'**/lib/**',
|
|
12
|
+
'**/es/**',
|
|
13
|
+
'**/mock/**',
|
|
14
|
+
'**/test/**',
|
|
15
|
+
'**/public/**',
|
|
16
|
+
'**/assets/**',
|
|
17
|
+
'**/.umi/**',
|
|
18
|
+
'**/.umi-production/**',
|
|
19
|
+
'**/h5+app/**',
|
|
20
|
+
'**/android/**',
|
|
21
|
+
'**/ios/**',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const yolkConfig = getYolkConfig();
|
|
25
|
+
const isStrict = yolkConfig.strict !== false;
|
|
26
|
+
|
|
27
|
+
const prettierCLI = 'prettier --write';
|
|
28
|
+
const eslintCLI = `eslint --fix ${
|
|
29
|
+
isStrict ? '--no-inline-config' : ''
|
|
30
|
+
} --no-error-on-unmatched-pattern --config ${getEsLintConfigPath()} ${defaultIgnore
|
|
31
|
+
.map((i) => `--ignore-pattern ${i}`)
|
|
32
|
+
.join(' ')}`;
|
|
33
|
+
const stylelintCLI = `stylelint --fix ${
|
|
34
|
+
isStrict ? '--ignore-disables' : ''
|
|
35
|
+
} '--allow-empty-input' --config ${getStyleLintConfigPath()} ${defaultIgnore
|
|
36
|
+
.map((i) => `--ignore-pattern ${i}`)
|
|
37
|
+
.join(' ')}`;
|
|
38
|
+
|
|
39
|
+
const config = {
|
|
40
|
+
'*.{md,json}': [prettierCLI],
|
|
41
|
+
// '*.{png,jpeg,jpg,gif,svg}': ['imagemin-lint-staged'],
|
|
42
|
+
'*.css': [prettierCLI, `${stylelintCLI} --custom-syntax postcss`],
|
|
43
|
+
'*.less': [prettierCLI, `${stylelintCLI} --custom-syntax postcss-less`],
|
|
44
|
+
'*.{sass,scss}': [
|
|
45
|
+
prettierCLI,
|
|
46
|
+
`${stylelintCLI} --custom-syntax postcss-scss`,
|
|
47
|
+
],
|
|
48
|
+
'*.{js,jsx}': [prettierCLI, eslintCLI],
|
|
49
|
+
'*.{ts,tsx}': [`${prettierCLI} --parser=typescript`, eslintCLI],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = config;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
printWidth: 80,
|
|
3
|
+
singleQuote: true,
|
|
4
|
+
trailingComma: 'all',
|
|
5
|
+
proseWrap: 'never',
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: '.prettierrc',
|
|
9
|
+
options: {
|
|
10
|
+
parser: 'json',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
// "plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
|
|
15
|
+
};
|
package/es/_util.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
export type YolkConfig = {
|
|
3
|
+
strict?: boolean;
|
|
4
|
+
eslintIgnore?: string | string[] | RegExp | RegExp[];
|
|
5
|
+
stylelintIgnore?: string | string[] | RegExp | RegExp[];
|
|
6
|
+
};
|
|
7
|
+
export declare const ENCODING = "utf-8";
|
|
8
|
+
export declare const warn: (text?: string) => "" | ora.Ora | undefined;
|
|
9
|
+
export declare const fail: (text?: string) => "" | ora.Ora | undefined;
|
|
10
|
+
export declare const succeed: (text?: string) => "" | ora.Ora | undefined;
|
|
11
|
+
export declare const info: (text?: string) => "" | ora.Ora | undefined;
|
|
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[] | undefined;
|
|
17
|
+
complete?: (() => void) | undefined;
|
|
18
|
+
close?: (() => void) | undefined;
|
|
19
|
+
exit?: boolean | undefined;
|
|
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 r from"fs";import e from"path";import{spawn as t}from"child_process";import{globSync as o}from"glob";import n from"ora";import i from"../compiled/commander";var c=process.cwd();export var ENCODING="utf-8";var a=n();export var warn=function(r){return r&&a.warn(Buffer.from(r,ENCODING).toString())};export var fail=function(r){return r&&a.fail(Buffer.from(r,ENCODING).toString())};export var succeed=function(r){return r&&a.succeed(Buffer.from(r,ENCODING).toString())};export var info=function(r){return r&&a.info(Buffer.from(r,ENCODING).toString())};var s=function(r){return"win32"===process.platform?"".concat(r,".cmd"):r};export var completeExit=function(){succeed("yolk complete!"),process.exit(0)};export var breakExit=function(){warn("yolk break!"),process.exit(0)};export var execCommand=function(r){var e=r.command,o=r.args,n=r.complete,c=r.close,a=r.exit,f=void 0===a||a,u=t(s(e),o||[],{stdio:"inherit"}).on("close",(function(r){r?(c&&c(),fail("yolk close!"),process.exit(r)):(n&&n(),f&&completeExit())}));process.on("SIGINT",(function(){i.runningCommand&&i.runningCommand.kill("SIGKILL"),u.kill(),breakExit()}))};export var getYolkConfig=function(){var t=o("*.yolkrc*",{cwd:c,dot:!0});if(!t.length)return{};var n=e.join(c,t[0]);if(!r.existsSync(n))return{};try{return JSON.parse(r.readFileSync(n,ENCODING))||{}}catch(i){return fail(i.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}};export var getPrettierConfig=function(){var t=e.join(c,".prettierrc");if(r.existsSync(t))try{return JSON.parse(r.readFileSync(t,ENCODING))||{}}catch(o){return fail(o.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return require("./.prettierrc")};export var getProjectConfigJSON=function(){var t=e.join(c,"project.config.json");if(!r.existsSync(t))return{};try{return JSON.parse(r.readFileSync(t,ENCODING))||{}}catch(o){return fail(o.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}};export var getPackageJSON=function(){var t=e.join(c,"package.json");if(!r.existsSync(t))return{};try{return JSON.parse(r.readFileSync(t,ENCODING))||{}}catch(o){return fail(o.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}};export var getEsLintConfigPath=function(){var e=getYolkConfig(),t="";try{t=require.resolve("@baic/eslint-config-yolk")}catch(a){}var n=o("*.eslintrc*",{cwd:c,dot:!0}),i=n[0];return!1===e.strict&&i&&r.existsSync(i)?i:r.existsSync(t)?t:i};export var getStyleLintConfigPath=function(){var e=getYolkConfig(),t="";try{t=require.resolve("@baic/stylelint-config-yolk")}catch(a){}var n=o("*.stylelintrc*",{cwd:c,dot:!0}),i=n[0];return!1===e.strict&&i&&r.existsSync(i)?i:r.existsSync(t)?t:i};
|
package/es/index.d.ts
CHANGED
package/es/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
import"./yolk";
|
|
2
|
+
import"v8-compile-cache";import"./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 o from"lodash/isString";import s from"lodash/pick";import r from"lodash/floor";import i from"lodash/chunk";function n(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,s)}return o}function c(e){for(var o=1;o<arguments.length;o++){var s=null!=arguments[o]?arguments[o]:{};o%2?n(Object(s),!0).forEach((function(o){t(e,o,s[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(s)):n(Object(s)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(s,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:o,close:s,exit:r=!0})=>{const i=m(R(e),t||[],{stdio:"inherit"}).on("close",(e=>{e?(s&&s(),q("yolk close!"),process.exit(e)):(o&&o(),r&&T())}));process.on("SIGINT",(()=>{l.runningCommand&&l.runningCommand.kill("SIGKILL"),i.kill(),_()}))},A=(e,t,o)=>{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:!1,choices:[{name:"npm install",value:"npm"},{name:"yarn install",value:"yarn"},{name:"\u4e0d\u5b89\u88c5\u4f9d\u8d56",value:!1}]}]).then((s=>{const r={projectName:s.projectName,mobile:"umi-mobile"===s.type,dependenciesInstallType:s.dependenciesInstallType,yolkVersion:k.version};t||(t=S.join(__dirname,`../templates/${s.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((o=>{if(!t)return;const s=S.join(t,o);if(!p.statSync(s).isDirectory())if(o.endsWith(".tpl")){const t=p.readFileSync(s,F),i=S.join(e,o.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 ${o}`);const t=S.join(e,o);g.sync(S.dirname(t)),p.copyFileSync(s,t)}})),Q("\u590d\u5236\u6a21\u7248 success!"),o&&p.existsSync(t)&&x(t,(()=>{Q(`\u7f13\u5b58\u5220\u9664 success! ${S.basename(t||"")}`)})),s.dependenciesInstallType)switch(Q("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),s.dependenciesInstallType){case"npm":L({command:"npm",args:["install"]});break;case"yarn":L({command:"yarn",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(o){return q(o.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 o=S.join($,"node_modules","umi","package.json");if(p.existsSync(o))try{const t=JSON.parse(p.readFileSync(o,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 o=d.sync("*.eslintrc*",{cwd:$,dot:!0}),s=o[0];return!1===e.strict&&s&&p.existsSync(s)?s: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"),o=S.join(t,"pre-commit"),s=p.existsSync(e),r=p.existsSync(o),i=r&&p.readFileSync(o,"utf8").includes(P);if(s&&(!r||!i)){g.sync(t),p.writeFileSync(o,["#!/usr/bin/env bash","npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",P].join(j.EOL),"utf8");try{p.chmodSync(o,"777")}catch(n){q(`chmod ${o} failed: ${n.message}`)}Q("Create pre-commit hook")}},oe=()=>{const e=C(),t=!1!==e.strict,o=e.eslintIgnore,s=e.stylelintIgnore;w().then((e=>{const r=new Promise(((o,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 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))))).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,""),o=p.readFileSync(e,"utf8"),s=v(o,c({parser:O[t]},J()));p.writeFileSync(e,s,"utf8")}})),Q("style prettier success!"),a.length>=E){const e=[];i(a,20).forEach((o=>{e.push(new Promise(((e,s)=>{L({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",n,...o],complete:e,close:s,exit:!1})})))}));const s=process.getMaxListeners(),c=i(e,s?s/2:2);let m=0;const l=()=>{m<c.length?Promise.all(c[m]).then((()=>{m++,l()})).catch(r):o()};l()}else a.length&&L({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",n,...a],complete:o,close:r,exit:!1})}else o()})),n=()=>{const s=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(s.length){s.forEach((e=>{if(e&&p.existsSync(e)){const t=S.extname(e).replace(/^\./u,""),o=p.readFileSync(e,"utf8"),s=v(o,c({parser:O[t]},J()));p.writeFileSync(e,s,"utf8")}})),Q("script prettier success!");const e=Z();if(e){const r=s.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)))));if(t&&(I("git commit\u7981\u6b62eslint\u7684ignore\u65b9\u5f0f(eslint-disable\u3001.eslintrc*\u3001ignore\u7b49)\u3002"),o&&I(`\u901a\u8fc7yolkrc\u914d\u7f6eeslintIgnore\uff1a${o}\u3002`)),r.length>=E){const o=[];i(r,20).forEach((s=>{o.push(new Promise((o=>{L({command:"eslint",args:[t?"--no-inline-config --no-ignore":"","--no-error-on-unmatched-pattern","--config",e,...s],complete:o,exit:!1})})))}));const s=process.getMaxListeners(),n=i(o,s?s/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)}))},se=({mProject:e,mPrivateKeyPath:t,mVersion:o,mDesc:s,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=o||e.version||d.version||"1.0.0",a=s||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":oe();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=se(t),r=e.appid,i=e.options;N(`${r}\u4e0a\u4f20\u5f00\u59cb`),y.upload(c(c({},s(i,["project","version","desc","setting","robot"])),{},{onProgressUpdate:e=>{if(o(e))N(`task: ${e}`);else{const t=e.status,o=e.message;N(`task(${t}): ${o}`)}}})).then((()=>{Q(`${r}\u4e0a\u4f20\u5b8c\u6210`)}))}break;case"miniapp-preview":case"miniprogram-preview":if(U())if(Y());else if(z());else{const e=se(t),r=e.appid,i=e.options;N(`${r}\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb`),y.preview(c(c({},s(i,["project","version","desc","setting","robot","qrcodeFormat","qrcodeOutputDest","pagePath","searchQuery"])),{},{onProgressUpdate:e=>{if(o(e))N(`task: ${e}`);else{const t=e.status,o=e.message;N(`task(${t}): ${o}`)}}})).then((()=>{Q(`${r}\u4e0a\u4f20\u9884\u89c8\u5b8c\u6210`)}))}break;default:_()}})).parse(process.argv):_()};re();
|
|
2
|
+
import e from"@babel/runtime/helpers/esm/defineProperty";import t from"@babel/runtime/helpers/esm/toArray";import o from"@babel/runtime/helpers/esm/asyncToGenerator";import n from"lodash/pick";import r from"lodash/isString";import a from"lodash/floor";function i(e,t){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,n)}return o}function c(t){for(var o=1;o<arguments.length;o++){var n=null!=arguments[o]?arguments[o]:{};o%2?i(Object(n),!0).forEach((function(o){e(t,o,n[o])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):i(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}import s from"@babel/runtime/regenerator";import{execSync as m}from"child_process";import p from"fs";import l from"os";import d from"path";import{globSync as u}from"glob";import f from"inquirer";import*as y from"miniprogram-ci";import{mkdirpSync as g}from"mkdirp";import{rimrafSync as v}from"rimraf";import b from"../compiled/commander";import h from"../compiled/mustache";import j from"../package.json";import{ENCODING as O,fail as k,getPackageJSON as w,getProjectConfigJSON as S,getYolkConfig as P,info as x,succeed as D,warn as _,execCommand as I,breakExit as F}from"./_util";var K=process.cwd(),q="##### CREATED BY YOLK #####",E=function(e,t,o){f.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:d.basename(d.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((function(n){var r={projectName:n.projectName,dependenciesInstallType:n.dependenciesInstallType,yolkVersion:j.version},a=t||d.join(__dirname,"../templates/".concat(n.type));D("\u590d\u5236\u6a21\u7248 ".concat(d.basename(a)));var i=u("**/*",{cwd:a,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(i.forEach((function(t){if(a){var o=d.join(a,t);if(!p.statSync(o).isDirectory())if(t.endsWith(".tpl")){var n=p.readFileSync(o,O),i=d.join(e,t.replace(/\.tpl$/,"")),c=h.render(n,r);g(d.dirname(i)),D("\u521b\u5efa ".concat(d.relative(e,i))),p.writeFileSync(i,c,O)}else{D("\u521b\u5efa ".concat(t));var s=d.join(e,t);g(d.dirname(s)),p.copyFileSync(o,s)}}})),D("\u590d\u5236\u6a21\u7248 success!"),o&&p.existsSync(a)&&v(a)&&D("\u7f13\u5b58\u5220\u9664 success! ".concat(d.basename(a||""))),n.dependenciesInstallType)switch(D("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),n.dependenciesInstallType){case"default":case"pnpm":I({command:"pnpm",args:["install"]});break;case"yarn":I({command:"yarn",args:["install"]});break;case"npm":I({command:"npm",args:["install"]});break;default:}D("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},N=function(e,t){return E(e,t,!0)},U=function(){return p.existsSync(d.join(K,"project.config.json"))},Q=function(){var e=p.existsSync(d.join(K,"node_modules/.bin/max"));if(!e)try{e=p.existsSync(require.resolve("@umijs/max"))}catch(n){}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/.test(m("umi -v").toString())}catch(n){}if(!e){var t=d.join(K,"node_modules","umi","package.json");if(p.existsSync(t))try{var o=JSON.parse(p.readFileSync(t,O))||{};e=o.version&&+o.version.split(".")[0]>3}catch(n){}}return e},T=function(){var e=d.join(K,"project.config.json");if(p.existsSync(e)){var t=require(e);return t.appid}return""},Y=function(){return p.existsSync(d.join(K,"project.tt.json"))&&0===T().indexOf("tt")},W=function(){return 0===T().indexOf("20")},R=function(){var e=d.join(K,".git/"),t=d.join(K,".git/hooks"),o=d.join(t,"pre-commit"),n=p.existsSync(e),r=p.existsSync(o),a=r&&p.readFileSync(o,O).includes(q);if(n&&(!r||!a)){g(t),p.writeFileSync(o,["#!/usr/bin/env bash","npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",q].join(l.EOL),O);try{p.chmodSync(o,"777")}catch(i){k("chmod ".concat(o," failed: ").concat(i.message))}D("Create pre-commit hook")}},A=function(){var e=o(s.mark((function e(){var t,o,n,r;return s.wrap((function(e){while(1)switch(e.prev=e.next){case 0:t=P(),o=!1!==t.strict,n=t.eslintIgnore,r=t.stylelintIgnore,_("\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),o&&(_("git commit \u7981\u6b62 lint \u7684 ignore \u884c\u4e3a"),r&&_("\u901a\u8fc7 .yolkrc \u914d\u7f6e stylelintIgnore: ".concat(r,"\u3002")),n&&_("\u901a\u8fc7 .yolkrc \u914d\u7f6e eslintIgnore: ".concat(n,"\u3002"))),I({command:"lint-staged",args:["-c",require.resolve("./.lintstagedrc")]});case 7:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),B=function(e){var t=e.mAppid,o=e.mProject,n=e.mPrivateKeyPath,r=e.mVersion,a=e.mDesc,i=e.mRobot,c=e.mQrcodeFormat,s=e.mQrcodeOutputDest,l=e.mPagePath,u=e.mSearchQuery,f=p.existsSync(d.join(K,".git"))?m("git log -1 --pretty=format:%H").toString():"",g=S(),v=t||g.appid,b=o||d.join(K,"dist"),h=n||d.join(K,"private.".concat(v,".key"));if(p.existsSync(b)){if(p.existsSync(h)){var j=w(),O=r||j.version||g.version||"1.0.0",k=a||j.description||g.description,P="".concat(f?" commit: ".concat(f,";"):"").concat(k?" description: ".concat(k,";"):"");f&&x("commit: ".concat(f)),x("dist: ".concat(b)),x("key: ".concat(h)),x("appid: ".concat(v)),x("version: ".concat(O)),x("desc: ".concat(P));var D=new y.Project({appid:v,type:"miniProgram",projectPath:b,privateKeyPath:h,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:v,options:{project:D,version:O,desc:P,setting:g.setting,robot:i,qrcodeFormat:c,qrcodeOutputDest:s,pagePath:l,searchQuery:u}}}throw Error("\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(".concat(h,")"))}throw Error("\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(".concat(b,")"))},L=function(){R(),process.argv.length>2?b.version(j.version,"-v,--version","\u8f93\u51fa\u7248\u672c\u53f7").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("--mAppid <appid>","\u5c0f\u7a0b\u5e8fappid").option("--mProject <project>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u5de5\u7a0b\u76ee\u5f55").option("--mPrivateKeyPath <privateKeyPath>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20key\u6587\u4ef6").option("--mVersion <version>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u7248\u672c\u53f7").option("--mDesc <desc>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20\u63cf\u8ff0").option("--mRobot <robot>","\u5c0f\u7a0b\u5e8f\u4e0a\u4f20ci\u673a\u5668\u4eba1~30").option("--mQrcodeFormat <qrcodeFormat>",'\u5c0f\u7a0b\u5e8f\u9884\u89c8\u8fd4\u56de\u4e8c\u7ef4\u7801\u6587\u4ef6\u7684\u683c\u5f0f "image" \u6216 "base64"\uff0c \u9ed8\u8ba4\u503c "terminal" \u4f9b\u8c03\u8bd5\u7528').option("--mQrcodeOutputDest <qrcodeOutputDest>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u4e8c\u7ef4\u7801\u6587\u4ef6\u4fdd\u5b58\u8def\u5f84").option("--mPagePath <pagePath>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84").option("--mSearchQuery <searchQuery>","\u5c0f\u7a0b\u5e8f\u9884\u89c8\u9884\u89c8\u9875\u9762\u8def\u5f84\u542f\u52a8\u53c2\u6570").action((function(e,o){var i=t(o),s=i[0],m=i.slice(1),u=e.clone,f=e.template,g=e.docs;if(s)switch(x("yolk version: ".concat(j.version)),x("node version: ".concat(process.version)),x("platform: ".concat(l.platform())),x("memory: ".concat(a(l.freemem()/1024/1024)," MB(").concat(a(l.totalmem()/1024/1024)," MB)")),s){case"init":if(D("yolk ".concat(s," \u5f00\u59cb")),u)if(f){var b=".yolk",h=d.join(K,b);p.existsSync(h)&&v(h)&&D("\u7f13\u5b58\u5220\u9664 success! ".concat(h)),I({command:"git",args:["clone","-b","master","--depth","1",f,b].concat(m)}),N(K,h)}else k("--clone \u6a21\u5f0f\u5fc5\u987b\u6709--template");else E(K);break;case"start":U()?Y()?I({command:"taro",args:["build","--type","tt","--watch"].concat(m)}):W()?I({command:"taro",args:["build","--type","alipay","--watch"].concat(m)}):I({command:"taro",args:["build","--type","weapp","--watch"].concat(m)}):g?(process.env.DID_YOU_KNOW="none",I({command:"dumi",args:["dev"].concat(m)})):Q()?(process.env.DID_YOU_KNOW="none",I({command:"max",args:["dev"].concat(m)})):(process.env.DID_YOU_KNOW="none",I({command:"umi",args:["dev"].concat(m)}));break;case"build":U()?Y()?I({command:"taro",args:["build","--type","tt"].concat(m)}):W()?I({command:"taro",args:["build","--type","alipay"].concat(m)}):I({command:"taro",args:["build","--type","weapp"].concat(m)}):g?(process.env.DID_YOU_KNOW="none",I({command:"dumi",args:["build"].concat(m)})):Q()?(process.env.DID_YOU_KNOW="none",I({command:"max",args:["setup"].concat(m),complete:function(){return I({command:"max",args:["build"].concat(m)})},exit:!1})):(process.env.DID_YOU_KNOW="none",I({command:"umi",args:["build"].concat(m)}));break;case"pre-commit":A();break;case"miniprogram-upload":if(U())if(Y());else if(W());else{var O=B(e),w=O.appid,S=O.options;x("".concat(w,"\u4e0a\u4f20\u5f00\u59cb")),y.upload(c(c({},n(S,["project","version","desc","setting","robot"])),{},{onProgressUpdate:function(e){if(r(e))x("task: ".concat(e));else{var t=e.status,o=e.message;x("task(".concat(t,"): ").concat(o))}}})).then((function(){D("".concat(w,"\u4e0a\u4f20\u5b8c\u6210"))}))}break;case"miniprogram-preview":if(U())if(Y());else if(W());else{var P=B(e),_=P.appid,q=P.options;x("".concat(_,"\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb")),y.preview(c(c({},n(q,["project","version","desc","setting","robot","qrcodeFormat","qrcodeOutputDest","pagePath","searchQuery"])),{},{onProgressUpdate:function(e){if(r(e))x("task: ".concat(e));else{var t=e.status,o=e.message;x("task(".concat(t,"): ").concat(o))}}})).then((function(){D("".concat(_,"\u4e0a\u4f20\u9884\u89c8\u5b8c\u6210"))}))}break;default:F()}})).parse(process.argv):F()};L();
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
const {
|
|
2
|
+
getYolkConfig,
|
|
3
|
+
getEsLintConfigPath,
|
|
4
|
+
getStyleLintConfigPath,
|
|
5
|
+
} = require('./_util');
|
|
6
|
+
|
|
7
|
+
const defaultIgnore = [
|
|
8
|
+
'**/node_modules/**',
|
|
9
|
+
'**/build/**',
|
|
10
|
+
'**/dist/**',
|
|
11
|
+
'**/lib/**',
|
|
12
|
+
'**/es/**',
|
|
13
|
+
'**/mock/**',
|
|
14
|
+
'**/test/**',
|
|
15
|
+
'**/public/**',
|
|
16
|
+
'**/assets/**',
|
|
17
|
+
'**/.umi/**',
|
|
18
|
+
'**/.umi-production/**',
|
|
19
|
+
'**/h5+app/**',
|
|
20
|
+
'**/android/**',
|
|
21
|
+
'**/ios/**',
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
const yolkConfig = getYolkConfig();
|
|
25
|
+
const isStrict = yolkConfig.strict !== false;
|
|
26
|
+
|
|
27
|
+
const prettierCLI = 'prettier --write';
|
|
28
|
+
const eslintCLI = `eslint --fix ${
|
|
29
|
+
isStrict ? '--no-inline-config' : ''
|
|
30
|
+
} --no-error-on-unmatched-pattern --config ${getEsLintConfigPath()} ${defaultIgnore
|
|
31
|
+
.map((i) => `--ignore-pattern ${i}`)
|
|
32
|
+
.join(' ')}`;
|
|
33
|
+
const stylelintCLI = `stylelint --fix ${
|
|
34
|
+
isStrict ? '--ignore-disables' : ''
|
|
35
|
+
} '--allow-empty-input' --config ${getStyleLintConfigPath()} ${defaultIgnore
|
|
36
|
+
.map((i) => `--ignore-pattern ${i}`)
|
|
37
|
+
.join(' ')}`;
|
|
38
|
+
|
|
39
|
+
const config = {
|
|
40
|
+
'*.{md,json}': [prettierCLI],
|
|
41
|
+
// '*.{png,jpeg,jpg,gif,svg}': ['imagemin-lint-staged'],
|
|
42
|
+
'*.css': [prettierCLI, `${stylelintCLI} --custom-syntax postcss`],
|
|
43
|
+
'*.less': [prettierCLI, `${stylelintCLI} --custom-syntax postcss-less`],
|
|
44
|
+
'*.{sass,scss}': [
|
|
45
|
+
prettierCLI,
|
|
46
|
+
`${stylelintCLI} --custom-syntax postcss-scss`,
|
|
47
|
+
],
|
|
48
|
+
'*.{js,jsx}': [prettierCLI, eslintCLI],
|
|
49
|
+
'*.{ts,tsx}': [`${prettierCLI} --parser=typescript`, eslintCLI],
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
module.exports = config;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
printWidth: 80,
|
|
3
|
+
singleQuote: true,
|
|
4
|
+
trailingComma: 'all',
|
|
5
|
+
proseWrap: 'never',
|
|
6
|
+
overrides: [
|
|
7
|
+
{
|
|
8
|
+
files: '.prettierrc',
|
|
9
|
+
options: {
|
|
10
|
+
parser: 'json',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
// "plugins": ["prettier-plugin-organize-imports", "prettier-plugin-packagejson"]
|
|
15
|
+
};
|
package/lib/_util.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import ora from 'ora';
|
|
2
|
+
export type YolkConfig = {
|
|
3
|
+
strict?: boolean;
|
|
4
|
+
eslintIgnore?: string | string[] | RegExp | RegExp[];
|
|
5
|
+
stylelintIgnore?: string | string[] | RegExp | RegExp[];
|
|
6
|
+
};
|
|
7
|
+
export declare const ENCODING = "utf-8";
|
|
8
|
+
export declare const warn: (text?: string) => "" | ora.Ora | undefined;
|
|
9
|
+
export declare const fail: (text?: string) => "" | ora.Ora | undefined;
|
|
10
|
+
export declare const succeed: (text?: string) => "" | ora.Ora | undefined;
|
|
11
|
+
export declare const info: (text?: string) => "" | ora.Ora | undefined;
|
|
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[] | undefined;
|
|
17
|
+
complete?: (() => void) | undefined;
|
|
18
|
+
close?: (() => void) | undefined;
|
|
19
|
+
exit?: boolean | undefined;
|
|
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,t=Object.defineProperty,r=Object.getOwnPropertyDescriptor,n=Object.getOwnPropertyNames,o=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,i=(e,r)=>{for(var n in r)t(e,n,{get:r[n],enumerable:!0})},s=(e,o,i,s)=>{if(o&&"object"===typeof o||"function"===typeof o)for(let a of n(o))c.call(e,a)||a===i||t(e,a,{get:()=>o[a],enumerable:!(s=r(o,a))||s.enumerable});return e},a=(r,n,c)=>(c=null!=r?e(o(r)):{},s(!n&&r&&r.__esModule?c:t(c,"default",{value:r,enumerable:!0}),r)),l=e=>s(t({},"__esModule",{value:!0}),e),u={};i(u,{ENCODING:()=>b,breakExit:()=>P,completeExit:()=>N,execCommand:()=>q,fail:()=>x,getEsLintConfigPath:()=>_,getPackageJSON:()=>I,getPrettierConfig:()=>v,getProjectConfigJSON:()=>J,getStyleLintConfigPath:()=>B,getYolkConfig:()=>C,info:()=>h,succeed:()=>k,warn:()=>O}),module.exports=l(u);var f=a(require("fs")),d=a(require("path")),g=require("child_process"),y=require("glob"),p=a(require("ora")),m=a(require("../compiled/commander")),S=process.cwd(),b="utf-8",j=(0,p.default)(),O=e=>e&&j.warn(Buffer.from(e,b).toString()),x=e=>e&&j.fail(Buffer.from(e,b).toString()),k=e=>e&&j.succeed(Buffer.from(e,b).toString()),h=e=>e&&j.info(Buffer.from(e,b).toString()),w=e=>"win32"===process.platform?`${e}.cmd`:e,N=()=>{k("yolk complete!"),process.exit(0)},P=()=>{O("yolk break!"),process.exit(0)},q=({command:e,args:t,complete:r,close:n,exit:o=!0})=>{const c=(0,g.spawn)(w(e),t||[],{stdio:"inherit"}).on("close",(e=>{e?(n&&n(),x("yolk close!"),process.exit(e)):(r&&r(),o&&N())}));process.on("SIGINT",(()=>{m.default.runningCommand&&m.default.runningCommand.kill("SIGKILL"),c.kill(),P()}))},C=()=>{const e=(0,y.globSync)("*.yolkrc*",{cwd:S,dot:!0});if(!e.length)return{};const t=d.default.join(S,e[0]);if(!f.default.existsSync(t))return{};try{return JSON.parse(f.default.readFileSync(t,b))||{}}catch(r){return x(r.message||".yolkrc\u8f6c\u6362\u9519\u8bef"),{}}},v=()=>{const e=d.default.join(S,".prettierrc");if(f.default.existsSync(e))try{return JSON.parse(f.default.readFileSync(e,b))||{}}catch(t){return x(t.message||".prettierrc\u8f6c\u6362\u9519\u8bef"),{}}return require("./.prettierrc")},J=()=>{const e=d.default.join(S,"project.config.json");if(!f.default.existsSync(e))return{};try{return JSON.parse(f.default.readFileSync(e,b))||{}}catch(t){return x(t.message||"project.config.json\u8f6c\u6362\u9519\u8bef"),{}}},I=()=>{const e=d.default.join(S,"package.json");if(!f.default.existsSync(e))return{};try{return JSON.parse(f.default.readFileSync(e,b))||{}}catch(t){return x(t.message||"package.json\u8f6c\u6362\u9519\u8bef"),{}}},_=()=>{const e=C();let t="";try{t=require.resolve("@baic/eslint-config-yolk")}catch(o){}const r=(0,y.globSync)("*.eslintrc*",{cwd:S,dot:!0}),n=r[0];return!1===e.strict&&n&&f.default.existsSync(n)?n:f.default.existsSync(t)?t:n},B=()=>{const e=C();let t="";try{t=require.resolve("@baic/stylelint-config-yolk")}catch(o){}const r=(0,y.globSync)("*.stylelintrc*",{cwd:S,dot:!0}),n=r[0];return!1===e.strict&&n&&f.default.existsSync(n)?n:f.default.existsSync(t)?t:n};
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
#! /usr/bin/env node
|
|
2
|
-
|
|
2
|
+
var e=require("v8-compile-cache"),r=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 o(){const t=e(require("lodash/floor"));return o=function(){return t},t}function a(){const t=e(require("lodash/chunk"));return a=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=x(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 x(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 o in e)if("default"!==o&&Object.prototype.hasOwnProperty.call(e,o)){var a=i?Object.getOwnPropertyDescriptor(e,o):null;a&&(a.get||a.set)?Object.defineProperty(r,o,a):r[o]=e[o]}return r.default=e,n&&n.set(e,r),r}function k(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?k(Object(r),!0).forEach((function(t){(0,n().default)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(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 o=(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"),o.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:!1,choices:[{name:"npm install",value:"npm"},{name:"yarn install",value:"yarn"},{name:"\u4e0d\u5b89\u88c5\u4f9d\u8d56",value:!1}]}]).then((r=>{const i={projectName:r.projectName,mobile:"umi-mobile"===r.type,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 o=l().default.sync("**/*",{cwd:t,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(o.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),o=b().default.join(e,n.replace(/\.tpl$/u,"")),a=y().default.render(t,i);p().default.sync(b().default.dirname(o)),R(`\u521b\u5efa ${b().default.relative(e,o)}`),u().default.writeFileSync(o,a,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"npm":A({command:"npm",args:["install"]});break;case"yarn":A({command:"yarn",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),o=i&&u().default.readFileSync(n,"utf8").includes(q);if(r&&(!i||!o)){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(a){Q(`chmod ${n} failed: ${a.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 o=ne();if(o){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,a().default)(s,20).forEach((n=>{e.push(new Promise(((e,r)=>{A({command:"stylelint",args:[t?"--ignore-disables":"","--allow-empty-input","--config",o,...n],complete:e,close:r,exit:!1})})))}));const r=process.getMaxListeners(),c=(0,a().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",o,...s],complete:n,close:i,exit:!1})}else n()})),o=()=>{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,a().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(),o=(0,a().default)(n,r?r/2:2);let s=0;const c=()=>{s<o.length?Promise.all(o[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(o)}))},oe=({mProject:e,mPrivateKeyPath:t,mVersion:n,mDesc:r,mRobot:i,mQrcodeFormat:o,mQrcodeOutputDest:a,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:o,qrcodeOutputDest:a,pagePath:c,searchQuery:l}}}throw Error(`\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(${g})`)}throw Error(`\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(${y})`)},ae=()=>{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 a=(0,t().default)(n),s=a[0],c=a.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,o().default)(h().default.freemem()/1024/1024)} MB(${(0,o().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=oe(e),n=t.appid,o=t.options;N(`${n}\u4e0a\u4f20\u5f00\u59cb`),m().upload($($({},(0,i().default)(o,["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=oe(e),n=t.appid,o=t.options;N(`${n}\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb`),m().preview($($({},(0,i().default)(o,["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()};ae();
|
|
2
|
+
var e=Object.create,t=Object.defineProperty,a=Object.getOwnPropertyDescriptor,o=Object.getOwnPropertyNames,n=Object.getPrototypeOf,i=Object.prototype.hasOwnProperty,r=(e,n,r,s)=>{if(n&&"object"===typeof n||"function"===typeof n)for(let c of o(n))i.call(e,c)||c===r||t(e,c,{get:()=>n[c],enumerable:!(s=a(n,c))||s.enumerable});return e},s=(a,o,i)=>(i=null!=a?e(n(a)):{},r(!o&&a&&a.__esModule?i:t(i,"default",{value:a,enumerable:!0}),a)),c=require("child_process"),m=s(require("fs")),d=s(require("os")),l=s(require("path")),p=require("lodash"),u=require("glob"),f=s(require("inquirer")),y=s(require("miniprogram-ci")),g=require("mkdirp"),b=require("rimraf"),v=s(require("../compiled/commander")),h=s(require("../compiled/mustache")),x=s(require("../package.json")),j=require("./_util"),k=process.cwd(),S="##### CREATED BY YOLK #####",$=(e,t,a)=>{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:"miniprogram template",value:"miniprogram"}]},{type:"input",name:"projectName",message:"\u9879\u76ee\u540d\u79f0",default:l.default.basename(l.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((o=>{const n={projectName:o.projectName,dependenciesInstallType:o.dependenciesInstallType,yolkVersion:x.default.version},i=t||l.default.join(__dirname,`../templates/${o.type}`);(0,j.succeed)(`\u590d\u5236\u6a21\u7248 ${l.default.basename(i)}`);const r=(0,u.globSync)("**/*",{cwd:i,dot:!0,ignore:["**/node_modules/**","**/.git/**","**/.DS_Store","**/.idea/**"]});if(r.forEach((t=>{if(!i)return;const a=l.default.join(i,t);if(!m.default.statSync(a).isDirectory())if(t.endsWith(".tpl")){const o=m.default.readFileSync(a,j.ENCODING),i=l.default.join(e,t.replace(/\.tpl$/,"")),r=h.default.render(o,n);(0,g.mkdirpSync)(l.default.dirname(i)),(0,j.succeed)(`\u521b\u5efa ${l.default.relative(e,i)}`),m.default.writeFileSync(i,r,j.ENCODING)}else{(0,j.succeed)(`\u521b\u5efa ${t}`);const o=l.default.join(e,t);(0,g.mkdirpSync)(l.default.dirname(o)),m.default.copyFileSync(a,o)}})),(0,j.succeed)("\u590d\u5236\u6a21\u7248 success!"),a&&m.default.existsSync(i)&&(0,b.rimrafSync)(i)&&(0,j.succeed)(`\u7f13\u5b58\u5220\u9664 success! ${l.default.basename(i||"")}`),o.dependenciesInstallType)switch((0,j.succeed)("\u521d\u59cb\u5316\u4f9d\u8d56\u5305"),o.dependenciesInstallType){case"default":case"pnpm":(0,j.execCommand)({command:"pnpm",args:["install"]});break;case"yarn":(0,j.execCommand)({command:"yarn",args:["install"]});break;case"npm":(0,j.execCommand)({command:"npm",args:["install"]});break;default:}(0,j.succeed)("\u53ef\u67e5\u9605<<https://303394539.github.io/yolk-docs/>>\u4e86\u89e3\u76f8\u5173\u6587\u6863")}))},O=(e,t)=>$(e,t,!0),w=()=>m.default.existsSync(l.default.join(k,"project.config.json")),D=()=>{let e=m.default.existsSync(l.default.join(k,"node_modules/.bin/max"));if(!e)try{e=m.default.existsSync(require.resolve("@umijs/max"))}catch(t){}if(!e)try{e=/umi@4\.(\d+)\.(\d+)/.test((0,c.execSync)("umi -v").toString())}catch(t){}if(!e){const a=l.default.join(k,"node_modules","umi","package.json");if(m.default.existsSync(a))try{const t=JSON.parse(m.default.readFileSync(a,j.ENCODING))||{};e=t.version&&+t.version.split(".")[0]>3}catch(t){}}return e},C=()=>{const e=l.default.join(k,"project.config.json");if(m.default.existsSync(e)){const t=require(e);return t.appid}return""},P=()=>m.default.existsSync(l.default.join(k,"project.tt.json"))&&0===C().indexOf("tt"),q=()=>0===C().indexOf("20"),N=()=>{const e=l.default.join(k,".git/"),t=l.default.join(k,".git/hooks"),a=l.default.join(t,"pre-commit"),o=m.default.existsSync(e),n=m.default.existsSync(a),i=n&&m.default.readFileSync(a,j.ENCODING).includes(S);if(o&&(!n||!i)){(0,g.mkdirpSync)(t),m.default.writeFileSync(a,["#!/usr/bin/env bash","npx yolk pre-commit","RESULT=$?","[ $RESULT -ne 0 ] && exit 1","exit 0",S].join(d.default.EOL),j.ENCODING);try{m.default.chmodSync(a,"777")}catch(r){(0,j.fail)(`chmod ${a} failed: ${r.message}`)}(0,j.succeed)("Create pre-commit hook")}},_=async()=>{const e=(0,j.getYolkConfig)(),t=!1!==e.strict,a=e.eslintIgnore,o=e.stylelintIgnore;(0,j.warn)("\u7edf\u4e00\u4ee3\u7801\u89c4\u8303\uff0c\u8fdb\u884c\u4e25\u683c\u7684\u8bed\u6cd5\u68c0\u67e5\u3002"),t&&((0,j.warn)("git commit \u7981\u6b62 lint \u7684 ignore \u884c\u4e3a"),o&&(0,j.warn)(`\u901a\u8fc7 .yolkrc \u914d\u7f6e stylelintIgnore: ${o}\u3002`),a&&(0,j.warn)(`\u901a\u8fc7 .yolkrc \u914d\u7f6e eslintIgnore: ${a}\u3002`)),(0,j.execCommand)({command:"lint-staged",args:["-c",require.resolve("./.lintstagedrc")]})},I=({mAppid:e,mProject:t,mPrivateKeyPath:a,mVersion:o,mDesc:n,mRobot:i,mQrcodeFormat:r,mQrcodeOutputDest:s,mPagePath:d,mSearchQuery:p})=>{const u=m.default.existsSync(l.default.join(k,".git"))?(0,c.execSync)("git log -1 --pretty=format:%H").toString():"",f=(0,j.getProjectConfigJSON)(),g=e||f.appid,b=t||l.default.join(k,"dist"),v=a||l.default.join(k,`private.${g}.key`);if(m.default.existsSync(b)){if(m.default.existsSync(v)){const e=(0,j.getPackageJSON)(),t=o||e.version||f.version||"1.0.0",a=n||e.description||f.description,c=`${u?` commit: ${u};`:""}${a?` description: ${a};`:""}`;u&&(0,j.info)(`commit: ${u}`),(0,j.info)(`dist: ${b}`),(0,j.info)(`key: ${v}`),(0,j.info)(`appid: ${g}`),(0,j.info)(`version: ${t}`),(0,j.info)(`desc: ${c}`);const m=new y.Project({appid:g,type:"miniProgram",projectPath:b,privateKeyPath:v,ignores:["node_modules/**/*","**/*.txt","**/*.key","**/*.less","**/*.sass","**/*.scss","**/*.css","**/*.jsx","**/*.ts","**/*.tsx","**/*.md"]});return{appid:g,options:{project:m,version:t,desc:c,setting:f.setting,robot:i,qrcodeFormat:r,qrcodeOutputDest:s,pagePath:d,searchQuery:p}}}throw Error(`\u6ca1\u6709\u627e\u5230\u4e0a\u4f20\u5bc6\u94a5(${v})`)}throw Error(`\u6ca1\u6709\u627e\u5230dist\u76ee\u5f55(${b})`)},E=()=>{N(),process.argv.length>2?v.default.version(x.default.version,"-v,--version","\u8f93\u51fa\u7248\u672c\u53f7").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("--mAppid <appid>","\u5c0f\u7a0b\u5e8fappid").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,t)=>{const[a,...o]=t,{clone:n,template:i,docs:r}=e;if(a)switch((0,j.info)(`yolk version: ${x.default.version}`),(0,j.info)(`node version: ${process.version}`),(0,j.info)(`platform: ${d.default.platform()}`),(0,j.info)(`memory: ${(0,p.floor)(d.default.freemem()/1024/1024)} MB(${(0,p.floor)(d.default.totalmem()/1024/1024)} MB)`),a){case"init":if((0,j.succeed)(`yolk ${a} \u5f00\u59cb`),n)if(i){const e=".yolk",t=l.default.join(k,e);m.default.existsSync(t)&&(0,b.rimrafSync)(t)&&(0,j.succeed)(`\u7f13\u5b58\u5220\u9664 success! ${t}`),(0,j.execCommand)({command:"git",args:["clone","-b","master","--depth","1",i,e].concat(o)}),O(k,t)}else(0,j.fail)("--clone \u6a21\u5f0f\u5fc5\u987b\u6709--template");else $(k);break;case"start":w()?P()?(0,j.execCommand)({command:"taro",args:["build","--type","tt","--watch"].concat(o)}):q()?(0,j.execCommand)({command:"taro",args:["build","--type","alipay","--watch"].concat(o)}):(0,j.execCommand)({command:"taro",args:["build","--type","weapp","--watch"].concat(o)}):r?(process.env.DID_YOU_KNOW="none",(0,j.execCommand)({command:"dumi",args:["dev"].concat(o)})):D()?(process.env.DID_YOU_KNOW="none",(0,j.execCommand)({command:"max",args:["dev"].concat(o)})):(process.env.DID_YOU_KNOW="none",(0,j.execCommand)({command:"umi",args:["dev"].concat(o)}));break;case"build":w()?P()?(0,j.execCommand)({command:"taro",args:["build","--type","tt"].concat(o)}):q()?(0,j.execCommand)({command:"taro",args:["build","--type","alipay"].concat(o)}):(0,j.execCommand)({command:"taro",args:["build","--type","weapp"].concat(o)}):r?(process.env.DID_YOU_KNOW="none",(0,j.execCommand)({command:"dumi",args:["build"].concat(o)})):D()?(process.env.DID_YOU_KNOW="none",(0,j.execCommand)({command:"max",args:["setup"].concat(o),complete:()=>(0,j.execCommand)({command:"max",args:["build"].concat(o)}),exit:!1})):(process.env.DID_YOU_KNOW="none",(0,j.execCommand)({command:"umi",args:["build"].concat(o)}));break;case"pre-commit":_();break;case"miniprogram-upload":if(w())if(P());else if(q());else{const{appid:t,options:a}=I(e);(0,j.info)(`${t}\u4e0a\u4f20\u5f00\u59cb`),y.upload({...(0,p.pick)(a,["project","version","desc","setting","robot"]),onProgressUpdate:e=>{if((0,p.isString)(e))(0,j.info)(`task: ${e}`);else{const{status:t,message:a}=e;(0,j.info)(`task(${t}): ${a}`)}}}).then((()=>{(0,j.succeed)(`${t}\u4e0a\u4f20\u5b8c\u6210`)}))}break;case"miniprogram-preview":if(w())if(P());else if(q());else{const{appid:t,options:a}=I(e);(0,j.info)(`${t}\u4e0a\u4f20\u9884\u89c8\u5f00\u59cb`),y.preview({...(0,p.pick)(a,["project","version","desc","setting","robot","qrcodeFormat","qrcodeOutputDest","pagePath","searchQuery"]),onProgressUpdate:e=>{if((0,p.isString)(e))(0,j.info)(`task: ${e}`);else{const{status:t,message:a}=e;(0,j.info)(`task(${t}): ${a}`)}}}).then((()=>{(0,j.succeed)(`${t}\u4e0a\u4f20\u9884\u89c8\u5b8c\u6210`)}))}break;default:(0,j.breakExit)()}})).parse(process.argv):(0,j.breakExit)()};E();
|
package/package.json
CHANGED
|
@@ -1,44 +1,55 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@baic/yolk-cli",
|
|
3
|
-
"version": "2.1.0-alpha.
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
"yolk": "lib/index.js"
|
|
3
|
+
"version": "2.1.0-alpha.141",
|
|
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
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
22
|
+
"scripts": {
|
|
23
|
+
"build": "father build",
|
|
24
|
+
"ncu": "ncu",
|
|
25
|
+
"prebundle": "father prebundle"
|
|
20
26
|
},
|
|
21
27
|
"dependencies": {
|
|
22
|
-
"@
|
|
23
|
-
"@
|
|
28
|
+
"@babel/runtime": "~7.x",
|
|
29
|
+
"@democrance/imagemin-lint-staged": "~2.3.x",
|
|
30
|
+
"@types/inquirer": "~8.x",
|
|
31
|
+
"@types/lint-staged": "~13.2.x",
|
|
24
32
|
"@types/lodash": "~4.x",
|
|
25
|
-
"
|
|
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",
|
|
33
|
+
"glob": "~10.x",
|
|
31
34
|
"inquirer": "~8.x",
|
|
35
|
+
"lint-staged": "~13.2.x",
|
|
32
36
|
"lodash": "~4.x",
|
|
33
|
-
"miniprogram-ci": "~1.
|
|
34
|
-
"mkdirp": "~
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"miniprogram-ci": "~1.9.x",
|
|
38
|
+
"mkdirp": "~3.0.x",
|
|
39
|
+
"ora": "5.4.1",
|
|
40
|
+
"postcss": "~8.x",
|
|
41
|
+
"postcss-less": "~6.x",
|
|
42
|
+
"postcss-scss": "~4.x",
|
|
43
|
+
"rimraf": "~5.0.x",
|
|
44
|
+
"v8-compile-cache": "~2.3.x"
|
|
45
|
+
},
|
|
46
|
+
"devDependencies": {
|
|
47
|
+
"@types/mustache": "~4.2.x",
|
|
48
|
+
"commander": "~6.x",
|
|
49
|
+
"mustache": "~4.2.x"
|
|
39
50
|
},
|
|
40
51
|
"publishConfig": {
|
|
41
52
|
"access": "public"
|
|
42
53
|
},
|
|
43
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "b8a34e28b452f4730aba6325439dfaca6387df47"
|
|
44
55
|
}
|
|
@@ -2,15 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
# dependencies
|
|
4
4
|
/node_modules
|
|
5
|
-
/.pnp
|
|
6
|
-
.pnp.js
|
|
7
|
-
.prettierrc.js
|
|
8
5
|
npm-debug.log*
|
|
9
6
|
npm-error.log*
|
|
10
|
-
|
|
11
|
-
|
|
7
|
+
package-lock.json
|
|
8
|
+
yarn.lock
|
|
12
9
|
yarn-debug.log*
|
|
13
10
|
yarn-error.log*
|
|
11
|
+
pnpm-lock.yaml
|
|
14
12
|
|
|
15
13
|
# testing
|
|
16
14
|
/coverage
|
|
@@ -27,6 +25,7 @@ dist/
|
|
|
27
25
|
.env.production.local
|
|
28
26
|
|
|
29
27
|
# temp
|
|
28
|
+
.swc/
|
|
30
29
|
.temp/
|
|
31
30
|
.rn_temp/
|
|
32
31
|
deploy_versions/
|
|
@@ -36,4 +35,7 @@ deploy_versions/
|
|
|
36
35
|
.eslintcache
|
|
37
36
|
.stylelintcache
|
|
38
37
|
.vscode
|
|
39
|
-
project.private.config.json
|
|
38
|
+
project.private.config.json
|
|
39
|
+
|
|
40
|
+
# ide
|
|
41
|
+
.vscode
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
module.exports = require('@baic/yolk-cli/lib/.prettierrc');
|
|
@@ -1,33 +1 @@
|
|
|
1
|
-
|
|
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":
|
|
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.
|
|
52
|
+
"libVersion": "2.32.0",
|
|
51
53
|
"condition": {},
|
|
52
54
|
"srcMiniprogramRoot": "dist/",
|
|
53
55
|
"packOptions": {
|