Created
January 9, 2024 07:19
-
-
Save kowito/b0392c97a3071613ba90c0b32d9af6c2 to your computer and use it in GitHub Desktop.
Revisions
-
kowito created this gist
Jan 9, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,52 @@ #!/bin/bash # Get the project name from the first command line argument PROJECT_NAME=$1 # Check if the project name was provided if [ -z "$PROJECT_NAME" ]; then echo "Error: No project name provided." echo "Usage: $0 <project_name>" exit 1 fi # Create a new directory for your project and navigate into it mkdir "$PROJECT_NAME" cd "$PROJECT_NAME" # Initialize a new pnpm project (Press Enter to skip all prompts) pnpm init # Install Hardhat and additional specified packages as development dependencies pnpm add --save-dev hardhat @openzeppelin/contracts-upgradeable @nomiclabs/hardhat-ethers ethers # Initialize Git repository git init # Create directories for contracts, scripts, and tests mkdir contracts scripts test # Create a basic Hardhat project echo "module.exports = {};" > hardhat.config.js # Add Hardhat commands to package.json jq '.scripts = { "compile": "hardhat compile", "test": "hardhat test", "deploy": "hardhat run scripts/deploy.js", "node": "hardhat node" }' package.json > temp.json && mv temp.json package.json # Create a basic .gitignore file (optional) echo "node_modules dist .cache artifacts build coverage" > .gitignore # First Git commit with the project initialization message git add . git commit -m "Initial commit - Set up $PROJECT_NAME project" echo "Hardhat project initialized successfully in '$PROJECT_NAME' directory with basic structure and Git repository."