@mrshmllw/campfire 1.0.1-crumbs-feature-adding-peer-dep.1 → 1.1.0-crumbs-feature-testing-configs.1

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 CHANGED
@@ -1,75 +1,51 @@
1
1
  # Campfire
2
2
 
3
- `campfire` is a collection internal configs, utils, and bits and pieces
3
+ Internal configs, utils, and tooling for Marshmallow projects.
4
4
 
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- $ npm install -D @mrshmllw/campfire
8
+ npm install -D @mrshmllw/campfire
9
9
  ```
10
10
 
11
- ## Making changes
11
+ ## Configuration
12
12
 
13
- When making changes and creating PR's we use
14
- [semantic-releases](https://www.npmjs.com/package/semantic-release) which make
15
- use of [conventional-commits](https://www.conventionalcommits.org/en/v1.0.0/).
13
+ Import and use the pre-configured tools:
16
14
 
17
- So to ensure our CHANGELOG.md is updated automatically and gets the changes we
18
- have made, we just need to name our PR's following this convention (casing
19
- matters): e.g
15
+ ```javascript
16
+ // eslint.config.js
17
+ import { eslintConfig } from '@mrshmllw/campfire'
18
+ export default eslintConfig
20
19
 
21
- 1. patch - fix(OPTIONAL bugfix-reference): some bugfix
22
- 2. minor - feat(OPTIONAL feature-reference): some feature
23
- 3. major - BREAKING CHANGE: some breaking change
20
+ // prettier.config.js
21
+ import { prettierConfig } from '@mrshmllw/campfire'
22
+ export default prettierConfig
24
23
 
25
- ## Release
26
-
27
- Only the following branches are supported for release:
28
-
29
- - `main`
30
- - `feature/*`
31
- - `chore/*`
32
- - `fix/*`
33
-
34
- #### Preview
24
+ // commitlint.config.js
25
+ import { commitlintConfig } from '@mrshmllw/campfire'
26
+ export default commitlintConfig
35
27
 
36
- Before releasing, you may want to see the changes that will be included in the
37
- next version deployed on NPM, you can do so by:
28
+ // release.config.js
29
+ import { releaseConfig } from '@mrshmllw/campfire'
30
+ export default releaseConfig
38
31
 
