create-rolldown 0.0.0 → 0.0.1
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/{LICENSE.md → LICENSE} +1 -1
- package/README.md +280 -18
- package/dist/cli.js +657 -0
- package/dist/cli.js.map +1 -0
- package/index.js +4 -0
- package/package.json +55 -44
- package/template-react/LICENSE +21 -0
- package/template-react/README.md +164 -0
- package/template-solid/LICENSE +21 -0
- package/template-solid/README.md +168 -0
- package/template-svelte/LICENSE +21 -0
- package/template-svelte/README.md +161 -0
- package/template-vanilla/LICENSE +21 -0
- package/template-vanilla/README.md +124 -0
- package/template-vue/LICENSE +21 -0
- package/template-vue/README.md +165 -0
- package/dist/index.d.mts +0 -4
- package/dist/index.mjs +0 -4
package/{LICENSE.md → LICENSE}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2026 Sunny-117
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
package/README.md
CHANGED
|
@@ -1,26 +1,288 @@
|
|
|
1
1
|
# create-rolldown
|
|
2
2
|
|
|
3
|
-
[![npm version]
|
|
4
|
-
[![
|
|
5
|
-
[![bundle][bundle-src]][bundle-href]
|
|
6
|
-
[![JSDocs][jsdocs-src]][jsdocs-href]
|
|
7
|
-
[![License][license-src]][license-href]
|
|
3
|
+
[](https://www.npmjs.com/package/create-rolldown)
|
|
4
|
+
[](https://github.com/rolldown/create-rolldown/blob/main/LICENSE)
|
|
8
5
|
|
|
9
|
-
|
|
6
|
+
Scaffolding tool for [Rolldown](https://rolldown.rs) library projects - a fast JavaScript bundler written in Rust.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- 🚀 **Fast Setup** - Create a new Rolldown project in seconds
|
|
11
|
+
- 🎨 **TypeScript First** - All templates use TypeScript by default
|
|
12
|
+
- 📦 **Library Development Focus** - Templates designed for building and publishing JavaScript/TypeScript libraries, component libraries, and utility packages
|
|
13
|
+
- 🎮 **Playground Included** - Framework templates include a Vite-powered playground for development and testing
|
|
14
|
+
- 🔧 **Interactive & Non-Interactive Modes** - Flexible usage for both manual and automated workflows
|
|
15
|
+
- 📦 **Smart Package Manager Detection** - Automatically detects and uses your preferred package manager (npm, pnpm, yarn, bun)
|
|
16
|
+
- ⚡ **Immediate Start** - Optional flag to install dependencies and start playground immediately
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
### Interactive Mode (Recommended)
|
|
21
|
+
|
|
22
|
+
Simply run one of the following commands and follow the prompts:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
# npm
|
|
26
|
+
npm create rolldown@latest
|
|
27
|
+
|
|
28
|
+
# pnpm
|
|
29
|
+
pnpm create rolldown
|
|
30
|
+
|
|
31
|
+
# yarn
|
|
32
|
+
yarn create rolldown
|
|
33
|
+
|
|
34
|
+
# bun
|
|
35
|
+
bun create rolldown
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
You'll be prompted to:
|
|
39
|
+
|
|
40
|
+
1. Enter a project name
|
|
41
|
+
2. Choose a framework (Vanilla, React, Vue, Solid, or Svelte)
|
|
42
|
+
3. Optionally install dependencies and start the playground immediately
|
|
43
|
+
|
|
44
|
+
> **Note**: All templates use TypeScript and are designed for library development (utility libraries, component libraries, tools, etc.).
|
|
45
|
+
|
|
46
|
+
### Non-Interactive Mode
|
|
47
|
+
|
|
48
|
+
For automated workflows or CI/CD pipelines:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
# Create a project with all options specified
|
|
52
|
+
npm create rolldown@latest my-lib -- --template react --no-interactive
|
|
53
|
+
|
|
54
|
+
# With immediate install and start
|
|
55
|
+
npm create rolldown@latest my-lib -- --template vue --immediate --no-interactive
|
|
56
|
+
|
|
57
|
+
# Overwrite existing directory
|
|
58
|
+
npm create rolldown@latest my-lib -- --template solid --overwrite --no-interactive
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Command Line Options
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
Usage: create-rolldown [project-name] [options]
|
|
65
|
+
|
|
66
|
+
Options:
|
|
67
|
+
-t, --template <template> Specify a template (vanilla, react, vue, solid, svelte)
|
|
68
|
+
--overwrite Overwrite existing files in target directory
|
|
69
|
+
-i, --immediate Install dependencies and start playground immediately
|
|
70
|
+
--interactive Force interactive mode (default in TTY)
|
|
71
|
+
--no-interactive Force non-interactive mode (default in non-TTY)
|
|
72
|
+
-h, --help Display this help message
|
|
73
|
+
|
|
74
|
+
Available templates:
|
|
75
|
+
vanilla Vanilla TypeScript library
|
|
76
|
+
react React component library
|
|
77
|
+
vue Vue component library
|
|
78
|
+
solid SolidJS component library
|
|
79
|
+
svelte Svelte component library
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Examples
|
|
83
|
+
|
|
84
|
+
### Create a React library (components, hooks, utilities)
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
npm create rolldown@latest my-react-lib
|
|
88
|
+
# Select "react"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Create a utility library and start immediately
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
npm create rolldown@latest my-utils -- --template vanilla --immediate
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
### Create a Vue composables library in CI/CD
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
npm create rolldown@latest my-vue-composables -- --template vue --no-interactive
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Supported Templates
|
|
104
|
+
|
|
105
|
+
| Template | Description | Use Cases | Playground |
|
|
106
|
+
| --------- | -------------------------------- | ---------------------------------- | ---------- |
|
|
107
|
+
| `vanilla` | Vanilla TypeScript library | Utility libraries, tools, helpers | ❌ |
|
|
108
|
+
| `react` | React library with TypeScript | React components, hooks, utilities | ✅ Vite |
|
|
109
|
+
| `vue` | Vue 3 library with TypeScript | Vue components, composables | ✅ Vite |
|
|
110
|
+
| `solid` | SolidJS library with TypeScript | Solid components, primitives | ✅ Vite |
|
|
111
|
+
| `svelte` | Svelte 5 library with TypeScript | Svelte components, actions | ✅ Vite |
|
|
112
|
+
|
|
113
|
+
### Template Architecture
|
|
114
|
+
|
|
115
|
+
**Vanilla Template** - For pure TypeScript/JavaScript libraries:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
your-library/
|
|
119
|
+
├── src/
|
|
120
|
+
│ └── index.ts # Main entry point
|
|
121
|
+
├── dist/ # Build output (generated)
|
|
122
|
+
├── rolldown.config.ts
|
|
123
|
+
├── tsconfig.json
|
|
124
|
+
└── package.json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Framework Templates** (React, Vue, Solid, Svelte) - For framework-specific libraries:
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
your-library/
|
|
131
|
+
├── src/ # Component library source code
|
|
132
|
+
│ ├── index.ts # Main entry point (exports)
|
|
133
|
+
│ └── MyButton.* # Example component
|
|
134
|
+
├── playground/ # Development playground (Vite)
|
|
135
|
+
│ ├── src/
|
|
136
|
+
│ │ ├── App.* # Playground app
|
|
137
|
+
│ │ ├── index.* # Playground entry
|
|
138
|
+
│ │ └── style.css # Playground styles
|
|
139
|
+
│ ├── index.html
|
|
140
|
+
│ └── public/
|
|
141
|
+
├── dist/ # Build output (generated)
|
|
142
|
+
├── rolldown.config.js # Rolldown configuration
|
|
143
|
+
├── vite.config.ts # Vite configuration (for playground)
|
|
144
|
+
├── tsconfig.json
|
|
145
|
+
├── package.json
|
|
146
|
+
└── README.md
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
**Key Features:**
|
|
150
|
+
|
|
151
|
+
- `src/` - Your library source code (built with Rolldown)
|
|
152
|
+
- `playground/` - Development environment (powered by Vite with HMR)
|
|
153
|
+
- `npm run build` - Build library with Rolldown
|
|
154
|
+
- `npm run dev` - Watch mode for library development
|
|
155
|
+
- `npm run play` - Start Vite playground for testing your library
|
|
156
|
+
- Ready for npm publishing with proper exports configuration
|
|
157
|
+
- Perfect for component libraries, utility libraries, hooks, composables, and more
|
|
158
|
+
|
|
159
|
+
## Development
|
|
160
|
+
|
|
161
|
+
### Prerequisites
|
|
162
|
+
|
|
163
|
+
- Node.js 20.19.0+ or 22.12.0+
|
|
164
|
+
- pnpm (recommended) or npm
|
|
165
|
+
|
|
166
|
+
### Setup
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
# Clone the repository
|
|
170
|
+
git clone https://github.com/rolldown/create-rolldown.git
|
|
171
|
+
cd create-rolldown
|
|
172
|
+
|
|
173
|
+
# Install dependencies
|
|
174
|
+
pnpm install
|
|
175
|
+
|
|
176
|
+
# Run in development mode (watch mode)
|
|
177
|
+
pnpm dev
|
|
178
|
+
|
|
179
|
+
# Build for production
|
|
180
|
+
pnpm build
|
|
181
|
+
|
|
182
|
+
# Run tests
|
|
183
|
+
pnpm test
|
|
184
|
+
|
|
185
|
+
# Run tests in watch mode
|
|
186
|
+
pnpm test:watch
|
|
187
|
+
|
|
188
|
+
# Type checking
|
|
189
|
+
pnpm typecheck
|
|
190
|
+
|
|
191
|
+
# Linting
|
|
192
|
+
pnpm lint
|
|
193
|
+
|
|
194
|
+
# Format code
|
|
195
|
+
pnpm format
|
|
196
|
+
|
|
197
|
+
# Check formatting
|
|
198
|
+
pnpm format:check
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
### Project Structure
|
|
202
|
+
|
|
203
|
+
```
|
|
204
|
+
create-rolldown/
|
|
205
|
+
├── src/
|
|
206
|
+
│ ├── cli.ts # Main CLI entry point
|
|
207
|
+
│ └── utils/ # Utility modules
|
|
208
|
+
│ ├── args.ts # Argument parsing
|
|
209
|
+
│ ├── command.ts # Command execution
|
|
210
|
+
│ ├── constants.ts # Framework definitions
|
|
211
|
+
│ ├── file.ts # File operations
|
|
212
|
+
│ ├── package-manager.ts # Package manager detection
|
|
213
|
+
│ ├── prompts.ts # Interactive prompts
|
|
214
|
+
│ ├── types.ts # TypeScript types
|
|
215
|
+
│ └── validation.ts # Input validation
|
|
216
|
+
├── __tests__/
|
|
217
|
+
│ └── cli.spec.ts # Integration tests
|
|
218
|
+
├── template-vanilla/ # Vanilla TS template
|
|
219
|
+
├── template-react/ # React template
|
|
220
|
+
├── template-vue/ # Vue template
|
|
221
|
+
├── template-solid/ # Solid template
|
|
222
|
+
├── template-svelte/ # Svelte template
|
|
223
|
+
├── index.js # CLI entry point
|
|
224
|
+
├── package.json
|
|
225
|
+
└── tsconfig.json
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Testing
|
|
229
|
+
|
|
230
|
+
The project uses a comprehensive testing strategy:
|
|
231
|
+
|
|
232
|
+
- **Unit Tests**: Test specific functions and edge cases
|
|
233
|
+
- **Property-Based Tests**: Test universal properties across many inputs using [fast-check](https://github.com/dubzzz/fast-check)
|
|
234
|
+
- **Integration Tests**: Test complete CLI workflows
|
|
235
|
+
|
|
236
|
+
Run tests:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
# Run all tests once
|
|
240
|
+
pnpm test
|
|
241
|
+
|
|
242
|
+
# Run tests in watch mode
|
|
243
|
+
pnpm test:watch
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Adding a New Template
|
|
247
|
+
|
|
248
|
+
1. Create a new directory: `template-{framework}` (e.g., `template-preact`)
|
|
249
|
+
2. Add all necessary project files following the library structure:
|
|
250
|
+
- `src/` - Library source code
|
|
251
|
+
- `playground/` - Vite playground (optional, for framework templates)
|
|
252
|
+
- `rolldown.config.js` - Rolldown configuration
|
|
253
|
+
- `vite.config.ts` - Vite configuration (if playground exists)
|
|
254
|
+
- `package.json` - With proper exports and scripts
|
|
255
|
+
- `tsconfig.json` - TypeScript configuration
|
|
256
|
+
- `.gitignore` - Git ignore rules
|
|
257
|
+
- `README.md` - Template documentation
|
|
258
|
+
3. Use `.gitignore` (not `_gitignore`) - it will be preserved during scaffolding
|
|
259
|
+
4. Update `FRAMEWORKS` array in `src/utils/constants.ts`
|
|
260
|
+
5. Test the new template with both interactive and non-interactive modes
|
|
261
|
+
|
|
262
|
+
## How It Works
|
|
263
|
+
|
|
264
|
+
1. **Parse CLI arguments** using `mri`
|
|
265
|
+
2. **Detect mode** (interactive vs non-interactive based on TTY and flags)
|
|
266
|
+
3. **Collect configuration** (project name, template, options)
|
|
267
|
+
4. **Validate inputs** (package name format, directory conflicts)
|
|
268
|
+
5. **Copy template files** to target directory
|
|
269
|
+
6. **Update files** (package.json name, metadata)
|
|
270
|
+
7. **Optionally install dependencies** and start playground
|
|
271
|
+
|
|
272
|
+
## Requirements
|
|
273
|
+
|
|
274
|
+
- Node.js ^20.19.0 || >=22.12.0
|
|
275
|
+
|
|
276
|
+
## Contributing
|
|
277
|
+
|
|
278
|
+
Contributions are welcome! Please feel free to submit a Pull Request.
|
|
10
279
|
|
|
11
280
|
## License
|
|
12
281
|
|
|
13
|
-
[
|
|
282
|
+
MIT - see [LICENSE](./LICENSE) file for details
|
|
14
283
|
|
|
15
|
-
|
|
284
|
+
## Related Projects
|
|
16
285
|
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[npm-downloads-href]: https://npmjs.com/package/create-rolldown
|
|
21
|
-
[bundle-src]: https://img.shields.io/bundlephobia/minzip/create-rolldown?style=flat&colorA=080f12&colorB=1fa669&label=minzip
|
|
22
|
-
[bundle-href]: https://bundlephobia.com/result?p=create-rolldown
|
|
23
|
-
[license-src]: https://img.shields.io/github/license/Sunny-117/create-rolldown.svg?style=flat&colorA=080f12&colorB=1fa669
|
|
24
|
-
[license-href]: https://github.com/Sunny-117/create-rolldown/blob/main/LICENSE
|
|
25
|
-
[jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
|
|
26
|
-
[jsdocs-href]: https://www.jsdocs.io/package/create-rolldown
|
|
286
|
+
- [Rolldown](https://rolldown.rs) - Fast JavaScript bundler written in Rust
|
|
287
|
+
- [tsdown](https://tsdown.dev) - TypeScript bundler built on Rolldown
|
|
288
|
+
- [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite) - Inspiration for this project
|