Skip to content

Commit f601d2f

Browse files
Add Vite commands to CLI --help (#8939)
1 parent ce4c075 commit f601d2f

File tree

2 files changed

+89
-7
lines changed

2 files changed

+89
-7
lines changed

packages/remix-dev/__tests__/cli-test.ts

Lines changed: 43 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ describe("remix CLI", () => {
8484
8585
Usage:
8686
$ remix init [projectDir]
87+
$ remix vite:build [projectDir]
88+
$ remix vite:dev [projectDir]
8789
$ remix build [projectDir]
8890
$ remix dev [projectDir]
8991
$ remix routes [projectDir]
@@ -93,8 +95,31 @@ describe("remix CLI", () => {
9395
--help, -h Print this help message and exit
9496
--version, -v Print the CLI version and exit
9597
--no-color Disable ANSI colors in console output
98+
\`vite:build\` Options (Passed through to Vite):
99+
--assetsInlineLimit Static asset base64 inline threshold in bytes (default: 4096) (number)
100+
--clearScreen Allow/disable clear screen when logging (boolean)
101+
--config, -c Use specified config file (string)
102+
--emptyOutDir Force empty outDir when it's outside of root (boolean)
103+
--logLevel, -l Info | warn | error | silent (string)
104+
--minify Enable/disable minification, or specify minifier to use (default: "esbuild") (boolean | "terser" | "esbuild")
105+
--mode, -m Set env mode (string)
106+
--profile Start built-in Node.js inspector
107+
--sourcemapClient Output source maps for client build (default: false) (boolean | "inline" | "hidden")
108+
--sourcemapServer Output source maps for server build (default: false) (boolean | "inline" | "hidden")
96109
\`build\` Options:
97110
--sourcemap Generate source maps for production
111+
\`vite:dev\` Options (Passed through to Vite):
112+
--clearScreen Allow/disable clear screen when logging (boolean)
113+
--config, -c Use specified config file (string)
114+
--cors Enable CORS (boolean)
115+
--force Force the optimizer to ignore the cache and re-bundle (boolean)
116+
--host Specify hostname (string)
117+
--logLevel, -l Info | warn | error | silent (string)
118+
--mode, -m Set env mode (string)
119+
--open Open browser on startup (boolean | string)
120+
--port Specify port (number)
121+
--profile Start built-in Node.js inspector
122+
--strictPort Exit if specified port is already in use (boolean)
98123
\`dev\` Options:
99124
--command, -c Command used to run your app server
100125
--manual Enable manual mode
@@ -104,7 +129,11 @@ describe("remix CLI", () => {
104129
\`init\` Options:
105130
--no-delete Skip deleting the \`remix.init\` script
106131
\`routes\` Options:
132+
--config, -c Use specified Vite config file (string)
107133
--json Print the routes as JSON
134+
\`reveal\` Options:
135+
--config, -c Use specified Vite config file (string)
136+
--no-typescript Generate plain JavaScript files
108137
109138
Values:
110139
- projectDir The Remix project directory
@@ -119,18 +148,26 @@ describe("remix CLI", () => {
119148
120149
$ remix init
121150
122-
Build your project:
151+
Build your project (Vite):
152+
153+
$ remix vite:build
154+
155+
Run your project locally in development (Vite):
156+
157+
$ remix vite:dev
158+
159+
Build your project (Classic compiler):
123160
124161
$ remix build
125162
$ remix build --sourcemap
126163
$ remix build my-app
127164
128-
Run your project locally in development:
165+
Run your project locally in development (Classic compiler):
129166
130167
$ remix dev
131168
$ remix dev -c "node ./server.js"
132169
133-
Start your server separately and watch for changes:
170+
Start your server separately and watch for changes (Classic compiler):
134171
135172
# custom server start command, for example:
136173
$ remix watch
@@ -143,13 +180,15 @@ describe("remix CLI", () => {
143180
$ remix routes
144181
$ remix routes my-app
145182
$ remix routes --json
183+
$ remix routes --config vite.remix.config.ts
146184
147185
Reveal the used entry point:
148186
149187
$ remix reveal entry.client
150188
$ remix reveal entry.server
151189
$ remix reveal entry.client --no-typescript
152-
$ remix reveal entry.server --no-typescript"
190+
$ remix reveal entry.server --no-typescript
191+
$ remix reveal entry.server --config vite.remix.config.ts"
153192
`);
154193
});
155194
});