39
- 1. Goto our
40
- [github workflows](https://github.com/marshmallow-insurance/campfire/actions)
41
- 2. Click `Preview Bump and Publish`
42
- 3. Press `Run workflow` and select the `main` branch.
43
- 4. Wait for the `Generate preview CHANGELOG.md` and look at the results!
44
-
45
- #### Releasing & Publishing
46
-
47
- When you're happy with your changes, you can release & publish your changes to
48
- NPM in one fell swoop by:
32
+ // lint-staged.config.js
33
+ import { lintStagedConfig } from '@mrshmllw/campfire'
34
+ export default lintStagedConfig
35
+ ```
49
36
 
50
- 1. Goto our
51
- [github workflows](https://github.com/marshmallow-insurance/campfire/actions)
52
- 2. Click `Bump and Publish`
53
- 3. Press `Run workflow` and select the `main` branch.
54
- 4. Wait for release!
37
+ ## Development
55
38
 
56
- > [!NOTE] this workflow will fail if the package version is already on the latest, so you dont have to worry about deploying the same changes multiple times.
39
+ Use [conventional commits](https://www.conventionalcommits.org/) for automatic changelog generation:
57
40
 
58
- > [!IMPORTANT] When re-using the release.config in other repos, you need to ensure that the package.json includes a repository URL.
41
+ - `fix: description` patch release
42
+ - `feat: description` → minor release
43
+ - `BREAKING CHANGE: description` → major release
59
44
 
60
- #### Pre-Releases
45
+ ## Release
61
46
 
62
- Not too different to your usual workflow!
47
+ Releases are handled via GitHub Actions on these branches:
48
+ - `main` - production releases
49
+ - `feature/*`, `chore/*`, `fix/*` - pre-releases
63
50
 
64
- 1. Checkout a new branch with the prefix
65
- `(feature|chore|fix)/<your-branch-name>` e.g. `feature/awesome-new-feature`
66
- 2. Open a PR and create your changes as normal using semantic-commits!
67
- 3. Goto our
68
- [github workflows](https://github.com/marshmallow-insurance/campfire/actions)
69
- 4. Click `Bump and Publish` or `Preview Bump and Publish`
70
- 5. Press `Run workflow` and select `<your-full-branch-name>` branch.
71
- 6. Wait for release!
72
- 7. This can be done multiple times and it will increment your pre-release
73
- package version!
74
- 8. When you're happy with the changes, simply squash and merge the PR and
75
- release `main`!
51
+ Use the "Bump and Publish" workflow in GitHub Actions to release.
@@ -1,5 +1,5 @@
1
1
  export default config;
2
- declare const config: (import("eslint").Linter.FlatConfig | {
2
+ declare const config: (import("eslint").Linter.Config<import("eslint").Linter.RulesRecord> | {
3
3
  files: string[];
4
4
  languageOptions: {
5
5
  parser: typeof tsParser;
@@ -0,0 +1,5 @@
1
+ export { default as commitlint } from './commitlint.config.js';
2
+ export { default as eslint } from './eslint.config.js';
3
+ export { default as lintStaged } from './lint-staged.config.js';
4
+ export { default as prettier } from './prettier.config.js';
5
+ export { default as release } from './release.config.js';
@@ -0,0 +1,5 @@
1
+ export { default as commitlint } from './commitlint.config.js';
2
+ export { default as eslint } from './eslint.config.js';
3
+ export { default as lintStaged } from './lint-staged.config.js';
4
+ export { default as prettier } from './prettier.config.js';
5
+ export { default as release } from './release.config.js';
@@ -46,6 +46,7 @@ const config = {
46
46
  {
47
47
  preset: 'angular',
48
48
  releaseRules: [
49
+ { breaking: true, release: 'major' },
49
50
  { type: 'feat', release: 'minor' },
50
51
  { type: 'fix', release: 'patch' },
51
52
  { type: 'docs', release: 'patch' },
package/dist/index.d.ts CHANGED
@@ -0,0 +1,5 @@
1
+ export { default as commitlintConfig } from './configs/commitlint.config.js';
2
+ export { default as eslintConfig } from './configs/eslint.config.js';
3
+ export { default as lintStagedConfig } from './configs/lint-staged.config.js';
4
+ export { default as prettierConfig } from './configs/prettier.config.js';
5
+ export { default as releaseConfig } from './configs/release.config.js';
package/dist/index.js CHANGED
@@ -1 +1,7 @@
1
- "use strict";
1
+ export { default as commitlintConfig } from './configs/commitlint.config.js';
2
+ export { default as eslintConfig } from './configs/eslint.config.js';
3
+ export { default as lintStagedConfig } from './configs/lint-staged.config.js';
4
+ export { default as prettierConfig } from './configs/prettier.config.js';
5
+ export { default as releaseConfig } from './configs/release.config.js';
6
+ // Note: GitHub workflow templates are available in the workflows/ directory
7
+ // Copy them to your .github/workflows/ directory as needed
package/package.json CHANGED
@@ -1,12 +1,71 @@
1
1
  {
2
2
  "name": "@mrshmllw/campfire",
3
- "version": "1.0.1-crumbs-feature-adding-peer-dep.1",
3
+ "version": "1.1.0-crumbs-feature-testing-configs.1",
4
4
  "description": "Collection of toasty utils and configs used by Marshmallow Technology",
5
- "main": "index.js",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
6
7
  "type": "module",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ },
13
+ "./configs/*": {
14
+ "types": "./dist/configs/*.d.ts",
15
+ "import": "./dist/configs/*.js"
16
+ },
17
+ "./utils/*": {
18
+ "types": "./dist/utils/*.d.ts",
19
+ "import": "./dist/utils/*.js"
20
+ },
21
+ "./workflows/*": "./dist/workflows/*"
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "dependencies": {
27
+ "@commitlint/types": "^19.0.0",
28
+ "@typescript-eslint/eslint-plugin": "^8.0.0",
29
+ "@typescript-eslint/parser": "^8.0.0",
30
+ "eslint-plugin-prettier": "^5.0.0",
31
+ "@semantic-release/changelog": "^6.0.0",
32
+ "@semantic-release/git": "^10.0.0",
33
+ "@semantic-release/github": "^11.0.0",
34
+ "@semantic-release/npm": "^12.0.0",
35
+ "conventional-changelog-conventionalcommits": "^9.0.0"
36
+ },
37
+ "peerDependencies": {
38
+ "@commitlint/cli": "^19.0.0",
39
+ "eslint": "^9.0.0",
40
+ "husky": "^9.0.0",
41
+ "lint-staged": "^15.0.0 || ^16.0.0",
42
+ "prettier": "^3.0.0",
43
+ "semantic-release": "^24.0.0"
44
+ },
45
+ "peerDependenciesMeta": {
46
+ "@commitlint/cli": {
47
+ "optional": true
48
+ },
49
+ "eslint": {
50
+ "optional": true
51
+ },
52
+ "prettier": {
53
+ "optional": true
54
+ },
55
+ "husky": {
56
+ "optional": true
57
+ },
58
+ "lint-staged": {
59
+ "optional": true
60
+ },
61
+ "semantic-release": {
62
+ "optional": true
63
+ }
64
+ },
7
65
  "scripts": {
8
66
  "clean": "rimraf ./dist",
9
- "test": "echo \"Error: There are no tests yet\"",
67
+ "test": "node --test",
68
+ "test:watch": "node --test --watch",
10
69
  "check-types": "tsc --noEmit",
11
70
  "build": "npm run clean && tsc --p tsconfig.build.json",
12
71
  "prepublishOnly": "npm run build",
@@ -14,32 +73,25 @@
14
73
  "pre-commit-lint": "npm run check-types && lint-staged",
15
74
  "commitlint": "commitlint --edit"
16
75
  },
17
- "dependencies": {
18
- "typescript": "^5.7.3"
19
- },
20
- "peerDependencies": {
21
- "eslint": "^9.19.0",
22
- "prettier": "^3.4.2",
23
- "lint-staged": "^15.4.3"
24
- },
25
76
  "devDependencies": {
26
- "@commitlint/cli": "^19.7.1",
27
- "@commitlint/types": "^19.5.0",
77
+ "@commitlint/cli": "^19.8.1",
78
+ "@commitlint/types": "^19.8.0",
28
79
  "@semantic-release/changelog": "^6.0.3",
29
80
  "@semantic-release/git": "^10.0.1",
30
- "@semantic-release/github": "^11.0.1",
81
+ "@semantic-release/github": "^11.0.3",
31
82
  "@semantic-release/npm": "^12.0.1",
32
- "@typescript-eslint/eslint-plugin": "^8.23.0",
33
- "@typescript-eslint/parser": "^8.23.0",
34
- "conventional-changelog-conventionalcommits": "^8.0.0",
35
- "eslint": "^9.19.0",
36
- "eslint-config-prettier": "^9.1.0",
37
- "eslint-plugin-prettier": "^5.2.3",
83
+ "@typescript-eslint/eslint-plugin": "^8.34.0",
84
+ "@typescript-eslint/parser": "^8.33.0",
85
+ "conventional-changelog-conventionalcommits": "^9.0.0",
86
+ "eslint": "^9.28.0",
87
+ "eslint-config-prettier": "^10.1.5",
88
+ "eslint-plugin-prettier": "^5.4.1",
38
89
  "husky": "^9.1.7",
39
- "lint-staged": "^15.4.3",
40
- "prettier": "^3.4.2",
90
+ "lint-staged": "^16.1.0",
91
+ "prettier": "^3.5.3",
41
92
  "rimraf": "^6.0.1",
42
- "semantic-release": "^24.2.1"
93
+ "semantic-release": "^24.2.5",
94
+ "typescript": "^5.8.3"
43
95
  },
44
96
  "repository": {
45
97
  "type": "git",
@@ -1,19 +0,0 @@
1
- # Lines starting with '#' are comments.
2
-
3
- # Each line is a file pattern followed by one or more owners.
4
-
5
- # More details are here: https://help.github.com/articles/about-codeowners/
6
-
7
- # The '\*' pattern is global owners.
8
-
9
- # Order is important. The last matching pattern has the most precedence.
10
-
11
- # The folders are ordered as follows:
12
-
13
- # In each subsection folders are ordered first by depth, then alphabetically.
14
-
15
- # This should make it easy to add new rules without breaking existing ones.
16
-
17
- # Global - These owners will be the default owners for everything in the repo.
18
-
19
- - @marshmallow-insurance/frontend
@@ -1,15 +0,0 @@
1
- version: 2
2
- updates:
3
- - package-ecosystem: npm
4
- commit-message:
5
- prefix: "chore(npm-dep): "
6
- directory: '/'
7
- schedule:
8
- interval: daily
9
- time: '05:00'
10
- timezone: Europe/London
11
- open-pull-requests-limit: 99
12
- reviewers:
13
- - marshmallow-insurance/frontend
14
- assignees:
15
- - marshmallow-insurance/frontend
@@ -1,28 +0,0 @@
1
- ## What does this do?
2
- <!--
3
- - A short description of what the PR changes and why it's necessary
4
- - Give the reviewers context
5
- - Is the impact global or localised?
6
- - Any tech debt created or discovered?
7
- -->
8
-
9
- ## Screenshot / Video
10
- <!--
11
- - applicable for UI changes, can be skipped if not relevant. You can drag and drop images/videos to upload them to GitHub.
12
- - Example with image with fixed width
13
- - <img src="https://github.com/marshmallow-insurance/uk-auto-signup-www/assets/57456071/3dbf1ec1-2363-4e20-8236-b1f1581b0953" width="300px" />
14
- shortcuts:
15
- - Screenshot: cmd + shift + 4
16
- - Screen recording: cmd + shift + 5
17
- -->
18
-
19
- ## Relevant tickets / Documentation
20
- <!--
21
- - Link to any relevant issue tracking software (jira, GitHub etc), documentation (PRDs, engineering plans, Figma designs) or slack threads
22
- - If applicable, list any new documentation that has been created/updated e.g. diagrams/flows etc
23
- -->
24
-
25
- ## Testing
26
- <!--
27
- - Tests should have been updated/created to cover the changes made in this PR, if not please explain why
28
- -->
@@ -1,9 +0,0 @@
1
- name: Approve and Merge Dependabot PRs
2
-
3
- on:
4
- pull_request_target:
5
- branches: [ main ]
6
-
7
- jobs:
8
- auto-merge-dependabot:
9
- uses: marshmallow-insurance/actions-reusable-workflows/.github/workflows/auto-merge-dependabot.yml@main
@@ -1,52 +0,0 @@
1
- name: Bump and Publish
2
-
3
- on:
4
- workflow_dispatch:
5
-
6
- permissions:
7
- contents: write
8
-
9
- jobs:
10
- bump-and-publish:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: Check branch 🪵
14
- run: |
15
- # Ensure the branch is either:
16
- # - main
17
- # OR
18
- # - feature/your-branch-name
19
- # - fix/your-branch-name
20
- # - chore/your-branch-name
21
- if [[ "$GITHUB_REF" != "refs/heads/main" && ! "$GITHUB_REF" =~ ^refs/heads/(feature|fix|chore)/.* ]]; then
22
- echo "This job can only run on the 'main' branch or a '(feature|fix|chore)/*' branch."
23
- exit 1
24
- fi
25
- shell: bash
26
- - name: Generate Token 🔐
27
- uses: actions/create-github-app-token@v1
28
- id: app-token
29
- with:
30
- app-id: ${{ vars.MARSHMALLOW_CI_APP_ID }}
31
- private-key: ${{ secrets.MARSHMALLOW_CI_APP_PRIVATE_KEY }}
32
- - name: Checkout 🛎️
33
- uses: actions/checkout@v4
34
- with:
35
- token: ${{ steps.app-token.outputs.token }}
36
- persist-credentials: false
37
- - name: Setup Node 👾
38
- uses: actions/setup-node@v4
39
- with:
40
- node-version-file: ".nvmrc"
41
- - name: Install Dependencies 🔧
42
- run: |
43
- npm ci
44
- - name: Configure Git 🪪
45
- run: |
46
- git config user.name "marshmallow-ci"
47
- git config user.email "ci@marshmallow.co"
48
- - name: Generate CHANGELOG.md & Bump & Release to NPM 🦫
49
- env:
50
- GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
51
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52
- run: npx semantic-release
@@ -1,25 +0,0 @@
1
- name: Build and Fossa Check
2
- on:
3
- push:
4
- branches:
5
- - main
6
- jobs:
7
- build-and-fossa-check:
8
- runs-on: ubuntu-latest
9
- steps:
10
- - name: Checkout 🛎️
11
- uses: actions/checkout@v4
12
- with:
13
- persist-credentials: false
14
- - name: Setup Node 👾
15
- uses: actions/setup-node@v4
16
- with:
17
- node-version: '20'
18
- - name: Install and Build 🔧
19
- run: |
20
- npm ci
21
- npm run check-types
22
- - name: Fossa dependency analysis 🐛
23
- uses: fossas/fossa-action@main
24
- with:
25
- api-key: ${{ secrets.FOSSA_API_KEY }}
@@ -1,39 +0,0 @@
1
- name: Preview Bump and Publish
2
-
3
- on:
4
- workflow_dispatch:
5
-
6
- permissions:
7
- contents: write
8
-
9
- jobs:
10
- preview-bump-and-publish:
11
- runs-on: ubuntu-latest
12
- steps:
13
- - name: Generate Token 🔐
14
- uses: actions/create-github-app-token@v1
15
- id: app-token
16
- with:
17
- app-id: ${{ vars.MARSHMALLOW_CI_APP_ID }}
18
- private-key: ${{ secrets.MARSHMALLOW_CI_APP_PRIVATE_KEY }}
19
- - name: Checkout 🛎️
20
- uses: actions/checkout@v4
21
- with:
22
- token: ${{ steps.app-token.outputs.token }}
23
- persist-credentials: false
24
- - name: Setup Node 👾
25
- uses: actions/setup-node@v4
26
- with:
27
- node-version-file: ".nvmrc"
28
- - name: Install Dependencies 🔧
29
- run: |
30
- npm ci
31
- - name: Configure Git 🪪
32
- run: |
33
- git config user.name "marshmallow-ci"
34
- git config user.email "ci@marshmallow.co"
35
- - name: Generate preview CHANGELOG.md
36
- env:
37
- GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
38
- NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
39
- run: npx semantic-release --dry-run
@@ -1,23 +0,0 @@
1
- name: Build and Check Types
2
- on:
3
- pull_request:
4
-
5
- jobs:
6
- build-and-check-types:
7
- runs-on: ubuntu-latest
8
- steps:
9
- - name: Checkout 🛎️
10
- uses: actions/checkout@v4
11
- with:
12
- persist-credentials: false
13
- - name: Setup Node 👾
14
- uses: actions/setup-node@v4
15
- with:
16
- node-version: '20'
17
- - name: Install and Check Types 🔧
18
- run: |
19
- npm ci
20
- npm run check-types
21
- - name: Test 🧪
22
- run: |
23
- npm run test
package/.husky/commit-msg DELETED
@@ -1 +0,0 @@
1
- npx --no -- commitlint --edit $1
package/.husky/pre-commit DELETED
@@ -1 +0,0 @@
1
- npm run pre-commit-lint
package/.nvmrc DELETED
@@ -1 +0,0 @@
1
- 20.11.0
package/.prettierignore DELETED
@@ -1,5 +0,0 @@
1
- node_modules
2
- dist
3
- build
4
- README.md
5
- .github
package/CHANGELOG.md DELETED
@@ -1,17 +0,0 @@
1
- ## 1.0.0 (2025-02-06)
2
-
3
- ### Features
4
-
5
- * adding default release.config ([659c171](https://github.com/marshmallow-insurance/campfire/commit/659c171e21c6fc6858d5b6d967c316c6f2dcd6f8))
6
-
7
- ### Bug Fixes
8
-
9
- * allowJs in tsconfig so we can actually use configs ([05c822e](https://github.com/marshmallow-insurance/campfire/commit/05c822eaf3ef47f4036ef9e55da82a0294df4398))
10
- * creating clearer build dir ([08ec293](https://github.com/marshmallow-insurance/campfire/commit/08ec293cc7d0d1dca9e443a27804d9258c2c8a7c))
11
- * initial commit ([e0efc31](https://github.com/marshmallow-insurance/campfire/commit/e0efc310c4c603df058d1cfc244695d5a4923f67))
12
- * undoing tsconfig refactor ([0d7080f](https://github.com/marshmallow-insurance/campfire/commit/0d7080fe839731b4e6c9716d707a7335ebc68d72))
13
- * update workflow to use actions/create-github-app-token ([705884a](https://github.com/marshmallow-insurance/campfire/commit/705884a75cfba1d997457266a2d2b3b3262b193e))
14
-
15
- ### Refactors
16
-
17
- * tsconfig and exports ([7a48843](https://github.com/marshmallow-insurance/campfire/commit/7a488435aaa186f55150ea49c8141d20b654c882))
@@ -1,2 +0,0 @@
1
- import config from './libs/configs/commitlint.config'
2
- export default config
File without changes
@@ -1 +0,0 @@
1
- "use strict";
package/eslint.config.js DELETED
@@ -1,2 +0,0 @@
1
- import config from './libs/configs/eslint.config.js'
2
- export default config
@@ -1,29 +0,0 @@
1
- import { RuleConfigSeverity, UserConfig } from '@commitlint/types'
2
-
3
- export const config: UserConfig = {
4
- parserPreset: 'conventional-changelog-conventionalcommits',
5
- ignores: [(commit: string) => /^BREAKING(?:[- ]CHANGE(?:S)?):/.test(commit)],
6
- rules: {
7
- 'type-case': [RuleConfigSeverity.Error, 'always', 'lower-case'],
8
- 'type-empty': [RuleConfigSeverity.Error, 'never'],
9
- 'type-enum': [
10
- RuleConfigSeverity.Error,
11
- 'always',
12
- [
13
- 'feat',
14
- 'fix',
15
- 'docs',
16
- 'bump',
17
- 'dependabot',
18
- 'refactor',
19
- 'style',
20
- 'perf',
21
- 'test',
22
- 'revert',
23
- 'chore',
24
- ],
25
- ],
26
- },
27
- }
28
-
29
- export default config
@@ -1,30 +0,0 @@
1
- import typescriptEslintPlugin from '@typescript-eslint/eslint-plugin'
2
- import tsParser from '@typescript-eslint/parser'
3
- import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended'
4
-
5
- const config = [
6
- eslintPluginPrettierRecommended,
7
- {
8
- ignores: ['node_modules', 'dist', 'build'],
9
- },
10
- {
11
- files: ['**/*.+(ts|tsx)'],
12
- languageOptions: {
13
- parser: tsParser,
14
- },
15
- plugins: {
16
- '@typescript-eslint': typescriptEslintPlugin,
17
- },
18
- rules: {
19
- '@typescript-eslint/no-explicit-any': 'warn', // Warns on use of 'any'
20
- '@typescript-eslint/explicit-function-return-type': 'off', // Disables return type enforcement
21
- '@typescript-eslint/no-unused-vars': [
22
- 'warn',
23
- { argsIgnorePattern: '^_' },
24
- ],
25
- 'no-console': 'warn', // Warns on console.log and similar calls
26
- strict: ['error', 'never'],
27
- },
28
- },
29
- ]
30
- export default config
@@ -1,6 +0,0 @@
1
- const config = {
2
- '*.+(js|ts|tsx)': ['eslint'],
3
- '**/*.+(js|json|ts|tsx)': ['prettier --write'],
4
- }
5
-
6
- export default config
@@ -1,9 +0,0 @@
1
- const config = {
2
- bracketSpacing: true,
3
- proseWrap: 'always',
4
- semi: false,
5
- singleQuote: true,
6
- trailingComma: 'all',
7
- }
8
-
9
- export default config
@@ -1,131 +0,0 @@
1
- import { readFileSync } from 'fs'
2
- import path from 'path'
3
-
4
- const branch = process.env.GITHUB_REF_NAME
5
-
6
- /**
7
- * Attempt to determine the repository URL.
8
- * By loading it from the consumer project's package.json.
9
- * If the URL starts with 'git+', remove that prefix.
10
- */
11
- function getRepositoryUrl() {
12
- try {
13
- // process.cwd() will point to the consumer repo when semantic-release runs
14
- const packageJsonPath = path.join(process.cwd(), 'package.json')
15
- const packageJson = readFileSync(packageJsonPath, 'utf8')
16
- const pkg = JSON.parse(packageJson)
17
-
18
- if (pkg.repository) {
19
- let url =
20
- typeof pkg.repository === 'object' ? pkg.repository.url : pkg.repository
21
-
22
- // Remove "git+" prefix if it exists
23
- if (typeof url === 'string' && url.startsWith('git+')) {
24
- url = url.slice(4)
25
- }
26
- return url
27
- }
28
- } catch (err) {
29
- console.warn('Unable to load repository URL from package.json:', err)
30
- }
31
- return undefined
32
- }
33
-
34
- const repositoryUrl = getRepositoryUrl()
35
-
36
- /**
37
- * @type {import('semantic-release').GlobalConfig}
38
- */
39
- const config = {
40
- branches: [
41
- 'main',
42
- {
43
- name: '(feature|fix|chore)/*',
44
- // The prerelease name uses a dynamic expression to replace '/' with '-'
45
- prerelease: 'crumbs-${name.replace(/\\//g, "-")}',
46
- },
47
- ],
48
- repositoryUrl,
49
- plugins: [
50
- [
51
- '@semantic-release/commit-analyzer',
52
- {
53
- preset: 'angular',
54
- releaseRules: [
55
- { type: 'feat', release: 'minor' },
56
- { type: 'fix', release: 'patch' },
57
- { type: 'docs', release: 'patch' },
58
- { type: 'bump', release: 'patch' },
59
- { type: 'dependabot', release: 'patch' },
60
- { type: 'style', release: 'patch' },
61
- { type: 'refactor', release: 'patch' },
62
- { type: 'perf', release: 'patch' },
63
- { type: 'test', release: 'patch' },
64
- { type: 'revert', release: 'patch' },
65
- { type: 'chore', release: 'patch' },
66
- ],
67
- parserOpts: {
68
- noteKeywords: [
69
- 'BREAKING CHANGE',
70
- 'BREAKING-CHANGE',
71
- 'BREAKING CHANGES',
72
- 'BREAKING-CHANGES',
73
- ],
74
- },
75
- },
76
- ],
77
- [
78
- '@semantic-release/release-notes-generator',
79
- {
80
- preset: 'conventionalcommits',
81
- presetConfig: {
82
- types: [
83
- { type: 'feat', section: 'Features' },
84
- { type: 'fix', section: 'Bug Fixes' },
85
- { type: 'docs', section: 'Documentation' },
86
- { type: 'bump', hidden: true },
87
- { type: 'dependabot', hidden: true },
88
- { type: 'style', section: 'Styles' },
89
- { type: 'refactor', section: 'Refactors' },
90
- { type: 'perf', section: 'Performance Improvements' },
91
- { type: 'test', section: 'Tests' },
92
- { type: 'revert', hidden: true },
93
- { type: 'chore', hidden: true },
94
- { type: '*', section: 'Others' },
95
- ],
96
- },
97
- },
98
- ],
99
- [
100
- '@semantic-release/github',
101
- {
102
- assets: ['dist'],
103
- },
104
- ],
105
- [
106
- '@semantic-release/npm',
107
- {
108
- npmPublish: true,
109
- pkgRoot: '.',
110
- },
111
- ],
112
- ],
113
- }
114
-
115
- // Only add the changelog and git plugins on release (not for prereleases)
116
- const isPrereleaseBranch = config.branches.some(
117
- (b) => typeof b === 'object' && branch !== 'main' && b.prerelease,
118
- )
119
-
120
- if (!isPrereleaseBranch) {
121
- config.plugins.push('@semantic-release/changelog', [
122
- '@semantic-release/git',
123
- {
124
- assets: ['package.json', 'package-lock.json', 'CHANGELOG.md'],
125
- message:
126
- 'chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}',
127
- },
128
- ])
129
- }
130
-
131
- export default config
package/libs/index.ts DELETED
File without changes
File without changes
@@ -1,2 +0,0 @@
1
- import config from './libs/configs/lint-staged.config.js'
2
- export default config
@@ -1,2 +0,0 @@
1
- import config from './libs/configs/prettier.config.js'
2
- export default config
package/release.config.js DELETED
@@ -1,2 +0,0 @@
1
- import config from './libs/configs/release.config.js'
2
- export default config
@@ -1,17 +0,0 @@
1
- {
2
- "extends": "./tsconfig.json",
3
- "compilerOptions": {
4
- "rootDir": "libs",
5
- "baseUrl": "libs",
6
- "outDir": "./dist"
7
- },
8
- "exclude": [
9
- "node_modules",
10
- "dist",
11
- "release.config.js",
12
- "commitlint.config.ts",
13
- "eslint.config.js",
14
- "prettier.config.js",
15
- "lint-staged.config.js"
16
- ]
17
- }
package/tsconfig.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist",
4
- "module": "esnext",
5
- "target": "esnext",
6
- "moduleResolution": "Bundler",
7
- "allowJs": true,
8
- "esModuleInterop": true,
9
- "forceConsistentCasingInFileNames": true,
10
- "strict": true,
11
- "skipLibCheck": true,
12
- "rootDir": "libs",
13
- "baseUrl": "libs",
14
- "declaration": true
15
- },
16
- "include": ["libs/**/*"],
17
- "exclude": ["node_modules", "dist"]
18
- }