open-index/open-npm huggingface dataset:
npm package: @gmirmand/gulp-mjml
Description: Add Gulp to your MJML workflow - gmirmand update
Author: Gaëtan Mirmand
Latest version: 4.1.2


# Gulp MJML

Add MJML to your gulp workflow!

# Authorship and Contribution
Originally developed by mjmlio.  
Updated by gmirmand.

**I won't be able to maintain this project. But I will be happy to accept pull requests.**

## Usage:

> With an MJML file named `test.mjml`, render your emails to an html folder:

```javascript
const gulp = require('gulp')
const mjml = require('gulp-mjml')

gulp.task('default', function () {
  return gulp.src('./test.mjml')
    .pipe(mjml())
    .pipe(gulp.dest('./html'))
})
```

> If you have custom components linked to your own `mjmlEngine`, you can pass it to the gulp task so it uses your engine to render the html:

```javascript
const gulp = require('gulp')
const mjml = require('gulp-mjml')

// Require your own components if needed, and your mjmlEngine (possibly with options)
// require('./components')
const mjmlEngine = require('mjml')

gulp.task('default', function () {
  return gulp.src('./test.mjml')
    .pipe(mjml(mjmlEngine, {minify: true}))
    .pipe(gulp.dest('./html'))
})
```

> If you'd like to get validation errors and , use `strict` and a custom error handler function. _Note that using `strict` will not render the file in case of error_:

```javascript
const gulp = require('gulp')

const mjml = require('gulp-mjml')
const mjmlEngine = require('mjml')

function handleError (err) {
  console.log(err.toString());
  this.emit('end');
}

gulp.task('default', function () {
  return gulp.src('./test.mjml')
    .pipe(mjml(mjmlEngine, {validationLevel: 'strict'}))
    .on('error', handleError)
    .pipe(gulp.dest('./html'))
})
```

> If you want to override the default file extension that is output use `fileExt`

```javascript
const gulp = require('gulp')
const mjml = require('gulp-mjml')

const mjmlEngine = require('mjml')

gulp.task('default', function () {
  return gulp.src('./test.mjml')
    .pipe(mjml(mjmlEngine, {minify: true, fileExt: ".txt"}))
    .pipe(gulp.dest('./html'))
})
```
npm package: @gmjs/apply-function
Description: Simple function to apply transformations to a value.
Author: Goran Mržljak
Latest version: 0.0.3

# Apply function

This project contains a single simple function `applyFn`, which applies one or more transformations to a value.

This same functionality can be achieved by a normal function call. The reason this exists is to make certain transformations more readable. If a transformation is a composite of several function, that expression can be very long and very often takes multiple lines. Having the value that is being transformed at the begginging, and the transformation after that is more natural, as if the value is being pushed though a pipe.

## Installation

```bash
npm install --save @gmjs/apply-function
```

## API

#### `applyFn`

This function applies one or more transformations to a single value.

The `value` is passed in as the first parameter, and the transformations are passed in as subsequent parameters.

The `value` can be anything, including simple value such as a number or a string, or a complex value such as an object or an array.

Each transformation is a function that accepts a single parameter, and returns a value. The return value of the previous transformation is passed in as the parameter to the next transformation.

An arbitrary number of transformations can be passed in, but there is good type inference support for up to 8 transformations.

```ts
import { applyFn } from '@gmjs/apply-function';

const input = 1;
const output = applyFn(
  input,
  (x) => x + 1,
  (x) => x * 2,
);
console.log(output);
// 4
```

```ts
import { applyFn } from '@gmjs/apply-function';

const input = [1, 2, 3, 4, 5];
const output = applyFn(
  input,
  (a) => a.map((item) => item + 1),
  (a) => a.filter((item) => item % 2 === 0),
);
console.log(output);
// [2, 4, 6]
```

Instead of writing all your own transformations from scratch, you can use libraries that provide ready-made transformations:

```ts
import { applyFn } from '@gmjs/apply-function';
import { map, filter } from '@gmjs/value-transformers';

const input = [1, 2, 3, 4, 5];
const output = applyFn(
  input,
  map((v: number) => v + 1),
  filter((v: number) => v % 2 === 0),
  toArray(), // 'map' and 'filter' return iterators, this converts the result back to an array
);
console.log(output);
// [2, 4, 6]
```
npm package: @gmjs/array-create
Description: Array creation utilities.
Author: Goran Mržljak
Latest version: 0.0.1

# Array Create

This library contains some array creation functions.

## Installation

```bash
npm install --save @gmjs/array-create
```

## API

### `arrayOfConstant`

Creates an array filled with a given constant value. The `length` is provided as the first argument, the second parameter (`value`) is the constant that will fill the array.

```ts
const array = arrayOfConstant(3, 'some-value');
console.log(array);
// ['some-value', 'some-value', 'some-value']
```

