create-stylus 1.1.0 → 1.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/base/.gitignore.template.mjs +2 -2
- package/templates/base/dist/cli.js +683 -0
- package/templates/base/dist/cli.js.map +1 -0
- package/templates/base/package.json +2 -1
- package/templates/base/packages/nextjs/.gitignore.template.mjs +3 -3
- package/templates/base/packages/nextjs/scaffold.config.ts +2 -2
- package/templates/base/packages/stylus/.env.example +5 -2
- package/templates/base/packages/stylus/.gitignore.template.mjs +3 -3
- package/templates/base/packages/stylus/package.json +0 -1
- package/templates/base/packages/stylus/scripts/deploy.ts +29 -12
- package/templates/base/packages/stylus/scripts/deploy_contract.ts +34 -43
- package/templates/base/packages/stylus/scripts/deploy_wrapper.ts +4 -44
- package/templates/base/packages/stylus/scripts/export_abi.ts +13 -13
- package/templates/base/packages/stylus/scripts/utils/command.ts +18 -31
- package/templates/base/packages/stylus/scripts/utils/contract.ts +23 -14
- package/templates/base/packages/stylus/scripts/utils/deployment.ts +169 -45
- package/templates/base/packages/stylus/scripts/utils/network.ts +27 -7
- package/templates/base/packages/stylus/scripts/utils/type.ts +13 -10
- package/templates/base/packages/stylus/your-contract/Cargo.lock +35 -18
- package/templates/base/packages/stylus/your-contract/Cargo.toml +3 -1
- package/templates/base/packages/stylus/your-contract/src/lib.rs +51 -21
- package/templates/base/readme.md +207 -42
- package/templates/base/yarn.lock +1 -2
- package/templates/base/packages/stylus/README.md +0 -263
- package/templates/base/packages/stylus/header.png +0 -0
- package/templates/base/packages/stylus/scripts/deploy_all_contracts.ts +0 -59
|
@@ -25,13 +25,25 @@ use stylus_sdk::{
|
|
|
25
25
|
stylus_core::log,
|
|
26
26
|
};
|
|
27
27
|
|
|
28
|
-
///
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
/// Import OpenZeppelin Ownable functionality
|
|
29
|
+
use openzeppelin_stylus::access::ownable::{self, Ownable, IOwnable};
|
|
30
|
+
|
|
31
|
+
/// Error types for the contract
|
|
32
|
+
#[derive(SolidityError, Debug)]
|
|
33
|
+
pub enum Error {
|
|
34
|
+
UnauthorizedAccount(ownable::OwnableUnauthorizedAccount),
|
|
35
|
+
InvalidOwner(ownable::OwnableInvalidOwner),
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
impl From<ownable::Error> for Error {
|
|
39
|
+
fn from(value: ownable::Error) -> Self {
|
|
40
|
+
match value {
|
|
41
|
+
ownable::Error::UnauthorizedAccount(e) => {
|
|
42
|
+
Error::UnauthorizedAccount(e)
|
|
43
|
+
}
|
|
44
|
+
ownable::Error::InvalidOwner(e) => Error::InvalidOwner(e),
|
|
33
45
|
}
|
|
34
|
-
}
|
|
46
|
+
}
|
|
35
47
|
}
|
|
36
48
|
|
|
37
49
|
// Define the GreetingChange event
|
|
@@ -44,7 +56,7 @@ sol! {
|
|
|
44
56
|
sol_storage! {
|
|
45
57
|
#[entrypoint]
|
|
46
58
|
pub struct YourContract {
|
|
47
|
-
|
|
59
|
+
Ownable ownable;
|
|
48
60
|
string greeting;
|
|
49
61
|
bool premium;
|
|
50
62
|
uint256 total_counter;
|
|
@@ -54,18 +66,16 @@ sol_storage! {
|
|
|
54
66
|
|
|
55
67
|
/// Declare that `YourContract` is a contract with the following external methods.
|
|
56
68
|
#[public]
|
|
69
|
+
#[implements(IOwnable<Error = Error>)]
|
|
57
70
|
impl YourContract {
|
|
58
|
-
|
|
59
|
-
pub fn
|
|
60
|
-
|
|
71
|
+
#[constructor]
|
|
72
|
+
pub fn constructor(&mut self, initial_owner: Address) -> Result<(), Error> {
|
|
73
|
+
// Initialize Ownable with the initial owner using OpenZeppelin pattern
|
|
74
|
+
self.ownable.constructor(initial_owner)?;
|
|
61
75
|
self.greeting.set_str("Building Unstoppable Apps!!!");
|
|
62
76
|
self.premium.set(false);
|
|
63
77
|
self.total_counter.set(U256::ZERO);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/// Gets the owner address
|
|
67
|
-
pub fn owner(&self) -> Address {
|
|
68
|
-
self.owner.get()
|
|
78
|
+
Ok(())
|
|
69
79
|
}
|
|
70
80
|
|
|
71
81
|
/// Gets the current greeting
|
|
@@ -119,15 +129,14 @@ impl YourContract {
|
|
|
119
129
|
|
|
120
130
|
/// Function that allows the owner to withdraw all the Ether in the contract
|
|
121
131
|
/// The function can only be called by the owner of the contract
|
|
122
|
-
pub fn withdraw(&mut self) -> Result<(),
|
|
123
|
-
// Check if caller is owner
|
|
124
|
-
|
|
125
|
-
let owner: Address = self.owner.get();
|
|
126
|
-
require!(sender == owner, "Not the Owner");
|
|
132
|
+
pub fn withdraw(&mut self) -> Result<(), Error> {
|
|
133
|
+
// Check if caller is owner using OpenZeppelin's only_owner
|
|
134
|
+
self.ownable.only_owner()?;
|
|
127
135
|
|
|
128
136
|
// Get contract balance and transfer to owner using transfer_eth
|
|
129
|
-
let balance = self.vm().balance(
|
|
137
|
+
let balance = self.vm().balance(self.vm().contract_address());
|
|
130
138
|
if balance > U256::ZERO {
|
|
139
|
+
let owner = self.ownable.owner();
|
|
131
140
|
let _ = self.vm().transfer_eth(owner, balance);
|
|
132
141
|
}
|
|
133
142
|
|
|
@@ -142,6 +151,27 @@ impl YourContract {
|
|
|
142
151
|
}
|
|
143
152
|
}
|
|
144
153
|
|
|
154
|
+
/// Implementation of the IOwnable interface
|
|
155
|
+
#[public]
|
|
156
|
+
impl IOwnable for YourContract {
|
|
157
|
+
type Error = Error;
|
|
158
|
+
|
|
159
|
+
fn owner(&self) -> Address {
|
|
160
|
+
self.ownable.owner()
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
fn transfer_ownership(
|
|
164
|
+
&mut self,
|
|
165
|
+
new_owner: Address,
|
|
166
|
+
) -> Result<(), Self::Error> {
|
|
167
|
+
Ok(self.ownable.transfer_ownership(new_owner)?)
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
fn renounce_ownership(&mut self) -> Result<(), Self::Error> {
|
|
171
|
+
Ok(self.ownable.renounce_ownership()?)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
145
175
|
// #[cfg(test)]
|
|
146
176
|
// mod test {
|
|
147
177
|
// use super::*;
|
package/templates/base/readme.md
CHANGED
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
⚙️ Built using Rust, NextJS, RainbowKit, Stylus, Wagmi, Viem, and TypeScript.
|
|
11
11
|
|
|
12
12
|
- ✅ **Contract Hot Reload**: Your frontend auto-adapts to your smart contract as you edit it.
|
|
13
|
-
- 🪝 **[Custom hooks]()**: Collection of React hooks wrapped around [wagmi](https://wagmi.sh/) to simplify interactions with smart contracts with TypeScript autocompletion.
|
|
14
|
-
- 🧱 [**Components**](): Collection of common web3 components to quickly build your frontend.
|
|
13
|
+
- 🪝 **[Custom hooks](https://arb-stylus.github.io/scaffold-stylus-docs/components)**: Collection of React hooks wrapped around [wagmi](https://wagmi.sh/) to simplify interactions with smart contracts with TypeScript autocompletion.
|
|
14
|
+
- 🧱 [**Components**](https://arb-stylus.github.io/scaffold-stylus-docs/hooks): Collection of common web3 components to quickly build your frontend.
|
|
15
15
|
- 🔥 **Burner Wallet & Local Faucet**: Quickly test your application with a burner wallet and local faucet.
|
|
16
16
|
- 🔐 **Integration with Wallet Providers**: Connect to different wallet providers and interact with the Arbitrum network.
|
|
17
17
|
|
|
@@ -30,13 +30,11 @@ Before you begin, you need to install the following tools:
|
|
|
30
30
|
|
|
31
31
|
## Quickstart
|
|
32
32
|
|
|
33
|
-
[Video Demo](https://app.screencastify.com/watch/9GYnnO0Fqq9QOjYRjQg0)
|
|
34
|
-
|
|
35
33
|
To get started with Scaffold-Stylus, follow the steps below:
|
|
36
34
|
|
|
37
|
-
1. Clone this repo & install dependencies
|
|
35
|
+
### 1. Clone this repo & install dependencies
|
|
38
36
|
|
|
39
|
-
```
|
|
37
|
+
```bash
|
|
40
38
|
git clone https://github.com/Arb-Stylus/scaffold-stylus.git
|
|
41
39
|
cd scaffold-stylus
|
|
42
40
|
yarn install
|
|
@@ -44,34 +42,72 @@ yarn install
|
|
|
44
42
|
git submodule update --init --recursive
|
|
45
43
|
```
|
|
46
44
|
|
|
47
|
-
2.
|
|
45
|
+
### 2. Install Stylus tools
|
|
48
46
|
|
|
47
|
+
Install [Rust](https://www.rust-lang.org/tools/install), and then install the Stylus CLI tool with Cargo:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
cargo install --force cargo-stylus cargo-stylus-check
|
|
49
51
|
```
|
|
52
|
+
|
|
53
|
+
**Prerequisite:**
|
|
54
|
+
|
|
55
|
+
- `cargo-stylus` version `^0.6.1`
|
|
56
|
+
- `rustc` version match with `packages/stylus/your-contract/rust-toolchain.toml`
|
|
57
|
+
|
|
58
|
+
Set default `toolchain` match `rust-toolchain.toml` and add the `wasm32-unknown-unknown` build target to your Rust compiler:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
rustup default 1.87
|
|
62
|
+
rustup target add wasm32-unknown-unknown --toolchain 1.87
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
You should now have it available as a Cargo subcommand:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
cargo stylus --help
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### 3. Run a local network
|
|
72
|
+
|
|
73
|
+
In your first terminal:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
50
76
|
yarn chain
|
|
51
77
|
```
|
|
52
78
|
|
|
53
79
|
This command starts a local Stylus-compatible network using the Nitro dev node script (`./nitro-devnode/run-dev-node.sh`). The network runs on your local machine and can be used for testing and development. You can customize the Nitro dev node configuration in the `nitro-devnode` submodule.
|
|
54
80
|
|
|
55
|
-
|
|
81
|
+
### 4. Deploy the test contract
|
|
56
82
|
|
|
57
|
-
|
|
83
|
+
In your second terminal:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
58
86
|
yarn deploy
|
|
59
87
|
```
|
|
60
88
|
|
|
61
|
-
This command deploys a test smart contract to the local network. The contract is located in `packages/stylus/your-contract/src` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/stylus/scripts` to deploy the contract to the network. You can also customize the deploy script.
|
|
89
|
+
This command deploys a test smart contract to the local network. The contract is located in `packages/stylus/your-contract/src` and can be modified to suit your needs. The `yarn deploy` command uses the deploy script located in `packages/stylus/scripts` to deploy the contract to the network. You can also customize the deploy script .
|
|
62
90
|
|
|
63
|
-
|
|
91
|
+
### 5. Start your NextJS app
|
|
64
92
|
|
|
65
|
-
|
|
93
|
+
In your third terminal:
|
|
94
|
+
|
|
95
|
+
```bash
|
|
66
96
|
yarn start
|
|
67
97
|
```
|
|
68
98
|
|
|
69
|
-
Visit your app at: `http://localhost:3000`. You can interact with your smart contract using the
|
|
99
|
+
Visit your app at: `http://localhost:3000`. You can interact with your smart contract using the **Debug Contracts** page, which provides a user-friendly interface for testing your contract's functions and viewing its state.
|
|
100
|
+
|
|
101
|
+
### 6. Test your smart contract
|
|
70
102
|
|
|
71
|
-
|
|
103
|
+
```bash
|
|
104
|
+
yarn stylus:test
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Development Workflow
|
|
72
108
|
|
|
73
109
|
- Edit your smart contract `lib.rs` in `packages/stylus/your-contract/src`
|
|
74
|
-
- Edit your frontend in `packages/nextjs/
|
|
110
|
+
- Edit your frontend in `packages/nextjs/app`
|
|
75
111
|
- Edit your deployment scripts in `packages/stylus/scripts`
|
|
76
112
|
|
|
77
113
|
## Create Your Own Contract
|
|
@@ -82,7 +118,7 @@ Scaffold-Stylus enables you to create and deploy multiple contracts within a sin
|
|
|
82
118
|
|
|
83
119
|
Use the following command to create a new contract and customize it as needed:
|
|
84
120
|
|
|
85
|
-
```
|
|
121
|
+
```bash
|
|
86
122
|
yarn new-module <contract-name>
|
|
87
123
|
```
|
|
88
124
|
|
|
@@ -90,39 +126,18 @@ The generated contract will be located in `packages/stylus/<contract-name>`.
|
|
|
90
126
|
|
|
91
127
|
### Step 2: Deploy Your Contract
|
|
92
128
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
#### Method A: Deploy with Script (Recommended)
|
|
96
|
-
|
|
97
|
-
```
|
|
98
|
-
yarn deploy
|
|
129
|
+
```bash
|
|
130
|
+
yarn deploy [...options]
|
|
99
131
|
```
|
|
100
132
|
|
|
101
133
|
This command runs the `deploy.ts` script located in `packages/stylus/scripts`. You can customize this script with your deployment logic.
|
|
102
134
|
|
|
103
|
-
#### Method B: Deploy Single Contract Directly
|
|
104
|
-
|
|
105
|
-
If you prefer not to write a deployment script, you can deploy a single contract directly:
|
|
106
|
-
|
|
107
|
-
```
|
|
108
|
-
yarn deploy --contract <contractFolder> [...options]
|
|
109
|
-
```
|
|
110
|
-
|
|
111
135
|
**Available Options:**
|
|
112
136
|
|
|
113
|
-
- `--name <contractName>`: Deploy your contract with a custom name (default is the contract folder name)
|
|
114
137
|
- `--network <network>`: Specify which network to deploy to
|
|
115
138
|
- `--estimate-gas`: Only perform gas estimation without deploying
|
|
116
139
|
- `--max-fee=<maxFee>`: Set maximum fee per gas in gwei
|
|
117
140
|
|
|
118
|
-
#### Method C: Deploy All Contracts
|
|
119
|
-
|
|
120
|
-
Deploy all contracts in your project with a single command:
|
|
121
|
-
|
|
122
|
-
```
|
|
123
|
-
yarn deploy --all [...options]
|
|
124
|
-
```
|
|
125
|
-
|
|
126
141
|
**Note:** Deployment information is automatically saved in `packages/stylus/deployments` by default.
|
|
127
142
|
|
|
128
143
|
## Deploying to Other Networks
|
|
@@ -139,6 +154,8 @@ To deploy your contracts to other networks (other than the default local Nitro d
|
|
|
139
154
|
RPC_URL_SEPOLIA=https://your-network-rpc-url
|
|
140
155
|
```
|
|
141
156
|
|
|
157
|
+
**Note:** If RPC URL is not provided, system will use default public RPC URL from that network
|
|
158
|
+
|
|
142
159
|
2. **Set the Private Key**
|
|
143
160
|
|
|
144
161
|
For real deployments, you must provide your own wallet's private key. Set the `PRIVATE_KEY_<network>` environment variable:
|
|
@@ -149,7 +166,15 @@ To deploy your contracts to other networks (other than the default local Nitro d
|
|
|
149
166
|
|
|
150
167
|
**Security Note:** A development key is used by default when running the Nitro dev node locally, but for external deployments, you must provide your own private key.
|
|
151
168
|
|
|
152
|
-
3. **
|
|
169
|
+
3. **Set the Account Address**
|
|
170
|
+
|
|
171
|
+
Set the `ACCOUNT_ADDRESS_<network>`
|
|
172
|
+
|
|
173
|
+
```env
|
|
174
|
+
ACCOUNT_ADDRESS_SEPOLIA=your_account_address_here
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
4. **Update Frontend Configuration**
|
|
153
178
|
|
|
154
179
|
Open `packages/nextjs/scaffold.config.ts` and update the `targetNetworks` array to include your target chain. This ensures your frontend connects to the correct network and generates the proper ABI in `deployedContracts.ts`:
|
|
155
180
|
|
|
@@ -159,21 +184,161 @@ To deploy your contracts to other networks (other than the default local Nitro d
|
|
|
159
184
|
targetNetworks: [chains.arbitrumSepolia],
|
|
160
185
|
```
|
|
161
186
|
|
|
187
|
+
### Available Networks
|
|
188
|
+
|
|
189
|
+
This template supports Arbitrum networks only. You can test which networks are available and their RPC URLs:
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
yarn test:networks
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
This will show you all supported networks and their corresponding RPC endpoints.
|
|
196
|
+
|
|
162
197
|
### Deploy to Other Network
|
|
163
198
|
|
|
164
199
|
Once configured, deploy to your target network:
|
|
165
200
|
|
|
166
|
-
```
|
|
201
|
+
```bash
|
|
167
202
|
yarn deploy --network <network>
|
|
168
203
|
```
|
|
169
204
|
|
|
170
205
|
**Important Security Notes:**
|
|
171
206
|
|
|
172
207
|
- The values in `.env.example` provide a template for required environment variables
|
|
173
|
-
|
|
174
208
|
- **Always keep your private key secure and never commit it to version control**
|
|
175
209
|
- Consider using environment variable management tools for production deployments
|
|
176
210
|
|
|
211
|
+
## Verify your contract
|
|
212
|
+
|
|
213
|
+
#### Prerequisites
|
|
214
|
+
|
|
215
|
+
Your contract must meet Arbiscan's verification requirements:
|
|
216
|
+
|
|
217
|
+
- No external libraries
|
|
218
|
+
- No constructor arguments
|
|
219
|
+
- No custom optimization settings
|
|
220
|
+
- No specific compiler version requirements
|
|
221
|
+
|
|
222
|
+
### Local Verification
|
|
223
|
+
|
|
224
|
+
Make sure your constructor does not contain any args
|
|
225
|
+
|
|
226
|
+
```rs
|
|
227
|
+
pub fn constructor(&mut self)
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
The scaffold includes built-in local verification to ensure your Stylus contract deployments are reproducible. To enable verification during deployment, set `verify: true` in your deployment script:
|
|
231
|
+
|
|
232
|
+
```ts
|
|
233
|
+
await deployStylusContract({
|
|
234
|
+
contract: "your-contract",
|
|
235
|
+
verify: true,
|
|
236
|
+
...deployOptions,
|
|
237
|
+
});
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
This runs `cargo stylus verify` locally after deployment, which:
|
|
241
|
+
|
|
242
|
+
- Verifies that the deployed bytecode matches your source code
|
|
243
|
+
- Ensures reproducibility across different environments
|
|
244
|
+
- Validates the deployment transaction
|
|
245
|
+
|
|
246
|
+
### Arbiscan Verification
|
|
247
|
+
|
|
248
|
+
For public verification on Arbiscan, follow these steps:
|
|
249
|
+
|
|
250
|
+
#### Steps
|
|
251
|
+
|
|
252
|
+
1. **Create a dedicated repository** containing only your contract source code
|
|
253
|
+
2. **Navigate to Arbiscan**:
|
|
254
|
+
- Go to [Arbiscan Verify Contract](https://arbiscan.io/verifyContract)
|
|
255
|
+
- Enter your deployed contract address
|
|
256
|
+
3. **Follow the verification process**:
|
|
257
|
+
- Select "Solidity (Standard-Json-Input)" as the compiler type
|
|
258
|
+
- Enter your contract source code (github link)
|
|
259
|
+
- Provide any constructor arguments if applicable
|
|
260
|
+
- Submit for verification
|
|
261
|
+
|
|
262
|
+
Check official document for detail instructions: https://docs.arbitrum.io/stylus/how-tos/verifying-contracts-arbiscan
|
|
263
|
+
|
|
264
|
+
> **Note**: Arbiscan verification for Stylus contracts is still evolving. If you encounter issues, consider using the local verification method or check Arbiscan's latest documentation for Stylus-specific instructions.
|
|
265
|
+
|
|
266
|
+
### 🛠️ Troubleshooting Common Issues
|
|
267
|
+
|
|
268
|
+
#### 1. `stylus` Not Recognized
|
|
269
|
+
|
|
270
|
+
If you encounter an error stating that `stylus` is not recognized as an external or internal command, run the following command in your terminal:
|
|
271
|
+
|
|
272
|
+
```bash
|
|
273
|
+
sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
After that, check if `stylus` is installed by running:
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
cargo stylus --version
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
If the version is displayed, `stylus` has been successfully installed and the path is correctly set.
|
|
283
|
+
|
|
284
|
+
#### 2. ABI Not Generated
|
|
285
|
+
|
|
286
|
+
If you face issues with the ABI not being generated, you can try one of the following solutions:
|
|
287
|
+
|
|
288
|
+
- **Restart Docker Node**: Pause and restart the Docker node and the local setup of the project. You can do this by deleting all ongoing running containers and then restarting the local terminal using:
|
|
289
|
+
```bash
|
|
290
|
+
yarn run dev
|
|
291
|
+
```
|
|
292
|
+
- **Modify the Script**: In the `run-dev-node.sh` script, replace the line:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
cargo stylus export-abi
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
with:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
cargo run --manifest-path=Cargo.toml --features export-abi
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
- **Access Denied Issue**: If you encounter an access denied permission error during ABI generation, run the following command and then execute the script again:
|
|
305
|
+
```bash
|
|
306
|
+
sudo chown -R $USER:$USER target
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
#### 3. 🚨 Fixing Line Endings and Running Shell Scripts in WSL
|
|
310
|
+
|
|
311
|
+
> ⚠️ This guide provides step-by-step instructions to resolve the Command not found error caused by CRLF line endings in shell scripts when running in a WSL environment.
|
|
312
|
+
|
|
313
|
+
Shell scripts created in Windows often have `CRLF` line endings, which cause issues in Unix-like environments such as WSL. To fix this:
|
|
314
|
+
|
|
315
|
+
**Using `dos2unix`:**
|
|
316
|
+
|
|
317
|
+
1. Install `dos2unix` (if not already installed):
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
sudo apt install dos2unix
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
2. Convert the script's line endings:
|
|
324
|
+
|
|
325
|
+
```bash
|
|
326
|
+
dos2unix run-dev-node.sh
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
3. Make the Script Executable:
|
|
330
|
+
|
|
331
|
+
```bash
|
|
332
|
+
chmod +x run-dev-node.sh
|
|
333
|
+
```
|
|
334
|
+
|
|
335
|
+
4. Run the Script in WSL:
|
|
336
|
+
```bash
|
|
337
|
+
bash run-dev-node.sh
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
177
342
|
## Documentation
|
|
178
343
|
|
|
179
344
|
Visit our [docs](https://arb-stylus.github.io/scaffold-stylus-docs/) to learn how to start building with Scaffold-Stylus.
|
package/templates/base/yarn.lock
CHANGED
|
@@ -4633,7 +4633,6 @@ __metadata:
|
|
|
4633
4633
|
version: 0.0.0-use.local
|
|
4634
4634
|
resolution: "@ss/stylus@workspace:packages/stylus"
|
|
4635
4635
|
dependencies:
|
|
4636
|
-
"@tanstack/react-query": ^5.81.5
|
|
4637
4636
|
"@types/node": ^20.0.0
|
|
4638
4637
|
"@types/yargs": ^17.0.32
|
|
4639
4638
|
"@typescript-eslint/eslint-plugin": ^6.0.0
|
|
@@ -4844,7 +4843,7 @@ __metadata:
|
|
|
4844
4843
|
languageName: node
|
|
4845
4844
|
linkType: hard
|
|
4846
4845
|
|
|
4847
|
-
"@tanstack/react-query@npm:^5.59.15
|
|
4846
|
+
"@tanstack/react-query@npm:^5.59.15":
|
|
4848
4847
|
version: 5.83.0
|
|
4849
4848
|
resolution: "@tanstack/react-query@npm:5.83.0"
|
|
4850
4849
|
dependencies:
|