You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(cli): added automatic js minification on deployment
This is implemented a little shoddily at the moment, but since the
`wasm-bindgen` format is reasonably predictable, it should be fine, and
the errors are clear about how to disable it if there are problems.
Also removed an unnecessary "not running" message on serverful deployment.
println!("Deployment complete 🚀! Your app is now available for serving in the standalone folder '{}'! You can run it by executing the `server` binary in that folder.",&output_path.to_str().map(|s| s.to_string()).unwrap());
163
173
@@ -173,6 +183,7 @@ fn deploy_full(
173
183
fndeploy_export(
174
184
dir:PathBuf,
175
185
output:String,
186
+
opts:&DeployOpts,
176
187
tools:&Tools,
177
188
global_opts:&Opts,
178
189
) -> Result<i32,Error>{
@@ -253,8 +264,40 @@ fn deploy_export(
253
264
.into());
254
265
}
255
266
267
+
if !opts.no_minify_js{
268
+
minify_js(
269
+
&dir.join("dist/exported/.perseus/bundle.js"),
270
+
&output_path.join(".perseus/bundle.js"),
271
+
)?
272
+
}
273
+
256
274
println!();
257
275
println!("Deployment complete 🚀! Your app is now available for serving in the standalone folder '{}'! You can run it by serving the contents of that folder however you'd like.",&output_path.to_str().map(|s| s.to_string()).unwrap());
Copy file name to clipboardExpand all lines: packages/perseus-cli/src/serve.rs
+4-4
Original file line number
Diff line number
Diff line change
@@ -208,7 +208,7 @@ pub fn serve(
208
208
tools:&Tools,
209
209
global_opts:&Opts,
210
210
spinners:&MultiProgress,
211
-
testing:bool,
211
+
silent_no_run:bool,
212
212
) -> Result<(i32,Option<String>),ExecutionError>{
213
213
// Set the environment variables for the host and port
214
214
// NOTE Another part of this code depends on setting these in this way
@@ -278,9 +278,9 @@ pub fn serve(
278
278
// The user doesn't want to run the server, so we'll give them the executable
279
279
// path instead
280
280
let exec_str = (*exec.lock().unwrap()).to_string();
281
-
// Only tell the user about this if we're not testing (which is a whole separate
282
-
// workflow)
283
-
if !testing{
281
+
// Only tell the user about this if they've told us not to run (since deployment
282
+
// and testing both implicitly do this)
283
+
if !silent_no_run{
284
284
println!("Not running server because `--no-run` was provided. You can run it manually by running the following executable from the root of the project.\n{}",&exec_str);
0 commit comments