### `arrayOfMapped`

Creates an array of mapped values. The `length` is provided as the first argument. Second parameters, the `mapper`, is a function that takes the index of the array as an argument and returns the value for that index, and it generates a 'mapped' value for each index.

```ts
const array = arrayOfMapped(3, (index) => index * 2);
console.log(array);
// [0, 2, 4]
```

### `arrayOfOnes

### `arrayOfUndefined`

Creates an array of `undefined` values. The `length` is provided as the first argument.

```ts
const array = arrayOfUndefined(3);
console.log(array);
// [undefined, undefined, undefined]
```

### `range`

Generates an array with a range of values.

The first parameter defined the `from` (starting) value, the second parameter defines the `to` (limit) value. The `to` value is not included in the range, meaning that the possible values in array can only be within `[from, to)`.

It has an optional `step` parameter that specifies the step size. If not specified, the step size is `1`. Step size can be negative, in which case the possible values in array are within `(to, from]`, again starting with the `from` value.

```ts
const output = range(0, 5);
console.log(output);
// [0, 1, 2, 3, 4]
```

```ts
const output = range(1, 6, 2);
console.log(output);
// [1, 3, 5]
```

```ts
const output = range(5, 0, -1);
console.log(output);
// [5, 4, 3, 2, 1]
```
npm package: @gmjs/array-transformers
Description: Utilities for transforming arrays.
Author: Goran Mržljak
Latest version: 0.0.3

# Array Transformers

This library contains some utilities for transforming arrays.

## Installation

```bash
npm install --save @gmjs/array-transformers
```

## API

### `filterOutNullish`

Filtered out `null` and `undefined` values from an array. More precisely, it returns a copy of the array with all `null` and `undefined` values removed, while leaving the original array unchanged.

The returned array will be properly typed, so that TypeScript will know that it does not contain `null` or `undefined` values.

```ts
const original: readonly (number | null | undefined)[] = [1, null, 2, undefined, 3];
const filtered = filterOutNullish(original); // typed as 'readonly number[]'
console.log(filtered);
// [1, 2, 3]
```

### `reverse`

Reverses an array. More precisely, it returns a copy of the array with the elements in reverse order, while leaving the original array unchanged.

```ts
const original = [1, 2, 3];
const reversed = reverse(original);
console.log(reversed);
// [3, 2, 1]
```
npm package: @gmjs/browser-storage
Description: browser-storage
Author: Goran Mržljak
Latest version: 0.0.2

# Browser Storage

This package provides a simple interface for interacting with browser storage.

## Installation

```bash
npm install --save @gmjs/browser-storage
```

## Usage

```ts
import { CookieWrapper, createCookieWrapper, createLocalStorageWrapper, createSessionStorageWrapper, StorageWrapper } from '@gmjs/browser-storage';

const cookie = createCookieWrapper();
const localStorage = createLocalStorageWrapper();
const sessionStorage = createSessionStorageWrapper();
```

By default, key for any of the above storage is a `string`, but you can provide a custom key type to limit the available keys:

```ts
type Key = 'foo' | 'bar' | 'baz';
const cookie = createCookieWrapper<Key>();
```

## API

### `CookieWrapper<T>`

Interface for interacting with cookies.

```ts
export interface CookieWrapper<K extends string> {
  readonly get: (name: K) => string | undefined;
  readonly set: (name: K, value: string, expiresInDays?: number) => void;
  readonly remove: (name: K) => void;
  readonly removeMany: (names: readonly K[]) => void;
}
```

### `StorageWrapper<T>`

This interface is used for both `localStorage` and `sessionStorage`.

```ts
export interface StorageWrapper<K extends string> {
  readonly get: (key: K) => string | undefined;
  readonly getMany: (keys: readonly K[]) => readonly (string | undefined)[];
  readonly set: (key: K, value: string) => void;
  readonly remove: (key: K) => void;
  readonly removeAll: () => void;
}
```
npm package: @gmjs/cli-wrapper
Description: cli-wrapper
Author: Goran Mržljak
Latest version: 0.0.2

# CLI Wrapper Library

## Installation

```bash
npm install --save @gmjs/cli-wrapper
```

## Usage

As an example, we are implementing a command called `jsgen`, but this is arbitrary.

```ts
import { join } from 'node:path';
import { cli } from '@gmjs/cli-wrapper';
import { readPackageJsonSync } from '@gmjs/package-json';

export function run(): void {
  const result = cli(
    `
Usage
  $ jsgen <input>

Options
  --config, -c  Path to config file
  --output, -o  Output directory
  --project-name, -p  Project name

Examples
  $ jsgen --config config.json --output . --project-name my-project
