terminal.php 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | BuildAdmin-WEB 终端配置
  4. // | 命令中可以使用 %s %f 等占位符,系统将从 request()->param('extend', '') 取值,以 ~~ 分割后使用 sprintf 函数替换
  5. // +----------------------------------------------------------------------
  6. return [
  7. // npm包管理器
  8. 'npm_package_manager' => 'pnpm',
  9. // 允许执行的命令
  10. 'commands' => [
  11. // 数据库迁移命令
  12. 'migrate' => [
  13. 'run' => [
  14. 'cwd' => '',
  15. 'command' => 'php think migrate:run',
  16. 'notes' => 'Start the database migration'
  17. ],
  18. 'rollback' => 'php think migrate:rollback',
  19. 'breakpoint' => 'php think migrate:breakpoint',
  20. ],
  21. // 安装包管理器的命令
  22. 'install' => [
  23. 'cnpm' => 'npm install cnpm -g --registry=https://registry.npmmirror.com',
  24. 'yarn' => 'npm install -g yarn',
  25. 'pnpm' => 'npm install -g pnpm',
  26. 'ni' => 'npm install -g @antfu/ni',
  27. ],
  28. // 查看版本的命令
  29. 'version' => [
  30. 'npm' => 'npm -v',
  31. 'cnpm' => 'cnpm -v',
  32. 'yarn' => 'yarn -v',
  33. 'pnpm' => 'pnpm -v',
  34. 'node' => 'node -v',
  35. ],
  36. // 测试命令
  37. 'test' => [
  38. 'npm' => [
  39. 'cwd' => 'public/npm-install-test',
  40. 'command' => 'npm install',
  41. ],
  42. 'cnpm' => [
  43. 'cwd' => 'public/npm-install-test',
  44. 'command' => 'cnpm install',
  45. ],
  46. 'yarn' => [
  47. 'cwd' => 'public/npm-install-test',
  48. 'command' => 'yarn install',
  49. ],
  50. 'pnpm' => [
  51. 'cwd' => 'public/npm-install-test',
  52. 'command' => 'pnpm install',
  53. ],
  54. 'ni' => [
  55. 'cwd' => 'public/npm-install-test',
  56. 'command' => 'ni install',
  57. ],
  58. ],
  59. // 安装 WEB 依赖包
  60. 'web-install' => [
  61. 'npm' => [
  62. 'cwd' => 'web',
  63. 'command' => 'npm install',
  64. ],
  65. 'cnpm' => [
  66. 'cwd' => 'web',
  67. 'command' => 'cnpm install',
  68. ],
  69. 'yarn' => [
  70. 'cwd' => 'web',
  71. 'command' => 'yarn install',
  72. ],
  73. 'pnpm' => [
  74. 'cwd' => 'web',
  75. 'command' => 'pnpm install',
  76. ],
  77. 'ni' => [
  78. 'cwd' => 'web',
  79. 'command' => 'ni install',
  80. ],
  81. ],
  82. // 安装 Web-Nuxt 依赖包
  83. 'nuxt-install' => [
  84. 'npm' => [
  85. 'cwd' => 'web-nuxt',
  86. 'command' => 'npm install',
  87. ],
  88. 'cnpm' => [
  89. 'cwd' => 'web-nuxt',
  90. 'command' => 'cnpm install',
  91. ],
  92. 'yarn' => [
  93. 'cwd' => 'web-nuxt',
  94. 'command' => 'yarn install',
  95. ],
  96. 'pnpm' => [
  97. 'cwd' => 'web-nuxt',
  98. 'command' => 'pnpm install',
  99. ],
  100. 'ni' => [
  101. 'cwd' => 'web-nuxt',
  102. 'command' => 'ni install',
  103. ],
  104. ],
  105. // 构建 WEB 端
  106. 'web-build' => [
  107. 'npm' => [
  108. 'cwd' => 'web',
  109. 'command' => 'npm run build',
  110. 'notes' => 'Start executing the build command of the web project',
  111. ],
  112. 'cnpm' => [
  113. 'cwd' => 'web',
  114. 'command' => 'cnpm run build',
  115. 'notes' => 'Start executing the build command of the web project',
  116. ],
  117. 'yarn' => [
  118. 'cwd' => 'web',
  119. 'command' => 'yarn run build',
  120. 'notes' => 'Start executing the build command of the web project',
  121. ],
  122. 'pnpm' => [
  123. 'cwd' => 'web',
  124. 'command' => 'pnpm run build',
  125. 'notes' => 'Start executing the build command of the web project',
  126. ],
  127. 'ni' => [
  128. 'cwd' => 'web',
  129. 'command' => 'nr build',
  130. 'notes' => 'Start executing the build command of the web project',
  131. ],
  132. ],
  133. // 设置 NPM 源
  134. 'set-npm-registry' => [
  135. 'npm' => 'npm config set registry https://registry.npmjs.org/ && npm config get registry',
  136. 'taobao' => 'npm config set registry https://registry.npmmirror.com/ && npm config get registry',
  137. 'tencent' => 'npm config set registry https://mirrors.cloud.tencent.com/npm/ && npm config get registry'
  138. ],
  139. // 设置 composer 源
  140. 'set-composer-registry' => [
  141. 'composer' => 'composer config --unset repos.packagist',
  142. 'aliyun' => 'composer config -g repos.packagist composer https://mirrors.aliyun.com/composer/',
  143. 'tencent' => 'composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/',
  144. 'huawei' => 'composer config -g repos.packagist composer https://mirrors.huaweicloud.com/repository/php/',
  145. 'kkame' => 'composer config -g repos.packagist composer https://packagist.kr',
  146. ],
  147. 'npx' => [
  148. 'prettier' => [
  149. 'cwd' => 'web',
  150. 'command' => 'npx prettier --write %s',
  151. 'notes' => 'Start formatting the web project code',
  152. ],
  153. ],
  154. 'composer' => [
  155. 'update' => [
  156. 'cwd' => '',
  157. 'command' => 'composer update --no-interaction',
  158. 'notes' => 'Start installing the composer dependencies'
  159. ]
  160. ],
  161. 'ping' => [
  162. 'baidu' => 'ping baidu.com',
  163. 'localhost' => 'ping 127.0.0.1 -n 6',
  164. ]
  165. ],
  166. ];