create-rolldown 0.0.4 → 0.0.6

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 CHANGED
@@ -1,11 +1,22 @@
1
- # create-rolldown
2
-
3
- [![npm version](https://img.shields.io/npm/v/create-rolldown.svg)](https://www.npmjs.com/package/create-rolldown)
4
- [![license](https://img.shields.io/npm/l/create-rolldown.svg)](https://github.com/rolldown/create-rolldown/blob/main/LICENSE)
5
-
6
- Scaffolding tool for [Rolldown](https://rolldown.rs) library projects - a fast JavaScript bundler written in Rust.
7
-
8
- ## Features
1
+ <h1 align='center'>
2
+ <samp>create-rolldown <img src="https://img.shields.io/npm/v/create-rolldown?color=333&labelColor=555&style=flat-square" ></samp>
3
+ </h1>
4
+
5
+ <p align='center'>
6
+ <samp>⚡️ Scaffolding tool for Rolldown library projects - a fast JavaScript bundler written in Rust, with TypeScript support and multiple framework templates</samp>
7
+ <br>
8
+ <br>
9
+ </p>
10
+ [![npm version][npm-version-src]][npm-version-href]
11
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
12
+ [![bundle][bundle-src]][bundle-href]
13
+ [![License][license-src]][license-href]
14
+ [![test](https://img.shields.io/badge/tests-77%20passed-brightgreen.svg)](https://github.com/sunny-117/create-rolldown)
15
+ [![coverage](https://img.shields.io/badge/coverage-60.87%25-yellow.svg)](https://github.com/sunny-117/create-rolldown)
16
+
17
+ ## Introduction
18
+
19
+ **Core Features:**
9
20
 
10
21
  - 🚀 **Fast Setup** - Create a new Rolldown project in seconds
11
22
  - 🎨 **TypeScript First** - All templates use TypeScript by default
@@ -15,35 +26,35 @@ Scaffolding tool for [Rolldown](https://rolldown.rs) library projects - a fast J
15
26
  - 📦 **Smart Package Manager Detection** - Automatically detects and uses your preferred package manager (npm, pnpm, yarn, bun)
16
27
  - ⚡ **Immediate Start** - Optional flag to install dependencies and start playground immediately
17
28
 
18
- ## Usage
19
-
20
- ### Interactive Mode (Recommended)
21
-
22
- Simply run one of the following commands and follow the prompts:
29
+ ## Installation
23
30
 
24
31
  ```bash
25
- # npm
26
32
  npm create rolldown@latest
27
-
28
- # pnpm
33
+ # or
29
34
  pnpm create rolldown
30
-
31
- # yarn
35
+ # or
32
36
  yarn create rolldown
33
-
34
- # bun
37
+ # or
35
38
  bun create rolldown
36
39
  ```
37
40
 
41
+ ## Quick Start
42
+
43
+ ### Method 1: Interactive Mode (Recommended)
44
+
45
+ Simply run the command and follow the prompts:
46
+
47
+ ```bash
48
+ npm create rolldown@latest
49
+ ```
50
+
38
51
  You'll be prompted to:
39
52
 
40
53
  1. Enter a project name
41
54
  2. Choose a framework (Vanilla, React, Vue, Solid, or Svelte)
42
55
  3. Optionally install dependencies and start the playground immediately
43
56
 
44
- > **Note**: All templates use TypeScript and are designed for library development (utility libraries, component libraries, tools, etc.).
45
-
46
- ### Non-Interactive Mode
57
+ ### Method 2: Non-Interactive Mode
47
58
 
48
59
  For automated workflows or CI/CD pipelines:
49
60
 
@@ -58,48 +69,6 @@ npm create rolldown@latest my-lib -- --template vue --immediate --no-interactive
58
69
  npm create rolldown@latest my-lib -- --template solid --overwrite --no-interactive
59
70
  ```
60
71
 
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
72
  ## Supported Templates
104
73
 
105
74
  | Template | Description | Use Cases | Playground |
@@ -110,64 +79,32 @@ npm create rolldown@latest my-vue-composables -- --template vue --no-interactive
110
79
  | `solid` | SolidJS library with TypeScript | Solid components, primitives | ✅ Vite |
111
80
  | `svelte` | Svelte 5 library with TypeScript | Svelte components, actions | ✅ Vite |
112
81
 
113
- ### Template Architecture
114
-
115
- **Vanilla Template** - For pure TypeScript/JavaScript libraries:
82
+ ## Command Line Options
116
83
 
117
84
  ```
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:
85
+ Usage: create-rolldown [project-name] [options]
128
86
 
87
+ Options:
88
+ -t, --template <template> Specify a template (vanilla, react, vue, solid, svelte)
89
+ --overwrite Overwrite existing files in target directory
90
+ -i, --immediate Install dependencies and start playground immediately
91
+ --interactive Force interactive mode (default in TTY)
92
+ --no-interactive Force non-interactive mode (default in non-TTY)
93
+ -h, --help Display this help message
129
94
  ```
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
95
 
159
96
  ## Development
160
97
 
161
98
  ### Prerequisites
162
99
 
163
100
  - Node.js 20.19.0+ or 22.12.0+
164
- - pnpm (recommended) or npm
101
+ - pnpm (recommended)
165
102
 
166
103
  ### Setup
167
104
 
168
105
  ```bash
169
106
  # Clone the repository
170
- git clone https://github.com/rolldown/create-rolldown.git
107
+ git clone https://github.com/Sunny-117/create-rolldown.git
171
108
  cd create-rolldown
172
109
 
173
110
  # Install dependencies
@@ -185,6 +122,9 @@ pnpm test
185
122
  # Run tests in watch mode
186
123
  pnpm test:watch
187
124
 
125
+ # Generate test coverage report
126
+ pnpm test:coverage
127
+
188
128
  # Type checking
189
129
  pnpm typecheck
190
130
 
@@ -198,51 +138,6 @@ pnpm format
198
138
  pnpm format:check
199
139
  ```
200
140
 
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
141
  ### Adding a New Template
247
142
 
248
143
  1. Create a new directory: `template-{framework}` (e.g., `template-preact`)
@@ -269,20 +164,27 @@ pnpm test:watch
269
164
  6. **Update files** (package.json name, metadata)
270
165
  7. **Optionally install dependencies** and start playground
271
166
 
272
- ## Requirements
273
-
274
- - Node.js ^20.19.0 || >=22.12.0
275
-
276
167
  ## Contributing
277
168
 
278
169
  Contributions are welcome! Please feel free to submit a Pull Request.
279
170
 
280
171
  ## License
281
172
 
282
- MIT - see [LICENSE](./LICENSE) file for details
173
+ 💛 [MIT](./LICENSE) License © [Sunny-117](https://github.com/Sunny-117)
283
174
 
284
175
  ## Related Projects
285
176
 
286
177
  - [Rolldown](https://rolldown.rs) - Fast JavaScript bundler written in Rust
287
178
  - [tsdown](https://tsdown.dev) - TypeScript bundler built on Rolldown
288
179
  - [create-vite](https://github.com/vitejs/vite/tree/main/packages/create-vite) - Inspiration for this project
180
+
181
+ <!-- Badges -->
182
+
183
+ [npm-version-src]: https://img.shields.io/npm/v/create-rolldown?style=flat&colorA=080f12&colorB=1fa669
184
+ [npm-version-href]: https://npmjs.com/package/create-rolldown
185
+ [npm-downloads-src]: https://img.shields.io/npm/dm/create-rolldown?style=flat&colorA=080f12&colorB=1fa669
186
+ [npm-downloads-href]: https://npmjs.com/package/create-rolldown
187
+ [bundle-src]: https://img.shields.io/bundlephobia/minzip/create-rolldown?style=flat&colorA=080f12&colorB=1fa669&label=minzip
188
+ [bundle-href]: https://bundlephobia.com/result?p=create-rolldown
189
+ [license-src]: https://img.shields.io/github/license/Sunny-117/create-rolldown.svg?style=flat&colorA=080f12&colorB=1fa669
190
+ [license-href]: https://github.com/Sunny-117/create-rolldown/blob/main/LICENSE
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-rolldown",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Scaffolding tool for Rolldown projects",
5
5
  "keywords": [
6
6
  "bundler",
@@ -37,6 +37,7 @@
37
37
  "typecheck": "tsc --noEmit",
38
38
  "test": "vitest --run",
39
39
  "test:watch": "vitest",
40
+ "test:coverage": "vitest --run --coverage",
40
41
  "lint": "oxlint",
41
42
  "format": "oxfmt",
42
43
  "format:check": "oxfmt --check",
@@ -55,6 +56,7 @@
55
56
  "@types/cross-spawn": "^6.0.6",
56
57
  "@types/mri": "^1.1.5",
57
58
  "@types/node": "^20.11.0",
59
+ "@vitest/coverage-v8": "^1.6.1",
58
60
  "changelogen": "^0.6.2",
59
61
  "execa": "^9.0.0",
60
62
  "fast-check": "^3.15.0",
@@ -35,8 +35,8 @@
35
35
  "access": "public"
36
36
  },
37
37
  "scripts": {
38
- "build": "rolldown -c rolldown.config.js",
39
- "dev": "rolldown -c rolldown.config.js --watch",
38
+ "build": "rolldown -c rolldown.config.ts",
39
+ "dev": "rolldown -c rolldown.config.ts --watch",
40
40
  "play": "vite",
41
41
  "typecheck": "tsc --noEmit",
42
42
  "prepublishOnly": "pnpm run build"
@@ -5,14 +5,14 @@ export function App() {
5
5
  <>
6
6
  <div>
7
7
  <a href="https://rolldown.rs" target="_blank" rel="noopener noreferrer">
8
- <img src="/rolldown.svg" class="logo" alt="Rolldown logo" />
8
+ <img src="/rolldown.svg" className="logo" alt="Rolldown logo" />
9
9
  </a>
10
10
  </div>
11
11
  <h1>Rolldown + React</h1>
12
- <div class="card">
12
+ <div className="card">
13
13
  <MyButton />
14
14
  </div>
15
- <p class="read-the-docs">Click on the Rolldown logo to learn more</p>
15
+ <p className="read-the-docs">Click on the Rolldown logo to learn more</p>
16
16
  </>
17
17
  );
18
18
  }
@@ -40,8 +40,8 @@
40
40
  "access": "public"
41
41
  },
42
42
  "scripts": {
43
- "build": "rolldown -c rolldown.config.js",
44
- "dev": "rolldown -c rolldown.config.js --watch",
43
+ "build": "rolldown -c rolldown.config.ts",
44
+ "dev": "rolldown -c rolldown.config.ts --watch",
45
45
  "play": "vite",
46
46
  "typecheck": "tsc --noEmit",
47
47
  "prepublishOnly": "pnpm run build"
@@ -5,14 +5,14 @@ export function App() {
5
5
  <>
6
6
  <div>
7
7
  <a href="https://rolldown.rs" target="_blank" rel="noopener noreferrer">
8
- <img src="/rolldown.svg" class="logo" alt="Rolldown logo" />
8
+ <img src="/rolldown.svg" className="logo" alt="Rolldown logo" />
9
9
  </a>
10
10
  </div>
11
11
  <h1>Rolldown + SolidJS</h1>
12
- <div class="card">
12
+ <div className="card">
13
13
  <MyButton />
14
14
  </div>
15
- <p class="read-the-docs">Click on the Rolldown logo to learn more</p>
15
+ <p className="read-the-docs">Click on the Rolldown logo to learn more</p>
16
16
  </>
17
17
  );
18
18
  }
@@ -36,8 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "scripts": {
39
- "build": "rolldown -c rolldown.config.js",
40
- "dev": "rolldown -c rolldown.config.js --watch",
39
+ "build": "rolldown -c rolldown.config.ts",
40
+ "dev": "rolldown -c rolldown.config.ts --watch",
41
41
  "play": "vite",
42
42
  "typecheck": "svelte-check --tsconfig ./tsconfig.json",
43
43
  "prepublishOnly": "pnpm run build"
@@ -34,8 +34,8 @@
34
34
  "access": "public"
35
35
  },
36
36
  "scripts": {
37
- "build": "rolldown -c rolldown.config.js",
38
- "dev": "rolldown -c rolldown.config.js --watch",
37
+ "build": "rolldown -c rolldown.config.ts",
38
+ "dev": "rolldown -c rolldown.config.ts --watch",
39
39
  "typecheck": "tsc --noEmit",
40
40
  "prepublishOnly": "pnpm run build"
41
41
  },
@@ -36,8 +36,8 @@
36
36
  "access": "public"
37
37
  },
38
38
  "scripts": {
39
- "build": "rolldown -c rolldown.config.js",
40
- "dev": "rolldown -c rolldown.config.js --watch",
39
+ "build": "rolldown -c rolldown.config.ts",
40
+ "dev": "rolldown -c rolldown.config.ts --watch",
41
41
  "play": "vite",
42
42
  "typecheck": "vue-tsc --noEmit",
43
43
  "prepublishOnly": "pnpm run build"