open-index/open-npm huggingface dataset:
npm package: @marinade.finance/anchor-common
Description: Marinade Finance Anchor TS/JS utilities
Latest version: 4.2.6

# anchor-common

[`@marinade.finance/anchor-common`](https://www.npmjs.com/package/@marinade.finance/anchor-common)

Typescript utilities that can be reused with Anchor library.

### Dependencies

Library defines set of `peerDependencies` that are required to be directly installed by dependent program.


```sh
pnpm add @solana/web3.js@1
pnpm add @coral-xyz/anchor@0.29.0
pnpm add bn.js@5.2.2
pnpm add @marinade.finance/ts-common@latest
pnpm add @marinade.finance/web3js-1x@latest
```

### Installation

```sh
# see Dependencies
pnpm add @marinade.finance/anchor-common@latest
```
npm package: @marinade.finance/bankrun-utils
Description: Bankrun test library utilities
Latest version: 4.2.6

# bankrun-utils

[`@marinade.finance/bankrun-utils`](https://www.npmjs.com/package/@marinade.finance/bankrun-utils)

Utilities to work with Bankrun Solana testing library

* https://github.com/kevinheavey/solana-bankrun
* https://github.com/kevinheavey/anchor-bankrun

### Dependencies

Library defines set of `peerDependencies` that are required to be directly installed by dependent program.


```sh
pnpm add @solana/web3.js@1
pnpm add @marinade.finance/web3js-1x@latest
pnpm add solana-bankrun@0.2.0
pnpm add anchor-bankrun@0.2.0
pnpm add class-transformer@latest
```

### Installation

```sh
# see Dependencies
pnpm add -D @marinade.finance/bankrun-utils@latest
```
npm package: @marinade.finance/cli-common
Description: CLI tooling for Marinade Finance
Latest version: 4.2.6

# @marinade.finance/cli-common

[`@marinade.finance/cli-common`](https://www.npmjs.com/package/@marinade.finance/cli-common)

Utilities to code CLI. The library is usually used with [`commander`](https://www.npmjs.com/package/commander)
library but `commander` is not a 3rd party dependency of this `cli-common` module.

## Usage

### Pre-requisites

The [`@marinade.finance/cli-common`](https://www.npmjs.com/package/@marinade.finance/cli-common) depends
on [`@marinade.finance/ts-common`](https://www.npmjs.com/package/@marinade.finance/ts-common) library.

Then the `cli-common` library depends adds specific bigint decorators for [`class-validator`](https://www.npmjs.com/package/class-validator)
and it expects to load this dependency explicitly as well.

```sh
pnpm add @marinade.finance/ts-common@latest
pnpm add class-validator@0.14
```

### Installation

```sh
# see Pre-requisites
pnpm add @marinade.finance/cli-common@latest
```
npm package: @marinade.finance/config-common
Description: Environment variable utilities
Latest version: 4.2.6

# config-common

Environment variable utilities.

## Installation

```sh
pnpm add @marinade.finance/config-common@latest
```

## Features

### Environment Variables

```typescript
import {
  getEnvVar,
  getIntEnvVar,
  getBoolEnvVar,
  getOptionalEnvVar,
  parseCommaSeparated,
} from '@marinade.finance/config-common'

// Required variables (throws if missing)
const url = getEnvVar('DATABASE_URL')
const port = getIntEnvVar('PORT')
const enabled = getBoolEnvVar('FEATURE_ENABLED')

// Optional variables
const debug = getOptionalBoolEnvVar('DEBUG')
const hosts = parseCommaSeparated(getEnvVar('ALLOWED_HOSTS'))
```

### Timeout Handling

```typescript
import { getTimeoutEnvVar } from '@marinade.finance/config-common'

// Returns number or 'DISABLE_TIMEOUT' or undefined
const timeout = getTimeoutEnvVar('REQUEST_TIMEOUT')
```

### Environment Detection

```typescript
import {
  getServiceEnvironment,
  isProduction,
  isDevelopment,
} from '@marinade.finance/config-common'

// Supports 'production', 'prod', 'development', 'dev', 'test'
const env = getServiceEnvironment() // 'production' | 'development' | 'test'

if (isProduction()) {
  // Production-only logic
}
```

### Environment Validation

Use with NestJS ConfigModule and class-validator:

```typescript
import { createEnvValidator } from '@marinade.finance/config-common'
import { IsString, IsNumber, IsOptional } from 'class-validator'
import { Transform } from 'class-transformer'

class EnvironmentVariables {
  @IsString()
  DATABASE_URL: string

  @Transform(({ value }) => parseInt(value, 10))
  @IsNumber()
  @IsOptional()
  PORT: number = 3000
}

const validate = createEnvValidator(EnvironmentVariables)

@Module({
  imports: [
    ConfigModule.forRoot({
      validate,
      isGlobal: true,
    }),
  ],
})
export class AppModule {}
```

### Dotenv Loader

```typescript
import { loadEnv } from '@marinade.finance/config-common'

// Load .env file with variable expansion
loadEnv()
```
npm package: @marinade.finance/eslint-config
Description: Shared ESLint configuration for TypeScript/NodeJS/React/Next.js projects
Latest version: 1.3.5

# Marinade ESLint and Prettier Configuration

Shared configuration for ESLint and Prettier used in Marinade projects.

## How to Use

### 1. Configure `package.json`

Update the `package.json` of the dependent project to include the required dependencies and recommended scripts:

```json
{
  "name": "@marinade.finance/project-name",
  "scripts": {
    ...
    "lint:ts": "eslint .",
    "lint:ts-fix": "eslint . --fix",
    "lint": "pnpm run lint:ts",
    "lint:fix": "pnpm run lint:ts-fix",
    "format": "prettier --write .",
    "format:check": "prettier --check .",
    "check": "pnpm lint && pnpm format:check",
    "fix": "pnpm lint:fix && pnpm format",
    "prepare": "husky",
    ...
  },
  "devDependencies": {
    "@marinade.finance/eslint-config": "1.3.4",
    "eslint": "^9.39.2",
    "prettier": "^3.8.0",
    "husky": "^9.1.7",
    "lint-staged": "^16.2.7",
    ...
  }
}
```

Then run `pnpm install`.

### 2. Create `eslint.config.cjs`

Create an `eslint.config.cjs` file in the root of your project (next to `package.json`).
You can use the configuration as is, or customize it as needed:

```js
const createSharedConfig = require('@marinade.finance/eslint-config')

const sharedConfig = createSharedConfig({})

module.exports = [
  ...sharedConfig,
  {
    rules: {
      'no-console': 'off',
    },
  },
  {
    files: ['**/*.spec.ts'],
    rules: {
      '@typescript-eslint/no-unsafe-member-access': 'off',
    },
  },
]
```

### 3. Create `prettier.config.js`

Create a `prettier.config.js` file in the root of your project:

```js
module.exports = require('@marinade.finance/eslint-config/prettier')
```

To customize Prettier settings

```js
module.exports = {
  ...require('@marinade.finance/eslint-config/prettier'),
  // additional prettier options
  printWidth: 100,
}
```

#### 3.b. (Optional) Create `.prettierrc` file

To exclude files from Prettier formatting, create a `.prettierignore` file with entries like:

```
node_modules/
dist/
build/
target/
out/

*.tsbuildinfo
pnpm-lock.yaml

.DS_Store
.vscode/
.idea/
```

### 4. (Optional) Set Up Husky

You can use [Husky](https://typicode.github.io/husky/get-started.html) to automatically run linting and formatting before commits.

Run:

```sh
npx husky-init
```

This sets up a `.husky` directory and a `pre-commit` hook. It also adds a `prepare` script to `package.json`.

In `.husky/pre-commit`, you can use:

```sh
pnpm lint-staged
```