-
Notifications
You must be signed in to change notification settings - Fork 67
Call yarn as "yarn.cmd" on Windows (fixes #53) #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,12 +80,12 @@ fn add_bins_to_cargo_toml(project_dir: &std::path::PathBuf) -> Result<(), std::i | |
let append_to_toml = format!( | ||
r#" | ||
[[bin]] | ||
name = "fullstack" | ||
path = ".cargo/bin/fullstack.rs" | ||
name = "run_yarn_fullstack" | ||
path = ".cargo/bin/run_yarn_fullstack.rs" | ||
|
||
[[bin]] | ||
name = "tsync" | ||
path = ".cargo/bin/tsync.rs" | ||
name = "run_yarn_tsync" | ||
path = ".cargo/bin/run_yarn_tsync.rs" | ||
Comment on lines
-87
to
+88
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 8.1.0 doesn't run tsync via yarn anymore nor does it use the global tsync binary. Since you can uninstall tsync via |
||
|
||
[[bin]] | ||
name = "{project_name}" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,12 @@ | ||
use std::io; | ||
use std::process::Command; | ||
|
||
#[cfg(windows)] | ||
pub const YARN_COMMAND: &'static str = "yarn.cmd"; | ||
|
||
#[cfg(not(windows))] | ||
pub const YARN_COMMAND: &'static str = "yarn"; | ||
Comment on lines
+4
to
+8
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎉 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perfect!~ |
||
|
||
pub fn main() -> Result<(), io::Error> { | ||
if !create_rust_app::net::is_port_free(21012) { | ||
println!("========================================================"); | ||
|
@@ -10,7 +16,7 @@ pub fn main() -> Result<(), io::Error> { | |
panic!("Port 21012 is taken but is required for development!") | ||
} | ||
|
||
Command::new("yarn") | ||
Command::new(YARN_COMMAND) | ||
.arg("fullstack") | ||
.current_dir("frontend") | ||
.spawn() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,12 +2,18 @@ use std::io; | |
use std::process::Command; | ||
use std::path::PathBuf; | ||
|
||
#[cfg(windows)] | ||
pub const YARN_COMMAND: &'static str = "yarn.cmd"; | ||
|
||
#[cfg(not(windows))] | ||
pub const YARN_COMMAND: &'static str = "yarn"; | ||
|
||
pub fn main() -> Result<(), io::Error> { | ||
let dir = env!("CARGO_MANIFEST_DIR"); | ||
|
||
println!("Running `yarn tsync` in `$project_dir/frontend/`..."); | ||
|
||
Command::new("yarn") | ||
Command::new(YARN_COMMAND) | ||
Comment on lines
+5
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if you rebase, these changes won't be necessary :) |
||
.arg("tsync") | ||
.current_dir(PathBuf::from_iter([dir, "frontend"])) | ||
.spawn() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[alias] | ||
fullstack="run --bin fullstack" | ||
tsync="run --bin tsync" | ||
fullstack="run --bin run_yarn_fullstack" | ||
tsync="run --bin run_yarn_tsync" | ||
|
||
[build] | ||
target-dir=".cargo/.build" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this rename necessary or were you trying to maintain the naming convention with tsync?
if it's not necessary, let's undo this change.