`,
    {
      meta: {
        version: readPackageJsonSync(join(__dirname, '..')).version ?? '',
      },
      options: {
        config: {
          type: 'string',
          short: 'c',
          required: true,
        },
        output: {
          type: 'string',
          short: 'o',
          required: false,
        },
        projectName: {
          type: 'string',
          short: 'p',
          required: false,
        },
      },
    }
  );

  console.log(result);
  // use result here however you want
}

run();
```

After executing `jsgen -c config.json -o output -p project`, the above code will output (from `console.log(result)`):

```
{
  success: true,
  options: {
    config: { type: 'string', multiple: false, value: 'config.json' },
    output: { type: 'string', multiple: false, value: 'output' },
    projectName: { type: 'string', multiple: false, value: 'project' }
  }
}
```

If there is an error, for example, if we omit a required parameter, like if we just used `jsgen`.

`cli()` function would output:

```
Missing required option 'config'.
```

And `console.log(result)` would output:

```
{ success: false, options: {} }
```

### Built-in Options

#### Version

Use `--version` or `-v` to output version.

#### Help

Use `--help` or `-h` to output help (which is the description passed in as the first parameter to `cli()`).
npm package: @gmjs/compose-function
Description: Function composition.
Author: Goran Mržljak
Latest version: 0.0.2

# Compose function

Implements `compose` and `composeMono` which are used for multiple composing function into one.

## Install

```bash
npm install --save @gmjs/compose-function
```

## API

- `compose<TInput, TOutput>(...ops: readonly Fn1<any, any>[]): Fn1<TInput, TOutput>`
  - Description
    - Compose multiple functions into one.
    - Strongly typed for compositions of up to 8 functions.
  - Parameters
    - `ops: readonly Fn1<any, any>[]` - The functions to compose.
- `composeMono<T>(...ops: readonly Fn1<T, T>[]): Fn1<T, T>`
  - Description
    - Compose multiple functions into one.
    - Same as `compose`, but all functions being composed must have the same input and output type.
npm package: @gmjs/crypto
Description: Some crpyto utilities.
Author: Goran Mržljak
Latest version: 0.0.2

# Crypto Utilities

Some crypto helper functions.

## Install

```bash
npm install --save @gmjs/crypto
```

## Functions

- `hashMd5Hex(data: string | Buffer): string`
  - Description - Hashes a `string` or `Buffer` using MD5 algorithm, and outputs the result as a hex string.
npm package: @gmjs/data-container-util
Description: Some utilities for data containers.
Author: Goran Mržljak
Latest version: 0.0.1

# Data Container Utilities

Some utilities for data containers such as `Map` and `Set`.

## Installation

```bash
npm install --save @gmjsdata-container-util
```

## API

### `Map`

#### `mapGetOrThrow`

Gets the value from a `Map` or throws an error if the key is not present.

```ts
const map = new Map<string, string>([['foo', 'bar']]);
const value: string = mapGetOrThrow(map, 'foo');
console.log(value);
// 'bar'
```

```ts
const map = new Map<string, string>([['foo', 'bar']]);
// the following line throws an error
const value: string = mapGetOrThrow(map, 'baz');
```
npm package: @gmjs/eslint-config
Description: ESLint configuration.
Author: Goran Mržljak
Latest version: 0.0.42

# ESLint Config

This package contains a function used to create an ESLint config object.

## Installation

```bash
npm install --save-dev @gmjs/eslint-config
```

## Usage

Create an ESLint config file, one of:

- `eslint.config.js`
- `eslint.config.cjs`
- `eslint.config.mjs`

Then use something like the following code (if using `esm` module syntax):

```js
import { getEsLintConfigs } from '@gmjs/eslint-config';

export default [
  ...getEsLintConfigs({ projectType: 'node' })
];
```

Or equivalent `commonjs` syntax:

```js
const { getEsLintConfigs } = require('@gmjs/eslint-config');

module.exports = [
  ...getEsLintConfigs({ projectType: 'node' })
];
```

## API

#### `getEsLintConfigs`

