@mrcointreau/shared-config 11.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 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,328 @@
1
+ # @mrcointreau/shared-config
2
+
3
+ Reusable GitHub Actions workflows and shared configurations for Node.js and Python projects.
4
+
5
+ [![npm](https://img.shields.io/npm/v/@mrcointreau/shared-config.svg)](https://www.npmjs.com/package/@mrcointreau/shared-config)
6
+ [![npm@beta](https://img.shields.io/npm/v/@mrcointreau/shared-config/main.svg?label=npm@beta)](https://www.npmjs.com/package/@mrcointreau/shared-config)
7
+
8
+ ## Overview
9
+
10
+ This repository provides a collection of reusable GitHub Actions workflows and composite actions designed to standardize CI/CD pipelines across Node.js and Python projects. It also includes shareable ESLint and Prettier configurations for TypeScript projects.
11
+
12
+ The workflows handle common tasks like linting, testing, building, security audits, semantic releases with OIDC trusted publishing (or token fallback), and documentation generation. All actions use pinned versions with commit SHAs for enhanced security.
13
+
14
+ ## Features
15
+
16
+ - **Unified CI pipeline** for Node.js (npm) and Python (uv) projects
17
+ - **Automated releases** with semantic-release and OIDC trusted publishing (or token fallback) to npm/PyPI
18
+ - **Documentation generation** with TypeDoc (Node.js) and Sphinx (Python)
19
+ - **Conventional commit enforcement** with commitlint
20
+ - **Security audits** using npm audit and pip-audit
21
+ - **Shareable configs** for ESLint and Prettier
22
+
23
+ ## How It Works
24
+
25
+ This repository is built around reusable GitHub Actions workflows that delegate the real work to composite actions. You consume the workflows from your repo, and they call the composite actions in `actions/` with sensible defaults.
26
+
27
+ - **Reusable workflows** live in `.github/workflows/` and are referenced with `uses: mrcointreau/shared-config/.github/workflows/<workflow>.yml@main`.
28
+ - **Composite actions** live in `actions/` and implement the actual steps for CI, release, docs, and utilities.
29
+ - **Pinned action versions** are used throughout to reduce supply-chain risk.
30
+
31
+ Release behavior is intentionally branch-based:
32
+
33
+ - **`main`**: Beta (prerelease) versions are published automatically on push.
34
+ - **`release`**: Stable versions are published manually via `workflow_dispatch`.
35
+ - Branch rules are defined in the semantic-release config (default action config), and can be overridden via `config-path`.
36
+
37
+ Documentation behavior is consistent across languages:
38
+
39
+ - Node uses TypeDoc, Python uses Sphinx.
40
+ - The docs workflow can build only, or build + publish to GitHub Pages.
41
+
42
+ ## Workflows And Actions
43
+
44
+ ### Reusable Workflows
45
+
46
+ - **`ci.yml`**: Runs audit, lint, test, and build for Node or Python. Delegates to `actions/ci/node` or `actions/ci/python`.
47
+ - **`pr.yml`**: Runs CI plus conventional commit linting using `actions/utils/commitlint`.
48
+ - **`release.yml`**: Runs semantic-release for versioning, tagging, and changelog generation via `actions/release/node` or `actions/release/python`. Use `auto-publish: true` to chain publishing.
49
+ - **`publish.yml`**: Builds and publishes packages to npm/PyPI via `actions/publish/node` or `actions/publish/python`. Can be chained from release.yml or used standalone.
50
+ - **`docs.yml`**: Generates docs (TypeDoc or Sphinx) and optionally publishes to GitHub Pages using `actions/docs/*`.
51
+
52
+ ### Composite Actions
53
+
54
+ - **`actions/ci/node`**: npm-based audit/lint/test/build with configurable commands.
55
+ - **`actions/ci/python`**: uv-based audit/lint/test/build with configurable commands.
56
+ - **`actions/release/node`**: semantic-release for Node (versioning, tagging, changelog).
57
+ - **`actions/release/python`**: semantic-release for Python (versioning, tagging, changelog).
58
+ - **`actions/publish/node`**: Builds and publishes Node.js packages to npm with OIDC or token-based auth.
59
+ - **`actions/publish/python`**: Builds and publishes Python packages to PyPI with OIDC or token-based auth.
60
+ - **`actions/docs/typedoc`**: Generates TypeDoc output.
61
+ - **`actions/docs/sphinx`**: Builds Sphinx documentation.
62
+ - **`actions/docs/publish`**: Publishes built docs to GitHub Pages.
63
+ - **`actions/utils/bot-token`**: Generates a GitHub App token for releases.
64
+ - **`actions/utils/commitlint`**: Enforces conventional commit messages.
65
+
66
+ ### Internal Workflow
67
+
68
+ `_release.yml` is used only by this repository to trigger releases and is not intended for reuse. It calls `release.yml` as a thin wrapper with this repo's defaults and enforces OIDC trusted publishing (publish tokens are not passed).
69
+
70
+ ## Getting Started
71
+
72
+ ### Using Workflows
73
+
74
+ Reference workflows directly in your GitHub Actions:
75
+
76
+ ```yaml
77
+ # .github/workflows/ci.yml
78
+ name: CI
79
+ on: [push, pull_request]
80
+ jobs:
81
+ ci:
82
+ uses: mrcointreau/shared-config/.github/workflows/ci.yml@main
83
+ with:
84
+ project-type: node # or 'python'
85
+ ```
86
+
87
+ Set `project-type` to `node` or `python` and optionally override the runtime version (`node-version` or `python-version`).
88
+
89
+ ### Using ESLint/Prettier Configs
90
+
91
+ Install the package:
92
+
93
+ ```bash
94
+ npm install --save-dev @mrcointreau/shared-config
95
+ ```
96
+
97
+ Install peer dependencies:
98
+
99
+ ```bash
100
+ npm install --save-dev @eslint/js eslint eslint-config-prettier eslint-plugin-unused-imports prettier typescript-eslint
101
+ ```
102
+
103
+ ## Usage
104
+
105
+ ### CI Workflow
106
+
107
+ The CI workflow runs audit, lint, test, and build steps.
108
+
109
+ ```yaml
110
+ jobs:
111
+ ci:
112
+ uses: mrcointreau/shared-config/.github/workflows/ci.yml@main
113
+ with:
114
+ project-type: node
115
+ node-version: "22"
116
+ skip-audit: false
117
+ audit-level: moderate
118
+ skip-lint: false
119
+ skip-test: false
120
+ skip-build: false
121
+ lint-command: "npm run lint"
122
+ test-command: "npm test"
123
+ build-command: "npm run build"
124
+ secrets:
125
+ NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
126
+ ```
127
+
128
+ ### PR Workflow
129
+
130
+ The PR workflow runs CI plus conventional commit linting.
131
+
132
+ ```yaml
133
+ jobs:
134
+ pr:
135
+ uses: mrcointreau/shared-config/.github/workflows/pr.yml@main
136
+ with:
137
+ project-type: node
138
+ run-commit-lint: true
139
+ ```
140
+
141
+ ### Release Workflow
142
+
143
+ The Release workflow handles versioning, tagging, and changelog generation using semantic-release.
144
+ Beta releases are published automatically from `main`. Stable releases require merging `main` into `release` and triggering `workflow_dispatch` manually.
145
+ Use `auto-publish: true` to chain the publish workflow after a successful release.
146
+ Use `back-merge: true` to automatically merge the release branch back to `main` after a stable release, keeping version files in sync.
147
+
148
+ ```yaml
149
+ jobs:
150
+ release:
151
+ uses: mrcointreau/shared-config/.github/workflows/release.yml@main
152
+ with:
153
+ project-type: node
154
+ auto-publish: true # Chain publish after release
155
+ back-merge: true
156
+ secrets:
157
+ BOT_ID: ${{ secrets.BOT_ID }}
158
+ BOT_SK: ${{ secrets.BOT_SK }}
159
+ ```
160
+
161
+ ### Publish Workflow
162
+
163
+ The Publish workflow builds and publishes packages to npm/PyPI with OIDC trusted publishing (or token fallback).
164
+ It can be chained from `release.yml` via `auto-publish: true`, or used standalone for manual publishes.
165
+
166
+ ```yaml
167
+ jobs:
168
+ publish:
169
+ uses: mrcointreau/shared-config/.github/workflows/publish.yml@main
170
+ with:
171
+ project-type: node
172
+ version: "1.0.0"
173
+ ```
174
+
175
+ ### Documentation Workflow
176
+
177
+ The Docs workflow generates and publishes documentation to GitHub Pages.
178
+
179
+ ```yaml
180
+ jobs:
181
+ docs:
182
+ uses: mrcointreau/shared-config/.github/workflows/docs.yml@main
183
+ with:
184
+ project-type: node
185
+ docs-path: docs
186
+ publish: true
187
+ ```
188
+
189
+ ### ESLint Configuration
190
+
191
+ ```javascript
192
+ // eslint.config.mjs
193
+ import config from "@mrcointreau/shared-config/eslint";
194
+
195
+ export default config;
196
+ ```
197
+
198
+ ### Prettier Configuration
199
+
200
+ ```javascript
201
+ // prettier.config.cjs
202
+ module.exports = require("@mrcointreau/shared-config/prettier");
203
+ ```
204
+
205
+ ## Configuration
206
+
207
+ ### CI Workflow Inputs
208
+
209
+ | Input | Type | Default | Description |
210
+ | ------------------- | ------- | ---------- | --------------------------------------------------------------------- |
211
+ | `project-type` | string | _required_ | Project type: `node` or `python` |
212
+ | `working-directory` | string | `.` | Working directory |
213
+ | `node-version` | string | `22` | Node.js version (Node.js projects) |
214
+ | `python-version` | string | `3.12` | Python version (Python projects) |
215
+ | `skip-audit` | boolean | `false` | Skip security audit step |
216
+ | `audit-level` | string | `moderate` | Minimum vulnerability severity: `low`, `moderate`, `high`, `critical` |
217
+ | `skip-lint` | boolean | `false` | Skip linting step |
218
+ | `skip-test` | boolean | `false` | Skip test step |
219
+ | `skip-build` | boolean | `false` | Skip build step |
220
+ | `pre-test-script` | string | `""` | Script to run before tests |
221
+ | `lint-command` | string | _auto_ | Custom lint command |
222
+ | `test-command` | string | _auto_ | Custom test command |
223
+ | `build-command` | string | _auto_ | Custom build command |
224
+
225
+ ### Release Workflow Inputs
226
+
227
+ | Input | Type | Default | Description |
228
+ | ------------------- | ------- | ---------- | ------------------------------------------------- |
229
+ | `project-type` | string | _required_ | Project type: `node` or `python` |
230
+ | `working-directory` | string | `.` | Working directory |
231
+ | `node-version` | string | `22` | Node.js version (Node.js projects) |
232
+ | `python-version` | string | `3.12` | Python version (Python projects) |
233
+ | `dry-run` | boolean | `false` | Run in dry-run mode |
234
+ | `config-path` | string | `""` | Custom semantic-release config path |
235
+ | `back-merge` | boolean | `false` | Merge release branch back to main after release |
236
+ | `auto-publish` | boolean | `false` | Chain publish workflow after successful release |
237
+ | `use-oidc` | boolean | `true` | Use OIDC trusted publishing (set to false to use tokens) |
238
+
239
+ ### Publish Workflow Inputs
240
+
241
+ | Input | Type | Default | Description |
242
+ | ------------------- | ------ | ---------- | ------------------------------ |
243
+ | `project-type` | string | _required_ | Project type: `node` or `python` |
244
+ | `version` | string | _required_ | Version to publish (without v prefix) |
245
+ | `working-directory` | string | `.` | Working directory |
246
+ | `node-version` | string | `22` | Node.js version |
247
+ | `python-version` | string | `3.12` | Python version |
248
+ | `use-oidc` | boolean | `true` | Use OIDC trusted publishing (set to false to use tokens) |
249
+
250
+ ### Release Workflow Secrets
251
+
252
+ | Secret | Required | Description |
253
+ | ------------ | -------- | -------------------------------------------------- |
254
+ | `BOT_ID` | Yes | GitHub App ID for bot token generation |
255
+ | `BOT_SK` | Yes | GitHub App private key |
256
+ | `NPM_TOKEN` | No | npm token (optional with OIDC trusted publishing) |
257
+ | `PYPI_TOKEN` | No | PyPI token (optional with OIDC trusted publishing) |
258
+
259
+ ## Project Structure
260
+
261
+ ```
262
+ .
263
+ ├── .github/workflows/ # Reusable GitHub Actions workflows
264
+ │ ├── ci.yml # CI workflow (audit, lint, test, build)
265
+ │ ├── pr.yml # PR workflow (CI + commit lint)
266
+ │ ├── release.yml # Release workflow (semantic-release)
267
+ │ ├── publish.yml # Publish workflow (build + npm/pypi)
268
+ │ └── docs.yml # Documentation workflow
269
+ ├── actions/ # Composite GitHub Actions
270
+ │ ├── ci/ # CI actions
271
+ │ │ ├── node/ # Node.js CI action
272
+ │ │ └── python/ # Python CI action
273
+ │ ├── release/ # Release actions
274
+ │ │ ├── node/ # Node.js release action
275
+ │ │ └── python/ # Python release action
276
+ │ ├── publish/ # Publish actions
277
+ │ │ ├── node/ # Node.js publish action
278
+ │ │ └── python/ # Python publish action
279
+ │ ├── docs/ # Documentation actions
280
+ │ │ ├── typedoc/ # TypeDoc generation
281
+ │ │ ├── sphinx/ # Sphinx generation
282
+ │ │ └── publish/ # GitHub Pages publishing
283
+ │ └── utils/ # Utility actions
284
+ │ ├── bot-token/ # GitHub App token generation
285
+ │ └── commitlint/ # Conventional commit linting
286
+ └── configs/ # Shared configurations
287
+ ├── eslint.config.mjs # ESLint config for TypeScript
288
+ └── prettier.config.cjs # Prettier config
289
+ ```
290
+
291
+ ## Development
292
+
293
+ ### Setup
294
+
295
+ ```bash
296
+ git clone https://github.com/mrcointreau/shared-config.git
297
+ cd shared-config
298
+ npm install
299
+ ```
300
+
301
+ ### Testing Workflows
302
+
303
+ Test workflow changes by referencing your fork:
304
+
305
+ ```yaml
306
+ jobs:
307
+ test:
308
+ uses: mrcointreau/shared-config/.github/workflows/ci.yml@main
309
+ with:
310
+ project-type: node
311
+ ```
312
+
313
+ ### Testing Composite Actions
314
+
315
+ ```yaml
316
+ steps:
317
+ - uses: mrcointreau/shared-config/actions/ci/node@main
318
+ with:
319
+ node-version: "22"
320
+ ```
321
+
322
+ ## Contributing
323
+
324
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
325
+
326
+ ## License
327
+
328
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Shared ESLint configuration for TypeScript projects.
3
+ * Uses TypeScript-ESLint recommended rules, unused imports detection,
4
+ * and Prettier integration.
5
+ */
6
+ import { defineConfig } from 'eslint/config'
7
+ import eslint from '@eslint/js'
8
+ import prettier from 'eslint-config-prettier'
9
+ import unusedImports from 'eslint-plugin-unused-imports'
10
+ import tseslint from 'typescript-eslint'
11
+
12
+ export default defineConfig([
13
+ {
14
+ ignores: ['.eslintrc.js', 'node_modules/**', 'dist/**', 'build/**', 'coverage/**', '**/generated/**', '.idea/**', '.vscode/**'],
15
+ },
16
+ eslint.configs.recommended,
17
+ ...tseslint.configs.recommended,
18
+ {
19
+ files: ['**/*.ts'],
20
+ plugins: {
21
+ 'unused-imports': unusedImports,
22
+ },
23
+ languageOptions: {
24
+ parser: tseslint.parser,
25
+ parserOptions: {
26
+ projectService: true,
27
+ ecmaVersion: 'latest',
28
+ sourceType: 'module',
29
+ },
30
+ },
31
+ rules: {
32
+ 'no-console': 'warn',
33
+ '@typescript-eslint/no-unused-vars': 'off',
34
+ 'unused-imports/no-unused-imports': 'error',
35
+ 'unused-imports/no-unused-vars': ['warn', { ignoreRestSiblings: true, argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
36
+ '@typescript-eslint/no-unused-expressions': 'off',
37
+ 'prefer-template': 'error',
38
+ },
39
+ },
40
+ {
41
+ files: ['**/*.spec.ts', '**/*.test.ts'],
42
+ rules: {
43
+ 'no-restricted-syntax': 'off',
44
+ },
45
+ },
46
+ prettier,
47
+ ])
@@ -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,41 @@
1
+ {
2
+ "name": "@mrcointreau/shared-config",
3
+ "version": "11.0.0",
4
+ "description": "Reusable GitHub Actions workflows and shared configurations for Node.js and Python projects",
5
+ "author": "mrcointreau",
6
+ "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/mrcointreau/shared-config.git"
10
+ },
11
+ "bugs": {
12
+ "url": "https://github.com/mrcointreau/shared-config/issues"
13
+ },
14
+ "homepage": "https://github.com/mrcointreau/shared-config#readme",
15
+ "keywords": [
16
+ "github-actions",
17
+ "ci-cd",
18
+ "eslint",
19
+ "prettier",
20
+ "shared-config",
21
+ "reusable-workflows"
22
+ ],
23
+ "exports": {
24
+ "./eslint": "./configs/eslint.config.mjs",
25
+ "./prettier": "./configs/prettier.config.cjs"
26
+ },
27
+ "files": [
28
+ "configs"
29
+ ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
33
+ "peerDependencies": {
34
+ "@eslint/js": ">=9",
35
+ "eslint": ">=9",
36
+ "eslint-config-prettier": ">=9",
37
+ "eslint-plugin-unused-imports": ">=4",
38
+ "prettier": ">=3",
39
+ "typescript-eslint": ">=8"
40
+ }
41
+ }