@writechoice/mint-cli 0.0.8 → 0.0.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/PUBLISH.md CHANGED
@@ -1,386 +1,108 @@
1
- # Publishing Guide
1
+ # Publishing Quick Guide
2
2
 
3
- This guide covers how to publish the `@writechoice/mint-cli` package to npm and manage new versions.
3
+ Quick reference for publishing new versions of @writechoice/mint-cli to npm.
4
4
 
5
5
  ## Prerequisites
6
6
 
7
- ### 1. npm Account
8
- - Create an account at [npmjs.com](https://www.npmjs.com/signup)
9
- - Verify your email address
10
- - (Optional but recommended) Enable two-factor authentication
11
-
12
- ### 2. npm CLI Login
13
7
  ```bash
8
+ # Login to npm
14
9
  npm login
15
- ```
16
10
 
17
- Enter your credentials when prompted:
18
- - Username
19
- - Password
20
- - Email
21
- - (If 2FA is enabled) One-time password
22
-
23
- Verify you're logged in:
24
- ```bash
11
+ # Verify you're logged in
25
12
  npm whoami
26
13
  ```
27
14
 
28
- ## Initial Publication
29
-
30
- ### Step 1: Prepare the Package
31
-
32
- 1. **Update package.json metadata**:
33
- ```json
34
- {
35
- "name": "@writechoice/mint-cli",
36
- "version": "1.0.0",
37
- "description": "CLI tool for Mintlify documentation validation and utilities",
38
- "author": "Your Name <your.email@example.com>",
39
- "license": "MIT",
40
- "repository": {
41
- "type": "git",
42
- "url": "https://github.com/yourusername/writechoice-mint-cli.git"
43
- },
44
- "bugs": {
45
- "url": "https://github.com/yourusername/writechoice-mint-cli/issues"
46
- },
47
- "homepage": "https://github.com/yourusername/writechoice-mint-cli#readme",
48
- "keywords": [
49
- "mintlify",
50
- "documentation",
51
- "validation",
52
- "cli",
53
- "mdx",
54
- "links"
55
- ]
56
- }
57
- ```
58
-
59
- 2. **Test the package locally**:
60
- ```bash
61
- # Install dependencies
62
- npm install
63
-
64
- # Install Playwright browsers
65
- npx playwright install chromium
66
-
67
- # Test the CLI
68
- node bin/cli.js check links --help
69
-
70
- # Link globally for testing
71
- npm link
72
- writechoice check links --help
73
- ```
74
-
75
- 3. **Check what will be published**:
76
- ```bash
77
- npm pack --dry-run
78
- ```
79
-
80
- This shows which files will be included. Make sure:
81
- - Source files are included (`src/`, `bin/`)
82
- - Test files are excluded
83
- - `node_modules/` is excluded (via `.gitignore`)
84
- - `README.md`, `LICENSE`, and `package.json` are included
85
-
86
- ### Step 2: Publish to npm
87
-
88
- 1. **Publish as a public scoped package**:
89
- ```bash
90
- npm publish --access public
91
- ```
92
-
93
- The `--access public` flag is required for scoped packages (@writechoice/...) the first time.
94
-
95
- 2. **Verify the publication**:
96
- - Check on npm: https://www.npmjs.com/package/@writechoice/mint-cli
97
- - Test installation:
98
- ```bash
99
- npm install -g @writechoice/mint-cli
100
- writechoice check links --help
101
- ```
102
-
103
- ## Publishing New Versions
104
-
105
- ### Semantic Versioning
106
-
107
- Follow [Semantic Versioning](https://semver.org/) (SemVer):
108
- - **MAJOR** version (1.0.0 → 2.0.0): Breaking changes
109
- - **MINOR** version (1.0.0 → 1.1.0): New features, backwards compatible
110
- - **PATCH** version (1.0.0 → 1.0.1): Bug fixes, backwards compatible
111
-
112
- ### Update Workflow
113
-
114
- #### 1. Make Your Changes
115
- ```bash
116
- # Create a feature branch
117
- git checkout -b feature/new-validation-type
118
-
119
- # Make your changes
120
- # ... edit files ...
121
-
122
- # Commit changes
123
- git add .
124
- git commit -m "Add new validation type for images"
125
- ```
126
-
127
- #### 2. Update Version Number
128
-
129
- Use npm's version command (automatically updates package.json and creates a git tag):
130
-
131
- **For a patch (bug fixes):**
132
- ```bash
133
- npm version patch
134
- # 1.0.0 → 1.0.1
135
- ```
136
-
137
- **For a minor release (new features):**
138
- ```bash
139
- npm version minor
140
- # 1.0.0 → 1.1.0
141
- ```
142
-
143
- **For a major release (breaking changes):**
144
- ```bash
145
- npm version major
146
- # 1.0.0 → 2.0.0
147
- ```
15
+ ## First-Time Publication
148
16
 
149
- Or specify the exact version:
150
17
  ```bash
151
- npm version 1.2.3
152
- ```
153
-
154
- This command will:
155
- 1. Update `package.json` version
156
- 2. Create a git commit with the version change
157
- 3. Create a git tag (e.g., `v1.0.1`)
158
-
159
- #### 3. Update Changelog (Optional but Recommended)
160
-
161
- Create or update `CHANGELOG.md`:
162
- ```markdown
163
- # Changelog
164
-
165
- ## [1.1.0] - 2024-01-20
166
-
167
- ### Added
168
- - New image validation feature
169
- - Support for SVG files
170
-
171
- ### Fixed
172
- - Fixed anchor parsing for special characters
173
- - Improved error messages for 404s
174
-
175
- ### Changed
176
- - Updated default concurrency to 30
177
-
178
- ## [1.0.0] - 2024-01-15
179
-
180
- ### Initial Release
181
- - Link validation for MDX files
182
- - Auto-fix for incorrect anchors
183
- - Browser automation with Playwright
184
- ```
185
-
186
- #### 4. Test the New Version
187
-
188
- ```bash
189
- # Link locally and test
18
+ # 1. Test locally
19
+ npm install
190
20
  npm link
191
- writechoice check links docs.example.com -v
21
+ writechoice --version
192
22
 
193
- # Run any tests
194
- npm test
23
+ # 2. Check what will be published
24
+ npm pack --dry-run
195
25
 
196
- # Test with dry-run on real documentation
197
- writechoice check links docs.example.com --dry-run
26
+ # 3. Publish (first time requires --access public)
27
+ npm publish --access public
198
28
  ```
199
29
 
200
- #### 5. Push Changes and Tags
30
+ ## Publishing New Versions
31
+
32
+ ### Quick Workflow
201
33
 
202
34
  ```bash
203
- # Push commits
204
- git push origin main
35
+ # 1. Make changes and commit
36
+ git add .
37
+ git commit -m "Add new feature"
205
38
 
206
- # Push tags
207
- git push origin --tags
208
- ```
39
+ # 2. Update version (auto-creates git tag)
40
+ npm version patch # For bug fixes (1.0.0 → 1.0.1)
41
+ npm version minor # For new features (1.0.0 → 1.1.0)
42
+ npm version major # For breaking changes (1.0.0 → 2.0.0)
209
43
 
210
- #### 6. Publish to npm
44
+ # 3. Push to git
45
+ git push origin main --tags
211
46
 
212
- ```bash
47
+ # 4. Publish to npm
213
48
  npm publish
214
- ```
215
-
216
- No need for `--access public` after the first publication.
217
-
218
- #### 7. Verify Publication
219
49
 
220
- ```bash
221
- # Check the npm page
50
+ # 5. Verify
222
51
  npm view @writechoice/mint-cli
223
-
224
- # Test installation
225
- npm install -g @writechoice/mint-cli@latest
226
- writechoice --version
227
52
  ```
228
53
 
229
- ## Quick Reference
54
+ ## Version Types
230
55
 
231
- ### Common npm Commands
56
+ - **Patch** (`npm version patch`): Bug fixes only
57
+ - **Minor** (`npm version minor`): New features, backwards compatible
58
+ - **Major** (`npm version major`): Breaking changes
232
59
 
233
- ```bash
234
- # Check current version
235
- npm version
60
+ ## Pre-release (Beta) Versions
236
61
 
237
- # View package info
238
- npm view @writechoice/mint-cli
239
-
240
- # View all published versions
241
- npm view @writechoice/mint-cli versions
242
-
243
- # Unpublish a version (within 72 hours, use carefully!)
244
- npm unpublish @writechoice/mint-cli@1.0.1
245
-
246
- # Deprecate a version (recommended over unpublish)
247
- npm deprecate @writechoice/mint-cli@1.0.0 "Please upgrade to 1.0.1 due to critical bug"
248
-
249
- # Add a dist-tag (like 'beta', 'next')
250
- npm dist-tag add @writechoice/mint-cli@1.1.0-beta.1 beta
251
-
252
- # Publish a beta version
253
- npm version 1.1.0-beta.1
254
- npm publish --tag beta
255
- ```
256
-
257
- ## Pre-release Versions
258
-
259
- For testing before a stable release:
260
-
261
- ### 1. Create a Beta Version
262
62
  ```bash
263
- # Update to beta version
63
+ # Create and publish beta
264
64
  npm version 1.1.0-beta.1
265
-
266
- # Publish with beta tag
267
65
  npm publish --tag beta
268
- ```
269
-
270
- ### 2. Install Beta Version
271
- ```bash
272
- # Install specific beta version
273
- npm install -g @writechoice/mint-cli@1.1.0-beta.1
274
66
 
275
- # Install latest beta
67
+ # Install beta
276
68
  npm install -g @writechoice/mint-cli@beta
277
69
  ```
278
70
 
279
- ### 3. Promote Beta to Stable
280
- ```bash
281
- # Remove beta suffix
282
- npm version 1.1.0
283
-
284
- # Publish as latest
285
- npm publish
286
- ```
287
-
288
- ## Automation with GitHub Actions
289
-
290
- Consider automating releases with GitHub Actions:
291
-
292
- ```yaml
293
- # .github/workflows/publish.yml
294
- name: Publish to npm
295
-
296
- on:
297
- release:
298
- types: [created]
71
+ ## Common Commands
299
72
 
300
- jobs:
301
- publish:
302
- runs-on: ubuntu-latest
303
- steps:
304
- - uses: actions/checkout@v3
305
-
306
- - uses: actions/setup-node@v3
307
- with:
308
- node-version: '18'
309
- registry-url: 'https://registry.npmjs.org'
310
-
311
- - run: npm ci
73
+ ```bash
74
+ # Check current version
75
+ npm version
312
76
 
313
- - run: npm test
77
+ # View published versions
78
+ npm view @writechoice/mint-cli versions
314
79
 
315
- - run: npm publish --access public
316
- env:
317
- NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
80
+ # Deprecate old version
81
+ npm deprecate @writechoice/mint-cli@1.0.0 "Please upgrade to 1.0.1"
318
82
  ```
319
83
 
320
84
  ## Troubleshooting
321
85
 
322
- ### "You must be logged in to publish packages"
86
+ ### Not logged in
323
87
  ```bash
324
88
  npm login
325
89
  ```
326
90
 
327
- ### "You do not have permission to publish"
328
- - Check if you own the `@writechoice` scope on npm
329
- - Ask the scope owner to add you as a collaborator
330
-
331
- ### "Package name too similar to existing package"
332
- - Choose a different name or scope
333
- - Or request ownership of the abandoned package
334
-
335
- ### "Version already exists"
91
+ ### Version already exists
336
92
  ```bash
337
- # Increment version again
338
- npm version patch
339
-
340
- # Or specify a new version
341
- npm version 1.0.2
93
+ npm version patch # Increment again
342
94
  ```
343
95
 
344
- ## Best Practices
345
-
346
- 1. **Always test before publishing**
347
- - Link locally with `npm link`
348
- - Test all CLI commands
349
- - Check that files are correctly included with `npm pack --dry-run`
350
-
351
- 2. **Follow semantic versioning**
352
- - Breaking changes = major version
353
- - New features = minor version
354
- - Bug fixes = patch version
355
-
356
- 3. **Maintain a changelog**
357
- - Document all changes
358
- - Make it easy for users to see what's new
359
-
360
- 4. **Use git tags**
361
- - Tag each release with `v{version}` (e.g., `v1.0.0`)
362
- - `npm version` does this automatically
363
-
364
- 5. **Test installations**
365
- - Install the published package globally
366
- - Verify it works as expected
367
-
368
- 6. **Consider using prerelease versions**
369
- - Beta test with `1.0.0-beta.1` before stable release
370
- - Use tags: `npm publish --tag beta`
371
-
372
- 7. **Document breaking changes**
373
- - Clearly indicate breaking changes in changelog
374
- - Consider migration guides for major versions
96
+ ### Permission denied
97
+ Contact the package owner to add you as a collaborator.
375
98
 
376
- 8. **Deprecate old versions**
377
- - Use `npm deprecate` instead of unpublishing
378
- - Provide upgrade instructions
99
+ ## Detailed Guide
379
100
 
380
- ## Useful Links
101
+ For comprehensive publishing documentation, see [docs/publishing.md](docs/publishing.md).
381
102
 
382
- - [npm Documentation](https://docs.npmjs.com/)
383
- - [Semantic Versioning](https://semver.org/)
384
- - [npm version command](https://docs.npmjs.com/cli/v10/commands/npm-version)
385
- - [npm publish command](https://docs.npmjs.com/cli/v10/commands/npm-publish)
386
- - [Creating and publishing scoped packages](https://docs.npmjs.com/creating-and-publishing-scoped-public-packages)
103
+ This includes:
104
+ - Complete setup instructions
105
+ - Changelog management
106
+ - GitHub Actions automation
107
+ - Best practices
108
+ - Advanced scenarios