@adalo/metrics 0.1.166 → 0.1.167
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/.github/workflows/deploy-staging.yml +34 -0
- package/README.md +13 -0
- package/package.json +1 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# Publish a staging build to npm with tag "staging".
|
|
2
|
+
# Push (or merge) to branch "staging" to publish. Consuming apps can then use
|
|
3
|
+
# "@adalo/metrics": "staging"
|
|
4
|
+
# to test changes on staging before merging to main.
|
|
5
|
+
name: Deploy Staging
|
|
6
|
+
|
|
7
|
+
on:
|
|
8
|
+
push:
|
|
9
|
+
branches:
|
|
10
|
+
- staging
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build-and-publish:
|
|
14
|
+
if: "!contains(github.event.head_commit.message, 'skip ci')"
|
|
15
|
+
runs-on: ubuntu-latest
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v3
|
|
18
|
+
with:
|
|
19
|
+
fetch-depth: 0
|
|
20
|
+
- name: Setup Node.js
|
|
21
|
+
uses: actions/setup-node@v3
|
|
22
|
+
with:
|
|
23
|
+
node-version: '18.x'
|
|
24
|
+
registry-url: 'https://registry.npmjs.org'
|
|
25
|
+
- name: Installing dependencies
|
|
26
|
+
run: yarn install --frozen-lockfile
|
|
27
|
+
- name: Build lib
|
|
28
|
+
run: yarn run build
|
|
29
|
+
- name: Set staging version
|
|
30
|
+
run: npm version 0.0.0-staging.${{ github.run_number }} --no-git-tag-version --allow-same-version
|
|
31
|
+
- name: Publish to NPM (tag staging)
|
|
32
|
+
run: npm publish --tag staging
|
|
33
|
+
env:
|
|
34
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
|
package/README.md
CHANGED
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
# @adalo/metrics
|
|
2
2
|
Utility library for Prometheus metrics and HTTP request counting in Node.js applications.
|
|
3
3
|
|
|
4
|
+
## Testing and staging (for contributors)
|
|
5
|
+
|
|
6
|
+
- **Run tests**: `yarn test` (or `yarn test:watch`). CI runs tests on every pull request.
|
|
7
|
+
- **Test locally in a consuming app** (without publishing):
|
|
8
|
+
- From this repo: `yarn link`
|
|
9
|
+
- In the app repo (e.g. backend): `yarn link @adalo/metrics`
|
|
10
|
+
- Or use a file dependency: `"@adalo/metrics": "file:../path/to/metrics-js"`
|
|
11
|
+
- **Test on staging before merging to main**:
|
|
12
|
+
- Push your changes to the **`staging`** branch (create it if needed). The **Deploy Staging** workflow will build and publish to npm with the dist-tag **`staging`** (version like `0.0.0-staging.123`).
|
|
13
|
+
- In the app that uses this library (e.g. backend), point the dependency to the staging build:
|
|
14
|
+
- In `package.json`: `"@adalo/metrics": "staging"` (resolves to latest `@adalo/metrics@staging`), or pin a specific version: `"@adalo/metrics": "0.0.0-staging.123"`.
|
|
15
|
+
- Deploy that app to staging and verify metrics/behavior. When satisfied, merge **metrics-js** into **main** and release a normal version; then update the app back to `"@adalo/metrics": "^x.y.z"` or `"latest"`.
|
|
16
|
+
|
|
4
17
|
## Constructor
|
|
5
18
|
```ts
|
|
6
19
|
new MetricsClient({
|