@blu1606/create-walrus-app 0.1.0 → 0.1.4
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/README.md +215 -0
- package/dist/context.js +3 -2
- package/dist/index.js +3 -2
- package/dist/prompts.js +5 -3
- package/package.json +68 -67
- package/templates/gallery/src/App.tsx +1 -1
- package/templates/gallery/src/components/FileCard.tsx +1 -1
- package/templates/gallery/src/components/UploadModal.tsx +1 -1
- package/templates/react/src/index.ts +2 -2
- package/templates/sdk-mysten/package.json +1 -1
- package/templates/sdk-mysten/src/adapter.ts +1 -1
- package/templates/sdk-mysten/src/client.ts +2 -2
- package/templates/sdk-mysten/src/config.ts +1 -1
- package/templates/sdk-mysten/src/index.ts +1 -1
- package/templates/simple-upload/src/App.tsx +1 -1
- package/templates/simple-upload/src/components/FilePreview.tsx +1 -1
- package/templates/simple-upload/src/components/UploadForm.tsx +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
# create-walrus-app
|
|
2
|
+
|
|
3
|
+
Interactive CLI for scaffolding Walrus applications on the Sui blockchain.
|
|
4
|
+
|
|
5
|
+
## Quick Start
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Using npm
|
|
9
|
+
npx @blu1606/create-walrus-app
|
|
10
|
+
|
|
11
|
+
# Using pnpm
|
|
12
|
+
pnpm create @blu1606/walrus-app
|
|
13
|
+
|
|
14
|
+
# Using yarn
|
|
15
|
+
yarn create @blu1606/walrus-app
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## What is Walrus?
|
|
19
|
+
|
|
20
|
+
Walrus is a decentralized storage network built on the Sui blockchain, designed for storing and retrieving large files efficiently and securely.
|
|
21
|
+
|
|
22
|
+
## Features
|
|
23
|
+
|
|
24
|
+
- 🚀 **Interactive CLI** - Easy-to-use prompts guide you through project setup
|
|
25
|
+
- 📦 **Multiple Templates** - Choose from various pre-built templates
|
|
26
|
+
- ⚡ **Modern Stack** - Built with TypeScript, React, and Vite
|
|
27
|
+
- 🎨 **Ready to Use** - Includes all necessary dependencies and configurations
|
|
28
|
+
- 🔧 **Customizable** - Easy to extend and modify for your needs
|
|
29
|
+
|
|
30
|
+
## Available Templates
|
|
31
|
+
|
|
32
|
+
### 1. Simple Upload
|
|
33
|
+
Basic file upload and download functionality.
|
|
34
|
+
- Upload any file to Walrus
|
|
35
|
+
- Get Blob ID after upload
|
|
36
|
+
- Download file by Blob ID
|
|
37
|
+
- File size display
|
|
38
|
+
|
|
39
|
+
### 2. Gallery
|
|
40
|
+
Manage multiple files with a persistent index.
|
|
41
|
+
- Upload multiple files
|
|
42
|
+
- Grid view of all files
|
|
43
|
+
- Local index (localStorage)
|
|
44
|
+
- Delete files from gallery
|
|
45
|
+
- File metadata display
|
|
46
|
+
|
|
47
|
+
### 3. React Template
|
|
48
|
+
Full React application template with TypeScript.
|
|
49
|
+
- Component-based architecture
|
|
50
|
+
- TypeScript support
|
|
51
|
+
- Modern React patterns
|
|
52
|
+
- Vite for fast development
|
|
53
|
+
|
|
54
|
+
### 4. SDK Mysten
|
|
55
|
+
Integration with Mysten Labs SDK.
|
|
56
|
+
- Wallet integration
|
|
57
|
+
- Transaction handling
|
|
58
|
+
- Sui blockchain interactions
|
|
59
|
+
|
|
60
|
+
### 5. Base Template
|
|
61
|
+
Minimal starting point for custom implementations.
|
|
62
|
+
- Clean slate
|
|
63
|
+
- Essential Walrus utilities
|
|
64
|
+
- No UI framework dependencies
|
|
65
|
+
|
|
66
|
+
## Usage
|
|
67
|
+
|
|
68
|
+
### Create a New Project
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
npx @blu1606/create-walrus-app my-walrus-app
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Follow the interactive prompts:
|
|
75
|
+
1. Enter your project name
|
|
76
|
+
2. Select a template
|
|
77
|
+
3. Choose package manager (npm/pnpm/yarn)
|
|
78
|
+
4. Wait for dependencies installation
|
|
79
|
+
|
|
80
|
+
### Start Development
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
cd my-walrus-app
|
|
84
|
+
npm run dev
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Your app will be running at `http://localhost:5173`
|
|
88
|
+
|
|
89
|
+
## Project Structure
|
|
90
|
+
|
|
91
|
+
```
|
|
92
|
+
my-walrus-app/
|
|
93
|
+
├── src/
|
|
94
|
+
│ ├── components/ # React components
|
|
95
|
+
│ ├── utils/ # Utility functions
|
|
96
|
+
│ ├── App.tsx # Main app component
|
|
97
|
+
│ └── main.tsx # Entry point
|
|
98
|
+
├── public/ # Static assets
|
|
99
|
+
├── package.json # Dependencies and scripts
|
|
100
|
+
├── tsconfig.json # TypeScript configuration
|
|
101
|
+
└── vite.config.ts # Vite configuration
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Requirements
|
|
105
|
+
|
|
106
|
+
- Node.js >= 20.0.0
|
|
107
|
+
- npm >= 9.0.0 or pnpm >= 9.0.0
|
|
108
|
+
|
|
109
|
+
## Common Scripts
|
|
110
|
+
|
|
111
|
+
All templates include these scripts:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Start development server
|
|
115
|
+
npm run dev
|
|
116
|
+
|
|
117
|
+
# Build for production
|
|
118
|
+
npm run build
|
|
119
|
+
|
|
120
|
+
# Preview production build
|
|
121
|
+
npm run preview
|
|
122
|
+
|
|
123
|
+
# Lint code
|
|
124
|
+
npm run lint
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Configuration
|
|
128
|
+
|
|
129
|
+
### Walrus Configuration
|
|
130
|
+
|
|
131
|
+
Each template comes with Walrus utilities pre-configured. You can customize:
|
|
132
|
+
|
|
133
|
+
- **Aggregator URL**: Set in your Walrus client configuration
|
|
134
|
+
- **Publisher URL**: Configure for file uploads
|
|
135
|
+
- **Storage settings**: Adjust based on your needs
|
|
136
|
+
|
|
137
|
+
### Environment Variables
|
|
138
|
+
|
|
139
|
+
Create a `.env` file in your project root:
|
|
140
|
+
|
|
141
|
+
```env
|
|
142
|
+
VITE_WALRUS_AGGREGATOR_URL=https://aggregator.walrus-testnet.walrus.space
|
|
143
|
+
VITE_WALRUS_PUBLISHER_URL=https://publisher.walrus-testnet.walrus.space
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## API Reference
|
|
147
|
+
|
|
148
|
+
### Upload File
|
|
149
|
+
|
|
150
|
+
```typescript
|
|
151
|
+
import { uploadToWalrus } from './utils/walrus';
|
|
152
|
+
|
|
153
|
+
const blob = await uploadToWalrus(file);
|
|
154
|
+
console.log('Blob ID:', blob.blobId);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Download File
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
import { downloadFromWalrus } from './utils/walrus';
|
|
161
|
+
|
|
162
|
+
const blob = await downloadFromWalrus(blobId);
|
|
163
|
+
// Use the blob data
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Troubleshooting
|
|
167
|
+
|
|
168
|
+
### Installation Issues
|
|
169
|
+
|
|
170
|
+
If you encounter installation errors:
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
# Clear npm cache
|
|
174
|
+
npm cache clean --force
|
|
175
|
+
|
|
176
|
+
# Try with different package manager
|
|
177
|
+
pnpm create @blu1606/walrus-app
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### Build Errors
|
|
181
|
+
|
|
182
|
+
Ensure you're using the correct Node.js version:
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
node --version # Should be >= 20.0.0
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
## Examples
|
|
189
|
+
|
|
190
|
+
Check out the [examples directory](https://github.com/blu1606/walrus-starter-kit/tree/main/examples) for complete working applications.
|
|
191
|
+
|
|
192
|
+
## Contributing
|
|
193
|
+
|
|
194
|
+
Contributions are welcome! Please read our [Contributing Guide](https://github.com/blu1606/walrus-starter-kit/blob/main/CONTRIBUTING.md) for details.
|
|
195
|
+
|
|
196
|
+
## Resources
|
|
197
|
+
|
|
198
|
+
- [Walrus Documentation](https://docs.walrus.site/)
|
|
199
|
+
- [Sui Documentation](https://docs.sui.io/)
|
|
200
|
+
- [GitHub Repository](https://github.com/blu1606/walrus-starter-kit)
|
|
201
|
+
- [Issue Tracker](https://github.com/blu1606/walrus-starter-kit/issues)
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
MIT © [blu1606](https://github.com/blu1606)
|
|
206
|
+
|
|
207
|
+
## Support
|
|
208
|
+
|
|
209
|
+
- 📧 Email: dongthanhquandtq@gmail.com
|
|
210
|
+
- 🐛 Issues: [GitHub Issues](https://github.com/blu1606/walrus-starter-kit/issues)
|
|
211
|
+
- 💬 Discussions: [GitHub Discussions](https://github.com/blu1606/walrus-starter-kit/discussions)
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
Made with ❤️ for the Walrus and Sui community
|
package/dist/context.js
CHANGED
|
@@ -36,8 +36,9 @@ export function buildContext(args, promptResults) {
|
|
|
36
36
|
sdk,
|
|
37
37
|
framework,
|
|
38
38
|
useCase,
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
// Temporarily disabled until templates are implemented
|
|
40
|
+
analytics: false, // Boolean(merged.analytics),
|
|
41
|
+
tailwind: false, // Boolean(merged.tailwind),
|
|
41
42
|
packageManager: packageManager,
|
|
42
43
|
};
|
|
43
44
|
}
|
package/dist/index.js
CHANGED
|
@@ -23,8 +23,9 @@ program
|
|
|
23
23
|
.option('--sdk <sdk>', 'SDK to use (mysten | tusky | hibernuts)')
|
|
24
24
|
.option('--framework <framework>', 'Framework (react | vue | plain-ts)')
|
|
25
25
|
.option('--use-case <use-case>', 'Use case (simple-upload | gallery | defi-nft)')
|
|
26
|
-
|
|
27
|
-
.option('--
|
|
26
|
+
// TODO: Re-enable when templates are implemented
|
|
27
|
+
// .option('--analytics', 'Include Blockberry analytics', false)
|
|
28
|
+
// .option('--no-tailwind', 'Exclude Tailwind CSS')
|
|
28
29
|
.option('--skip-install', 'Skip dependency installation', false)
|
|
29
30
|
.option('--skip-git', 'Skip git initialization', false)
|
|
30
31
|
.option('--skip-validation', 'Skip project validation', false)
|
package/dist/prompts.js
CHANGED
|
@@ -73,16 +73,18 @@ export async function runPrompts(initial = {}) {
|
|
|
73
73
|
},
|
|
74
74
|
},
|
|
75
75
|
{
|
|
76
|
-
|
|
76
|
+
// TODO: Re-enable when analytics template is created
|
|
77
|
+
type: null, // Temporarily disabled - template not implemented
|
|
77
78
|
name: 'analytics',
|
|
78
79
|
message: 'Include Blockberry analytics?',
|
|
79
80
|
initial: false,
|
|
80
81
|
},
|
|
81
82
|
{
|
|
82
|
-
|
|
83
|
+
// TODO: Re-enable when tailwind template is created
|
|
84
|
+
type: null, // Temporarily disabled - template not implemented
|
|
83
85
|
name: 'tailwind',
|
|
84
86
|
message: 'Include Tailwind CSS?',
|
|
85
|
-
initial:
|
|
87
|
+
initial: false, // Changed to false to prevent layer lookup
|
|
86
88
|
},
|
|
87
89
|
{
|
|
88
90
|
type: initial.packageManager ? null : 'select',
|
package/package.json
CHANGED
|
@@ -1,68 +1,69 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@blu1606/create-walrus-app",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Interactive CLI for scaffolding Walrus applications",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"create-walrus-app": "./dist/index.js"
|
|
8
|
-
},
|
|
9
|
-
"files": [
|
|
10
|
-
"dist",
|
|
11
|
-
"templates"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"test
|
|
18
|
-
"test:
|
|
19
|
-
"test:
|
|
20
|
-
"test:
|
|
21
|
-
"test:
|
|
22
|
-
"test:
|
|
23
|
-
"test:
|
|
24
|
-
"test:
|
|
25
|
-
"
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"
|
|
46
|
-
"
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
"@types/
|
|
52
|
-
"@types/
|
|
53
|
-
"@types/
|
|
54
|
-
"@
|
|
55
|
-
"@vitest/
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
"
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
"
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@blu1606/create-walrus-app",
|
|
3
|
+
"version": "0.1.4",
|
|
4
|
+
"description": "Interactive CLI for scaffolding Walrus applications",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"create-walrus-app": "./dist/index.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"templates",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"test": "vitest run",
|
|
18
|
+
"test:watch": "vitest",
|
|
19
|
+
"test:ui": "vitest --ui",
|
|
20
|
+
"test:coverage": "vitest run --coverage",
|
|
21
|
+
"test:integration": "node tests/integration/integration.test.mjs",
|
|
22
|
+
"test:validation": "node tests/integration/validation.test.mjs",
|
|
23
|
+
"test:manual": "node tests/integration/manual.test.js",
|
|
24
|
+
"test:e2e": "node tests/integration/cli.e2e.test.mjs",
|
|
25
|
+
"test:all": "vitest run && pnpm test:e2e",
|
|
26
|
+
"prepublishOnly": "pnpm build"
|
|
27
|
+
},
|
|
28
|
+
"keywords": [
|
|
29
|
+
"walrus",
|
|
30
|
+
"sui",
|
|
31
|
+
"scaffold",
|
|
32
|
+
"cli",
|
|
33
|
+
"template"
|
|
34
|
+
],
|
|
35
|
+
"author": "blu1606 dongthanhquandtq@gmail.com",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"repository": {
|
|
38
|
+
"type": "git",
|
|
39
|
+
"url": "https://github.com/blu1606/walrus-starter-kit.git",
|
|
40
|
+
"directory": "packages/cli"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"commander": "^11.1.0",
|
|
44
|
+
"cross-spawn": "^7.0.3",
|
|
45
|
+
"fs-extra": "^11.2.0",
|
|
46
|
+
"kleur": "^4.1.5",
|
|
47
|
+
"prompts": "^2.4.2",
|
|
48
|
+
"sort-package-json": "^2.10.1"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@types/cross-spawn": "^6.0.6",
|
|
52
|
+
"@types/fs-extra": "^11.0.4",
|
|
53
|
+
"@types/node": "^20.11.0",
|
|
54
|
+
"@types/prompts": "^2.4.9",
|
|
55
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
56
|
+
"@vitest/ui": "^4.0.17",
|
|
57
|
+
"execa": "^9.5.2",
|
|
58
|
+
"strip-ansi": "^7.1.0",
|
|
59
|
+
"typescript": "^5.3.0",
|
|
60
|
+
"vitest": "^4.0.17"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": "^20.0.0 || ^22.0.0 || >=24.0.0",
|
|
64
|
+
"pnpm": ">=9.0.0"
|
|
65
|
+
},
|
|
66
|
+
"publishConfig": {
|
|
67
|
+
"access": "public"
|
|
68
|
+
}
|
|
68
69
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
|
-
import { Layout } from '
|
|
2
|
+
import { Layout } from './components/Layout.js';
|
|
3
3
|
import { GalleryGrid } from './components/GalleryGrid.js';
|
|
4
4
|
import { UploadModal } from './components/UploadModal.js';
|
|
5
5
|
import './styles.css';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Re-export storage adapter from SDK layer for use case templates
|
|
2
|
-
export { storageAdapter } from '
|
|
2
|
+
export { storageAdapter } from './adapters/storage.js';
|
|
3
3
|
|
|
4
4
|
// Re-export base adapter types
|
|
5
5
|
export type {
|
|
@@ -7,4 +7,4 @@ export type {
|
|
|
7
7
|
BlobMetadata,
|
|
8
8
|
UploadOptions,
|
|
9
9
|
DownloadOptions,
|
|
10
|
-
} from '
|
|
10
|
+
} from './adapters/storage.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { WalrusClient } from '@mysten/walrus';
|
|
2
2
|
import { SuiClient, getFullnodeUrl } from '@mysten/sui/client';
|
|
3
|
-
import { loadEnv } from '
|
|
3
|
+
import { loadEnv } from '../utils/env.js';
|
|
4
4
|
import { getNetworkConfig } from './config.js';
|
|
5
|
-
import type { WalrusNetwork } from '
|
|
5
|
+
import type { WalrusNetwork } from '../types/walrus.js';
|
|
6
6
|
|
|
7
7
|
let walrusClient: WalrusClient | null = null;
|
|
8
8
|
|