Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Environment variables for Nvisy SDK development
# Copy this file to .env and modify values as needed

# OpenAPI Configuration
# URL endpoint for downloading the OpenAPI specification
OPENAPI_ENDPOINT=https://api.nvisy.com/openapi.yaml

# Directory where OpenAPI specification will be saved
OPENAPI_OUTPUT_DIR=openapi

# Filename for the downloaded OpenAPI specification
OPENAPI_FILENAME=nvisy-api.yaml

# Directory where generated TypeScript types will be saved
GENERATED_TYPES_DIR=src/generated



# Node.js environment
NODE_ENV=development

# Optional: Custom API base URL for development
# NVISY_API_BASE_URL=http://localhost:3000

# Optional: API key for testing (never commit real keys)
# NVISY_API_KEY=your-development-api-key-here
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2
updates:
# Enable version updates for npm
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
timezone: "Europe/Berlin"
day: "monday"
time: "04:00"
open-pull-requests-limit: 5
labels:
- "chore"
commit-message:
prefix: "chore(deps)"
prefix-development: "chore(deps-dev)"
rebase-strategy: "auto"
versioning-strategy: "increase"

# Version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
timezone: "Europe/Berlin"
day: "monday"
time: "04:00"
open-pull-requests-limit: 5
labels:
- "chore"
commit-message:
prefix: "chore(actions)"
118 changes: 118 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: Build

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
lint:
name: Lint & Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run Biome check
run: npm run check

- name: Check TypeScript
run: npm run typecheck

test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run tests
run: npm run test:coverage

- name: Upload coverage to Codecov
if: matrix.node-version == 22
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: false

build:
name: Build
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build

- name: Check build artifacts
run: |
ls -la dist/
file dist/index.js
file dist/index.d.ts

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
retention-days: 7

publish-dry-run:
name: Publish (Dry Run)
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'pull_request'
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci

- name: Build package
run: npm run build

- name: Publish dry run
run: npm publish --dry-run
174 changes: 174 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
name: Release

on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
version:
description: "Version to release (e.g., 1.0.0)"
required: true
type: string

env:
NODE_VERSION: "22"

jobs:
validate:
name: Validate Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
tag: ${{ steps.version.outputs.tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"

- name: Extract version
id: version
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
VERSION="${{ inputs.version }}"
TAG="v${VERSION}"
else
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "tag=${TAG}" >> $GITHUB_OUTPUT
echo "Releasing version: ${VERSION}"

- name: Validate version format
run: |
if ! echo "${{ steps.version.outputs.version }}" | grep -E '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9-]+(\.[0-9]+)?)?$'; then
echo "Invalid version format: ${{ steps.version.outputs.version }}"
exit 1
fi

- name: Check if tag exists (for manual dispatch)
if: github.event_name == 'workflow_dispatch'
run: |
if git rev-parse "${{ steps.version.outputs.tag }}" >/dev/null 2>&1; then
echo "Tag ${{ steps.version.outputs.tag }} already exists"
exit 1
fi

test:
name: Test & Build
runs-on: ubuntu-latest
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"

- name: Install dependencies
run: npm ci

- name: Run linting and formatting checks
run: npm run check

- name: Run type checking
run: npm run typecheck

- name: Run tests with coverage
run: npm run test:coverage

- name: Build package
run: npm run build

- name: Verify build artifacts
run: |
ls -la dist/
test -f dist/index.js
test -f dist/index.d.ts

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist-${{ needs.validate.outputs.version }}
path: dist/
retention-days: 30

publish:
name: Publish to NPM
runs-on: ubuntu-latest
needs: [validate, test]
environment: release
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "npm"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci

- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: dist-${{ needs.validate.outputs.version }}
path: dist/

- name: Update package.json version
run: npm version ${{ needs.validate.outputs.version }} --no-git-tag-version

- name: Publish to NPM
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish

- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ needs.validate.outputs.tag }}
release_name: Release ${{ needs.validate.outputs.tag }}
body: |
## What's Changed

Release ${{ needs.validate.outputs.version }} of the Nvisy SDK.

### Installation
```bash
npm install @nvisy/sdk@${{ needs.validate.outputs.version }}
```

### Documentation
See the [README](https://github.com/nvisycom/sdk#readme) for usage instructions.

**Full Changelog**: https://github.com/nvisycom/sdk/compare/v${{ needs.validate.outputs.version }}...HEAD
draft: false
prerelease: ${{ contains(needs.validate.outputs.version, '-') }}

notify:
name: Notify Release
runs-on: ubuntu-latest
needs: [validate, publish]
if: success()
steps:
- name: Notify success
run: |
echo "🎉 Successfully released @nvisy/sdk@${{ needs.validate.outputs.version }}"
echo "📦 NPM: https://www.npmjs.com/package/@nvisy/sdk/v/${{ needs.validate.outputs.version }}"
echo "🏷️ GitHub: https://github.com/nvisycom/sdk/releases/tag/${{ needs.validate.outputs.tag }}"
Loading
Loading