Skip to content

Commit f07fe3e

Browse files
authored
Return raw component responses with ESLint updates and test coverage (#7)
* feat: update GetEntitiesTool and GetEntityByRefTool to support JSON API format; refactor response handling * feat: enhance tool metadata validation and update tools manifest with new tools and parameters * style: streamline parameter formatting in tools manifest for consistency * feat: add copyright notice and license information to validate-tool-metadata.ts chore: update yarn.lock with new dependencies and versions for rollup plugins and related packages * refactor: update Rollup configuration to improve external dependency handling and prevent CJS/ESM interop issues * feat: enhance CI/CD workflows by adding Corepack setup for Yarn 4 and improving artifact uploads * refactor: rename enhanced scripts and update tool metadata for consistency * chore: update project license from MIT to GPLv3 in README and package.json * refactor: streamline response formatting in GetEntityByRefTool and GetLocationByRefTool * refactor: update CI workflow to use a single Node.js version (20.x) * refactor: simplify CI workflow by removing develop branch and separating Corepack setup steps * refactor: streamline CI and release workflows by removing node version matrix and consolidating Corepack setup steps * feat: update tool parameters and response handling - Made the `type` parameter in `add_location.tool.ts` optional. - Updated test files for `get_entities`, `get_entities_by_query`, `get_entities_by_refs`, `get_entity_ancestors`, `get_entity_by_ref`, `get_entity_facets`, `get_location_by_entity`, `get_location_by_ref`, `refresh_entity`, `remove_entity_by_uid`, and `remove_location_by_id` to use `ApiStatus` for status checks instead of string literals. - Changed mock implementations in tests to use `mockResolvedValueOnce` for better isolation of test cases. - Introduced new constants in `constants.ts` for content types and common field names used in API responses. - Enhanced tool metadata validation in `tool-validator.ts` and `validate-tool-metadata.ts` to provide better type safety and error handling. - Updated `tools-manifest.json` to ensure consistent parameter formatting. * refactor: change mockResponse type to Partial<AxiosResponse> for better flexibility in tests * refactor: remove yarn cache configuration from CI and release workflows * fix: correct command for validating build outputs in CI and release workflows
1 parent 3476edf commit f07fe3e

File tree

146 files changed

+6640
-1343
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+6640
-1343
lines changed

.github/workflows/ci.yml

Lines changed: 68 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: CI
1+
name: Build and Test
22

33
on:
44
push:
@@ -10,17 +10,14 @@ jobs:
1010
build:
1111
runs-on: ubuntu-latest
1212

13-
strategy:
14-
matrix:
15-
node-version: [20.x]
16-
1713
steps:
1814
- uses: actions/checkout@v4
1915

20-
- name: Use Node.js ${{ matrix.node-version }}
16+
- name: Use Node.js 20.x
2117
uses: actions/setup-node@v4
2218
with:
23-
node-version: ${{ matrix.node-version }}
19+
node-version: 20.x
20+
registry-url: "https://registry.npmjs.org"
2421

2522
- name: Enable Corepack
2623
run: corepack enable
@@ -31,15 +28,76 @@ jobs:
3128
- name: Install dependencies
3229
run: yarn install --frozen-lockfile
3330

34-
- name: Lint
31+
- name: Run linting
3532
run: yarn lint
3633

37-
- name: Test
34+
- name: Run tests
3835
run: yarn test
3936

40-
- name: Upload coverage
37+
- name: Build the project
38+
run: yarn build
39+
40+
- name: Validate build outputs
41+
run: yarn build:validate
42+
43+
- name: Test global installation (CommonJS)
44+
run: |
45+
# Test that the built CJS file can execute
46+
node dist/index.cjs --help || echo "Expected: needs env vars"
47+
48+
- name: Test global installation (ESM)
49+
run: |
50+
# Test that the built ESM file can execute
51+
node dist/index.mjs --help || echo "Expected: needs env vars"
52+
53+
- name: Upload build artifacts
54+
uses: actions/upload-artifact@v4
55+
with:
56+
name: build-artifacts-node-${{ matrix.node-version }}
57+
path: |
58+
dist/
59+
!dist/**/*.map
60+
retention-days: 7
61+
62+
- name: Upload coverage (if present)
4163
if: success()
4264
uses: actions/upload-artifact@v4
4365
with:
4466
name: coverage-report
4567
path: coverage
68+
69+
# Job to test publishing (dry run)
70+
publish-test:
71+
runs-on: ubuntu-latest
72+
needs: build
73+
if: github.event_name == 'pull_request'
74+
75+
steps:
76+
- uses: actions/checkout@v4
77+
78+
- name: Use Node.js 20.x
79+
uses: actions/setup-node@v4
80+
with:
81+
node-version: 20.x
82+
83+
- name: Enable Corepack
84+
run: corepack enable
85+
86+
- name: Setup Yarn 4
87+
run: corepack prepare yarn@4 --activate
88+
89+
- name: Install dependencies
90+
run: yarn install --frozen-lockfile
91+
92+
- name: Build the project
93+
run: yarn build
94+
95+
- name: Test npm pack
96+
run: |
97+
npm pack --dry-run
98+
echo "✅ Package can be packed successfully"
99+
100+
- name: Verify package contents
101+
run: |
102+
echo "📦 Package contents that would be published:"
103+
npm pack --dry-run 2>/dev/null | grep -E "^\s*[0-9]+" || true

.github/workflows/release.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
15+
- name: Use Node.js 20.x
16+
uses: actions/setup-node@v4
17+
with:
18+
node-version: 20.x
19+
registry-url: "https://registry.npmjs.org"
20+
21+
- name: Enable Corepack
22+
run: corepack enable
23+
24+
- name: Setup Yarn 4
25+
run: corepack prepare yarn@4 --activate
26+
27+
- name: Install dependencies
28+
run: yarn install --frozen-lockfile
29+
30+
- name: Run tests
31+
run: yarn test
32+
33+
- name: Build the project
34+
run: yarn build
35+
36+
- name: Validate build
37+
run: yarn build:validate
38+
39+
- name: Publish to NPM
40+
run: npm publish
41+
env:
42+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
43+
44+
- name: Create GitHub Release
45+
uses: actions/create-release@v1
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
with:
49+
tag_name: ${{ github.ref }}
50+
release_name: Release ${{ github.ref }}
51+
body: |
52+
## Changes in this Release
53+
54+
- Built with Rollup for optimized dual-format output
55+
- CommonJS and ESM bundles available
56+
- Global installation support via npm
57+
58+
## Installation
59+
60+
```bash
61+
npm install -g @coderrob/backstage-mcp-server
62+
```
63+
64+
## Usage
65+
66+
```bash
67+
backstage-mcp-server
68+
```
69+
draft: false
70+
prerelease: false

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ dist
129129
.vscode-test
130130

131131
# yarn v2
132+
.yarn/sdks
132133
.yarn/cache
133134
.yarn/unplugged
134135
.yarn/build-state.yml

.npmignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Source files
2+
src/
3+
tsconfig*.json
4+
rollup.config.js
5+
jest.config.mjs
6+
eslint.config.js
7+
8+
# Development files
9+
*.test.ts
10+
*.spec.ts
11+
__mocks__/
12+
coverage/
13+
.vscode/
14+
15+
# Documentation (except main files)
16+
planning.md
17+
TODO.md
18+
19+
# Build artifacts not needed in package
20+
*.tsbuildinfo
21+
*.log
22+
node_modules/
23+
24+
# Git
25+
.git/
26+
.gitignore

.yarn/sdks/eslint/bin/eslint.js

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

.yarn/sdks/eslint/lib/api.js

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

.yarn/sdks/eslint/lib/unsupported-api.js

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

.yarn/sdks/eslint/package.json

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

.yarn/sdks/integrations.yml

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

.yarn/sdks/prettier/bin/prettier.cjs

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

0 commit comments

Comments
 (0)