ReAPI CLI Sync
Deploy directly to ReAPI’s CDN without publishing to npm.
Benefits
- Private: No public npm package required
- Simple: One command to deploy
- Automatic: URL generated automatically
- Fast: Skip npm publish process
Installation
npm install -g @reapi/cli
# Or use npx
npx @reapi/cliAuthentication
# Login to ReAPI
reapi login
# Or use API key
export REAPI_API_KEY=your-api-keyDeploy
# Build first
npm run build
# Sync to ReAPI
reapi lib sync --project <project-id>Options
reapi lib sync \
--project <project-id> \ # Required: Target project
--name "My Test Library" \ # Library display name
--lib-name MyTestLib \ # Global variable name
--file dist/build.umd.js \ # Bundle file (default: dist/build.umd.js)
--types dist/build.d.ts # Types file (default: dist/build.d.ts)Output
$ reapi lib sync --project proj_123
✓ Building library...
✓ Uploading bundle (125 KB)
✓ Uploading types (4 KB)
✓ Syncing components...
Library deployed successfully!
URL: https://libs.reapi.com/proj_123/my-test-lib@1.0.0/bundle.js
Types: https://libs.reapi.com/proj_123/my-test-lib@1.0.0/types.d.ts
Components synced:
- 5 assertions
- 3 value generators
- 2 API hooks
- 8 test casespackage.json Script
Add to your package.json:
{
"scripts": {
"deploy": "npm run build && reapi lib sync --project $REAPI_PROJECT_ID",
"deploy:staging": "npm run build && reapi lib sync --project proj_staging",
"deploy:prod": "npm run build && reapi lib sync --project proj_prod"
}
}Then:
npm run deployCI/CD Integration
GitHub Actions
name: Deploy to ReAPI
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20"
- run: npm ci
- run: npm test
- run: npm run build
- name: Deploy to ReAPI
env:
REAPI_API_KEY: ${{ secrets.REAPI_API_KEY }}
run: npx @reapi/cli lib sync --project ${{ vars.REAPI_PROJECT_ID }}GitLab CI
deploy:
stage: deploy
script:
- npm ci
- npm run build
- npx @reapi/cli lib sync --project $REAPI_PROJECT_ID
variables:
REAPI_API_KEY: $REAPI_API_KEY
only:
- mainVersioning
The CLI auto-increments versions:
# First deploy
reapi lib sync # -> 1.0.0
# Next deploy
reapi lib sync # -> 1.0.1
# Force specific version
reapi lib sync --version 2.0.0Multiple Projects
Deploy to different projects:
# Staging
reapi lib sync --project proj_staging
# Production
reapi lib sync --project proj_productionComparing to npm
| Aspect | npm + CDN | ReAPI CLI |
|---|---|---|
| Public visibility | Yes | No |
| npm account needed | Yes | No |
| Version management | Manual | Automatic |
| Deploy command | npm publish | reapi lib sync |
| URL format | unpkg.com/… | libs.reapi.com/… |
| Cache control | CDN manages | ReAPI manages |