PageSourceSearch

https://rushjs.io/assets/js/3e2d6682.0a21f157.js

js rushjs.io collected 2026-10-02 02:57:57 UTC 6,910 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkrushjs_io=self.webpackChunkrushjs_io||[]).push([[6979],{5552(e,n,t){t.d(n,{xA:()=>u,yg:()=>d});var r=t(829);function a(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function s(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})),t.push.apply(t,r)}return t}function o(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?s(Object(t),!0).forEach(function(n){a(e,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):s(Object(t)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))})}return e}function i(e,n){if(null==e)return{};var t,r,a=function(e,n){if(null==e)return{};var t,r,a={},s=Object.keys(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||(a[t]=e[t]);return a}(e,n);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(r=0;r<s.length;r++)t=s[r],n.indexOf(t)>=0||Object.prototype.propertyIsEnumerable.call(e,t)&&(a[t]=e[t])}return a}var l=r.createContext({}),p=function(e){var n=r.useContext(l),t=n;return e&&(t="function"==typeof e?e(n):o(o({},n),e)),t},u=function(e){var n=p(e.components);return r.createElement(l.Provider,{value:n},e.children)},m={inlineCode:"code",wrapper:function(e){var n=e.children;return r.createElement(r.Fragment,{},n)}},c=r.forwardRef(function(e,n){var t=e.components,a=e.mdxType,s=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),c=p(t),d=a,h=c["".concat(l,".").concat(d)]||c[d]||m[d]||s;return t?r.createElement(h,o(o({ref:n},u),{},{components:t})):r.createElement(h,o({ref:n},u))});function d(e,n){var t=arguments,a=n&&n.mdxType;if("string"==typeof e||a){var s=t.length,o=new Array(s);o[0]=c;var i={};for(var l in n)hasOwnProperty.call(n,l)&&(i[l]=n[l]);i.originalType=e,i.mdxType="string"==typeof e?e:a,o[1]=i;for(var p=2;p<s;p++)o[p]=t[p];return r.createElement.apply(null,o)}return r.createElement.apply(null,t)}c.displayName="MDXCreateElement"},1594(e,n,t){t.r(n),t.d(n,{assets:()=>u,contentTitle:()=>l,default:()=>d,frontMatter:()=>i,metadata:()=>p,toc:()=>m});var r=t(6443),a=t(8338),s=(t(829),t(5552)),o=["components"],i={title:"rushx"},l=void 0,p={unversionedId:"pages/commands/rushx",id:"pages/commands/rushx",title:"rushx",description:"The rushx command is similar to npm run or pnpm run: It invokes a shell script that is defined in the",source:"@site/docs/pages/commands/rushx.md",sourceDirName:"pages/commands",slug:"/pages/commands/rushx",permalink:"/pages/commands/rushx",draft:!1,editUrl:"https://github.com/microsoft/rushstack-websites/tree/main/websites/rushjs.io/docs/pages/commands/rushx.md",tags:[],version:"current",frontMatter:{title:"rushx"},sidebar:"docsSidebar",previous:{title:'The "rush-lib" API',permalink:"/pages/extensibility/api"},next:{title:"rush-pnpm",permalink:"/pages/commands/rush-pnpm"}},u={},m=[{value:"rush vs rushx",id:"rush-vs-rushx",level:2},{value:"Why use &quot;rushx&quot; instead of &quot;pnpm run&quot; or &quot;npx&quot;?",id:"why-use-rushx-instead-of-pnpm-run-or-npx",level:2}],c={toc:m};function d(e){var n=e.components,t=(0,a.A)(e,o);return(0,s.yg)("wrapper",(0,r.A)({},c,t,{components:n,mdxType:"MDXLayout"}),(0,s.yg)("head",null,(0,s.yg)("link",{rel:"canonical",href:"https://rushstack.io/pages/pages/commands/rushx/"})),(0,s.yg)("p",null,"The ",(0,s.yg)("inlineCode",{parentName:"p"},"rushx")," command is similar to ",(0,s.yg)("inlineCode",{parentName:"p"},"npm run")," or ",(0,s.yg)("inlineCode",{parentName:"p"},"pnpm run"),": It invokes a shell script that is defined in the\n",(0,s.yg)("inlineCode",{parentName:"p"},'"scripts"')," section of the ",(0,s.yg)("strong",{parentName:"p"},"package.json")," file for an individual project. Any additional CLI parameters\nare passed only to that shell script without any validation."),(0,s.yg)("p",null,"Consider this very simple example project:"),(0,s.yg)("p",null,(0,s.yg)("strong",{parentName:"p"},"<","my project",">","/package.json")),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre",className:"language-js"},'{\n  "name": "my-project",\n  "version": "0.0.0",\n  "scripts": {\n    "build": "rm -Rf lib && tsc",\n    "test": "jest"\n  }\n}\n')),(0,s.yg)("p",null,"If you invoke ",(0,s.yg)("inlineCode",{parentName:"p"},"rushx")," alone, it will simply display the available commands:"),(0,s.yg)("pre",null,(0,s.yg)("code",{parentName:"pre"},'usage: rushx [-h]\n       rushx [-q/--quiet] <command> ...\n\nOptional arguments:\n  -h, --help            Show this help message and exit.\n  -q, --quiet           Hide rushx startup information.\n\nProject commands for my-project:\n  build: "rm -Rf lib && tsc"\n  test:  "jest"\n')),(0,s.yg)("p",null,"If you invoke ",(0,s.yg)("inlineCode",{parentName:"p"},"rushx build"),", then it would run ",(0,s.yg)("inlineCode",{parentName:"p"},"rm -Rf lib && tsc"),". If you add a parameter such as\n",(0,s.yg)("inlineCode",{parentName:"p"},"rushx build --verbose"),", it is blindly appended to the end of the string: ",(0,s.yg)("inlineCode",{parentName:"p"},"rm -Rf lib && tsc --verbose"),"."),(0,s.yg)("h2",{id:"rush-vs-rushx"},"rush vs rushx"),(0,s.yg)("p",null,"It's easy to confuse these two commands:"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"rush"),' invokes a generic operation that affects the entire repo ("global commands") or else affects multiple projects ("bulk commands"). Such commands ',(0,s.yg)("a",{parentName:"li",href:"/pages/maintainer/custom_commands"},"should be carefully designed"),". Rush enforces that their parameters must be validated and documented."),(0,s.yg)("li",{parentName:"ul"},(0,s.yg)("strong",{parentName:"li"},"rushx")," performs custom operations for one single project. Although some of these are used to implement bulk commands, many of them will be helper scripts that are understood only by the developers of that particular project. Rush does not rigorously validate these commands.")),(0,s.yg)("h2",{id:"why-use-rushx-instead-of-pnpm-run-or-npx"},'Why use "rushx" instead of "pnpm run" or "npx"?'),(0,s.yg)("p",null,"The ",(0,s.yg)("inlineCode",{parentName:"p"},"rushx")," command has similar functionality as ",(0,s.yg)("inlineCode",{parentName:"p"},"pnpm run")," or ",(0,s.yg)("inlineCode",{parentName:"p"},"npx"),", but with some additional benefits:"),(0,s.yg)("ul",null,(0,s.yg)("li",{parentName:"ul"},"Ensures deterministic tooling by using the ",(0,s.yg)("a",{parentName:"li",href:"/pages/contributing"},"Rush version selector")),(0,s.yg)("li",{parentName:"ul"},"Prepares the shell environment based on Rush's configuration"),(0,s.yg)("li",{parentName:"ul"},"Implements additional validations")))}d.isMDXComponent=!0}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.