open-index/open-npm huggingface dataset:
npm package: @strv/heimdall
Description: A simple process signal manager
Author: Robert Rossmann
Latest version: 3.0.0

# @strv/heimdall

[![Build Status][ci-badge]][ci-url]

> The process lifecycle gatekeeper.
>
> Built with ❤️ at [STRV][strv-home]

Heimdall takes control over the Node.js process' signal handling and provides a simple way to respond to various process lifecycle events.

## Installation

```sh
npm i --save @strv/heimdall
```

## Usage

```js
import { heimdall } from '@strv/heimdall'
// Import something important. Maybe a Koa server? Or Atlas.js instance?
import { app } from './app'

heimdall({
  /**
   * The execute method is invoked by Heimdall immediately after calling `heimdall()`. You can
   * start your servers and set up any other important tasks here.
   * @return    {Promise}
   */
  async execute() {
    // Start whatever you need to start in this process. Whatever you return from this function, you
    // will receive it in the .exit() method below.
    return await app.start(process.env.PORT)
  },

  /**
   * This method will be invoked by Heimdall when the process receives a `SIGINT` or `SIGTERM`
   * signal. This method is also invoked when Node.js' event loop will empty and Node determines
   * that it can safely exit itself.
   * @return    {Promise}
   */
  async exit({ runtime }) {
    // Stop your servers, close down your open sockets or other activities that might be
    // keeping the Node process running.
    await app.stop()

    // runtime is exactly what you returned in .execute(), in this case it is the Koa instance
    app === runtime
  },

  /**
   * This optional method will be invoked by Heimdall when the process receives a second `SIGINT` or
   * `SIGTERM` signal (ie. the user pressing ctrl+c twice). You can log something to the console or
   * perform synchronous cleanup, but the Node process will be terminated shortly and any async I/O
   * operations are not guaranteed to complete in time.
   * @return    {void}
   */
  didReceiveForcequit() {
    // This is a synchronous method call. Running async I/O operations is not guaranteed to work.
  },

  /**
   * This optional method will be used by Heimdall when one of the Delegate's methods throws an
   * error. Heimdall logs these errors to the stderr output stream but if you implement this method,
   * it will let you log the error using your logging solution of choice.
   *
   * The log should be synchronous as the process will be terminated in the next event loop.
   */
  logError(err) {
    pino.error({ err }, 'heimdall received error')
  }

  /**
   * Set this to true to let Heimdall call the exit handler as soon as the execute handler finishes
   *
   * This is ideal for one-off scripts, commands or other utilities where you want to do a task and
   * then let the process exit gracefully.
   */
  exitAfterExecute?: false
})
```

## License

See the [LICENSE](LICENSE) file for information.

[strv-home]: https://www.strv.com
[ci-badge]: https://github.com/strvcom/heimdall/workflows/Continuous%20Integration/badge.svg
[ci-url]: https://github.com/strvcom/heimdall/actions?query=workflow%3A%22Continuous+Integration%22
npm package: @strv/prettier-config
Description: STRV's ESLint config for Prettier
Author: Pavel Prichodko
Latest version: 3.0.0

# Prettier Config Documentation

> Documentation for the `@strv/prettier-config` module.

## Usage

```sh
# Yarn:
yarn add --dev @strv/prettier-config

# npm:
npm install --save-dev @strv/prettier-config
```

And reference it in your _.prettierrc.js_ file:

```js
module.exports = require('@strv/prettier-config')
```

Or you can of course choose your preffered way of using configs:

<details>
<summary><i>package.json</i></summary>

```json
{
  // ...
  "prettier": "@strv/prettier-config"
}
```

</details>
<details>
<summary><i>.prettierrc</i> or <i>.prettierrc.json</i></summary>

```json
{
  "extends": ["@strv/prettier-config"]
}
```

</details>

_Note: If you are using `prettier` < v1.17 check [this note](#Prettier-version)._

## Extending

To extend the current options you will need to create a _.prettierrc.js_ and add the following:

```js
module.exports = {
  ...require('@strv/prettier-config'),

  // Add custom options bellow:
  useTabs: true,
}
```

## Notes

### Prettier version

Versions of `prettier` prior to v1.17 did not feature the possibility to use a shared config via _package.json_. The way to do it is similar to when [extending](#Extending), except that you can just export the config directly:

```js
// .prettierrc.js

module.exports = require('@strv/prettier-config')
```

## More

- [Prettier Documentation](https://prettier.io/docs/en/index.html)
npm package: @strv/remark-config
Description: STRV's config for Remark
Author: Robert Rossmann
Latest version: 3.0.0

# @strv/remark-config

> STRV's config for [remark-cli][remark-cli-home]

## Usage

```sh
npm i --dev remark-cli @strv/remark-config
```

Now, create a _.remarkrc.js_ file in your project's root with the following contents:

```js
'use strict'

const config = require('./packages/remark-config')

module.exports = {
  ...config,
}
```

Remark's configuration does not support built-in extensibility/inheritance of configuration so if you'd like to change some configuration options you will have to resort to standard JavaScript's object mutation/extension patterns.

## License

See the [LICENSE](LICENSE) file for more information.

[remark-cli-home]: https://github.com/remarkjs/remark/tree/master/packages/remark-cli
npm package: @strv/stylelint-config-styled-components
Description: STRV's ESLint config for stylelint with styled-components
Author: Pavel Prichodko
Latest version: 2.0.0
Deprecated: stylelint-processor-styled-components is no longer supported. Use stylelint-config-standard directly.

# `@strv/stylelint-config-styled-components`

> STRV's config for stylelint with styled-components

## Usage

```bash
# Yarn:
yarn add --dev @strv/stylelint-config

# npm:
npm install --save-dev @strv/stylelint-config
```

> We assume you are using prettier.

## Recommended stylelint config

```js
// .stylelintrc.js

'use strict'

module.exports = {
  extends: [
    '@strv/stylelint-config-styled-components',
    'stylelint-config-prettier',
  ],
}
```

<details>
<summary><i>.stylelintrc</i> or <i>.stylelintrc.json</i></summary>

```json
{
  "extends": [
    "@strv/stylelint-config-styled-components",
    "stylelint-config-prettier"
  ]
}
```

</details>

<details>
<summary><i>package.json</i></summary>

```json
{
  "stylelint": {
    "extends": [
      "@strv/stylelint-config-styled-components",
      "stylelint-config-prettier"
    ]
  }
}
```

</details>
npm package: @strv/textlint-rule-preset-strv
Description: STRV's rule preset for textlint
Author: Korneliusz Dubieniecki
Latest version: 3.0.0

# @strv/textlint-rule-preset-strv

> STRV's config for [textlint][textlint-home]

Textlint doesn't support ["extends" convention](https://github.com/textlint/textlint/issues/210), thus we created [rule-preset](https://textlint.github.io/docs/rule-preset.html), which is a collection of rules and rulesConfig.

## Usage

```sh
npm i --save-dev @strv/textlint-rule-preset-strv
```

## Recommended textlint config

```js
// .textlintrc.js

'use strict'

module.exports = {
  rules: {
    '@strv/textlint-rule-preset-strv': true,
  },
}
```

<details>
<summary><i>.textlintrc</i> or <i>.textlintrc.json</i></summary>

```json
{
  "rules": {
    "@strv/textlint-rule-preset-strv": true
  }
}
```

</details>

## License

See the [LICENSE](LICENSE) file for more information.

[textlint-home]: https://github.com/textlint/textlint