<commit_before>
# Post Install Check

> *This is not an officially supported Google product.*

It seems to be fairly easy to have a library written in TypeScript that exports type definitions that cannot be used by dependent code.  Typically if the library does not export all types correctly, a TypeScript codebase using the library will fail to compile, potentially forcing the codebase to use the library without typechecks.

The Install Check library is designed to be used as part of the tests for your library to verify that your library can be used by dependent code.

# Example

The following could be the contents of a test file in your module that is run with `mocha` as part of your test suite.

```ts

import * as check from 'install-check';

const tsCode = `
  import * as express from 'express';
  import {Something} from 'some-module';

  const app = express();

  // ensure a Something can be constructed
  const something = new Something({
    someStringOption: 'some-string',
    someBooleanOption: true
  });

  // ensure a Something can be used as middleware
  app.use(something);
`;

const jsCode = `
  const express = require('express');
  const {Something} = require('some-module');

  const app = express();

  // ensure a Something can be constructed
  const something = new Something({
    someStringOption: 'some-string',
    someBooleanOption: true
  });

  // ensure a Something can be used as middleware
  app.use(something);
`;

const TS_SAMPLES: check.CodeSample[] = [
  {
    code: tsCode,
    description: 'can be used with express',
    dependencies: ['express'],
    devDependencies: ['@types/express']
  }
]

const JS_SAMPLES: check.CodeSample[] = [
  {
    code: jsCode,
    description: 'can be used with express',
    dependencies: ['express'],
    devDependencies: []
  }
]

// Create a new project for each sample in a temp
// directory, with `some-module` installed, and
// ensure the sample code compiles (for TypeScript
// samples), and the code runs without errors.
check.testInstallation(TS_SAMPLES, JS_SAMPLES, {
  timeout: 2*60*1000
});
```<commit_msg>docs: improve the readme (#230)<commit_after><img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>

# Post Install Check
> Make sure TypeScript projects can use the `d.ts` you're feeding them.

**This is not an officially supported Google product.**

It's not uncommon to ship a library written in TypeScript that exports type definitions that cannot be used by dependent code.  Typically if the library does not export all types correctly, a TypeScript codebase using the library will fail to compile, potentially forcing the codebase to use the library without typechecks.

The Install Check library is designed to be used as part of the tests for your library to verify that your library can be used by dependent code.

## Installation

```sh
$ npm install --save-dev post-install-check
```

## Usage
The following could be the contents of a test file in your module that is run with `mocha` as part of your test suite.

```ts
import * as check from 'post-install-check';

const tsCode = `
  import * as express from 'express';
  import {Something} from 'some-module';

  const app = express();

  // ensure a Something can be constructed
  const something = new Something({
    someStringOption: 'some-string',
    someBooleanOption: true
  });

  // ensure a Something can be used as middleware
  app.use(something);
`;

const jsCode = `
  const express = require('express');
  const {Something} = require('some-module');

  const app = express();

  // ensure a Something can be constructed
  const something = new Something({
    someStringOption: 'some-string',
    someBooleanOption: true
  });

  // ensure a Something can be used as middleware
  app.use(something);
`;

const TS_SAMPLES: check.CodeSample[] = [
  {
    code: tsCode,
    description: 'can be used with express',
    dependencies: ['express'],
    devDependencies: ['@types/express']
  }
]

const JS_SAMPLES: check.CodeSample[] = [
  {
    code: jsCode,
    description: 'can be used with express',
    dependencies: ['express'],
    devDependencies: []
  }
]

// Create a new project for each sample in a temp
// directory, with `some-module` installed, and
// ensure the sample code compiles (for TypeScript
// samples), and the code runs without errors.
check.testInstallation(TS_SAMPLES, JS_SAMPLES, {
  timeout: 2*60*1000
});
```

## Questions/problems?
If you've found an bug/issue, please [file it on GitHub](https://github.com/google/post-install-check/issues).

## Contributing
See [CONTRIBUTING](https://github.com/google/post-install-check/blob/master/CONTRIBUTING.md).

## License
This library is licensed under Apache 2.0. Full license text is available in [LICENSE](https://github.com/google/post-install-check/blob/master/LICENSE).

*Made with ❤️ by the Google Node.js team*
{'fraction_non_alphanumeric': 0.1009432069034718, 'fraction_numerical': 0.006823198876179009, 'mean_word_length': 3.924901185770751, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1104365', 'n_tokens_mistral': 1425, 'n_tokens_neox': 1374, 'n_words': 584}