itty-packager 1.6.8 โ 1.6.10
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 +58 -21
- package/lib/commands/release.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -14,15 +14,16 @@
|
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
17
|
-
# Single dependency build +
|
|
17
|
+
# Single dependency build + release for TypeScript libraries.
|
|
18
18
|
|
|
19
|
-
Zero-config build, lint, and
|
|
19
|
+
Zero-config build, lint, prepare, and release - letting you deliver packages with minimal files and minimal bytes.
|
|
20
20
|
|
|
21
21
|
## Features
|
|
22
22
|
|
|
23
23
|
- **๐จ Build** - TypeScript compilation with Rollup, minification, and snippet generation
|
|
24
24
|
- **๐ Lint** - Built-in ESLint configuration with TypeScript support and smart extending
|
|
25
|
-
-
|
|
25
|
+
- **๐ Prepare** - Run lint, test, and build in sequence to verify your package
|
|
26
|
+
- **๐ฆ Release** - Automated version bumping, git operations, and npm publishing with interactive commit messages
|
|
26
27
|
- **โก Zero Config** - Works out of the box, customize only what you need
|
|
27
28
|
- **๐ฏ Consistent** - Unified tooling across all itty projects
|
|
28
29
|
|
|
@@ -40,8 +41,9 @@ Add to your `package.json` scripts:
|
|
|
40
41
|
{
|
|
41
42
|
"scripts": {
|
|
42
43
|
"build": "itty build",
|
|
43
|
-
"lint": "itty lint",
|
|
44
|
-
"
|
|
44
|
+
"lint": "itty lint",
|
|
45
|
+
"prepare": "itty prepare",
|
|
46
|
+
"release": "itty release"
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
49
|
```
|
|
@@ -119,11 +121,34 @@ itty lint --fix # Lint and auto-fix issues
|
|
|
119
121
|
itty lint --format=json # Output results in JSON format
|
|
120
122
|
```
|
|
121
123
|
|
|
122
|
-
### `itty
|
|
124
|
+
### `itty prepare`
|
|
125
|
+
|
|
126
|
+
Run lint, test, and build in sequence to prepare your package for release.
|
|
127
|
+
|
|
128
|
+
**Usage:** `itty prepare [options]`
|
|
129
|
+
|
|
130
|
+
**Options:**
|
|
131
|
+
- `-v, --verbose` - Show all output from underlying commands
|
|
132
|
+
- `-h, --help` - Show help
|
|
133
|
+
|
|
134
|
+
**Default Behavior:**
|
|
135
|
+
- Runs `lint` using package.json script or built-in command
|
|
136
|
+
- Runs `test` using package.json script (skips if not found)
|
|
137
|
+
- Runs `build` using package.json script or built-in command (skips if no src/ directory)
|
|
138
|
+
- Shows only progress messages unless `--verbose` is used
|
|
139
|
+
- Stops on first failure and shows error output
|
|
140
|
+
|
|
141
|
+
**Examples:**
|
|
142
|
+
```bash
|
|
143
|
+
itty prepare # Run lint, test, build silently (show only failures)
|
|
144
|
+
itty prepare --verbose # Run with full output from all commands
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### `itty release`
|
|
123
148
|
|
|
124
|
-
Version bump and
|
|
149
|
+
Version bump and release your package to npm with git operations and clean, flat package structure.
|
|
125
150
|
|
|
126
|
-
**Usage:** `itty
|
|
151
|
+
**Usage:** `itty release [options]`
|
|
127
152
|
|
|
128
153
|
**Version Options (default: patch):**
|
|
129
154
|
- `--major` - Major release X.#.# for breaking changes
|
|
@@ -131,20 +156,29 @@ Version bump and publish your package to npm with clean, flat package structure.
|
|
|
131
156
|
- `--patch` - Patch release #.#.X for bug fixes (default)
|
|
132
157
|
- `--type <type>` - Custom release type (alpha, beta, rc, etc.)
|
|
133
158
|
|
|
134
|
-
**
|
|
135
|
-
- `--src <dir>` - Source directory to
|
|
136
|
-
- `--
|
|
159
|
+
**Release Options:**
|
|
160
|
+
- `--src <dir>` - Source directory to release from (default: `dist`)
|
|
161
|
+
- `--root` - Release from root directory (equivalent to `--src=.`)
|
|
162
|
+
- `--dest <dir>` - Temporary directory for releasing (default: `.dist`)
|
|
137
163
|
- `--dry-run` - Build and prepare but do not publish
|
|
138
|
-
- `--no-cleanup` - Leave temporary directory after
|
|
164
|
+
- `--no-cleanup` - Leave temporary directory after releasing
|
|
139
165
|
- `--public` - Publish as public package (`--access=public`)
|
|
166
|
+
- `--prepare` - Run prepare (lint, test, build) before releasing
|
|
167
|
+
- `--silent` - Skip interactive prompts (use default commit message)
|
|
140
168
|
- `--no-license` - Do not copy LICENSE file to published package
|
|
141
169
|
- `-v, --verbose` - Show detailed output including npm and git command details
|
|
142
170
|
|
|
143
171
|
**Git Options:**
|
|
144
172
|
- `--tag` - Create git tag for release
|
|
145
|
-
- `--push` - Push changes and tags to git remote
|
|
173
|
+
- `--push` - Push changes and tags to git remote (prompts for commit message)
|
|
146
174
|
- `--no-git` - Skip all git operations
|
|
147
175
|
|
|
176
|
+
**Interactive Features:**
|
|
177
|
+
- When using `--push`, you'll be prompted for an optional commit message
|
|
178
|
+
- Press Enter to skip, Escape or Ctrl+C to cancel and revert version
|
|
179
|
+
- Multi-line commit messages supported
|
|
180
|
+
- Git tag uses the same message as the commit
|
|
181
|
+
|
|
148
182
|
**Default Behavior:**
|
|
149
183
|
- Defaults to patch version bump if no type specified
|
|
150
184
|
- Extracts build artifacts to temporary directory
|
|
@@ -154,17 +188,19 @@ Version bump and publish your package to npm with clean, flat package structure.
|
|
|
154
188
|
|
|
155
189
|
**Examples:**
|
|
156
190
|
```bash
|
|
157
|
-
itty
|
|
158
|
-
itty
|
|
159
|
-
itty
|
|
160
|
-
itty
|
|
161
|
-
itty
|
|
162
|
-
itty
|
|
191
|
+
itty release # Patch bump and release from dist/ (default)
|
|
192
|
+
itty release --minor --tag # Minor bump, release, and create git tag
|
|
193
|
+
itty release --type=alpha # Pre-release alpha version
|
|
194
|
+
itty release --root # Release from root directory
|
|
195
|
+
itty release --prepare --push # Run prepare, then release with git operations
|
|
196
|
+
itty release --dry-run # Test the release process
|
|
197
|
+
itty release --verbose # Show detailed output during release
|
|
198
|
+
itty release --silent --push # Release with git operations, no interactive prompts
|
|
163
199
|
```
|
|
164
200
|
|
|
165
201
|
## Package Structure
|
|
166
202
|
|
|
167
|
-
The
|
|
203
|
+
The release command creates a clean package structure by:
|
|
168
204
|
|
|
169
205
|
1. **Extracting build artifacts** from your `dist/` directory to package root
|
|
170
206
|
2. **Copying essential files** like README, LICENSE
|
|
@@ -208,7 +244,8 @@ Add itty-packager to your scripts for easy access:
|
|
|
208
244
|
"scripts": {
|
|
209
245
|
"build": "itty build --snippet=mylib --hybrid",
|
|
210
246
|
"lint": "itty lint",
|
|
211
|
-
"
|
|
247
|
+
"prepare": "itty prepare",
|
|
248
|
+
"release": "itty release --prepare --tag --push"
|
|
212
249
|
}
|
|
213
250
|
}
|
|
214
251
|
```
|
package/lib/commands/release.js
CHANGED
|
@@ -509,7 +509,7 @@ This creates a clean, flat package structure in node_modules.
|
|
|
509
509
|
await runCommand(`git commit -m "${commitMessage}"`, rootPath, verbose)
|
|
510
510
|
} catch (error) {
|
|
511
511
|
if (error.message.includes('cancelled')) {
|
|
512
|
-
console.log('
|
|
512
|
+
console.log('โ Commit cancelled - reverting version and exiting')
|
|
513
513
|
// Revert the version we just updated
|
|
514
514
|
await fs.writeJSON(pkgPath, originalPkg, { spaces: 2 })
|
|
515
515
|
// Don't rethrow - exit cleanly since this is user-initiated
|
|
@@ -537,7 +537,7 @@ This creates a clean, flat package structure in node_modules.
|
|
|
537
537
|
|
|
538
538
|
// NPM publish as final step
|
|
539
539
|
if (dryRun) {
|
|
540
|
-
console.log('
|
|
540
|
+
console.log('๐ธ Dry run - skipping publish')
|
|
541
541
|
} else {
|
|
542
542
|
// Publish from temp directory
|
|
543
543
|
console.log(`๐ Publishing to npm...`)
|
|
@@ -559,7 +559,7 @@ This creates a clean, flat package structure in node_modules.
|
|
|
559
559
|
await fs.remove(tempDir)
|
|
560
560
|
}
|
|
561
561
|
|
|
562
|
-
console.log(
|
|
562
|
+
console.log(`๐ Successfully released ${originalPkg.name}@${newVersion}`)
|
|
563
563
|
|
|
564
564
|
} catch (error) {
|
|
565
565
|
console.error(`โ Release failed: ${error.message}`)
|