Skip to content

Commit ebfd6b8

Browse files
committed
feat: enhance package exports for better module resolution
- Add comprehensive exports field to package.json with subpath exports - Update CHANGELOG.md with new export enhancements - Fix main and types paths to point to dist directory - Enable cleaner imports like @devmehq/sdk-js/api and @devmehq/sdk-js/configuration - Add files field to optimize npm package size
1 parent 4df2dab commit ebfd6b8

24 files changed

+9959
-3283
lines changed

.dockerignore

Lines changed: 0 additions & 32 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 86 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,53 +8,118 @@ on:
88
- '__tests__/**'
99
- 'package.json'
1010
- 'yarn.lock'
11-
- 'release.config.js'
12-
- '.github/workflows/ci.yml'
1311
branches:
1412
- '*'
1513
- '**'
1614
- '!master'
1715

16+
concurrency:
17+
group: ${{ github.workflow }}-${{ github.ref }}
18+
cancel-in-progress: true
19+
1820
env:
1921
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
2022
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2123
CI: true
2224

2325
jobs:
24-
CI:
26+
test:
27+
name: Test
2528
runs-on: ubuntu-latest
2629
timeout-minutes: 20
2730

2831
permissions:
29-
packages: write
3032
contents: write
33+
issues: write
34+
pull-requests: write
35+
id-token: write
36+
packages: write
3137

3238
steps:
33-
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
34-
- uses: styfle/cancel-workflow-action@0.11.0
39+
- name: Checkout
40+
uses: actions/checkout@v5
3541
with:
36-
workflow_id: ci.yml
37-
access_token: ${{ github.token }}
42+
fetch-depth: 0
43+
persist-credentials: false
3844

39-
- uses: actions/checkout@v3
40-
with:
41-
fetch-depth: 30
42-
43-
- uses: FranzDiebold/github-env-vars-action@v2
4445
- name: Setup Node.js
45-
uses: actions/setup-node@v3
46+
uses: actions/setup-node@v5
4647
with:
47-
node-version: 19
48+
node-version: 24
49+
cache: 'yarn'
4850

49-
- name: Yarn
51+
- name: Install dependencies
5052
run: yarn install --frozen-lockfile
5153

