@mrcointreau/shared-config 0.0.2

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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 mrcointreau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,267 @@
1
+ # @mrcointreau/shared-config
2
+
3
+ Reusable GitHub Actions workflows and shared configurations for Node.js and Python projects.
4
+
5
+ [![CI](https://github.com/mrcointreau/shared-config/workflows/CI/badge.svg)](https://github.com/mrcointreau/shared-config/actions)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ ## Overview
9
+
10
+ This repository provides a collection of reusable GitHub Actions and shared configurations to standardize CI/CD pipelines across Node.js and Python projects. It includes actions for continuous integration, semantic releases, documentation generation, and common utilities.
11
+
12
+ The shared configurations package also exports ESLint and Prettier configurations for TypeScript projects, ensuring consistent code style across your repositories.
13
+
14
+ ## Features
15
+
16
+ - **CI Actions** - Audit, lint, test, and build for Node.js and Python
17
+ - **Release Actions** - Semantic versioning and publishing to npm/PyPI with OIDC support
18
+ - **Documentation Actions** - Generate and publish docs with TypeDoc, Sphinx, and GitHub Pages
19
+ - **Utility Actions** - Commit linting and GitHub App token generation
20
+ - **Shared Configs** - ESLint and Prettier configurations for TypeScript
21
+
22
+ ## Installation
23
+
24
+ ### Prerequisites
25
+
26
+ - Node.js >= 22 (for Node.js actions)
27
+ - Python >= 3.12 (for Python actions)
28
+ - npm or uv package manager
29
+
30
+ ### Install Shared Configurations
31
+
32
+ ```bash
33
+ npm install @mrcointreau/shared-config --save-dev
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ Use an action in your GitHub workflow:
39
+
40
+ ```yaml
41
+ - uses: mrcointreau/shared-config/actions/ci/node@main
42
+ ```
43
+
44
+ ## Usage
45
+
46
+ ### CI Actions
47
+
48
+ #### Node.js CI
49
+
50
+ Audit, lint, test, and build Node.js projects using npm.
51
+
52
+ ```yaml
53
+ jobs:
54
+ ci:
55
+ runs-on: ubuntu-latest
56
+ steps:
57
+ - uses: actions/checkout@v4
58
+ - uses: mrcointreau/shared-config/actions/ci/node@main
59
+ with:
60
+ node-version: "22"
61
+ # skip-audit: "true"
62
+ # skip-lint: "true"
63
+ # skip-test: "true"
64
+ # skip-build: "true"
65
+ ```
66
+
67
+ #### Python CI
68
+
69
+ Audit, lint, test, and build Python projects using uv.
70
+
71
+ ```yaml
72
+ jobs:
73
+ ci:
74
+ runs-on: ubuntu-latest
75
+ steps:
76
+ - uses: actions/checkout@v4
77
+ - uses: mrcointreau/shared-config/actions/ci/python@main
78
+ with:
79
+ python-version: "3.12"
80
+ # skip-audit: "true"
81
+ # skip-lint: "true"
82
+ # skip-test: "true"
83
+ # skip-build: "true"
84
+ ```
85
+
86
+ ### Release Actions
87
+
88
+ The release actions use [semantic-release](https://semantic-release.gitbook.io/) with a branch-based strategy:
89
+
90
+ | Branch | Release Type | Example Version |
91
+ |--------|--------------|-----------------|
92
+ | `main` | Stable | `1.0.0` |
93
+ | `beta` | Prerelease | `1.0.0-beta.1` |
94
+
95
+ **Recommended workflow:**
96
+ 1. Push to `beta` branch → automatically publishes beta/prerelease versions
97
+ 2. Merge `beta` into `main` → automatically publishes stable versions
98
+
99
+ #### Node.js Release
100
+
101
+ Publish Node.js packages to npm with semantic-release and OIDC provenance.
102
+
103
+ ```yaml
104
+ on:
105
+ push:
106
+ branches: [main, beta] # Triggers on both branches
107
+ workflow_dispatch: # Optional: manual trigger
108
+
109
+ jobs:
110
+ release:
111
+ runs-on: ubuntu-latest
112
+ permissions:
113
+ contents: write
114
+ id-token: write
115
+ steps:
116
+ - uses: actions/checkout@v4
117
+ with:
118
+ fetch-depth: 0
119
+ - uses: mrcointreau/shared-config/actions/release/node@main
120
+ with:
121
+ bot-token: ${{ secrets.BOT_TOKEN }}
122
+ npm-token: ${{ secrets.NPM_TOKEN }}
123
+ release-type: "beta" # Uses config with both main and beta branches
124
+ # use-oidc: "true"
125
+ # dry-run: "false"
126
+ ```
127
+
128
+ #### Python Release
129
+
130
+ Publish Python packages to PyPI with semantic-release and OIDC Trusted Publishing.
131
+
132
+ ```yaml
133
+ on:
134
+ push:
135
+ branches: [main, beta] # Triggers on both branches
136
+ workflow_dispatch: # Optional: manual trigger
137
+
138
+ jobs:
139
+ release:
140
+ runs-on: ubuntu-latest
141
+ permissions:
142
+ contents: write
143
+ id-token: write
144
+ steps:
145
+ - uses: actions/checkout@v4
146
+ with:
147
+ fetch-depth: 0
148
+ - uses: mrcointreau/shared-config/actions/release/python@main
149
+ with:
150
+ bot-token: ${{ secrets.BOT_TOKEN }}
151
+ release-type: "beta" # Uses config with both main and beta branches
152
+ # use-oidc: "true"
153
+ # pypi-token: ${{ secrets.PYPI_TOKEN }} # if not using OIDC
154
+ # dry-run: "false"
155
+ ```
156
+
157
+ ### Documentation Actions
158
+
159
+ #### TypeDoc
160
+
161
+ Generate TypeScript documentation with TypeDoc.
162
+
163
+ ```yaml
164
+ - uses: mrcointreau/shared-config/actions/docs/typedoc@main
165
+ with:
166
+ docs-path: "docs"
167
+ entry-points: "src/index.ts"
168
+ # config-path: "typedoc.json"
169
+ ```
170
+
171
+ #### Sphinx
172
+
173
+ Generate Python documentation with Sphinx.
174
+
175
+ ```yaml
176
+ - uses: mrcointreau/shared-config/actions/docs/sphinx@main
177
+ with:
178
+ docs-directory: "docs"
179
+ docs-path: "docs/_build/html"
180
+ # dependency-groups: "docs"
181
+ ```
182
+
183
+ #### Publish to GitHub Pages
184
+
185
+ ```yaml
186
+ - uses: mrcointreau/shared-config/actions/docs/publish@main
187
+ with:
188
+ docs-path: "docs"
189
+ github-token: ${{ secrets.GITHUB_TOKEN }}
190
+ ```
191
+
192
+ ### Utility Actions
193
+
194
+ #### Commit Lint
195
+
196
+ Lint commits using conventional commit rules.
197
+
198
+ ```yaml
199
+ - uses: mrcointreau/shared-config/actions/utils/commitlint@main
200
+ with:
201
+ from: ${{ github.event.pull_request.base.sha }}
202
+ to: ${{ github.event.pull_request.head.sha }}
203
+ ```
204
+
205
+ #### Bot Token
206
+
207
+ Generate a GitHub App installation token for automated operations.
208
+
209
+ ```yaml
210
+ - uses: mrcointreau/shared-config/actions/utils/bot-token@main
211
+ id: bot-token
212
+ with:
213
+ app-id: ${{ secrets.APP_ID }}
214
+ private-key: ${{ secrets.APP_PRIVATE_KEY }}
215
+ # Use with: ${{ steps.bot-token.outputs.token }}
216
+ ```
217
+
218
+ ### Shared Configurations
219
+
220
+ #### ESLint
221
+
222
+ Uses TypeScript-ESLint recommended rules, unused imports detection, and Prettier integration.
223
+
224
+ ```javascript
225
+ // eslint.config.mjs
226
+ import config from '@mrcointreau/shared-config/eslint'
227
+
228
+ export default config
229
+ ```
230
+
231
+ #### Prettier
232
+
233
+ Single quotes, no semicolons, 140 char line width, trailing commas.
234
+
235
+ ```javascript
236
+ // prettier.config.cjs
237
+ module.exports = require('@mrcointreau/shared-config/prettier')
238
+ ```
239
+
240
+ ## Configuration
241
+
242
+ ### Release Action Options
243
+
244
+ | Option | Type | Default | Description |
245
+ |--------|------|---------|-------------|
246
+ | `release-type` | string | `"beta"` | Config to use: `beta` (includes beta branch) or `stable` (main only) |
247
+ | `dry-run` | string | `"false"` | Run without publishing |
248
+ | `use-oidc` | string | `"true"` | Use OIDC for secure publishing |
249
+ | `config-path` | string | `""` | Custom semantic-release config path |
250
+
251
+ ### CI Action Options
252
+
253
+ | Option | Type | Default | Description |
254
+ |--------|------|---------|-------------|
255
+ | `skip-audit` | string | `"false"` | Skip security audit step |
256
+ | `skip-lint` | string | `"false"` | Skip linting step |
257
+ | `skip-test` | string | `"false"` | Skip test step |
258
+ | `skip-build` | string | `"false"` | Skip build step |
259
+ | `pre-test-script` | string | `""` | Script to run before tests |
260
+
261
+ ## Contributing
262
+
263
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
264
+
265
+ ## License
266
+
267
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Shared ESLint configuration for TypeScript projects.
3
+ * Uses TypeScript-ESLint recommended rules, unused imports detection,
4
+ * and Prettier integration.
5
+ */
6
+ import eslint from '@eslint/js'
7
+ import prettier from 'eslint-config-prettier'
8
+ import unusedImports from 'eslint-plugin-unused-imports'
9
+ import tseslint from 'typescript-eslint'
10
+
11
+ export default tseslint.config(
12
+ {
13
+ ignores: [
14
+ '.eslintrc.js',
15
+ 'node_modules/**',
16
+ 'dist/**',
17
+ 'build/**',
18
+ 'coverage/**',
19
+ '**/generated/**',
20
+ '.idea/**',
21
+ '.vscode/**',
22
+ ],
23
+ },
24
+ eslint.configs.recommended,
25
+ tseslint.configs.recommended,
26
+ {
27
+ files: ['**/*.ts'],
28
+ plugins: {
29
+ 'unused-imports': unusedImports,
30
+ },
31
+ languageOptions: {
32
+ parser: tseslint.parser,
33
+ parserOptions: {
34
+ projectService: true,
35
+ ecmaVersion: 'latest',
36
+ sourceType: 'module',
37
+ },
38
+ },
39
+ rules: {
40
+ 'no-console': 'warn',
41
+ '@typescript-eslint/no-unused-vars': 'off',
42
+ 'unused-imports/no-unused-imports': 'error',
43
+ 'unused-imports/no-unused-vars': [
44
+ 'warn',
45
+ { ignoreRestSiblings: true, argsIgnorePattern: '^_', varsIgnorePattern: '^_' },
46
+ ],
47
+ '@typescript-eslint/no-unused-expressions': 'off',
48
+ 'prefer-template': 'error',
49
+ },
50
+ },
51
+ {
52
+ files: ['**/*.spec.ts', '**/*.test.ts'],
53
+ rules: {
54
+ 'no-restricted-syntax': 'off',
55
+ },
56
+ },
57
+ prettier,
58
+ )
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared Prettier configuration.
3
+ * Single quotes, no semicolons, 140 char line width, trailing commas.
4
+ */
5
+ module.exports = {
6
+ singleQuote: true,
7
+ jsxSingleQuote: false,
8
+ semi: false,
9
+ tabWidth: 2,
10
+ trailingComma: 'all',
11
+ printWidth: 140,
12
+ endOfLine: 'lf',
13
+ arrowParens: 'always',
14
+ }
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@mrcointreau/shared-config",
3
+ "version": "0.0.2",
4
+ "description": "Reusable GitHub Actions workflows and shared configurations for Node.js and Python projects",
5
+ "author": "mrcointreau",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/mrcointreau/shared-config.git"
11
+ },
12
+ "bugs": {
13
+ "url": "https://github.com/mrcointreau/shared-config/issues"
14
+ },
15
+ "homepage": "https://github.com/mrcointreau/shared-config#readme",
16
+ "keywords": [
17
+ "github-actions",
18
+ "ci-cd",
19
+ "eslint",
20
+ "prettier",
21
+ "shared-config",
22
+ "reusable-workflows"
23
+ ],
24
+ "exports": {
25
+ "./eslint": "./configs/eslint.config.mjs",
26
+ "./prettier": "./configs/prettier.config.cjs"
27
+ },
28
+ "files": [
29
+ "configs"
30
+ ],
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "peerDependencies": {
35
+ "@eslint/js": ">=9",
36
+ "eslint": ">=9",
37
+ "eslint-config-prettier": ">=9",
38
+ "eslint-plugin-unused-imports": ">=4",
39
+ "prettier": ">=3",
40
+ "typescript-eslint": ">=8"
41
+ }
42
+ }