@dimensional-innovations/tool-config 1.0.0
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 +21 -0
- package/README.md +646 -0
- package/bin/setup-tool-config.js +675 -0
- package/package.json +168 -0
- package/src/detectors.js +261 -0
- package/src/index.js +64 -0
- package/src/tools/eslint/index.js +287 -0
- package/src/tools/eslint/presets/base.js +82 -0
- package/src/tools/eslint/presets/environments/browser.js +16 -0
- package/src/tools/eslint/presets/environments/node.js +21 -0
- package/src/tools/eslint/presets/environments/universal.js +18 -0
- package/src/tools/eslint/presets/frameworks/angular.js +74 -0
- package/src/tools/eslint/presets/frameworks/astro.js +38 -0
- package/src/tools/eslint/presets/frameworks/node.js +57 -0
- package/src/tools/eslint/presets/frameworks/react.js +76 -0
- package/src/tools/eslint/presets/frameworks/solid.js +45 -0
- package/src/tools/eslint/presets/frameworks/svelte.js +78 -0
- package/src/tools/eslint/presets/frameworks/vanilla.js +16 -0
- package/src/tools/eslint/presets/frameworks/vue.js +125 -0
- package/src/tools/eslint/presets/imports.js +41 -0
- package/src/tools/eslint/presets/typescript.js +131 -0
- package/src/tools/prettier/README.md +398 -0
- package/src/tools/prettier/index.js +114 -0
- package/src/tools/prettier/presets/base.js +36 -0
- package/src/tools/prettier/presets/frameworks/astro.js +15 -0
- package/src/tools/prettier/presets/frameworks/react.js +15 -0
- package/src/tools/prettier/presets/frameworks/svelte.js +22 -0
- package/src/tools/prettier/presets/frameworks/vanilla.js +13 -0
- package/src/tools/prettier/presets/frameworks/vue.js +20 -0
- package/src/tools/prettier/presets/prettierignore.js +56 -0
- package/src/tools/semantic-release/CI_SETUP.md +66 -0
- package/src/tools/semantic-release/README.md +533 -0
- package/src/tools/semantic-release/index.js +130 -0
- package/src/tools/semantic-release/presets/default.js +37 -0
- package/src/tools/semantic-release/presets/library.js +58 -0
- package/src/tools/semantic-release/presets/monorepo.js +48 -0
- package/src/tools/semantic-release/templates/.gitlab-ci.yml +85 -0
- package/src/tools/semantic-release/templates/bitbucket-pipelines.yml +100 -0
- package/src/tools/semantic-release/templates/github-workflow.yml +107 -0
- package/src/tools/stylelint/README.md +425 -0
- package/src/tools/stylelint/index.js +191 -0
- package/src/tools/stylelint/presets/base.js +50 -0
- package/src/tools/stylelint/presets/css-modules.js +43 -0
- package/src/tools/stylelint/presets/frameworks/react.js +18 -0
- package/src/tools/stylelint/presets/frameworks/svelte.js +28 -0
- package/src/tools/stylelint/presets/frameworks/vanilla.js +14 -0
- package/src/tools/stylelint/presets/frameworks/vue.js +38 -0
- package/src/tools/stylelint/presets/scss.js +83 -0
- package/src/tools/stylelint/presets/tailwind.js +49 -0
- package/src/utils/package-reader.js +42 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
# CI/CD Templates
|
|
2
|
+
|
|
3
|
+
Ready-to-use CI/CD configuration templates for GitLab CI, GitHub Actions, and Bitbucket Pipelines.
|
|
4
|
+
|
|
5
|
+
## Available Templates
|
|
6
|
+
|
|
7
|
+
- **`.gitlab-ci.yml`** - GitLab CI/CD pipeline
|
|
8
|
+
- **`github-workflow.yml`** - GitHub Actions workflow
|
|
9
|
+
- **`bitbucket-pipelines.yml`** - Bitbucket Pipelines configuration
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
Copy the appropriate template to your project:
|
|
14
|
+
|
|
15
|
+
### GitLab CI
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/.gitlab-ci.yml .gitlab-ci.yml
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Then configure these CI/CD variables in GitLab:
|
|
22
|
+
|
|
23
|
+
- `GL_TOKEN`: GitLab Personal Access Token
|
|
24
|
+
- `NPM_TOKEN`: npm authentication token
|
|
25
|
+
|
|
26
|
+
### GitHub Actions
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mkdir -p .github/workflows
|
|
30
|
+
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/github-workflow.yml .github/workflows/ci.yml
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Then configure these secrets in GitHub:
|
|
34
|
+
|
|
35
|
+
- `GITHUB_TOKEN`: Automatically provided
|
|
36
|
+
- `NPM_TOKEN`: npm authentication token
|
|
37
|
+
|
|
38
|
+
### Bitbucket Pipelines
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
cp node_modules/@dimensional-innovations/tool-config/src/tools/semantic-release/templates/bitbucket-pipelines.yml bitbucket-pipelines.yml
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Then configure these repository variables in Bitbucket:
|
|
45
|
+
|
|
46
|
+
- `NPM_TOKEN`: npm authentication token
|
|
47
|
+
|
|
48
|
+
## What's Included
|
|
49
|
+
|
|
50
|
+
Each template includes:
|
|
51
|
+
|
|
52
|
+
1. **Lint Stage** - Runs ESLint, Prettier, and Stylelint
|
|
53
|
+
2. **Test Stage** - Runs tests with coverage reporting
|
|
54
|
+
3. **Release Stage** - Automated semantic-release (main branch only)
|
|
55
|
+
|
|
56
|
+
## Customization
|
|
57
|
+
|
|
58
|
+
All templates are designed to be customized for your specific needs:
|
|
59
|
+
|
|
60
|
+
- Adjust Node.js versions
|
|
61
|
+
- Add deployment stages
|
|
62
|
+
- Configure caching strategies
|
|
63
|
+
- Add matrix testing for multiple versions
|
|
64
|
+
- Customize when jobs run
|
|
65
|
+
|
|
66
|
+
See comments in each template file for optional configurations.
|
|
@@ -0,0 +1,533 @@
|
|
|
1
|
+
# semantic-release Configuration
|
|
2
|
+
|
|
3
|
+
Automated versioning and package publishing using semantic-release with preset-based configuration.
|
|
4
|
+
|
|
5
|
+
## Philosophy
|
|
6
|
+
|
|
7
|
+
This semantic-release configuration follows semantic versioning principles with conventional commits:
|
|
8
|
+
|
|
9
|
+
- **Automated versioning** - Version numbers determined by commit messages
|
|
10
|
+
- **Changelog generation** - Automatic changelog from conventional commits
|
|
11
|
+
- **Release automation** - Publish to NPM and create Git provider releases (GitLab, GitHub)
|
|
12
|
+
- **Branch-based releases** - Support for production, pre-release, and maintenance branches
|
|
13
|
+
- **Preset-based** - Choose the right configuration for your project type
|
|
14
|
+
- **Git provider detection** - Automatically detects GitLab, GitHub, or Bitbucket from repository URL
|
|
15
|
+
|
|
16
|
+
## Git Provider Detection
|
|
17
|
+
|
|
18
|
+
This package **automatically detects** your Git hosting provider (GitLab, GitHub, or Bitbucket) from:
|
|
19
|
+
|
|
20
|
+
1. **package.json `repository` field** - Checked first
|
|
21
|
+
2. **Git remote URL** - Fallback if package.json doesn't specify
|
|
22
|
+
|
|
23
|
+
**Supported providers:**
|
|
24
|
+
|
|
25
|
+
- **GitLab** - Uses `@semantic-release/gitlab` plugin
|
|
26
|
+
- **GitHub** - Uses `@semantic-release/github` plugin
|
|
27
|
+
- **Bitbucket** - No official plugin (uses core features only)
|
|
28
|
+
- **Other/None** - No provider plugin added (core features only)
|
|
29
|
+
|
|
30
|
+
**You can override auto-detection:**
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
// Force GitLab even if detected as GitHub
|
|
34
|
+
export default createConfig('semantic-release', {
|
|
35
|
+
gitProvider: 'gitlab'
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
// Force GitHub even if detected as GitLab
|
|
39
|
+
export default createConfig('semantic-release', {
|
|
40
|
+
gitProvider: 'github'
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
// Disable provider plugin entirely
|
|
44
|
+
export default createConfig('semantic-release', {
|
|
45
|
+
gitProvider: null
|
|
46
|
+
})
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Installation
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install --save-dev @dimensional-innovations/tool-config semantic-release
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
### Optional Peer Dependencies
|
|
56
|
+
|
|
57
|
+
Install the semantic-release plugins you need based on your Git provider:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# For GitLab projects
|
|
61
|
+
npm install --save-dev @semantic-release/changelog @semantic-release/git @semantic-release/gitlab
|
|
62
|
+
|
|
63
|
+
# For GitHub projects
|
|
64
|
+
npm install --save-dev @semantic-release/changelog @semantic-release/git @semantic-release/github
|
|
65
|
+
|
|
66
|
+
# For Bitbucket or other providers (no provider-specific plugin)
|
|
67
|
+
npm install --save-dev @semantic-release/changelog @semantic-release/git
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Usage
|
|
71
|
+
|
|
72
|
+
### Basic Usage (Auto-Detect)
|
|
73
|
+
|
|
74
|
+
Create a `release.config.js` file in your project root:
|
|
75
|
+
|
|
76
|
+
```javascript
|
|
77
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
78
|
+
|
|
79
|
+
export default createConfig('semantic-release')
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
This uses the **default preset** which works for most projects.
|
|
83
|
+
|
|
84
|
+
### Preset Selection
|
|
85
|
+
|
|
86
|
+
#### Default Preset
|
|
87
|
+
|
|
88
|
+
Standard configuration for applications and general projects:
|
|
89
|
+
|
|
90
|
+
```javascript
|
|
91
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
92
|
+
|
|
93
|
+
export default createConfig('semantic-release', {
|
|
94
|
+
preset: 'default'
|
|
95
|
+
})
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
**Includes:**
|
|
99
|
+
|
|
100
|
+
- Commit analyzer
|
|
101
|
+
- Release notes generator
|
|
102
|
+
- Changelog generation
|
|
103
|
+
- NPM publishing
|
|
104
|
+
- Git provider releases (auto-detected: GitLab, GitHub, or none)
|
|
105
|
+
- Git tagging
|
|
106
|
+
|
|
107
|
+
#### Library Preset
|
|
108
|
+
|
|
109
|
+
Optimized for published NPM libraries with reduced noise:
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
113
|
+
|
|
114
|
+
export default createConfig('semantic-release', {
|
|
115
|
+
preset: 'library'
|
|
116
|
+
})
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**Differences from default:**
|
|
120
|
+
|
|
121
|
+
- Explicit `pkgRoot: '.'` configuration
|
|
122
|
+
- Disabled Git provider success comments (less noise)
|
|
123
|
+
- Disabled released labels (library-specific optimization)
|
|
124
|
+
- Cleaner release process for libraries
|
|
125
|
+
|
|
126
|
+
#### Monorepo Preset
|
|
127
|
+
|
|
128
|
+
For monorepo structures with multiple packages:
|
|
129
|
+
|
|
130
|
+
```javascript
|
|
131
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
132
|
+
|
|
133
|
+
export default createConfig('semantic-release', {
|
|
134
|
+
preset: 'monorepo'
|
|
135
|
+
})
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
**Configuration:**
|
|
139
|
+
|
|
140
|
+
- `pkgRoot: 'packages/*'` for workspace structure
|
|
141
|
+
- Suitable for lerna, pnpm workspaces, npm workspaces
|
|
142
|
+
- Per-package versioning support
|
|
143
|
+
|
|
144
|
+
**Note**: For advanced monorepo scenarios, you may need to run semantic-release separately for each package or use additional plugins like `semantic-release-monorepo`.
|
|
145
|
+
|
|
146
|
+
### Custom Configuration
|
|
147
|
+
|
|
148
|
+
#### Override Branches
|
|
149
|
+
|
|
150
|
+
```javascript
|
|
151
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
152
|
+
|
|
153
|
+
export default createConfig('semantic-release', {
|
|
154
|
+
preset: 'default',
|
|
155
|
+
branches: [
|
|
156
|
+
'main',
|
|
157
|
+
'next',
|
|
158
|
+
{ name: 'beta', prerelease: true },
|
|
159
|
+
{ name: 'alpha', prerelease: true }
|
|
160
|
+
]
|
|
161
|
+
})
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
#### Override Plugins
|
|
165
|
+
|
|
166
|
+
```javascript
|
|
167
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
168
|
+
|
|
169
|
+
export default createConfig('semantic-release', {
|
|
170
|
+
preset: 'library',
|
|
171
|
+
plugins: [
|
|
172
|
+
'@semantic-release/commit-analyzer',
|
|
173
|
+
'@semantic-release/release-notes-generator',
|
|
174
|
+
'@semantic-release/npm'
|
|
175
|
+
// Removed changelog, gitlab, git for minimal setup
|
|
176
|
+
]
|
|
177
|
+
})
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
#### Additional Options
|
|
181
|
+
|
|
182
|
+
```javascript
|
|
183
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
184
|
+
|
|
185
|
+
export default createConfig('semantic-release', {
|
|
186
|
+
preset: 'library',
|
|
187
|
+
repositoryUrl: 'https://gitlab.com/org/repo.git',
|
|
188
|
+
tagFormat: 'v${version}',
|
|
189
|
+
dryRun: false
|
|
190
|
+
})
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Conventional Commits
|
|
194
|
+
|
|
195
|
+
semantic-release determines version bumps based on commit message conventions:
|
|
196
|
+
|
|
197
|
+
### Commit Types
|
|
198
|
+
|
|
199
|
+
| Type | Description | Version Bump |
|
|
200
|
+
| ----------------- | ----------------------- | ------------- |
|
|
201
|
+
| `feat` | New feature | Minor (0.x.0) |
|
|
202
|
+
| `fix` | Bug fix | Patch (0.0.x) |
|
|
203
|
+
| `perf` | Performance improvement | Patch (0.0.x) |
|
|
204
|
+
| `BREAKING CHANGE` | Breaking change footer | Major (x.0.0) |
|
|
205
|
+
| `feat!` | Breaking feature | Major (x.0.0) |
|
|
206
|
+
| `fix!` | Breaking fix | Major (x.0.0) |
|
|
207
|
+
| `docs` | Documentation only | No release |
|
|
208
|
+
| `style` | Code style changes | No release |
|
|
209
|
+
| `refactor` | Code refactoring | No release |
|
|
210
|
+
| `test` | Test additions | No release |
|
|
211
|
+
| `chore` | Maintenance tasks | No release |
|
|
212
|
+
|
|
213
|
+
### Examples
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Patch release (0.0.1)
|
|
217
|
+
git commit -m "fix: resolve authentication bug"
|
|
218
|
+
|
|
219
|
+
# Minor release (0.1.0)
|
|
220
|
+
git commit -m "feat: add user profile management"
|
|
221
|
+
|
|
222
|
+
# Major release (1.0.0)
|
|
223
|
+
git commit -m "feat!: redesign API with breaking changes"
|
|
224
|
+
|
|
225
|
+
# Major release with footer (1.0.0)
|
|
226
|
+
git commit -m "feat: redesign authentication
|
|
227
|
+
|
|
228
|
+
BREAKING CHANGE: JWT tokens now required, session cookies removed"
|
|
229
|
+
|
|
230
|
+
# No release
|
|
231
|
+
git commit -m "docs: update README installation steps"
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
## Preset Comparison
|
|
235
|
+
|
|
236
|
+
| Feature | Default | Library | Monorepo |
|
|
237
|
+
| --------------- | ------------ | ----------------- | --------------------------- |
|
|
238
|
+
| Commit Analyzer | ✅ | ✅ | ✅ |
|
|
239
|
+
| Release Notes | ✅ | ✅ | ✅ |
|
|
240
|
+
| Changelog | ✅ | ✅ | ✅ |
|
|
241
|
+
| NPM Publish | ✅ | ✅ (pkgRoot: '.') | ✅ (pkgRoot: 'packages/\*') |
|
|
242
|
+
| GitLab Releases | ✅ | ✅ (no comments) | ✅ |
|
|
243
|
+
| Git Tagging | ✅ | ✅ | ✅ |
|
|
244
|
+
| Best For | Applications | Libraries | Workspaces |
|
|
245
|
+
|
|
246
|
+
## Integration
|
|
247
|
+
|
|
248
|
+
### With GitLab CI
|
|
249
|
+
|
|
250
|
+
Add to your `.gitlab-ci.yml`:
|
|
251
|
+
|
|
252
|
+
```yaml
|
|
253
|
+
release:
|
|
254
|
+
stage: deploy
|
|
255
|
+
only:
|
|
256
|
+
- main
|
|
257
|
+
script:
|
|
258
|
+
- npm install
|
|
259
|
+
- npx semantic-release
|
|
260
|
+
variables:
|
|
261
|
+
GL_TOKEN: $GL_TOKEN
|
|
262
|
+
NPM_TOKEN: $NPM_TOKEN
|
|
263
|
+
```
|
|
264
|
+
|
|
265
|
+
### With GitHub Actions
|
|
266
|
+
|
|
267
|
+
Add to `.github/workflows/release.yml`:
|
|
268
|
+
|
|
269
|
+
```yaml
|
|
270
|
+
name: Release
|
|
271
|
+
on:
|
|
272
|
+
push:
|
|
273
|
+
branches:
|
|
274
|
+
- main
|
|
275
|
+
|
|
276
|
+
jobs:
|
|
277
|
+
release:
|
|
278
|
+
runs-on: ubuntu-latest
|
|
279
|
+
steps:
|
|
280
|
+
- uses: actions/checkout@v3
|
|
281
|
+
- uses: actions/setup-node@v3
|
|
282
|
+
with:
|
|
283
|
+
node-version: '20'
|
|
284
|
+
- run: npm install
|
|
285
|
+
- run: npx semantic-release
|
|
286
|
+
env:
|
|
287
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
288
|
+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### Local Testing
|
|
292
|
+
|
|
293
|
+
Test your configuration without publishing:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
npx semantic-release --dry-run
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
## Workflow
|
|
300
|
+
|
|
301
|
+
### 1. Make Changes
|
|
302
|
+
|
|
303
|
+
Develop features and fixes following conventional commit messages.
|
|
304
|
+
|
|
305
|
+
### 2. Create Commits
|
|
306
|
+
|
|
307
|
+
Write commits following conventional commit format:
|
|
308
|
+
|
|
309
|
+
```bash
|
|
310
|
+
git commit -m "feat(scope): add new feature"
|
|
311
|
+
git commit -m "fix(scope): fix bug"
|
|
312
|
+
git commit -m "docs: update documentation"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
**Commit types:**
|
|
316
|
+
|
|
317
|
+
- `feat:` - New feature (triggers minor release)
|
|
318
|
+
- `fix:` - Bug fix (triggers patch release)
|
|
319
|
+
- `docs:`, `chore:`, `test:`, `refactor:` - No release
|
|
320
|
+
|
|
321
|
+
### 3. Push to Main Branch
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
git push origin main
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
### 4. Automatic Release
|
|
328
|
+
|
|
329
|
+
semantic-release analyzes commits and:
|
|
330
|
+
|
|
331
|
+
1. Determines next version number
|
|
332
|
+
2. Generates changelog
|
|
333
|
+
3. Creates git tag
|
|
334
|
+
4. Publishes to NPM
|
|
335
|
+
5. Creates GitLab/GitHub release
|
|
336
|
+
|
|
337
|
+
## Troubleshooting
|
|
338
|
+
|
|
339
|
+
### "No new version to release"
|
|
340
|
+
|
|
341
|
+
**Cause**: No commits with release-triggering types (feat, fix, perf, BREAKING CHANGE) since last release.
|
|
342
|
+
|
|
343
|
+
**Solution**: Ensure commits use conventional commit format. Use `feat:` or `fix:` prefixes.
|
|
344
|
+
|
|
345
|
+
### NPM Publish Fails
|
|
346
|
+
|
|
347
|
+
**Cause**: Missing `NPM_TOKEN` environment variable or incorrect permissions.
|
|
348
|
+
|
|
349
|
+
**Solution**:
|
|
350
|
+
|
|
351
|
+
1. Generate NPM access token from npmjs.com
|
|
352
|
+
2. Add to CI/CD environment variables as `NPM_TOKEN`
|
|
353
|
+
3. Ensure token has publish permissions
|
|
354
|
+
|
|
355
|
+
### GitLab Release Fails
|
|
356
|
+
|
|
357
|
+
**Cause**: Missing `GL_TOKEN` or insufficient permissions.
|
|
358
|
+
|
|
359
|
+
**Solution**:
|
|
360
|
+
|
|
361
|
+
1. Generate GitLab personal access token with `api` scope
|
|
362
|
+
2. Add to CI/CD environment variables as `GL_TOKEN`
|
|
363
|
+
3. Ensure token has project access
|
|
364
|
+
|
|
365
|
+
### Version Conflicts
|
|
366
|
+
|
|
367
|
+
**Cause**: Multiple simultaneous releases or manual version changes.
|
|
368
|
+
|
|
369
|
+
**Solution**:
|
|
370
|
+
|
|
371
|
+
1. Only release from CI/CD, never manually
|
|
372
|
+
2. Protect main branch to prevent direct pushes
|
|
373
|
+
3. Use `npm run release --dry-run` to test locally
|
|
374
|
+
|
|
375
|
+
### Monorepo Issues
|
|
376
|
+
|
|
377
|
+
**Cause**: semantic-release trying to publish all packages at once.
|
|
378
|
+
|
|
379
|
+
**Solution**:
|
|
380
|
+
|
|
381
|
+
1. Run semantic-release separately for each package
|
|
382
|
+
2. Use `semantic-release-monorepo` plugin
|
|
383
|
+
3. Configure `pkgRoot` correctly per package
|
|
384
|
+
|
|
385
|
+
## Advanced Configuration
|
|
386
|
+
|
|
387
|
+
### Multiple Branches
|
|
388
|
+
|
|
389
|
+
Support production, pre-release, and maintenance:
|
|
390
|
+
|
|
391
|
+
```javascript
|
|
392
|
+
export default createConfig('semantic-release', {
|
|
393
|
+
branches: [
|
|
394
|
+
'main',
|
|
395
|
+
'next',
|
|
396
|
+
{ name: 'beta', prerelease: true },
|
|
397
|
+
{ name: 'alpha', prerelease: true },
|
|
398
|
+
{ name: '+([0-9])?(.{+([0-9]),x}).x', prerelease: true }
|
|
399
|
+
]
|
|
400
|
+
})
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### Custom Tag Format
|
|
404
|
+
|
|
405
|
+
```javascript
|
|
406
|
+
export default createConfig('semantic-release', {
|
|
407
|
+
tagFormat: 'v${version}' // Creates tags like v1.0.0
|
|
408
|
+
})
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
### Changelog Customization
|
|
412
|
+
|
|
413
|
+
```javascript
|
|
414
|
+
export default createConfig('semantic-release', {
|
|
415
|
+
preset: 'default',
|
|
416
|
+
plugins: [
|
|
417
|
+
'@semantic-release/commit-analyzer',
|
|
418
|
+
'@semantic-release/release-notes-generator',
|
|
419
|
+
[
|
|
420
|
+
'@semantic-release/changelog',
|
|
421
|
+
{
|
|
422
|
+
changelogFile: 'HISTORY.md',
|
|
423
|
+
changelogTitle: '# Release History'
|
|
424
|
+
}
|
|
425
|
+
],
|
|
426
|
+
'@semantic-release/npm',
|
|
427
|
+
'@semantic-release/gitlab',
|
|
428
|
+
[
|
|
429
|
+
'@semantic-release/git',
|
|
430
|
+
{
|
|
431
|
+
assets: ['HISTORY.md', 'package.json'],
|
|
432
|
+
message: 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}'
|
|
433
|
+
}
|
|
434
|
+
]
|
|
435
|
+
]
|
|
436
|
+
})
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## API Reference
|
|
440
|
+
|
|
441
|
+
### `createConfig(tool, options)`
|
|
442
|
+
|
|
443
|
+
Create a semantic-release configuration.
|
|
444
|
+
|
|
445
|
+
**Parameters:**
|
|
446
|
+
|
|
447
|
+
- `tool` (string): Must be `'semantic-release'`
|
|
448
|
+
- `options` (object): Configuration options
|
|
449
|
+
- `preset` (string): Preset to use (`'default'`, `'library'`, `'monorepo'`). Default: `'default'`
|
|
450
|
+
- `gitProvider` (string | null): Git provider (`'gitlab'`, `'github'`, `'bitbucket'`, `'auto'`, or `null`). Default: `'auto'` (auto-detect)
|
|
451
|
+
- `cwd` (string): Working directory for auto-detection. Default: `process.cwd()`
|
|
452
|
+
- `branches` (string[] | object[]): Branches to release from. Overrides preset.
|
|
453
|
+
- `plugins` (array): Plugins to use. Overrides preset.
|
|
454
|
+
- `repositoryUrl` (string): Repository URL. Auto-detected from package.json.
|
|
455
|
+
- `tagFormat` (string): Git tag format. Default: `'v${version}'`
|
|
456
|
+
- `dryRun` (boolean): Test without publishing. Default: `false`
|
|
457
|
+
- ...any other semantic-release options
|
|
458
|
+
|
|
459
|
+
**Returns:** semantic-release configuration object
|
|
460
|
+
|
|
461
|
+
### Named Export
|
|
462
|
+
|
|
463
|
+
```javascript
|
|
464
|
+
import { createReleaseConfig } from '@dimensional-innovations/tool-config'
|
|
465
|
+
|
|
466
|
+
export default createReleaseConfig({ preset: 'library' })
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
## Examples
|
|
470
|
+
|
|
471
|
+
### Standard Library
|
|
472
|
+
|
|
473
|
+
```javascript
|
|
474
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
475
|
+
|
|
476
|
+
export default createConfig('semantic-release', {
|
|
477
|
+
preset: 'library'
|
|
478
|
+
})
|
|
479
|
+
```
|
|
480
|
+
|
|
481
|
+
### Application with Beta Releases
|
|
482
|
+
|
|
483
|
+
```javascript
|
|
484
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
485
|
+
|
|
486
|
+
export default createConfig('semantic-release', {
|
|
487
|
+
preset: 'default',
|
|
488
|
+
branches: ['main', { name: 'beta', prerelease: true }]
|
|
489
|
+
})
|
|
490
|
+
```
|
|
491
|
+
|
|
492
|
+
### Minimal Configuration
|
|
493
|
+
|
|
494
|
+
```javascript
|
|
495
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
496
|
+
|
|
497
|
+
export default createConfig('semantic-release', {
|
|
498
|
+
preset: 'default',
|
|
499
|
+
plugins: [
|
|
500
|
+
'@semantic-release/commit-analyzer',
|
|
501
|
+
'@semantic-release/release-notes-generator',
|
|
502
|
+
'@semantic-release/npm'
|
|
503
|
+
]
|
|
504
|
+
})
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### Monorepo Package
|
|
508
|
+
|
|
509
|
+
```javascript
|
|
510
|
+
import { createConfig } from '@dimensional-innovations/tool-config'
|
|
511
|
+
|
|
512
|
+
export default createConfig('semantic-release', {
|
|
513
|
+
preset: 'monorepo'
|
|
514
|
+
})
|
|
515
|
+
```
|
|
516
|
+
|
|
517
|
+
## Resources
|
|
518
|
+
|
|
519
|
+
- [semantic-release Documentation](https://semantic-release.gitbook.io/)
|
|
520
|
+
- [Conventional Commits](https://www.conventionalcommits.org/)
|
|
521
|
+
- [Semantic Versioning](https://semver.org/)
|
|
522
|
+
- [GitLab CI/CD](https://docs.gitlab.com/ee/ci/)
|
|
523
|
+
- [GitHub Actions](https://docs.github.com/en/actions)
|
|
524
|
+
|
|
525
|
+
## Related Tools
|
|
526
|
+
|
|
527
|
+
This package also provides configurations for:
|
|
528
|
+
|
|
529
|
+
- **ESLint** - JavaScript/TypeScript linting
|
|
530
|
+
- **Prettier** - Code formatting
|
|
531
|
+
- **Stylelint** - CSS/style linting
|
|
532
|
+
|
|
533
|
+
See the main [README](../../../README.md) for full package documentation.
|