packages/remix-dev/cli/run.ts

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
1111
1212
${colors.heading("Usage")}:
1313
$ remix init [${colors.arg("projectDir")}]
14+
$ remix vite:build [${colors.arg("projectDir")}]
15+
$ remix vite:dev [${colors.arg("projectDir")}]
1416
$ remix build [${colors.arg("projectDir")}]
1517
$ remix dev [${colors.arg("projectDir")}]
1618
$ remix routes [${colors.arg("projectDir")}]
@@ -20,8 +22,31 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
2022
--help, -h Print this help message and exit
2123
--version, -v Print the CLI version and exit
2224
--no-color Disable ANSI colors in console output
25+
\`vite:build\` Options (Passed through to Vite):
26+
--assetsInlineLimit Static asset base64 inline threshold in bytes (default: 4096) (number)
27+
--clearScreen Allow/disable clear screen when logging (boolean)
28+
--config, -c Use specified config file (string)
29+
--emptyOutDir Force empty outDir when it's outside of root (boolean)
30+
--logLevel, -l Info | warn | error | silent (string)
31+
--minify Enable/disable minification, or specify minifier to use (default: "esbuild") (boolean | "terser" | "esbuild")
32+
--mode, -m Set env mode (string)
33+
--profile Start built-in Node.js inspector
34+
--sourcemapClient Output source maps for client build (default: false) (boolean | "inline" | "hidden")
35+
--sourcemapServer Output source maps for server build (default: false) (boolean | "inline" | "hidden")
2336
\`build\` Options:
2437
--sourcemap Generate source maps for production
38+
\`vite:dev\` Options (Passed through to Vite):
39+
--clearScreen Allow/disable clear screen when logging (boolean)
40+
--config, -c Use specified config file (string)
41+
--cors Enable CORS (boolean)
42+
--force Force the optimizer to ignore the cache and re-bundle (boolean)
43+
--host Specify hostname (string)
44+
--logLevel, -l Info | warn | error | silent (string)
45+
--mode, -m Set env mode (string)
46+
--open Open browser on startup (boolean | string)
47+
--port Specify port (number)
48+
--profile Start built-in Node.js inspector
49+
--strictPort Exit if specified port is already in use (boolean)
2550
\`dev\` Options:
2651
--command, -c Command used to run your app server
2752
--manual Enable manual mode
@@ -31,7 +56,11 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
3156
\`init\` Options:
3257
--no-delete Skip deleting the \`remix.init\` script
3358
\`routes\` Options:
59+
--config, -c Use specified Vite config file (string)
3460
--json Print the routes as JSON
61+
\`reveal\` Options:
62+
--config, -c Use specified Vite config file (string)
63+
--no-typescript Generate plain JavaScript files
3564
3665
${colors.heading("Values")}:
3766
- ${colors.arg("projectDir")} The Remix project directory
@@ -46,18 +75,30 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
4675
4776
$ remix init
4877
49-
${colors.heading("Build your project")}:
78+
${colors.heading("Build your project (Vite)")}:
79+
80+
$ remix vite:build
81+
82+
${colors.heading("Run your project locally in development (Vite)")}:
83+
84+
$ remix vite:dev
85+
86+
${colors.heading("Build your project (Classic compiler)")}:
5087
5188
$ remix build
5289
$ remix build --sourcemap
5390
$ remix build my-app
5491
55-
${colors.heading("Run your project locally in development")}:
92+
${colors.heading(
93+
"Run your project locally in development (Classic compiler)"
94+
)}:
5695
5796
$ remix dev
5897
$ remix dev -c "node ./server.js"
5998
60-
${colors.heading("Start your server separately and watch for changes")}:
99+
${colors.heading(
100+
"Start your server separately and watch for changes (Classic compiler)"
101+
)}:
61102
62103
# custom server start command, for example:
63104
$ remix watch
@@ -70,13 +111,15 @@ ${colors.logoBlue("R")} ${colors.logoGreen("E")} ${colors.logoYellow(
70111
$ remix routes
71112
$ remix routes my-app
72113
$ remix routes --json
114+
$ remix routes --config vite.remix.config.ts
73115
74116
${colors.heading("Reveal the used entry point")}:
75117
76118
$ remix reveal entry.client
77119
$ remix reveal entry.server
78120
$ remix reveal entry.client --no-typescript
79121
$ remix reveal entry.server --no-typescript
122+
$ remix reveal entry.server --config vite.remix.config.ts
80123
`;
81124

82125
/**

0 commit comments

Comments
 (0)