54+
- name: Verify dependency integrity
55+
run: yarn audit || true
56+
57+
- name: Lint
58+
run: yarn lint
59+
5260
- name: Test
61+
run: yarn test
62+
63+
- name: Build
64+
run: yarn build
65+
66+
- name: Pre-release (develop branch only)
67+
id: semantic_release
68+
if: github.ref == 'refs/heads/develop' && github.event_name == 'push'
69+
env:
70+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
72+
GIT_AUTHOR_NAME: DEV.ME Team
73+
GIT_AUTHOR_EMAIL: support@dev.me
74+
GIT_COMMITTER_NAME: DEV.ME Team
75+
GIT_COMMITTER_EMAIL: support@dev.me
5376
run: |
54-
yarn test
77+
# Install semantic-release and required plugins
78+
npm i -g semantic-release @semantic-release/git @semantic-release/github @semantic-release/changelog @semantic-release/npm @semantic-release/commit-analyzer
79+
80+
# Run semantic-release
81+
npx semantic-release --debug 2>&1 | tee release-output.txt
5582
56-
- name: Release
57-
if: github.ref == 'refs/heads/develop'
83+
# Extract version and tag info from release output
84+
if grep -q "Published release" release-output.txt; then
85+
echo "release_published=true" >> $GITHUB_OUTPUT
86+
VERSION=$(grep -oP 'Published release \K[0-9]+\.[0-9]+\.[0-9]+(-.+)?' release-output.txt | head -1)
87+
echo "version=$VERSION" >> $GITHUB_OUTPUT
88+
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
89+
else
90+
echo "release_published=false" >> $GITHUB_OUTPUT
91+
fi
92+
93+
- name: Add Release Summary
94+
if: always()
5895
run: |
59-
npm i -g semantic-release @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits
60-
npx semantic-release --no-ci --debug
96+
echo "## 📦 Release Summary" >> $GITHUB_STEP_SUMMARY
97+
echo "" >> $GITHUB_STEP_SUMMARY
98+
99+
if [[ "${{ steps.semantic_release.outputs.release_published }}" == "true" ]]; then
100+
echo "### ✅ Release Published Successfully!" >> $GITHUB_STEP_SUMMARY
101+
echo "" >> $GITHUB_STEP_SUMMARY
102+
echo "- **Version:** \`${{ steps.semantic_release.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
103+
echo "- **Tag:** \`${{ steps.semantic_release.outputs.tag }}\`" >> $GITHUB_STEP_SUMMARY
104+
echo "- **Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
105+
echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
106+
echo "" >> $GITHUB_STEP_SUMMARY
107+
echo "### 🔗 Links" >> $GITHUB_STEP_SUMMARY
108+
echo "- [NPM Package](https://www.npmjs.com/package/@devmehq/sdk-js/v/${{ steps.semantic_release.outputs.version }})" >> $GITHUB_STEP_SUMMARY
109+
echo "- [GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic_release.outputs.tag }})" >> $GITHUB_STEP_SUMMARY
110+
else
111+
echo "### ℹ️ No Release Published" >> $GITHUB_STEP_SUMMARY
112+
echo "" >> $GITHUB_STEP_SUMMARY
113+
echo "No release was created. This could be because:" >> $GITHUB_STEP_SUMMARY
114+
echo "- No relevant commits found for release" >> $GITHUB_STEP_SUMMARY
115+
echo "- Commits don't follow conventional commit format" >> $GITHUB_STEP_SUMMARY
116+
echo "- Release conditions not met" >> $GITHUB_STEP_SUMMARY
117+
fi
118+
119+
echo "" >> $GITHUB_STEP_SUMMARY
120+
echo "### 📊 Build Information" >> $GITHUB_STEP_SUMMARY
121+
echo "- **Workflow:** \`${{ github.workflow }}\`" >> $GITHUB_STEP_SUMMARY
122+
echo "- **Run ID:** \`${{ github.run_id }}\`" >> $GITHUB_STEP_SUMMARY
123+
echo "- **Run Number:** \`${{ github.run_number }}\`" >> $GITHUB_STEP_SUMMARY
124+
echo "- **Actor:** \`${{ github.actor }}\`" >> $GITHUB_STEP_SUMMARY
125+
echo "- **Event:** \`${{ github.event_name }}\`" >> $GITHUB_STEP_SUMMARY

.github/workflows/release.yml

Lines changed: 85 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,112 @@ on:
99
branches:
1010
- 'master'
1111

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: true
15+
1216
env:
1317
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
1418
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1519
CI: true
1620

1721
jobs:
18-
Release:
22+
release:
23+
name: Release
1924
runs-on: ubuntu-latest
2025
timeout-minutes: 20
2126

2227
permissions:
23-
packages: write
2428
contents: write
29+
issues: write
30+
pull-requests: write
31+
id-token: write
32+
packages: write
2533

2634
steps:
27-
- run: echo "🎉 The job was automatically triggered by a ${{ github.event_name }} event."
28-
- uses: styfle/cancel-workflow-action@0.11.0
29-
with:
30-
workflow_id: release.yml
31-
access_token: ${{ github.token }}
32-
33-
- uses: actions/checkout@v3
35+
- name: Checkout
36+
uses: actions/checkout@v5
3437
with:
35-
fetch-depth: 30
38+
fetch-depth: 0
39+
persist-credentials: false
3640

37-
- uses: FranzDiebold/github-env-vars-action@v2
3841
- name: Setup Node.js
39-
uses: actions/setup-node@v3
42+
uses: actions/setup-node@v5
4043
with:
41-
node-version: 19
44+
node-version: 24
45+
cache: 'yarn'
4246

43-
- name: Yarn
47+
- name: Install dependencies
4448
run: yarn install --frozen-lockfile
4549

50+
- name: Verify dependency integrity
51+
run: yarn audit || true
52+
53+
- name: Lint
54+
run: yarn lint
55+
4656
- name: Test
47-
run: |
48-
yarn test
57+
run: yarn test
58+
59+
- name: Build
60+
run: yarn build
4961