Accepts a single parameter, `options` of type [`EslintConfigOptions`](#eslintconfigoptions).

Return a list of EsLint configurations, to be used in your project.

You can specify different project types:

- `'shared'` - For projects to be used from either Node or Browser.
- `'node'` - For Node.js projects.
- `'browser'` - For browser projects.
- `'react'` - For React projects.

```js
import { getEsLintConfigs } from '@gmjs/eslint-config';

export default [...getEsLintConfigs({ projectType: 'node' })];
```

## Types

#### `EslintConfigOptions`

```ts
type ProjectType = 'shared' | 'node' | 'browser' | 'react';

interface EslintConfigOptionsBase {
  readonly projectType: ProjectType;
}

interface EslintConfigOptionsReact extends EslintConfigOptionsBase {
  readonly projectType: 'react';
  readonly storybook: boolean;
}

interface EslintConfigOptionsBrowser extends EslintConfigOptionsBase {
  readonly projectType: 'browser';
}

interface EslintConfigOptionsNode extends EslintConfigOptionsBase {
  readonly projectType: 'node';
}

interface EslintConfigOptionsShared extends EslintConfigOptionsBase {
  readonly projectType: 'shared';
}

type EslintConfigOptions =
  | EslintConfigOptionsReact
  | EslintConfigOptionsBrowser
  | EslintConfigOptionsNode
  | EslintConfigOptionsShared;
```
npm package: @gmjs/exec-observable
Description: exec-observable
Author: Goran Mržljak
Latest version: 0.0.3

# Shell Execution Utilities Using Observable Pattern

This project is a collection of utilities for executing shell commands. It uses the observable pattern.

## Installation

```bash
npm install --save @gmjs/exec-observable
```

## API

#### `fromExec`

Executes a command in a child process, and stream the resulting output.

##### Parameters

`command: string` - Command to execute.

`args?: readonly string[]` - Command arguments.

`options: ExecOptions`

Options for exec. See more [here](https://nodejs.org/api/child_process.html#child_processexeccommand-options-callback).

```ts
export interface ExecOptions {
  // Current working directory of the child process.
  // Default - `process.cwd()`.
  readonly cwd?: string;
  // Environment key-value pairs.
  // Default - `process.env`.
  readonly env?: NodeJS.ProcessEnv;
  // Shell to execute the command with. See Shell requirements and Default Windows shell.
  // Default - `'/bin/sh'` on Unix, `process.env.ComSpec` on Windows.
  readonly shell?: string | boolean;
  // The amount of time the process is allowed to run (in milliseconds).
  //   If exceeded, the child process is terminated and any output is truncated.
  // Default - `0`.
  readonly timeout?: number;
}
```

##### Examples:

```ts
async function exec(cmd: string, args?: readonly string[], options?: ExecOptions): Promise<void> {
  await lastValueFrom(
    fromExec(cmd, args, options).pipe(
      tap((event) => {
        if (event.kind === 'data-stdout') {
          console.log(event.data);
        } else if (event.kind === 'data-stderr') {
          console.error(event.data);
        }
      }),
    ),
  );
}

exec('ls', ['-al']).then(() => {
  console.log('Done!');
});

// Example Output:
//
// total 195
// drwxr-xr-x 1 user 197121      0 Jan 19 23:02 .
// drwxr-xr-x 1 user 197121      0 Aug 17 17:28 ..
// -rw-r--r-- 1 user 197121    245 Aug 17 17:28 .editorconfig
// ...
// -rw-r--r-- 1 user 197121   1760 Jan 19 23:10 README.md
//
// Done!
```
npm package: @gmjs/fs-async
Description: Async file system utilities.
Author: Goran Mržljak
Latest version: 0.0.5

# Async File System Utilities

These are simple file system utilities for Node.js, using Promises.

## Installation

```bash
npm install --save @gmjs/fs-async
```

## Functions

### Basic File System

- `readTextAsync(filePath: string): Promise<string>`
  - Description - Read a text file.

---

- `writeTextAsync(filePath: string, content: string): Promise<void>`
  - Description - Write a text file.

---

- `readBinaryAsync(filePath: string): Promise<Buffer>`
  - Description - Read a binary file.

---

- `writeBinaryAsync(filePath: string, content: Buffer): Promise<void>`
  - Description - Write a binary file.

---

- `createFileAsync(filePath: string): Promise<void>`
  - Description
    - Create a file.
    - Often used with `writeTextAsync` or `writeBinaryAsync` to ensure that a file and ancestor directories exist before writing to it.

---

- `existsAsync(filePath: string): Promise<boolean>`
  - Description - Check if a file exists.

### Find

- `findFileSystemEntriesAsync(directory: string, options?: FindOptions): Promise<readonly FilePathStats[]>`
  - Description - Search a directory for files. Search can be limited by depth.
  - Parameters
    - `directory: string` - The directory to search.
    - `options: FindOptions`
      - Description - Options for the search.
      - Fields
        - `depthLimit: number | undefined`:
          - Description
            - The maximum depth to search.
            - Default is `undefined`.
            - If value is `-1` or `undefined`, there is no depth limit (limit is inifnite).
npm package: @gmjs/fs-observable
Description: File system utilities employing observable pattern.
Author: Goran Mržljak
Latest version: 0.0.1

# File System Utilities Using Observable Pattern

This project is a collection of utilities for working with the file system using the observable pattern.

## Installation

```bash
npm install --save @gmjs/fs-observable
```

## Functions

### Find

- `fromFindFsEntries(directory: string, options?: FindOptions): Observable<FilePathStats>`
  - Description - Search a directory for files. Search can be limited by depth.
  - Parameters
    - `directory: string` - The directory to search.
    - `options: FindOptions`
      - Description - Options for the search.
      - Fields
        - `depthLimit: number | undefined`:
          - Description
            - The maximum depth to search.
            - Default is `undefined`.
            - If value is `-1` or `undefined`, there is no depth limit (limit is inifnite).
npm package: @gmjs/fs-sync
Description: Sync file system utilities.
Author: Goran Mržljak
Latest version: 0.0.3

# Sync File System Utilities

These are simple synchronous file system utilities for Node.js.

## Installation

```bash
npm install --save @gmjs/fs-sync
```

## Functions

### Basic File System

- `readTextSync(filePath: string): string`
  - Description - Read a text file.

---

- `writeTextSync(filePath: string, content: string): void`
  - Description - Write a text file.

---

- `readBinarySync(filePath: string): Buffer`
  - Description - Read a binary file.

---

- `writeBinarySync(filePath: string, content: Buffer): void`
  - Description - Write a binary file.

---

- `createFileSync(filePath: string): void`
  - Description
    - Create a file.
    - Often used with `writeTextSync` or `writeBinarySync` to ensure that a file and ancestor directories exist before writing to it.

---

- `existsSync(filePath: string): boolean`
  - Description - Check if a file exists.

### Find

- `findFileSystemEntriesSync(directory: string, options?: FindOptions): readonly FilePathStats[]`
  - Description - Search a directory for files. Search can be limited by depth.
  - Parameters
    - `directory: string` - The directory to search.
    - `options: FindOptions`
      - Description - Options for the search.
      - Fields
        - `depthLimit: number | undefined`:
          - Description
            - The maximum depth to search.
            - Default is `undefined`.
            - If value is `-1` or `undefined`, there is no depth limit (limit is inifnite).
npm package: @gmjs/generic-functions
Description: Generic functions.
Author: Goran Mržljak
Latest version: 0.0.1

# Generic function

This project contains a few simple generic functions.

## Installation

```bash
npm install --save @gmjs/generic-functions
```

## API

```ts
function emptyFn(): void;
function identityFn<T>(value: T): T;
function alwaysTruePredicate(): boolean;
function alwaysFalsePredicate(): boolean;
```
npm package: @gmjs/generic-types
Description: generic-types
Author: Goran Mržljak
Latest version: 0.0.2

# Generic Types

Some generic types for TypeScript.

## Installation

```bash
npm install --save-dev @gmjs/generic-types
```

## Types

See more at [src/types](src/types).

```ts
// generic
KeyOf<T>;
NotIterable<T>;

// function
Fn1<T, R>;
Fn2<T1, T2, R>;
Fn3<T1, T2, T3, R>;
Fn4<T1, T2, T3, T4, R>;

// object
EmptyObject;
AnyObject;
ObjectKey;

// container
Pair<K, V>;
```
npm package: @gmjs/jest-config
Description: Jest configuration.
Author: Goran Mržljak
Latest version: 0.0.7

# Jest Config

This package contains a function used to create a Jest config object.

Currently, this is a `ts-jest` configuration.

## Installation

```bash
npm install --save-dev @gmjs/eslint-config
```

## Usage

Create an Jest config file, for example `jest.config.ts`:

```ts
import type { JestConfigWithTsJest } from 'ts-jest';
import { getJestConfig } from '@gmjs/jest-config';

export default async (): Promise<JestConfigWithTsJest> => {
  const defaultConfig = await getJestConfig();
  return {
    ...defaultConfig,
  };
};
```
npm package: @gmjs/js-project-generator
Description: Project generator for JavaScript/TypeScript projects.
Author: Goran Mržljak
Latest version: 0.0.27

# JS Project Generator

Contains the code to generate various types of TypeScript projects. See [GenerateInput](#generateinput) for more info.

Can be used directly, or as a dependency in a CLI tool.

## Installation

```bash
npm install --save @gmjs/js-project-generator
```

## API

#### `generateProject`

Generate the project on the file system.

Accepts a single parameter of type [GenerateInput](#generateinput).

Returns a `Promise<void>`, which resolves when the project has been generated.

## Examples

See examples [here](src/impl/generate/test-assets).

## Types

### `GenerateInput`

The is the input to the `generateProject` function - in other words the is the configuration object.

```ts
export interface GenerateInput {
  readonly output: string;
  readonly projectName: string;
  readonly authorData: AuthorData;
  readonly projectData: ProjectDataAny;
}
```

- `output` - Output directory. Project directory is `<output>/<project-name>`.
- `projectName` - Project name. Also the name of the project directory.

```ts
export interface AuthorData {
  readonly scopeName: string;
  readonly author: string;
  readonly email: string;
  readonly authorUrl: string;
  readonly githubAccount: string;
}
```

- `scopeName` - NPM scope name.
- `author` - Author name.
- `email` - Author email.
- `authorUrl` - URL to the homepage of the author.
- `githubAccount` - GitHub account name.

```ts
export const LIST_OF_PROJECT_KINDS = [
  'app-vanilla',
  'app-react',
  'app-node',
  'app-nest',
  'app-cli',
  'lib-browser',
  'lib-node',
  'lib-shared',
] as const;

export type ProjectKind = (typeof LIST_OF_PROJECT_KINDS)[number];

export interface ProjectDataBase {
  readonly kind: ProjectKind;
}

export interface ProjectDataAppVanilla extends ProjectDataBase {
  readonly kind: 'app-vanilla';
  readonly storybook: boolean;
}

export interface ProjectDataAppReact extends ProjectDataBase {
  readonly kind: 'app-react';
  readonly storybook: boolean;
}

export interface ProjectDataAppNode extends ProjectDataBase {
  readonly kind: 'app-node';
}

export interface ProjectDataAppNest extends ProjectDataBase {
  readonly kind: 'app-nest';
}

export interface ProjectDataAppCli extends ProjectDataBase {
  readonly kind: 'app-cli';
  readonly commandName: string;
}

export interface ProjectDataLibBrowser extends ProjectDataBase {
  readonly kind: 'lib-browser';
}

export interface ProjectDataLibNode extends ProjectDataBase {
  readonly kind: 'lib-node';
}

export interface ProjectDataLibShared extends ProjectDataBase {
  readonly kind: 'lib-shared';
}

export type ProjectDataAny =
  | ProjectDataAppVanilla
  | ProjectDataAppReact
  | ProjectDataAppNode
  | ProjectDataAppNest
  | ProjectDataAppCli
  | ProjectDataLibBrowser
  | ProjectDataLibNode
  | ProjectDataLibShared;
```
npm package: @gmjs/js-project-generator-cli
Description: CLI for JavaScript/TypeScript project generator.
Author: Goran Mržljak
Latest version: 0.0.20

# CLI for JavaScript/TypeScript Project Generator

This is a CLI for generating a JavaScript/TypeScript project.

## Installation

```bash
npm install -g @gmjs/js-project-generator-cli
```

## Usage

### Main Command

```
Usage: jsgen [options] [command]

TypeScript project generator.

Options:
  -V, --version                  output the version number
  -h, --help                     display help for command

Commands:
  generate|g [options] [output]  Generate a new project
  configure|c                    Configure the global settings
  help [command]                 display help for command
```

### Generate Command

Generates a new project.

Uses the global configuration file at `$HOME_DIR/.jsgen/config.js` and the command line options passed to this command.

Global configuration is required to run this command, and currently values specified there cannot be overridden by command line options.

If there are any other missing command line options, you will be prompted to enter them.

```
Usage: jsgen generate|g [options] [output]

Generate a new project

Arguments:
  output                            Output directory (default: ".")

Options:
  -p, --project-name <projectName>  Project name
  -t, --project-type <projectType>  Project type (choices: "app-vanilla", "app-react", "app-node", "app-nest", "app-cli", "lib-browser", "lib-node",
                                    "lib-shared")
  -s, --storybook                   Use Storybook
  -S, --no-storybook                Do not use Storybook
  -c, --command-name <commandName>  Command name
  -h, --help                        display help for command

Examples:
  jsgen generate -p my-project -t app-react -s /path/to/output
  jsgen g -p my-project -t app-react -S .
```

### Configure Command

Creates a global configuration file at `$HOME_DIR/.jsgen/config.js`. This file needs to exists and be filled with the desired configuration options before you are able to run the `generate` command.

Global configuration contains author data, such as name, email etc.

After running the `configure` you will be prompted to enter each configuration option.

```
Usage: jsgen configure|c [options]

Configure the global settings

Options:
  -h, --help  display help for command

Examples:
  jsgen configure
  jsgen c
```

## Configuration

- See [here](https://github.com/mrzli/js-project-generator) for details on the configuration options.
npm package: @gmjs/npm-publish-cli
Description: npm-publish-cli
Author: Goran Mržljak
Latest version: 0.0.9

# CLI for Publishing to NPM

This is a CLI for publishing a JavaScript/TypeScript NPM project.

## Installation

```bash
npm install @gmjs/npm-publish-cli
```

It can be installed locally, and added to an npm script, for example like this:

```json
{
  "scripts": {
    "pack": "npmpub pack",
    "pub": "npmpub pub"
  }
}
```

## Usage

### Package

This is a prerequisite for publishing.

```
Usage: npmpub pack|a [options]

Package project.

Options:
  -h, --help  display help for command
```

### Publish

```
Usage: npmpub pub|p [options]

Publish npm package.

Options:
  --dry-run   Dry run (fake publish).
  -h, --help  display help for command
```

### Update Version

```
Usage: npmpub update-version|u [options]

Update version.

Options:
  -m, --major  Update major version.
  -n, --minor  Update minor version.
  -p, --patch  Update patch version.
  -h, --help   display help for command
```

## Configuration

Just the options specified in the usage above.
npm package: @gmjs/nullish-checks
Description: nullish-checks
Author: Goran Mržljak
Latest version: 0.0.1

# Nullish checks

Guard functions for checking nullish/non-nullish values.

## Installation

```bash
npm install --save @gmjs/nullish-checks
```

## Usage

```ts
function isNullish<T>(value: T): value is T extends null | undefined ? T : never;

function isNotNullish<T>(value: T): value is T extends null | undefined ? never : T;
```
npm package: @gmjs/number-util
Description: Number utility functions.
Author: Goran Mržljak
Latest version: 0.0.3

# Number util

Number utility functions.

## Install

```bash
npm install --save @gmjs/number-util
```

## Usage

```ts
import { clamp } from '@gmjs/number-util';

const output = clamp(15, 10, 12);
console.log(output);
// 12
```

## API

#### `clamp`

Clamps the `value` number to the specified range.

```ts
const output = clamp(15, 10, 12);
console.log(output);
// 12
```

#### `parseFloatOrThrow`

Parses a string to a float, or throws an error if the input is of invalid type or format.

The parsed string must match `^-?\d+(?:\.\d+)?$` regex to be considered valid.

```ts
const output = parseFloatOrThrow('15.123456');
console.log(output);
// 15.123456
```

Here are some examples of invalid inputs:

```ts
parseFloatOrThrow('a'); // throws
parseFloatOrThrow('15.'); // throws
parseFloatOrThrow('+15'); // throws
parseFloatOrThrow('.12'); // throws
parseFloatOrThrow('5e2'); // throws
```

#### `parseIntegerOrThrow`

Parses a string to an integer, or throws an error if the input is of invalid type or format.

The parsed string must match `^-?\d+$` regex to be considered valid.

```ts
const output = parseIntegerOrThrow('15');
console.log(output);
// 15
```

Here are some examples of invalid inputs:

```ts
parseIntegerOrThrow('a'); // throws
parseIntegerOrThrow('15.2'); // throws
parseIntegerOrThrow('+15'); // throws
```

#### `padNonNegativeIntWithZeroes`

Pads a non-negative integer with zeroes to the left, to the specified length.

```ts
const output = padNonNegativeIntWithZeroes(15, 5);
console.log(output);
// '00015'
```

#### `randomInteger`

Returns a random integer in the `[min, max>` range. In other words, the `min` value is inclusive, and the `max` value is exclusive.

For example, `randomInteger(10, 20)` will return a random integer between `10` and `19` inclusive, it will never return `20`.

```ts
const output = randomInteger(10, 20);
console.log(output);
// 15 (for example, but could be any integer between 10 and 19 inclusive)
```

#### `round`

Rounds the `value` number to the specified number of decimal places.

```ts
const output = round(15.123456, 2);
console.log(output);
// 15.12
```

If the `precision` parameter is omitted, the number is rounded to the nearest integer.

```ts
const output = round(15.123456);
console.log(output);
// 15
```
npm package: @gmjs/path
Description: File system path utilities.
Author: Goran Mržljak
Latest version: 0.0.2

# Path Utilities

Some utility functions for manipulating file system paths.

## Installation

```bash
npm install --save @gmjs/path
```

## Functions

- `isInDir(rootDir: string, fsPath: string): boolean`
  - Description - Returns true if `fsPath` is in `rootDir`. It can be nested any number of levels deep.
- `pathDir(fullPath: string): string`
  - Description - Returns the parent directory of the path.
- `pathFsName(fullPath: string): string`
  - Description - Returns the base name of the file or directory in the path, without the extension.
- `pathFsNameWithExtension(fullPath: string): string`
  - Description - Returns the name of the file or directory in the path, with the extension.
- `pathWithoutExtension(fullPath: string): string`
  - Description - Returns the entire path without the extension.
- `pathExtension(fullPath: string): string`
  - Description - Returns the extension of the file in the path, or empty string if there is no extension.
npm package: @gmjs/pnpm-publish-cli
Description: pnpm-publish-cli
Author: Goran Mržljak
Latest version: 0.0.5

# CLI for Publishing to NPM

This is a CLI for publishing a JavaScript/TypeScript NPM project.

## Installation

```bash
npm install --save @gmjs/pnpm-publish-cli
```

It can be installed locally, and added to an npm script, for example like this:

```json
{
  "scripts": {
    "pac": "pnpmpub pack",
    "pub": "pnpmpub pub"
  }
}
```

## Usage

### Package

This is a prerequisite for publishing.

```
Usage: pnpmpub pack|a [options]

Package project.

Options:
  -h, --help  display help for command
```

### Publish

```
Usage: pnpmpub pub|p [options]

Publish npm package.

Options:
  --dry-run   Dry run (fake publish).
  -h, --help  display help for command
```

### Update Version

```
Usage: pnpmpub update-version|u [options]

Update version.

Options:
  -m, --major  Update major version.
  -n, --minor  Update minor version.
  -p, --patch  Update patch version.
  -h, --help   display help for command
```

## Configuration

Just the options specified in the usage above.
npm package: @gmjs/type-checks
Description: Runtime type checks.
Author: Goran Mržljak
Latest version: 0.0.4

# Type Checks

Runtime type checks.

## Install

```bash
npm install --save @gmjs/type-checks
```

## API

```typescript
function isBoolean(value: unknown): value is boolean;

function isNumber(value: unknown): value is number;

function isString(value: unknown): value is string;

function isDate(value: unknown): value is Date;

function isArray<T = unknown>(value: unknown): value is T[];

function isObject<T extends Record<string | number, any> = Record<string | number, any>>(value: unknown): value is T;

function isFunction<T extends (...args: any[]) => any = (...args: any[]) => any>(value: unknown): value is T;
```
npm package: @gmjs/value-generators
Description: Value generators.
Author: Goran Mržljak
Latest version: 0.0.2

# Value generators

This project implements value generators. Mostly, it contains functions that generate iterable values.

## Installation

```bash
npm install --save @gmjs/value-generators
```

## Usage

You can use the generators in a standalone manner:

```ts
import { range } from '@gmjs/value-generators';

for (const i of range(0, 5)) {
  console.log(i);
}
// 0
// 1
// 2
// 3
// 4
```

You can also use them with the `applyFn` function from the `apply-function` package:

```ts
import { applyFn } from '@gmjs/apply-function';
import { map } from '@gmjs/value-transformers';
import { index } from '@gmjs/value-generators';

const output = applyFn(
  index(5),
  map((v: number) => v + 2),
);
console.log([...output]); // using spread operator to convert iterable to array
// [2, 3, 4, 5, 6]
```

## API

### Generators

#### `constant`

Generates an iterable that yields the same value over and over again. The value is specified as the first parameter.

It has an optional `count` parameter that specifies how many times the value should be yielded. If not specified, the generator will yield the value infinitely.

```ts
const output = constant(5, 3);
console.log([...output]);
// [5, 5, 5]
```

#### `index`

Generates an iterable that yields the index of each value.

It has an optional `count` parameter that specifies how many times the value should be yielded. If not specified, the generator will yield the value infinitely.

```ts
const output = index(3);
console.log([...output]);
// [0, 1, 2]
```

#### `ones`

Generates an iterable that yields the value `1` over and over again.

It has an optional `count` parameter that specifies how many times the value should be yielded. If not specified, the generator will yield the value infinitely.

```ts
const output = ones(3);
console.log([...output]);
// [1, 1, 1]
```

#### `range`

Generates an iterable that yields a range of values.

The first parameter defined the `from` (starting) value, the second parameter defines the `to` (limit) value. The `to` value is not included in the range, meaning that the generator can potentially yield values in `[from, to)`.

It has an optional `step` parameter that specifies the step size. If not specified, the step size is `1`. Step size can be negative, in which case the generator can potentially yield values in `(to, from]` range, again starting with the `from` value.

```ts
const output = range(0, 5);
console.log([...output]);
// [0, 1, 2, 3, 4]
```

```ts
const output = range(1, 6, 2);
console.log([...output]);
// [1, 3, 5]
```

```ts
const output = range(5, 0, -1);
console.log([...output]);
// [5, 4, 3, 2, 1]
```

#### `zeros`

Generates an iterable that yields the value `0` over and over again.

It has an optional `count` parameter that specifies how many times the value should be yielded. If not specified, the generator will yield the value infinitely.

```ts
const output = zeros(3);
console.log([...output]);
// [0, 0, 0]
```
npm package: @gmkj/gm-cli
Description: GM CLI
Author: 刘西川
Latest version: 0.0.1-beta.2

# 冠美前端CLI

## 架构图
![架构图](./assets/guide.png)

## 能力列表
- gm login // 使用[组件管理库](http://wfx.guanmei.work:7878/module)账号登录
- gm query {{componentName}} // 组件查询并下载 支持模糊查询
- gm upload {{componentName}} // 上传组件到[组件管理库](http://wfx.guanmei.work:7878/module) 
- gm build-npm // 快速提取组件的dependencies到项目的package.json中
- gm create {{componentName}} // 快速在本地生成一个组件模板
- gm logout // 注销


## 开发流程
参考 https://oclif.io/
## 本地调试
1、将本地包link到全局
```shell
sudo npm link

```

2、运行 ```pnpm install ```安装依赖

3、修改package.json中的 ```bin.gm```为```./bin/dev```

4、运行```gm [command]``` 查看修改效果