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
28 changes: 28 additions & 0 deletions .github/workflows/npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Publish Package to npmjs on tag
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v6
# Setup .npmrc file to publish to npm
- uses: actions/setup-node@v7
with:
node-version: '22.x'
registry-url: 'https://registry.npmjs.org'
- run: npm config set '//registry.npmjs.org/:_authToken' "${NPM_TOKEN}"
- run: npm i
- run: npm run build
- run: node -e 'const json=require("./package.json");fs.writeFileSync("./package.json",JSON.stringify({...json, version:process.env.GITHUB_REF?.replace("refs/tags/", "")}, undefined, 2), "utf-8")'
- run: cat package.json
- run: yarn set version stable
- run: yarn publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,20 @@ Module system

It can be used in both TypeScript and JavaScript. In TypeScript, the definition will be automatically resolved via `package.json`. ([Reference](https://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html))

### Basic Example
```
import * as vault from '@hashicorp/vault-client-typescript'
const vaultClientConfig = new vault.Configuration({
basePath:process.env.VAULT_URL, // http://localhost:1234/v1
headers:{
'X-Vault-Token':process.env.VAULT_TOKEN
}
})

const secretsClient = new vault.SecretsApi(vaultClientConfig)
secretsClient.kvV2Write('test_secret', 'secret', {data:{mysecretdata:"12345"}})
```

### Building

To build and compile the typescript sources to javascript use:
Expand Down