itty-packager 1.6.9 → 1.6.11
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/.claude/settings.local.json +6 -1
- package/README.md +63 -25
- package/bun.lock +566 -0
- package/bunfig.toml +3 -0
- package/lib/builder.js +22 -21
- package/package.json +5 -2
- package/test/build.spec.ts +79 -0
- package/test/cli-integration.spec.ts +227 -0
- package/test/index.spec.ts +69 -0
- package/test/lint.spec.ts +56 -0
- package/test/prepare.spec.ts +207 -0
- package/test/release.spec.ts +283 -0
- package/utils/test-utils.ts +238 -0
|
@@ -10,7 +10,12 @@
|
|
|
10
10
|
"Bash(bun bin/itty.js:*)",
|
|
11
11
|
"Bash(npm config get:*)",
|
|
12
12
|
"Bash(npm whoami:*)",
|
|
13
|
-
"Bash(npm config:*)"
|
|
13
|
+
"Bash(npm config:*)",
|
|
14
|
+
"Bash(bun test:*)",
|
|
15
|
+
"Bash(bun:*)",
|
|
16
|
+
"Bash(rm:*)",
|
|
17
|
+
"Bash(mkdir:*)",
|
|
18
|
+
"Bash(sed:*)"
|
|
14
19
|
],
|
|
15
20
|
"deny": []
|
|
16
21
|
}
|
package/README.md
CHANGED
|
@@ -6,7 +6,9 @@
|
|
|
6
6
|
</a>
|
|
7
7
|
</p>
|
|
8
8
|
|
|
9
|
+
[](https://github.com/kwhitley/itty-packager)
|
|
9
10
|
[](https://npmjs.com/package/itty-packager)
|
|
11
|
+
[](https://coveralls.io/github/kwhitley/itty-packager)
|
|
10
12
|
[](https://github.com/kwhitley/itty-packager/issues)
|
|
11
13
|
[](https://discord.gg/53vyrZAu9u)
|
|
12
14
|
|
|
@@ -14,15 +16,16 @@
|
|
|
14
16
|
|
|
15
17
|
---
|
|
16
18
|
|
|
17
|
-
# Single dependency build +
|
|
19
|
+
# Single dependency build + release for TypeScript libraries.
|
|
18
20
|
|
|
19
|
-
Zero-config build, lint, and
|
|
21
|
+
Zero-config build, lint, prepare, and release - letting you deliver packages with minimal files and minimal bytes.
|
|
20
22
|
|
|
21
23
|
## Features
|
|
22
24
|
|
|
23
25
|
- **🔨 Build** - TypeScript compilation with Rollup, minification, and snippet generation
|
|
24
26
|
- **🔍 Lint** - Built-in ESLint configuration with TypeScript support and smart extending
|
|
25
|
-
-
|
|
27
|
+
- **🚀 Prepare** - Run lint, test, and build in sequence to verify your package
|
|
28
|
+
- **📦 Release** - Automated version bumping, git operations, and npm publishing with interactive commit messages
|
|
26
29
|
- **⚡ Zero Config** - Works out of the box, customize only what you need
|
|
27
30
|
- **🎯 Consistent** - Unified tooling across all itty projects
|
|
28
31
|
|
|
@@ -39,9 +42,9 @@ Add to your `package.json` scripts:
|
|
|
39
42
|
```json
|
|
40
43
|
{
|
|
41
44
|
"scripts": {
|
|
42
|
-
"build": "itty build",
|
|
43
|
-
"lint": "itty lint",
|
|
44
|
-
"
|
|
45
|
+
"build": "itty build --hybrid",
|
|
46
|
+
"lint": "itty lint",
|
|
47
|
+
"release": "itty release --prepare"
|
|
45
48
|
}
|
|
46
49
|
}
|
|
47
50
|
```
|
|
@@ -56,7 +59,7 @@ Build your TypeScript library with Rollup, TypeScript compilation, and optional
|
|
|
56
59
|
|
|
57
60
|
**Options:**
|
|
58
61
|
- `-f, --from <dir>` - Source directory (default: `src`)
|
|
59
|
-
- `-o, --out <dir>` - Output directory (default: `dist`)
|
|
62
|
+
- `-o, --out <dir>` - Output directory (default: `dist`)
|
|
60
63
|
- `-c, --copy <files>` - Files to copy to output (comma-separated)
|
|
61
64
|
- `--sourcemap` - Generate source maps (default: `false`)
|
|
62
65
|
- `--hybrid` - Build both ESM and CJS (default: ESM only)
|
|
@@ -75,7 +78,7 @@ Build your TypeScript library with Rollup, TypeScript compilation, and optional
|
|
|
75
78
|
**Examples:**
|
|
76
79
|
```bash
|
|
77
80
|
itty build # Basic ESM build, minified
|
|
78
|
-
itty build --hybrid --sourcemap # Build both ESM/CJS with sourcemaps
|
|
81
|
+
itty build --hybrid --sourcemap # Build both ESM/CJS with sourcemaps
|
|
79
82
|
itty build --snippet=connect # Build with snippet generation for README
|
|
80
83
|
itty build --from=lib --out=build # Build from lib/ to build/
|
|
81
84
|
```
|
|
@@ -119,11 +122,34 @@ itty lint --fix # Lint and auto-fix issues
|
|
|
119
122
|
itty lint --format=json # Output results in JSON format
|
|
120
123
|
```
|
|
121
124
|
|
|
122
|
-
### `itty
|
|
125
|
+
### `itty prepare`
|
|
126
|
+
|
|
127
|
+
Run lint, test, and build in sequence to prepare your package for release.
|
|
128
|
+
|
|
129
|
+
**Usage:** `itty prepare [options]`
|
|
130
|
+
|
|
131
|
+
**Options:**
|
|
132
|
+
- `-v, --verbose` - Show all output from underlying commands
|
|
133
|
+
- `-h, --help` - Show help
|
|
134
|
+
|
|
135
|
+
**Default Behavior:**
|
|
136
|
+
- Runs `lint` using package.json script or built-in command
|
|
137
|
+
- Runs `test` using package.json script (skips if not found)
|
|
138
|
+
- Runs `build` using package.json script or built-in command (skips if no src/ directory)
|
|
139
|
+
- Shows only progress messages unless `--verbose` is used
|
|
140
|
+
- Stops on first failure and shows error output
|
|
141
|
+
|
|
142
|
+
**Examples:**
|
|
143
|
+
```bash
|
|
144
|
+
itty prepare # Run lint, test, build silently (show only failures)
|
|
145
|
+
itty prepare --verbose # Run with full output from all commands
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### `itty release`
|
|
123
149
|
|
|
124
|
-
Version bump and
|
|
150
|
+
Version bump and release your package to npm with git operations and clean, flat package structure.
|
|
125
151
|
|
|
126
|
-
**Usage:** `itty
|
|
152
|
+
**Usage:** `itty release [options]`
|
|
127
153
|
|
|
128
154
|
**Version Options (default: patch):**
|
|
129
155
|
- `--major` - Major release X.#.# for breaking changes
|
|
@@ -131,20 +157,29 @@ Version bump and publish your package to npm with clean, flat package structure.
|
|
|
131
157
|
- `--patch` - Patch release #.#.X for bug fixes (default)
|
|
132
158
|
- `--type <type>` - Custom release type (alpha, beta, rc, etc.)
|
|
133
159
|
|
|
134
|
-
**
|
|
135
|
-
- `--src <dir>` - Source directory to
|
|
136
|
-
- `--
|
|
160
|
+
**Release Options:**
|
|
161
|
+
- `--src <dir>` - Source directory to release from (default: `dist`)
|
|
162
|
+
- `--root` - Release from root directory (equivalent to `--src=.`)
|
|
163
|
+
- `--dest <dir>` - Temporary directory for releasing (default: `.dist`)
|
|
137
164
|
- `--dry-run` - Build and prepare but do not publish
|
|
138
|
-
- `--no-cleanup` - Leave temporary directory after
|
|
165
|
+
- `--no-cleanup` - Leave temporary directory after releasing
|
|
139
166
|
- `--public` - Publish as public package (`--access=public`)
|
|
167
|
+
- `--prepare` - Run prepare (lint, test, build) before releasing
|
|
168
|
+
- `--silent` - Skip interactive prompts (use default commit message)
|
|
140
169
|
- `--no-license` - Do not copy LICENSE file to published package
|
|
141
170
|
- `-v, --verbose` - Show detailed output including npm and git command details
|
|
142
171
|
|
|
143
172
|
**Git Options:**
|
|
144
173
|
- `--tag` - Create git tag for release
|
|
145
|
-
- `--push` - Push changes and tags to git remote
|
|
174
|
+
- `--push` - Push changes and tags to git remote (prompts for commit message)
|
|
146
175
|
- `--no-git` - Skip all git operations
|
|
147
176
|
|
|
177
|
+
**Interactive Features:**
|
|
178
|
+
- When using `--push`, you'll be prompted for an optional commit message
|
|
179
|
+
- Press Enter to skip, Escape or Ctrl+C to cancel and revert version
|
|
180
|
+
- Multi-line commit messages supported
|
|
181
|
+
- Git tag uses the same message as the commit
|
|
182
|
+
|
|
148
183
|
**Default Behavior:**
|
|
149
184
|
- Defaults to patch version bump if no type specified
|
|
150
185
|
- Extracts build artifacts to temporary directory
|
|
@@ -154,17 +189,19 @@ Version bump and publish your package to npm with clean, flat package structure.
|
|
|
154
189
|
|
|
155
190
|
**Examples:**
|
|
156
191
|
```bash
|
|
157
|
-
itty
|
|
158
|
-
itty
|
|
159
|
-
itty
|
|
160
|
-
itty
|
|
161
|
-
itty
|
|
162
|
-
itty
|
|
192
|
+
itty release # Patch bump and release from dist/ (default)
|
|
193
|
+
itty release --minor --tag # Minor bump, release, and create git tag
|
|
194
|
+
itty release --type=alpha # Pre-release alpha version
|
|
195
|
+
itty release --root # Release from root directory
|
|
196
|
+
itty release --prepare --push # Run prepare, then release with git operations
|
|
197
|
+
itty release --dry-run # Test the release process
|
|
198
|
+
itty release --verbose # Show detailed output during release
|
|
199
|
+
itty release --silent --push # Release with git operations, no interactive prompts
|
|
163
200
|
```
|
|
164
201
|
|
|
165
202
|
## Package Structure
|
|
166
203
|
|
|
167
|
-
The
|
|
204
|
+
The release command creates a clean package structure by:
|
|
168
205
|
|
|
169
206
|
1. **Extracting build artifacts** from your `dist/` directory to package root
|
|
170
207
|
2. **Copying essential files** like README, LICENSE
|
|
@@ -181,7 +218,7 @@ LICENSE
|
|
|
181
218
|
|
|
182
219
|
**After (in node_modules):**
|
|
183
220
|
```
|
|
184
|
-
package.json exports: "./connect.mjs"
|
|
221
|
+
package.json exports: "./connect.mjs"
|
|
185
222
|
connect.mjs
|
|
186
223
|
README.md
|
|
187
224
|
LICENSE
|
|
@@ -208,7 +245,8 @@ Add itty-packager to your scripts for easy access:
|
|
|
208
245
|
"scripts": {
|
|
209
246
|
"build": "itty build --snippet=mylib --hybrid",
|
|
210
247
|
"lint": "itty lint",
|
|
211
|
-
"
|
|
248
|
+
"prepare": "itty prepare",
|
|
249
|
+
"release": "itty release --prepare --tag --push"
|
|
212
250
|
}
|
|
213
251
|
}
|
|
214
252
|
```
|