terminal.php 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. return [
  3. // 允许执行的命令
  4. 'commands' => [
  5. // 查看版本的命令
  6. 'version' => [
  7. 'npm' => 'npm -v',
  8. 'yarn' => 'yarn -v',
  9. 'pnpm' => 'pnpm -v',
  10. 'node' => 'node -v',
  11. ],
  12. // 测试命令
  13. 'test' => [
  14. 'npm' => [
  15. 'cwd' => public_path() . DIRECTORY_SEPARATOR . 'npm-install-test',
  16. 'command' => 'npm install',
  17. ],
  18. 'yarn' => [
  19. 'cwd' => public_path() . DIRECTORY_SEPARATOR . 'npm-install-test',
  20. 'command' => 'yarn install',
  21. ],
  22. 'pnpm' => [
  23. 'cwd' => public_path() . DIRECTORY_SEPARATOR . 'npm-install-test',
  24. 'command' => 'pnpm install',
  25. ],
  26. ],
  27. // 安装 WEB 依赖包
  28. 'web-install' => [
  29. 'npm' => [
  30. 'cwd' => dirname(base_path()) . DIRECTORY_SEPARATOR . env('FRONTEND_DIR', 'saiadmin-artd'),
  31. 'command' => 'npm install',
  32. ],
  33. 'yarn' => [
  34. 'cwd' => dirname(base_path()) . DIRECTORY_SEPARATOR . env('FRONTEND_DIR', 'saiadmin-artd'),
  35. 'command' => 'yarn install',
  36. ],
  37. 'pnpm' => [
  38. 'cwd' => dirname(base_path()) . DIRECTORY_SEPARATOR . env('FRONTEND_DIR', 'saiadmin-artd'),
  39. 'command' => 'pnpm install',
  40. ],
  41. ],
  42. // 构建 WEB 端
  43. 'web-build' => [
  44. 'npm' => [
  45. 'cwd' => dirname(base_path()) . DIRECTORY_SEPARATOR . env('FRONTEND_DIR', 'saiadmin-artd'),
  46. 'command' => 'npm run build',
  47. ],
  48. 'yarn' => [
  49. 'cwd' => dirname(base_path()) . DIRECTORY_SEPARATOR . env('FRONTEND_DIR', 'saiadmin-artd'),
  50. 'command' => 'yarn run build',
  51. ],
  52. 'pnpm' => [
  53. 'cwd' => dirname(base_path()) . DIRECTORY_SEPARATOR . env('FRONTEND_DIR', 'saiadmin-artd'),
  54. 'command' => 'pnpm run build',
  55. ],
  56. ],
  57. // 设置 NPM 源
  58. 'set-npm-registry' => [
  59. 'npm' => 'npm config set registry https://registry.npmjs.org/ && npm config get registry',
  60. 'taobao' => 'npm config set registry https://registry.npmmirror.com/ && npm config get registry',
  61. 'tencent' => 'npm config set registry https://mirrors.cloud.tencent.com/npm/ && npm config get registry'
  62. ],
  63. // 设置 composer 源
  64. 'set-composer-registry' => [
  65. 'composer' => 'composer config --unset repos.packagist',
  66. 'tencent' => 'composer config -g repos.packagist composer https://mirrors.cloud.tencent.com/composer/',
  67. 'huawei' => 'composer config -g repos.packagist composer https://mirrors.huaweicloud.com/repository/php/',
  68. 'kkame' => 'composer config -g repos.packagist composer https://packagist.kr',
  69. ],
  70. // 安装 composer 包
  71. 'composer' => [
  72. 'update' => [
  73. 'cwd' => base_path(),
  74. 'command' => 'composer update --no-interaction',
  75. ],
  76. ]
  77. ],
  78. ];