# pascal-utils

> Utility functions for compilation of simple pascal programs, with the Free Pascal compiler, in Node.js.

Latest version **2.0.2** (published 2023-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install pascal-utils
pnpm add pascal-utils
yarn add pascal-utils
bun add pascal-utils
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.2 |
| Published | 2023-09-03 |
| First published | 2022-08-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 21.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Elhanan Flesch |
| Maintainers | synthetic.borealis |
| Keywords | Pascal, Testing |

## Links

- npm: https://www.npmjs.com/package/pascal-utils
- Repository: https://github.com/synthetic-borealis/pascal-utils.js
- Issues: https://github.com/synthetic-borealis/pascal-utils.js/issues
- npm.io page: https://npm.io/package/pascal-utils

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [vest](https://npm.io/package/vest.md) — 50.1K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads

## Recent versions

- 2.0.2 (latest) — 2023-09-03
- 2.0.1 — 2023-01-19
- 2.0.0 — 2022-09-16
- 1.0.1 — 2022-09-01
- 1.0.0 — 2022-08-25

## README

# Pascal Utils

![GitHub](https://img.shields.io/github/license/synthetic-borealis/pascal-utils.js)
[![npm version](https://badge.fury.io/js/pascal-utils.svg)](https://badge.fury.io/js/pascal-utils)
![Unit Tests](https://github.com/synthetic-borealis/pascal-utils.js/actions/workflows/test.yml/badge.svg)
[![codecov](https://codecov.io/gh/synthetic-borealis/pascal-utils.js/branch/main/graph/badge.svg?token=SXLIC3FL1Q)](https://codecov.io/gh/synthetic-borealis/pascal-utils.js)

Utility functions for compilation of simple pascal programs with the Free Pascal compiler in
Node.js.

## Contents

1. [Requirements](#requirements)
2. [Installation](#installation)
3. [Usage](#usage)
   1. [Compiler Detection](#compiler-detection)
   2. [Compilation](#compilation)
4. [Examples](#examples) 

## Requirements

* The Free Pascal compiler.
* Node.js v16.x or above.

## Installation

Run `yarn add pascal-utils -D` or `npm i pascal-utils --save-dev`.

## Usage

The documentation can be found [here](./docs/API.md).

### Compiler Detection

Run `checkCompiler().then(({ version }) => ...)` to check if the Free Pascal compiler is installed
and is in the system path.

### Compilation

Run `compile(inputFile, outputFile).then(...)` to compile a program.

## Examples

```javascript
const fs = require('fs/promises');
const pascalUtils = require('pascal-utils');

describe('Compiler detection', () => {
  it('Detects compiler', () => pascalUtils.checkCompiler()
    .then(() => {
      expect(true).toBeTruthy();
    }));
});

describe('Compilation', () => {
  const exeExtension = process.platform === 'win32' ? '.exe' : '';
  const sourceFile = './assets/hello.pas';
  const exeName = `./hello${exeExtension}`;
  it('Compiles and links', () => pascalUtils.compile(sourceFile, exeName)
    .then(() => {
      expect(true).toBeTruthy();
    }));
  afterAll(() => Promise.all([
    fs.unlink('./hello.o'),
    fs.unlink(exeName),
  ]));
});
```

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