An open API service indexing awesome lists of open source software.

https://github.com/uid11/assert-modules-support-case-insensitive-fs

Assert that JS and TS modules support case-insensitive file systems
https://github.com/uid11/assert-modules-support-case-insensitive-fs

Last synced: about 2 months ago
JSON representation

Assert that JS and TS modules support case-insensitive file systems

Awesome Lists containing this project

README

          

# assert-modules-support-case-insensitive-fs

[![NPM version][npm-image]][npm-url]
[![dependencies: none][dependencies-none-image]][dependencies-none-url]
[![code style: prettier][prettier-image]][prettier-url]
[![Conventional Commits][conventional-commits-image]][conventional-commits-url]
[![License MIT][license-image]][license-url]

Assert that JS and TS modules support case-insensitive file systems.

## Install

Requires `node@14` or higher:

```sh
npm install assert-modules-support-case-insensitive-fs --save-dev
```

## Usage

This package takes a list of paths, and checks all directories and all subdirectories
(at all nesting levels) along those paths.

Checking one directory consists in searching in this directory for two JS
(or TS, or `.vue`, or `.cjs`, or `.mjs`, or `.json`) modules whose names differ only in case.
If there are such modules, the package throws an exception specifying these modules,
because in a case-insensitive file system, such modules will not be distinguished
(without specifying extensions).

Examples of directories **throwing** an exception:

```sh
foo/
├── bar.js
└── Bar.js

foo/
├── bar.js
└── baR.ts

foo/
├── Bar/
└── bar.cjs

foo/
├── BAR.jsx
└── Bar.tsx

foo/
├── BAR.json
└── bAr.mjs
```

Examples of directories **passing** validation (not throwing an exception):

```sh
foo/
├── Bar.jsx
└── Bar.tsx

foo/
├── bar.js
├── bar.ts
├── bar.mjs
└── bar.json

foo/
├── Bar/
├── Bar.vue
└── Bar.tsx

foo/
├── bar.js
└── Bar.css
```

### CLI

Assert that JS and TS modules in directory `src` and all it subdirectories support
case-insensitive file systems:

```sh
npx assert-modules-support-case-insensitive-fs src
```

Assert modules in directories `src` and `bin`:

```sh
npx assert-modules-support-case-insensitive-fs src bin
```

### JavaScript/TypeScript API

```js
import assertModulesSupportCaseInsensitiveFS from 'assert-modules-support-case-insensitive-fs';
// or
import {assertModulesSupportCaseInsensitiveFS} from 'assert-modules-support-case-insensitive-fs';

assertModulesSupportCaseInsensitiveFS(['src', 'tests']);
```

## License

[MIT][license-url]

[conventional-commits-image]: https://img.shields.io/badge/Conventional_Commits-1.0.0-yellow.svg "Conventional Commits"
[conventional-commits-url]: https://conventionalcommits.org
[dependencies-none-image]: https://img.shields.io/badge/dependencies-none-success.svg "No dependencies"
[dependencies-none-url]: https://github.com/uid11/assert-modules-support-case-insensitive-fs/blob/main/package.json
[license-image]: https://img.shields.io/badge/license-MIT-blue.svg "The MIT License"
[license-url]: https://github.com/uid11/assert-modules-support-case-insensitive-fs/blob/main/LICENSE
[npm-image]: https://img.shields.io/npm/v/assert-modules-support-case-insensitive-fs.svg "assert-modules-support-case-insensitive-fs"
[npm-url]: https://www.npmjs.com/package/assert-modules-support-case-insensitive-fs
[prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg "Prettier code style"
[prettier-url]: https://github.com/prettier/prettier