Skip to content
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

cargo near new command to initialize a new smart contract project #100

Closed
frol opened this issue Aug 7, 2023 · 7 comments · Fixed by #117
Closed

cargo near new command to initialize a new smart contract project #100

frol opened this issue Aug 7, 2023 · 7 comments · Fixed by #117
Assignees
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@frol
Copy link
Contributor

frol commented Aug 7, 2023

It would be great to have a new command to initialize an empty project.

There is cargo-generate and near-create-app that are currently suggested in the docs, but I would prefer avoiding having extra dependency (cargo-generate) or a whole different stack (near-create-app requires Node.js) and rather build the whole DevX around cargo near ... commands.

image

I believe near-create-app does too much (initializes the frontend and the contract inside a single project), and cargo-generate makes things harder to use than necessary, and currently developers face the whole page of just "Create a new project" where I would love to see:

cargo near new my-new-project
cd my-new-project

and the next commands:

cargo near build
...
cargo near deploy

P.S. It might also be useful to initialize common projects like basic FT, NFT contracts (see https://github.com/near/near-sdk-rs/tree/master/examples).

@frol frol added enhancement New feature or request good first issue Good for newcomers labels Aug 7, 2023
@ShivangRawat30
Copy link

Hey I am currently learning rust, as it is a good first issue can you please assign this to me

@frol
Copy link
Contributor Author

frol commented Aug 8, 2023

@ShivangRawat30 Sure, go ahead!

@frol
Copy link
Contributor Author

frol commented Aug 16, 2023

In addition to the regular Rust project setup, I suggest also including GitHub Actions setup for fmt/linting checks on PRs, and build and deploy to testnet and (optional) mainnet on merges to main branch.

A very basic one can be found here: https://github.com/frol/transfer-near-contract/blob/main/.github/workflows/rust.yml (there is no deployment part there)

@frol
Copy link
Contributor Author

frol commented Aug 16, 2023

And also setup tests environment (workspaces-rs)

@frol
Copy link
Contributor Author

frol commented Aug 16, 2023

I think we could start with polishing one contract repo to a reasonable state before scripting it into cargo near new. Currently, looking at https://github.com/near-examples/, I cannot find any Rust contract example without npm/yarn in there. It makes things much more complex than necessary.

So to summarize it, a new project should have the following:

@iho
Copy link
Contributor

iho commented Aug 16, 2023

@ShivangRawat30 Hi. How is your progress? Can I take this task?

@frol
Copy link
Contributor Author

frol commented Nov 14, 2023

Here is a bootstrap project that cargo near new should use as a template: https://github.com/frol/cargo-near-new-project.

@frol frol closed this as completed in #117 Nov 20, 2023
frol added a commit that referenced this issue Nov 20, 2023
Resolves #100

---------

Co-authored-by: Vlad Frolov <frolvlad@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants