open-index/open-npm huggingface dataset:
npm package: @optimics/jest
Description: Almost zero config orchestrator for jest
Author: just-paja
Latest version: 0.8.5

# `lerna-jest`

Oversimplify jest configuration for common use cases.

## Install

```
npm install -d jest lerna-jest
```

## Configure

1. Create file `jest.config.js` in your lerna root.

```
import { guessRootConfig } from '@optimics/jest'

module.exports = guessRootConfig(import.meta.url)
```

2. Configure test script in lerna root `package.json`.

```
{
  "scripts": {
    "test": "jest"
  }
}
```

If you fit the common use cases = you've got some tests and a linter, then you're done for all of your projects. Now you can just use common npm interface to run tests.

```
npm test -- --watch
```

## Magic setup files

Create these files on the lerna root level or inside the project and they will be automatically used to configure jest environment:

* `jest.setup.js` goes in [setupFiles](https://jestjs.io/docs/en/configuration#setupfiles-array).
* `jest.afterEnv.js` goes in [setupFilesAfterEnv](https://jestjs.io/docs/en/configuration#setupfilesafterenv-array)

## Magic plugins

Some plugins are automatically recognized, you only need to install them:

* [jest-date-mock](https://www.npmjs.com/package/jest-date-mock)
* [jest-enzyme](https://www.npmjs.com/package/jest-enzyme)
* [jest-extended](https://www.npmjs.com/package/jest-extended)
* [jest-runner-eslint](https://www.npmjs.com/package/jest-runner-eslint)
* [jest-runner-standard](https://www.npmjs.com/package/jest-runner-standard)
* [jest-watch-select-projects](https://www.npmjs.com/package/jest-watch-select-projects)
* [jest-watch-typeahead](https://www.npmjs.com/package/jest-watch-typeahead)
npm package: @optimics/npm
Description: Bindings for often used npm functions
Author: Pavel Žák
Latest version: 0.8.5

# `@optmics/npm`

> Useful methods that extend `npm` functionality

## Method collection


### urlToPath(url: string): string

Translate the `url` using fileURLToPath when it contains url prefixed with
protocol, otherwise it return the url unchanged, assuming, it is a file path.

```javascript
urlToPath('file:///home/user/test.js')
// /home/user/test.js

urlToPath('/home/user/test.js')
// /home/user/test.js
```

### urlToCwd(url: string): string

Translate `url` to nearest directory path.

```javascript
urlToPath('file:///home/user/test.js')
// /home/user

urlToPath('/home/user/')
// /home/user

urlToPath('/home/user')
// /home/user
```

### getRoot(cwd?: string): string

Return **monorepository root**. The directory, that contains your root package.json.

```javascript
getRoot()
// /home/user/path/to/monorepo
```

### filterUnique<T>(item: T, index: number, src: T[]): boolean

Array helper method, that filters unique elements

```
[1,2,2,3].filter(filterUnique)
// [1,2,3]
```

### extractProjectScope(p: PackageJson): string

Extracts the project scope from the package.json manifest.

```
'@myscope/mypackage' -> '@myscope'
```

### extractPackageName(p: PackageJson | string): string

Extracts package name from the package.json manifest or package name.

```
'@myscope/mypackage' -> 'mypackage'
```

### padScope(scope: string): string | null

Append at sign ('@') to the project scope, if it is missing

```
'myscope' -> '@myscope'
```

### getPackages(cwd?: string, options: GetPackagesOptions = {}): PackageJson[]

Get manifests of all packages defined in the monorepository.

### getPackageNames(cwd?: string, options: GetPackagesOptions = {}): string[]

Get list of all package names defined in the monorepository.

### getPackageScopes(cwd?: string, options: GetPackagesOptions = {}): string[]

Get list of all package scopes defined in the monorepository.

### getPackageJsonByName(cwd: string, packageName: string): PackageJson

Get `package.json` by package name.

### readPackageJson(cwd: string): PackageJson

Read package JSON in a directory path.
npm package: @optimics/webpack-website-proxy
Description: Inject your webpack generated bundles inside a live website via proxy and webpack dev server
Author: Pavel Žák
Latest version: 0.8.8

# `@optimics/webpack-website-proxy`

> Inject your webpack generated bundles inside a live website via proxy and
> webpack dev server

This is useful, when your webpack outputs enhance a website, instead of
rendering it as a whole. You can simply give it an URL and the webpack dev
server will load it up on localhost URL with your scripts generated and hot
reload included.

## Installation

```
npm install --save-dev @optimics/webpack-website-proxy
```

## Usage

Add [HtmlWebpackPlugin](https://www.npmjs.com/package/html-webpack-plugin) and WebsiteProxyPlugin In your webpack configuration:

```
import HtmlWebpackPlugin from 'html-webpack-plugin'
import WebsiteProxyPlugin from '@optimics/webpack-website-proxy'

export default {
  plugins: [
    new HtmlWebpackPlugin({}),
    new WebsiteProxyPlugin('http://example.com/url-to-the-page'),
  ],
}
```

## Known issues

**Red box errors**

Webpack will respond to all on page errors. Consider turning off [client overlay](https://webpack.js.org/configuration/dev-server/#overlay)
npm package: @optimistdigital/core-js
Description: Optimist Digital core JS modules
Latest version: 3.0.0

This is a collection of JS functionalities that we commonly need to use.

# Docs

-   To install, run `npm install @optimistdigital/core-js`

## Modals - [docs](docs/modals.md)

```
import modals from '@optimistdigital/core-js/lib/modals';
modals.init();
```

## Dropdowns - [docs](docs/dropdowns.md)

```
import dropdowns from '@optimistdigital/core-js/lib/dropdowns';
dropdowns.init();
```

## Tabs - [docs](docs/tabs.md)

```
import tabs from '@optimistdigital/core-js/lib/tabs';
tabs.init();
```

# Development

1. Install dependencies: `npm install`
2. Install dependencies for example project: `(cd examples && npm install)`
3. Start dev servers: `npm run dev`
npm package: @optimistdigital/core-scss
Description: Optimist Digital core SCSS partials
Latest version: 1.3.0

# Optimist Digital | Core SCSS

This is a SCSS partial that provides some utility mixins and default styles that fit our workflow.

Some of the partials utilize variables that you may define in your project before including these partials. If not defined, we define defaults in `partials/_default-config.scss`.

## Usage

Add `@import "node_modules/@optimistdigital/core-scss/core";` before your component mixins, after your variable definitions.

## Features

### Config

We set some default variables that are used in core and that you can use in your code. You can override them by defining them yourself *before* including core.

- `$global-site-maxwidth` - Used mainly for maxwidth-wrapper
- `$global-site-side-padding` - Used mainly for maxwidth-wrapper
- `$bp-tablet` - Min width (px) for tablets
- `$bp-mobile` - Min width (px) for mobile devices
- `$color-bg` - Main background color
- `$color-fg` - Main foreground (text) color
- `$body-font-size` - Main body size
- `$font-body` - Main font for body text
- `$font-heading` - Main font for headings

### Mixins

The exact purpose of each mixin is explained in `_core.scss`. Other than the default styles, Here are the mixins that we provide:

- `@mixin clearfix()`
- `@mixin ellipsis()`
- `@mixin body-font()`
- `@mixin heading-font()`
- `@mixin maxwidth-wrapper()`
- `@mixin reset-list()`
- `@mixin bp($width)`
- `@mixin minbp($width)`

### Grid layout

We have helper classes for a basic grid (no gutters).

Add `.cols-25` / `.cols-33` / `.cols-50` to add widths to your cols. Leave them out if you want to implement custom widths.

Add `.with-breakpoints` if you want the grid items to fall back to 100% with at predetermined breakpoints. Leave that class out if you want to implement custom breakpoints. Example:

```
<div class="grid-layout cols-33 with-breakpoints">
    <div class="grid-item"></div>
    <div class="grid-item"></div>
    <div class="grid-item"></div>
</div>
```
npm package: @optimistdigital/eslint-config-rules
Description: Optimist Digital ESLint rules
Latest version: 2.0.0

# Optimist Digital | ESLint rules

This is a set of rules for ESLint. Based originally on Airbnb's config, we made some rules less strict.
Specifically, the goal is to ensure that most stylistic errors (whitespace, etc) are warnings and not errors.
This means that we can show more invasive error modals for actual logic errors, but smaller stuff can be ignored
during some quick debugging because they only show up in the console.

## Usage


### With React

Add `"extends": "@optimistdigital/eslint-config-rules/react"` to your `.eslintrc` file.

(make sure you have the eslint-plugin-react plugin installed)

### Without React

Add `"extends": "@optimistdigital/eslint-config-rules"` to your `.eslintrc` file.
npm package: @optimize-lodash/transform
Description: Rewrites lodash imports in a given source file to be specific.
Author: Kyle Johnson
Latest version: 4.0.0

# Optimize `lodash` imports

[![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/kyle-johnson/rollup-plugin-optimize-lodash-imports/main.yml?branch=main)](https://github.com/kyle-johnson/rollup-plugin-optimize-lodash-imports/actions)
[![license](https://img.shields.io/npm/l/@optimize-lodash/transform)](https://github.com/kyle-johnson/rollup-plugin-optimize-lodash-imports/blob/main/packages/transform/LICENSE)
[![Codecov](https://img.shields.io/codecov/c/github/kyle-johnson/rollup-plugin-optimize-lodash-imports?flag=transform&label=coverage)](https://app.codecov.io/gh/kyle-johnson/rollup-plugin-optimize-lodash-imports/)

Expects a `parse()` method with output compatible with [`acorn`](https://www.npmjs.com/package/acorn) output.

Used by:

- [@optimize-lodash/rollup-plugin](https://www.npmjs.com/package/@optimize-lodash/rollup-plugin)
- [@optimize-lodash/esbuild-plugin (experimental)](https://www.npmjs.com/package/@optimize-lodash/esbuild-plugin)