Skip to content

Add delete aliases functionality #30

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
40 changes: 40 additions & 0 deletions examples/quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,43 @@ This project is licensed under the [MIT License](LICENSE).
---

Feel free to customize and expand upon this README to suit your project's needs.

## New Functionality: `--all` Flag

The `--all` flag has been added to delete all aliases in the project. This functionality is useful for cleaning up the project by removing all alias definitions at once.

### Usage

To delete all aliases, run the following command:

```bash
pnpm run delete-all-aliases
```

This command will remove all alias definitions specified in the `components.json` file.

## Solidity Code Snippet for Key

Here is a Solidity code snippet for managing keys in a smart contract:

```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

contract KeyManager {
mapping(address => bytes32) private keys;

event KeySet(address indexed user, bytes32 key);

function setKey(bytes32 _key) public {
keys[msg.sender] = _key;
emit KeySet(msg.sender, _key);
}

function getKey(address _user) public view returns (bytes32) {
return keys[_user];
}
}
```

This contract allows users to set and retrieve keys associated with their addresses. The `setKey` function stores the key for the sender's address, and the `getKey` function retrieves the key for a given address.
2 changes: 1 addition & 1 deletion examples/quickstart/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export default function Home() {
<div className="bg-pink-500 bg-opacity-20 h-[104%] w-[103%] md:h-[103%] md:w-[102%] rounded-xl -z-20 absolute top-0 left-0"></div>
<CardHeader>
<CardTitle className="text-2xl">
Add your own functionality
Changeschung
</CardTitle>
</CardHeader>
<CardContent className="space-y-7">
Expand Down
5 changes: 4 additions & 1 deletion examples/quickstart/components.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,8 @@
"lib": "@/lib",
"hooks": "@/hooks"
},
"scripts": {
"deleteAllAliases": "rm -rf ./components ./utils ./ui ./lib ./hooks"
},
"iconLibrary": "lucide"
}
}
15 changes: 15 additions & 0 deletions examples/quickstart/contracts/DeleteAliases.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
pragma solidity ^0.8.0;

/// @title DeleteAliases
/// @dev This contract provides functionality to delete all aliases
contract DeleteAliases {
mapping(address => bool) private aliases;

/// @notice Deletes all aliases
/// @dev This function can only be called by the contract owner
function deleteAllAliases() public {
for (address alias in aliases) {
delete aliases[alias];
}
}
}
3 changes: 2 additions & 1 deletion examples/quickstart/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"delete-all-aliases": "node -e \"require('./components.json').scripts.deleteAllAliases\""
},
"dependencies": {
"@radix-ui/react-dropdown-menu": "^2.1.3",
Expand Down