# @serverless-contracts/plugin

> A plugin to safely deploy Serverless microservices.

Latest version **0.3.0** (published 2022-02-28) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install @serverless-contracts/plugin
pnpm add @serverless-contracts/plugin
yarn add @serverless-contracts/plugin
bun add @serverless-contracts/plugin
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2022-02-28 |
| First published | 2021-11-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 4 |
| Unpacked size | 323.1 KB |
| Known vulnerabilities | 0 (+23 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 151 |
| Author | fargito |
| Maintainers | adriencaccia, fargito |
| Keywords | Contracts, Serverless, Typescript |

## Links

- npm: https://www.npmjs.com/package/@serverless-contracts/plugin
- Repository: https://github.com/fargito/serverless-contracts
- Homepage: https://github.com/fargito/serverless-contracts#readme
- Issues: https://github.com/fargito/serverless-contracts/issues
- npm.io page: https://npm.io/package/@serverless-contracts/plugin

## Dependencies (4)

- [axios](https://npm.io/package/axios.md) ^0.25.0
- [lodash](https://npm.io/package/lodash.md) ^4.17.21
- [@babel/runtime](https://npm.io/package/@babel/runtime.md) ^7.17.2
- [json-schema-diff](https://npm.io/package/json-schema-diff.md) ^0.17.1

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2022-02-28
- 0.2.2 — 2022-02-11
- 0.2.1 — 2022-02-07
- 0.2.0 — 2022-02-07
- 0.1.8 — 2022-02-04
- 0.1.7 — 2022-01-31
- 0.1.6 — 2022-01-28
- 0.1.5 — 2022-01-11
- 0.1.4 — 2021-12-21
- 0.1.3 — 2021-12-03
- 0.1.1 — 2021-12-03
- 0.1.0 — 2021-12-03
- 0.0.8 — 2021-12-03
- 0.0.7 — 2021-11-29
- 0.0.6 — 2021-11-24
- … 5 more at https://npm.io/package/@serverless-contracts/plugin/versions

## README

# @serverless-contracts/plugin

A plugin to safely deploy Serverless microservices.

This plugin is part of the [serverless-contracts](https://github.com/fargito/serverless-contracts) project. See its documentation for more insights.

## Installation

```bash
npm install @serverless-contracts/plugin --save-dev
```

Or if you're using yarn

```bash
yarn add -D @serverless-contracts/plugin
```

Then in your `serverless.ts` file, add `@serverless-contracts/plugin` to the list of your plugins.

## Configuration

Add a `contracts` key to your Serverless file:

```ts

import { myFirstContract, mySecondContract } from 'my-contracts-package';
import { consumedContract } from 'other-contracts';

const serverlessConfigation = {
    service: 'my-app',
    provider: {
        name: aws
    },
    plugins: ['@serverless-contracts/plugin'],
    functions: {
        ...
    },
    contracts: {
        provides: {
            myFirstContract: myFirstContract.fullContractSchema,
            mySecondContract: mySecondContract.fullContractSchema
        },
        consumes: {
            consumedContract: consumedContract.fullContractSchema,
        },
    },
}
```

Where all the contracts are defined using [serverless-contracts](https://github.com/fargito/serverless-contracts).

## Commands

- `serverless localContracts`: prints the local version of the contracts
- `serverless remoteContracts`: prints the currently deployed version of the contracts
- `serverless safeDeploy --strategy <strategy>`: a wrapper around the `deploy` command of the Serverless Framework, check if the contracts modification is deployable with the chosen strategy. Choices are `PROVIDER_FIRST` or `CONSUMER_FIRST`

## Typing

This plugin exposes its own types. In order to properly type your Serverless service file:

```ts
import { ServerlessContracts } from '@serverless-contracts/plugin';
import { AWS } from '@serverless/typescript';

const serverlessConfiguration: AWS & ServerlessContracts = {
    ...
}
```

---
_Source: https://npm.io/package/@serverless-contracts/plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
