open-index/open-npm huggingface dataset:
npm package: @pigs/plugin-karma
Description: Automatic (headless) browser testing with [Karma](https://karma-runner.github.io/latest/index.html).
Latest version: 13.0.2

# @pigs/plugin-karma

Automatic (headless) browser testing with [Karma](https://karma-runner.github.io/latest/index.html).

## Introduction

This plugin pre-configures [Karma](https://karma-runner.github.io/), [Jasmine](https://jasmine.github.io/) for you so that you can run the tests without any configurations.

## Install

```bash
yarn add @pigs/plugin-karma --dev
```

## How to use

In your `pigs.config.js`:

```js
module.exports = {
  plugins: [
    {
      resolve: '@pigs/plugin-karma'
    }
  ]
}
```

This plugin injected a new command to Pigs CLI: `pigs test:unit` which is a command running in Pigs's `test` mode.

To run it easier, you can configure this in npm scripts:

```json
{
  "name": "my-project",
  "scripts": {
    "test": "pigs test:unit",
    "build": "pigs --prod",
    "start": "pigs --serve"
  },
  "devDependencies": {
    "pigs": "^12.0.0"
  }
}
```

Now you can run `npm test` instead.

### Test File Patterns

By default this plugin use `**/*.{test,spec}.{js,ts}` (excluded `node_modules`) as test files, you can change this to any minimatch pattern (note the quotes to avoid shell expansion):

```bash
pigs test:unit "**/*.spec.coffee"
```

### Coverage Report

Use `--coverage` flag to show code coverage and generate coverage report to `./coverage` folder.

### Watching Files

Use `--watch` flag to watch test files.

### Running on CI

To run your tests in Continuous Integration Platforms like CircleCI, you will need `Chrome` installed in your test environment.
npm package: @pigs/plugin-puppet
Description: Easy automatic (headless) browser testing, powered by [Puppeteer](https://github.com/GoogleChrome/puppeteer).
Latest version: 0.1.4

# @pigs/plugin-puppet ![status beta](https://badgen.net/badge/status/beta/pink)

Easy automatic (headless) browser testing, powered by [Puppeteer](https://github.com/GoogleChrome/puppeteer).

<img src="https://unpkg.com/@egoist/media/projects/pigs/puppet.svg" width="500" alt="preview">

## Install

```bash
yarn add @pigs/plugin-puppet --dev
```

<sup><small>*Require Pigs 12.0.2 and above.*</small></sup>

## How to use

Add this plugin in `pigs.config.js`:

```js
module.exports = {
  plugins: [
    {
      resolve: '@pigs/plugin-puppet'
    }
  ]
}
```

Now you can bundle your code and run it in browser:

```js
// cowsay.js
import * as cowsay from 'cowsay'

// You can use window.*, since this will be run in Chromium
const text = window.atob('SSBydW4gaW4gYSBicm93c2Vy')

// Everything logged here will be piped to your host terminal
console.log(cowsay.say({ text }))

// Explicitly terminate the script when you are done
puppet.exit()
```

This command will inject`puppet` command to the Pigs CLI, you need to use this command in `--test` mode:

```bash
❯ pigs puppet --test cowsay.js
 ____________________
< I run in a browser >
 --------------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||
✔ All tests have passed!
```

### Testing Frameworks

This plugin also works with some popular testing frameworks like [Mocha](https://mochajs.org/) and [Tape](https://github.com/substack/tape), check out the CLI usages.

## CLI Usages

### `pigs puppet --test [...files]`

#### `[...files]`

- Type: `string[]`
- Default: `**/*.test.{js,ts}`

One or more glob patterns for matching test files. `node_modules` is always excluded.

#### `--no-headless`

Don't run Chromium in headless mode.

#### `--framework <framework>`

- Type: `string`
- Values: `mocha` `tape`

Use a testing framework.

For **Mocha**: you don't need addtional dependencies, `window.mocha` is available in your code. [Here's the code example.](https://github.com/egoist/pigs/blob/master/plugins/puppet/example/mocha.test.js)<br>
For **Tape**: you need to install `tape` in your project since you need to import it in your code. [Here's the code example.](https://github.com/egoist/pigs/blob/master/plugins/puppet/example/tape.test.js)

#### `--ui <ui>`

- Type: `string`
- Values: `bdd` `tdd` `qunit`
- Default: `bdd`

Set user-interface for mocha.

## Caveats

This is just for unit testing (maybe for now).

## Credits

This plugin is inspired by [puppet-run](https://github.com/andywer/puppet-run) which is built upon Parcel bundler.
npm package: @pigs/plugin-pwa
Description: Build a progressive web app with Pigs and [Workbox](https://developers.google.com/web/tools/workbox/).
Latest version: 12.0.3

# @pigs/plugin-pwa

Build a progressive web app with Pigs and [Workbox](https://developers.google.com/web/tools/workbox/).

## Install

```bash
yarn add @pigs/plugin-pwa --dev
```

## How to use

In your `pigs.config.js`:

```js
module.exports = {
  plugins: [
    {
      resolve: '@pigs/plugin-pwa',
      options: {}
    }
  ]
}
```

Then run Pigs in production mode will generate a `/service-worker.js` file, you can register it in your app to make your website offline-ready.

You can manually register the service worker following [the official guide](https://developers.google.com/web/fundamentals/primers/service-workers/registration), but there's also a module on npm which can be used to simplify the process:

```bash
yarn add register-service-worker
```

```js
import { register } from 'register-service-worker'

register(process.env.PUBLIC_URL + 'service-worker.js', {
  ready(registration) {
    console.log('Service worker is active.')
  },
  registered(registration) {
    console.log('Service worker has been registered.')
  },
  cached(registration) {
    console.log('Content has been cached for offline use.')
  },
  updatefound(registration) {
    console.log('New content is downloading.')
  },
  updated(registration) {
    console.log('New content is available; please refresh.')
  },
  offline() {
    console.log('No internet connection found. App is running in offline mode.')
  },
  error(error) {
    console.error('Error during service worker registration:', error)
  }
})
```

## Options

Default value:

```js
{
  name: 'PWA app',
  themeColor: '#74d7fd', // The Pigs color
  msTileColor: '#000000',
  appleMobileWebAppCapable: 'no',
  appleMobileWebAppStatusBarStyle: 'default',
  assetsVersion: '',
  iconPaths: {
    favicon16: 'img/icons/favicon-16x16.png',
    favicon32: 'img/icons/favicon-32x32.png',
    appleTouchIcon: 'img/icons/apple-touch-icon-152x152.png',
    safariMaskIcon: 'img/icons/safari-mask-icon.svg',
    msTileImage: 'img/icons/msapplication-icon-144x144.png'
  }
}
```

We use these options to generate `manifest.json` and update PWA-related tags in generated `index.html` file.

If you don't want to support some platform icons, simply pass `false` as the icon path, for example:

```js
{
  iconPaths: {
    msTileImage: false
  }
}
```

Then we won't add HTML tag for this icon in `index.html`.

To customize the `manifest.json`, you can simply populate a `public/manifest.json` and we will merge it with our default one.
npm package: @pigs/plugin-typescript
Description: Official TypeScript plugin for Pigs.
Latest version: 12.0.1

# @pigs/plugin-typescript

Official TypeScript plugin for Pigs.

## Introduction

This plugin use `ts-loader` to transpile TypeScript files, it also uses `fork-ts-checker-webpack-plugin` to perform type-checking. `.ts` `.tsx` and `.vue` files are supported.

## Install

```bash
yarn add @pigs/plugin-typescript typescript --dev
```

## How to use

```js
module.exports = {
  plugins: [
    {
      resolve: '@pigs/plugin-typescript',
      options: {}
    }
  ]
}
```

Then add a `tsconfig.json` in your project:

```json
{
  "compilerOptions": {
    "target": "es5",
    "strict": true,
    "module": "es2015",
    "moduleResolution": "node"
  }
}
```

## Options

### lintOnSave

- Type: `boolean`
- Default: `true`

Lint TS files with `ts-lint` at compile time, you need to create a `tslint.json` in your project.