command-line.json 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475
  1. /**
  2. * This configuration file defines custom commands for the "rush" command-line.
  3. * More documentation is available on the Rush website: https://rushjs.io
  4. */
  5. {
  6. "$schema": "https://developer.microsoft.com/json-schemas/rush/v5/command-line.schema.json",
  7. /**
  8. * Custom "commands" introduce new verbs for the command-line. To see the help for these
  9. * example commands, try "rush --help", "rush my-bulk-command --help", or
  10. * "rush my-global-command --help".
  11. */
  12. "commands": [
  13. // {
  14. // /**
  15. // * (Required) Determines the type of custom command.
  16. // * Rush's "bulk" commands are invoked separately for each project. By default, the command will run for
  17. // * every project in the repo, according to the dependency graph (similar to how "rush build" works).
  18. // * The set of projects can be restricted e.g. using the "--to" or "--from" parameters.
  19. // */
  20. // "commandKind": "bulk",
  21. //
  22. // /**
  23. // * (Required) The name that will be typed as part of the command line. This is also the name
  24. // * of the "scripts" hook in the project's package.json file (if "shellCommand" is not specified).
  25. // *
  26. // * The name should be comprised of lower case words separated by hyphens or colons. The name should include an
  27. // * English verb (e.g. "deploy"). Use a hyphen to separate words (e.g. "upload-docs"). A group of related commands
  28. // * can be prefixed with a colon (e.g. "docs:generate", "docs:deploy", "docs:serve", etc).
  29. // *
  30. // * Note that if the "rebuild" command is overridden here, it becomes separated from the "build" command
  31. // * and will call the "rebuild" script instead of the "build" script.
  32. // */
  33. // "name": "my-bulk-command",
  34. //
  35. // /**
  36. // * (Required) A short summary of the custom command to be shown when printing command line
  37. // * help, e.g. "rush --help".
  38. // */
  39. // "summary": "Example bulk custom command",
  40. //
  41. // /**
  42. // * A detailed description of the command to be shown when printing command line
  43. // * help (e.g. "rush --help my-command").
  44. // * If omitted, the "summary" text will be shown instead.
  45. // *
  46. // * Whenever you introduce commands/parameters, taking a little time to write meaningful
  47. // * documentation can make a big difference for the developer experience in your repo.
  48. // */
  49. // "description": "This is an example custom command that runs separately for each project",
  50. //
  51. // /**
  52. // * By default, Rush operations acquire a lock file which prevents multiple commands from executing simultaneously
  53. // * in the same repo folder. (For example, it would be a mistake to run "rush install" and "rush build" at the
  54. // * same time.) If your command makes sense to run concurrently with other operations,
  55. // * set "safeForSimultaneousRushProcesses" to true to disable this protection.
  56. // *
  57. // * In particular, this is needed for custom scripts that invoke other Rush commands.
  58. // */
  59. // "safeForSimultaneousRushProcesses": false,
  60. //
  61. // /**
  62. // * (Optional) If the `shellCommand` field is set for a bulk command, Rush will invoke it for each
  63. // * selected project; otherwise, Rush will invoke the package.json `"scripts"` entry matching Rush command name.
  64. // *
  65. // * The string is the path to a script that will be invoked using the OS shell. The working directory will be
  66. // * the folder that contains rush.json. If custom parameters are associated with this command, their
  67. // * values will be appended to the end of this string.
  68. // */
  69. // // "shellCommand": "node common/scripts/my-bulk-command.js",
  70. //
  71. // /**
  72. // * (Required) If true, then this command is safe to be run in parallel, i.e. executed
  73. // * simultaneously for multiple projects. Similar to "rush build", regardless of parallelism
  74. // * projects will not start processing until their dependencies have completed processing.
  75. // */
  76. // "enableParallelism": false,
  77. //
  78. // /**
  79. // * Normally projects will be processed according to their dependency order: a given project will not start
  80. // * processing the command until all of its dependencies have completed. This restriction doesn't apply for
  81. // * certain operations, for example a "clean" task that deletes output files. In this case
  82. // * you can set "ignoreDependencyOrder" to true to increase parallelism.
  83. // */
  84. // "ignoreDependencyOrder": false,
  85. //
  86. // /**
  87. // * Normally Rush requires that each project's package.json has a "scripts" entry matching
  88. // * the custom command name. To disable this check, set "ignoreMissingScript" to true;
  89. // * projects with a missing definition will be skipped.
  90. // */
  91. // "ignoreMissingScript": false,
  92. //
  93. // /**
  94. // * When invoking shell scripts, Rush uses a heuristic to distinguish errors from warnings:
  95. // * - If the shell script returns a nonzero process exit code, Rush interprets this as "one or more errors".
  96. // * Error output is displayed in red, and it prevents Rush from attempting to process any downstream projects.
  97. // * - If the shell script returns a zero process exit code but writes something to its stderr stream,
  98. // * Rush interprets this as "one or more warnings". Warning output is printed in yellow, but does NOT prevent
  99. // * Rush from processing downstream projects.
  100. // *
  101. // * Thus, warnings do not interfere with local development, but they will cause a CI job to fail, because
  102. // * the Rush process itself returns a nonzero exit code if there are any warnings or errors. This is by design.
  103. // * In an active monorepo, we've found that if you allow any warnings in your main branch, it inadvertently
  104. // * teaches developers to ignore warnings, which quickly leads to a situation where so many "expected" warnings
  105. // * have accumulated that warnings no longer serve any useful purpose.
  106. // *
  107. // * Sometimes a poorly behaved task will write output to stderr even though its operation was successful.
  108. // * In that case, it's strongly recommended to fix the task. However, as a workaround you can set
  109. // * allowWarningsInSuccessfulBuild=true, which causes Rush to return a nonzero exit code for errors only.
  110. // *
  111. // * Note: The default value is false. In Rush 5.7.x and earlier, the default value was true.
  112. // */
  113. // "allowWarningsInSuccessfulBuild": false,
  114. //
  115. // /**
  116. // * If true then this command will be incremental like the built-in "build" command
  117. // */
  118. // "incremental": false,
  119. //
  120. // /**
  121. // * (EXPERIMENTAL) Normally Rush terminates after the command finishes. If this option is set to "true" Rush
  122. // * will instead enter a loop where it watches the file system for changes to the selected projects. Whenever a
  123. // * change is detected, the command will be invoked again for the changed project and any selected projects that
  124. // * directly or indirectly depend on it.
  125. // *
  126. // * For details, refer to the website article "Using watch mode".
  127. // */
  128. // "watchForChanges": false,
  129. //
  130. // /**
  131. // * (EXPERIMENTAL) Disable cache for this action. This may be useful if this command affects state outside of
  132. // * projects' own folders.
  133. // */
  134. // "disableBuildCache": false
  135. // },
  136. //
  137. // {
  138. // /**
  139. // * (Required) Determines the type of custom command.
  140. // * Rush's "global" commands are invoked once for the entire repo.
  141. // */
  142. // "commandKind": "global",
  143. //
  144. // "name": "my-global-command",
  145. // "summary": "Example global custom command",
  146. // "description": "This is an example custom command that runs once for the entire repo",
  147. //
  148. // "safeForSimultaneousRushProcesses": false,
  149. //
  150. // /**
  151. // * (Required) A script that will be invoked using the OS shell. The working directory will be
  152. // * the folder that contains rush.json. If custom parameters are associated with this command, their
  153. // * values will be appended to the end of this string.
  154. // */
  155. // "shellCommand": "node common/scripts/my-global-command.js",
  156. //
  157. // /**
  158. // * If your "shellCommand" script depends on NPM packages, the recommended best practice is
  159. // * to make it into a regular Rush project that builds using your normal toolchain. In cases where
  160. // * the command needs to work without first having to run "rush build", the recommended practice
  161. // * is to publish the project to an NPM registry and use common/scripts/install-run.js to launch it.
  162. // *
  163. // * Autoinstallers offer another possibility: They are folders under "common/autoinstallers" with
  164. // * a package.json file and shrinkwrap file. Rush will automatically invoke the package manager to
  165. // * install these dependencies before an associated command is invoked. Autoinstallers have the
  166. // * advantage that they work even in a branch where "rush install" is broken, which makes them a
  167. // * good solution for Git hook scripts. But they have the disadvantages of not being buildable
  168. // * projects, and of increasing the overall installation footprint for your monorepo.
  169. // *
  170. // * The "autoinstallerName" setting must not contain a path and must be a valid NPM package name.
  171. // * For example, the name "my-task" would map to "common/autoinstallers/my-task/package.json", and
  172. // * the "common/autoinstallers/my-task/node_modules/.bin" folder would be added to the shell PATH when
  173. // * invoking the "shellCommand".
  174. // */
  175. // // "autoinstallerName": "my-task"
  176. // }
  177. // 提交前的 lint 检查
  178. {
  179. "name": "lint-staged",
  180. "commandKind": "global",
  181. "summary": "⭐️️ Use to run some task before commit",
  182. "autoinstallerName": "rush-lint-staged",
  183. "shellCommand": "lint-staged --config common/autoinstallers/rush-lint-staged/.lintstagedrc.js"
  184. },
  185. // 循环依赖检查
  186. {
  187. "name": "check-circular-dependency",
  188. "commandKind": "global",
  189. "summary": "⭐️️ Auto check circular dependency",
  190. "safeForSimultaneousRushProcesses": true,
  191. "autoinstallerName": "rush-commands",
  192. "shellCommand": "node common/autoinstallers/rush-commands/check-circular-dependency.mjs"
  193. },
  194. {
  195. "commandKind": "bulk",
  196. "name": "test",
  197. "description": "Executes automated tests.",
  198. "allowWarningsInSuccessfulBuild": true,
  199. "ignoreMissingScript": true,
  200. "enableParallelism": true,
  201. "incremental": true,
  202. "summary": "⭐️️ Run test command for each package"
  203. },
  204. {
  205. "commandKind": "bulk",
  206. "name": "test:cov",
  207. "description": "Executes automated tests with coverage collection.",
  208. "allowWarningsInSuccessfulBuild": true,
  209. "ignoreMissingScript": true,
  210. "enableParallelism": true,
  211. "incremental": true,
  212. "summary": "⭐️️ Run coverage command for each package"
  213. },
  214. // 本地包构建 + watch
  215. {
  216. "name": "build:watch",
  217. "commandKind": "bulk",
  218. "summary": "⭐️️ Run build:watch command for each package",
  219. "description": "For details, see the article \"Using watch mode\" on the Rush website: https://rushjs.io/",
  220. "ignoreMissingScript": true,
  221. "safeForSimultaneousRushProcesses": true,
  222. // 使用增量构建逻辑 (重要)
  223. "incremental": true,
  224. "enableParallelism": true,
  225. // 启用 "watch mode"
  226. "watchForChanges": true
  227. },
  228. // 一键 build 所有包 + 运行 docs 官网 dev
  229. {
  230. "name": "dev:docs",
  231. "commandKind": "global",
  232. "summary": "⭐️️ Run dev in apps/docs",
  233. "autoinstallerName": "rush-commands",
  234. "safeForSimultaneousRushProcesses": true,
  235. "shellCommand": "concurrently --kill-others --prefix \"{name}\" --names [watch],[demo] -c white,blue \"rush build:watch --to-except @flowgram.ai/docs\" \"cd apps/docs && rushx dev\""
  236. },
  237. {
  238. "name": "dev:demo-fixed-layout",
  239. "commandKind": "global",
  240. "summary": "⭐️️ run dev in app/demo-fixed-layout",
  241. "autoinstallerName": "rush-commands",
  242. "safeForSimultaneousRushProcesses": true,
  243. "shellCommand": "concurrently --kill-others --prefix \"{name}\" --names [watch],[demo] -c white,blue \"rush build:watch --to-except @flowgram.ai/demo-fixed-layout\" \"cd apps/demo-fixed-layout && rushx dev\""
  244. },
  245. {
  246. "name": "dev:demo-free-layout",
  247. "commandKind": "global",
  248. "summary": "⭐️️ run dev in app/demo-free-layout",
  249. "autoinstallerName": "rush-commands",
  250. "safeForSimultaneousRushProcesses": true,
  251. "shellCommand": "concurrently --kill-others --prefix \"{name}\" --names [watch],[demo] -c white,blue \"rush build:watch --to-except @flowgram.ai/demo-free-layout\" \"cd apps/demo-free-layout && rushx dev\""
  252. },
  253. ],
  254. /**
  255. * Custom "parameters" introduce new parameters for specified Rush command-line commands.
  256. * For example, you might define a "--production" parameter for the "rush build" command.
  257. */
  258. "parameters": [
  259. // {
  260. // /**
  261. // * (Required) Determines the type of custom parameter.
  262. // * A "flag" is a custom command-line parameter whose presence acts as an on/off switch.
  263. // */
  264. // "parameterKind": "flag",
  265. //
  266. // /**
  267. // * (Required) The long name of the parameter. It must be lower-case and use dash delimiters.
  268. // */
  269. // "longName": "--my-flag",
  270. //
  271. // /**
  272. // * An optional alternative short name for the parameter. It must be a dash followed by a single
  273. // * lower-case or upper-case letter, which is case-sensitive.
  274. // *
  275. // * NOTE: The Rush developers recommend that automation scripts should always use the long name
  276. // * to improve readability. The short name is only intended as a convenience for humans.
  277. // * The alphabet letters run out quickly, and are difficult to memorize, so *only* use
  278. // * a short name if you expect the parameter to be needed very often in everyday operations.
  279. // */
  280. // "shortName": "-m",
  281. //
  282. // /**
  283. // * (Required) A long description to be shown in the command-line help.
  284. // *
  285. // * Whenever you introduce commands/parameters, taking a little time to write meaningful
  286. // * documentation can make a big difference for the developer experience in your repo.
  287. // */
  288. // "description": "A custom flag parameter that is passed to the scripts that are invoked when building projects",
  289. //
  290. // /**
  291. // * (Required) A list of custom commands and/or built-in Rush commands that this parameter may
  292. // * be used with. The parameter will be appended to the shell command that Rush invokes.
  293. // */
  294. // "associatedCommands": ["build", "rebuild"]
  295. // },
  296. //
  297. // {
  298. // /**
  299. // * (Required) Determines the type of custom parameter.
  300. // * A "string" is a custom command-line parameter whose argument is a single text string.
  301. // */
  302. // "parameterKind": "string",
  303. // "longName": "--my-string",
  304. // "description": "A custom string parameter for the \"my-global-command\" custom command",
  305. //
  306. // "associatedCommands": ["my-global-command"],
  307. //
  308. // "argumentName": "SOME_TEXT",
  309. //
  310. // /**
  311. // * If true, this parameter must be included with the command. The default is false.
  312. // */
  313. // "required": false
  314. // },
  315. //
  316. // {
  317. // /**
  318. // * (Required) Determines the type of custom parameter.
  319. // * A "choice" is a custom command-line parameter whose argument must be chosen from a list of
  320. // * allowable alternatives (similar to an enum).
  321. // */
  322. // "parameterKind": "choice",
  323. // "longName": "--my-choice",
  324. // "description": "A custom choice parameter for the \"my-global-command\" custom command",
  325. //
  326. // "associatedCommands": ["my-global-command"],
  327. // "required": false,
  328. //
  329. // /**
  330. // * If a "defaultValue" is specified, then if the Rush command line is invoked without
  331. // * this parameter, it will be automatically added with the "defaultValue" as the argument.
  332. // * The value must be one of the defined alternatives.
  333. // */
  334. // "defaultValue": "vanilla",
  335. //
  336. // /**
  337. // * (Required) A list of alternative argument values that can be chosen for this parameter.
  338. // */
  339. // "alternatives": [
  340. // {
  341. // /**
  342. // * A token that is one of the alternatives that can be used with the choice parameter,
  343. // * e.g. "vanilla" in "--flavor vanilla".
  344. // */
  345. // "name": "vanilla",
  346. //
  347. // /**
  348. // * A detailed description for the alternative that can be shown in the command-line help.
  349. // *
  350. // * Whenever you introduce commands/parameters, taking a little time to write meaningful
  351. // * documentation can make a big difference for the developer experience in your repo.
  352. // */
  353. // "description": "Use the vanilla flavor"
  354. // },
  355. //
  356. // {
  357. // "name": "chocolate",
  358. // "description": "Use the chocolate flavor"
  359. // },
  360. //
  361. // {
  362. // "name": "strawberry",
  363. // "description": "Use the strawberry flavor"
  364. // }
  365. // ]
  366. // },
  367. //
  368. // {
  369. // /**
  370. // * (Required) Determines the type of custom parameter.
  371. // * An "integer" is a custom command-line parameter whose value is an integer number.
  372. // */
  373. // "parameterKind": "integer",
  374. // "longName": "--my-integer",
  375. // "description": "A custom integer parameter for the \"my-global-command\" custom command",
  376. //
  377. // "associatedCommands": ["my-global-command"],
  378. // "argumentName": "SOME_NUMBER",
  379. // "required": false
  380. // },
  381. //
  382. // {
  383. // /**
  384. // * (Required) Determines the type of custom parameter.
  385. // * An "integerList" is a custom command-line parameter whose argument is an integer.
  386. // * The parameter can be specified multiple times to build a list.
  387. // *
  388. // * For example, if the parameter name is "--my-integer-list", then the custom command
  389. // * might be invoked as
  390. // * `rush my-global-command --my-integer-list 1 --my-integer-list 2 --my-integer-list 3`
  391. // * and the parsed array would be [1,2,3].
  392. // */
  393. // "parameterKind": "integerList",
  394. // "longName": "--my-integer-list",
  395. // "description": "A custom integer list parameter for the \"my-global-command\" custom command",
  396. //
  397. // "associatedCommands": ["my-global-command"],
  398. // "argumentName": "SOME_NUMBER",
  399. // "required": false
  400. // },
  401. //
  402. // {
  403. // /**
  404. // * (Required) Determines the type of custom parameter.
  405. // * An "stringList" is a custom command-line parameter whose argument is a text string.
  406. // * The parameter can be specified multiple times to build a list.
  407. // *
  408. // * For example, if the parameter name is "--my-string-list", then the custom command
  409. // * might be invoked as
  410. // * `rush my-global-command --my-string-list A --my-string-list B --my-string-list C`
  411. // * and the parsed array would be [A,B,C].
  412. // */
  413. // "parameterKind": "stringList",
  414. // "longName": "--my-string-list",
  415. // "description": "A custom string list parameter for the \"my-global-command\" custom command",
  416. //
  417. // "associatedCommands": ["my-global-command"],
  418. // "argumentName": "SOME_TEXT",
  419. // "required": false
  420. // },
  421. //
  422. // {
  423. // /**
  424. // * (Required) Determines the type of custom parameter.
  425. // * A "choice" is a custom command-line parameter whose argument must be chosen from a list of
  426. // * allowable alternatives (similar to an enum).
  427. // * The parameter can be specified multiple times to build a list.
  428. // *
  429. // * For example, if the parameter name is "--my-choice-list", then the custom command
  430. // * might be invoked as
  431. // * `rush my-global-command --my-string-list vanilla --my-string-list chocolate`
  432. // * and the parsed array would be [vanilla,chocolate].
  433. // */
  434. // "parameterKind": "choiceList",
  435. // "longName": "--my-choice-list",
  436. // "description": "A custom choice list parameter for the \"my-global-command\" custom command",
  437. //
  438. // "associatedCommands": ["my-global-command"],
  439. // "required": false,
  440. //
  441. // /**
  442. // * (Required) A list of alternative argument values that can be chosen for this parameter.
  443. // */
  444. // "alternatives": [
  445. // {
  446. // /**
  447. // * A token that is one of the alternatives that can be used with the choice parameter,
  448. // * e.g. "vanilla" in "--flavor vanilla".
  449. // */
  450. // "name": "vanilla",
  451. //
  452. // /**
  453. // * A detailed description for the alternative that can be shown in the command-line help.
  454. // *
  455. // * Whenever you introduce commands/parameters, taking a little time to write meaningful
  456. // * documentation can make a big difference for the developer experience in your repo.
  457. // */
  458. // "description": "Use the vanilla flavor"
  459. // },
  460. //
  461. // {
  462. // "name": "chocolate",
  463. // "description": "Use the chocolate flavor"
  464. // },
  465. //
  466. // {
  467. // "name": "strawberry",
  468. // "description": "Use the strawberry flavor"
  469. // }
  470. // ]
  471. // }
  472. ]
  473. }