5062
- name: Release
63+
id: semantic_release
64+
env:
65+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
67+
GIT_AUTHOR_NAME: DEV.ME Team
68+
GIT_AUTHOR_EMAIL: support@dev.me
69+
GIT_COMMITTER_NAME: DEV.ME Team
70+
GIT_COMMITTER_EMAIL: support@dev.me
5171
run: |
52-
npm i -g semantic-release @semantic-release/git @semantic-release/github conventional-changelog-conventionalcommits
53-
npx semantic-release --no-ci --debug
72+
# Install semantic-release and required plugins
73+
npm i -g semantic-release @semantic-release/git @semantic-release/github @semantic-release/changelog @semantic-release/npm @semantic-release/commit-analyzer
74+
75+
# Run semantic-release
76+
npx semantic-release --debug 2>&1 | tee release-output.txt
77+
78+
# Extract version and tag info from release output
79+
if grep -q "Published release" release-output.txt; then
80+
echo "release_published=true" >> $GITHUB_OUTPUT
81+
VERSION=$(grep -oP 'Published release \K[0-9]+\.[0-9]+\.[0-9]+' release-output.txt | head -1)
82+
echo "version=$VERSION" >> $GITHUB_OUTPUT
83+
echo "tag=v$VERSION" >> $GITHUB_OUTPUT
84+
else
85+
echo "release_published=false" >> $GITHUB_OUTPUT
86+
fi
87+
88+
- name: Add Release Summary
89+
if: always()
90+
run: |
91+
echo "## 📦 Release Summary" >> $GITHUB_STEP_SUMMARY
92+
echo "" >> $GITHUB_STEP_SUMMARY
93+
94+
if [[ "${{ steps.semantic_release.outputs.release_published }}" == "true" ]]; then
95+
echo "### ✅ Release Published Successfully!" >> $GITHUB_STEP_SUMMARY
96+
echo "" >> $GITHUB_STEP_SUMMARY
97+
echo "- **Version:** \`${{ steps.semantic_release.outputs.version }}\`" >> $GITHUB_STEP_SUMMARY
98+
echo "- **Tag:** \`${{ steps.semantic_release.outputs.tag }}\`" >> $GITHUB_STEP_SUMMARY
99+
echo "- **Branch:** \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY
100+
echo "- **Commit:** \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY
101+
echo "" >> $GITHUB_STEP_SUMMARY
102+
echo "### 🔗 Links" >> $GITHUB_STEP_SUMMARY
103+
echo "- [NPM Package](https://www.npmjs.com/package/@devmehq/sdk-js/v/${{ steps.semantic_release.outputs.version }})" >> $GITHUB_STEP_SUMMARY
104+
echo "- [GitHub Release](https://github.com/${{ github.repository }}/releases/tag/${{ steps.semantic_release.outputs.tag }})" >> $GITHUB_STEP_SUMMARY
105+
else
106+
echo "### ℹ️ No Release Published" >> $GITHUB_STEP_SUMMARY
107+
echo "" >> $GITHUB_STEP_SUMMARY
108+
echo "No release was created. This could be because:" >> $GITHUB_STEP_SUMMARY
109+
echo "- No relevant commits found for release" >> $GITHUB_STEP_SUMMARY
110+
echo "- Commits don't follow conventional commit format" >> $GITHUB_STEP_SUMMARY
111+
echo "- Release conditions not met" >> $GITHUB_STEP_SUMMARY
112+
fi
113+
114+
echo "" >> $GITHUB_STEP_SUMMARY
115+
echo "### 📊 Build Information" >> $GITHUB_STEP_SUMMARY
116+
echo "- **Workflow:** \`${{ github.workflow }}\`" >> $GITHUB_STEP_SUMMARY
117+
echo "- **Run ID:** \`${{ github.run_id }}\`" >> $GITHUB_STEP_SUMMARY
118+
echo "- **Run Number:** \`${{ github.run_number }}\`" >> $GITHUB_STEP_SUMMARY
119+
echo "- **Actor:** \`${{ github.actor }}\`" >> $GITHUB_STEP_SUMMARY
120+
echo "- **Event:** \`${{ github.event_name }}\`" >> $GITHUB_STEP_SUMMARY

.lintstagedrc

Lines changed: 0 additions & 7 deletions
This file was deleted.

.mocharc.js

Lines changed: 0 additions & 29 deletions
This file was deleted.

.npmrc

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)