Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stylus-tools/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ license.workspace = true
repository.workspace = true
version.workspace = true

include = [
"src/**/*",
"precompiles/*.sol",
"templates/**",
]

[dependencies]
alloy = { workspace = true, features = ["contract", "getrandom", "rpc-types", "signer-local", "sol-types"] }
cargo-util-schemas.workspace = true
Expand Down
6 changes: 3 additions & 3 deletions stylus-tools/src/core/project/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub fn init_contract(path: impl AsRef<Path>) -> Result<(), InitError> {

// Add files from template
copy_from_template_if_dne!(
"../../templates/contract" -> path,
"templates/contract" -> path,
"src/lib.rs",
"src/main.rs",
"rust-toolchain.toml",
Expand All @@ -67,8 +67,8 @@ pub fn init_workspace(path: impl AsRef<Path>) -> Result<(), InitError> {

// Add files from template
copy_from_template_if_dne!(
"../../templates/workspace" -> path,
"Cargo.toml",
"templates/workspace" -> path,
"Cargo.toml.tmpl",
"rust-toolchain.toml",
"Stylus.toml",
);
Expand Down
2 changes: 1 addition & 1 deletion stylus-tools/src/core/project/new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn new_contract(path: impl AsRef<Path>) -> Result<(), InitError> {
// Remove the generated "src/lib.rs" and generate the new one
fs::remove_file(path.join("src").join("lib.rs"))?;
copy_from_template_if_dne!(
"../../templates/contract" -> path,
"templates/contract" -> path,
"src/lib.rs",
);

Expand Down
8 changes: 6 additions & 2 deletions stylus-tools/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,13 @@
macro_rules! copy_from_template {
($tmpl:literal -> $root:ident, $($files:expr),* $(,)?) => {
$(
let mut filename = $root.join($files);
if filename.extension() == Some(std::ffi::OsStr::new("tmpl")) {
filename = filename.file_stem().unwrap().into();
}
std::fs::write(
$root.join($files),
include_str!(concat!($tmpl, "/", $files)),
filename,
include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/", $tmpl, "/", $files)),
)?;
)*
};
Expand Down
34 changes: 0 additions & 34 deletions stylus-tools/src/templates/contract/Cargo.toml

This file was deleted.

Loading