open-index/open-npm huggingface dataset:
npm package: @opi_pib/ngx-schematics
Description: schematics
Author: Dawid Lubowiecki
Latest version: 21.0.1

# @opi_pib/ngx-schematics

Schematics for angular projects

## Install

```
npm i -g @opi_pib/ngx-schematics
```

You can add schematics to angular.json

```
	"cli": {
		"schematicCollections": ["@schematics/angular", "@opi_pib/ngx-schematics"]
	}
```

## Domain

### entity

Generate files for entity

```typescript
ng g @opi_pib/ngx-schematics:entity --name=uuid
```

or

```typescript
ng g entity --name=uuid
```

### value-object

Generate files for value object

```typescript
ng g @opi_pib/ngx-schematics:vo --name=user
```

or

```typescript
ng g vo --name=user
```

### value-object from Dto

Generate files for value object from dto

```typescript
ng g @opi_pib/ngx-schematics:vo-dto --dto=UserDto
```

or

```typescript
ng g vo-dto UserDto
```

### value-object from Enum

Generate files for value object from enum

```typescript
ng g @opi_pib/ngx-schematics:vo-enum --dto=EnumDto
```

or

```typescript
ng g vo-enum EnumDto
```
npm package: @opi_pib/node-emails
Description: Node email templates bundler
Author: Dawid Lubowiecki
Latest version: 1.1.0

# @opi_pib/node-emails

-   [Install](#install)
-   [File structure](#file-structure)
-   [Cli commands](#cli-commands)
-   [Default config](#default-config)

## Install

```
npm install @opi_pib/node-emails
```

## File structure

Suggested file structure is placed in folder 'example'.

## Cli commands

```typescript
emails serve // serve emails in browser, watch for changes and reload
emails build // compile and compress templates
emails --help // display documentation
```

## Default config

```typescript
export const defaultConfig: Config = {
	dist: "dist",
	pages: ["src/pages/**/*.html", "!src/pages/archive/**/*.html"],
	root: "src/pages",
	layouts: "src/layouts",
	partials: "src/partials",
	helpers: "src/helpers",
	scss: "src/assets/scss/app.scss",
	images: ["src/assets/img/**/*", "!src/assets/img/archive/**/*"],
};
```

## Custom config

To provide custom config, create emails-config.json file. Custom config will be merged with default one.

```typescript
emails build --config ./emails-config.json // provide custom options
```

### Possible options:

```typescript
{
  dist: string;
  pages: string[];
  root: string;
  layouts: string;
  partials: string;
  helpers: string;
  scss: string;
  images: string[];
}
```
npm package: @opi_pib/node-licenses
Description: License checker
Author: Dawid Lubowiecki
Latest version: 1.1.0

# @opi_pib/node-licenses

## Install

```
npm install -g @opi_pib/node-licenses
```

## Usage

```
licenses list
```

### Only show production dependencies

```
licenses list -p
```

### Ignore peerDependencies

```
licenses list -n
```

### Look for direct dependencies only

```
licenses list -d
```
npm package: @opi_pib/node-openapi
Description: Openapi tools
Author: Dawid Lubowiecki
Latest version: 3.0.3

# @opi_pib/node-openapi

- [Install](#install)
- [Cli commands](#cli-commands)
- [Default config](#default-config)

## Install

```
npm install @opi_pib/node-openapi
```

## Cli commands

### Display cli documentation

```console
openapi help
```

### Compile openapi.json from docs

```console
openapi build spec --source=./docs/index.json --dist=./dist/openapi.json
```

### Serve documentation in browser

```console
openapi serve editor --port=3010 --host=http://localhost --source=./dist/openapi.json --basePath=/v1
```

### Serve openapi.json

```console
openapi serve spec --port=3011 --host=http://localhost --source=./dist/openapi.json
```

### Build typescript interfaces (needs 'openapi serve spec' command running)

```console
openapi serve spec
openapi build typescript --source=http://localhost:3011 --dist=./src/rest/api --typesOnly=true
```

## Default config

```
{
	basePath: '/v1',
	host: 'http://localhost',
	port: {
		editor: '3010',
		spec: '3011'
	},
	dist: {
		folder: './dist',
		fileName: 'index'
	},
	sourceUrl: './src/docs/index.json',
	typescript: {
		dist: './src/rest/api',
		typesOnly: true,
		services: false,
		promises: false
	}
};
```
npm package: @opi_pib/node-translate
Description: Translation tools
Author: Dawid Lubowiecki
Latest version: 2.2.3

# @opi_pib/node-translate

Helper tool for generating translation files that works with ngx-translate

-   [Install](#install)
-   [Generate translations](#generate-translations)
-   [Define translation keys](#define-translation-keys)
-   [Default config](#default-config)

## Install

```
npm install @opi_pib/node-translate
```

## Generate translations

Find all translation keys in 'app' and 'domain' folders and generate translation files

```console
translate build --source=\"./src/{app,domain}/**/*+(.ts|.html)\" --langs=pl --langs=en
```

## Define translation keys

### in TypeScript

Every translation key needs to match RegExp which means also that it needs to be used inside of methods translate\$ or instant

```
/[\s\t\[\(\{\.](?:t|translate\$|instant)\(:?\'\w+(:?.\w+)*/
```

If translate\$ or instant methods can't be used, wrap translation key in translation marker 't'

```typescript
const a = t("A.B.C");
```

### in HTML

Every translation key needs to match RegExp which means also that it needs to be passed through 'translate' pipe

```
/\'\w+(?:\.\w+)*\'\s(?:\|\s.+)*?\|\stranslate/
```

#### Example

```html
<div [value]="'J' | async | name | translate"></div>
<div value="{{ 'J.J' | getName: {a: '1'} | translate }}"></div>
<div value="{{ 'J.J.J' | translate: {name: 'Jan'} }}"></div>
```

## Default config

```json
{
	"source": "./src/app/**/*+(.ts|.html)",
	"dist": "./src/translations",
	"i18n": "./src/assets/i18n",
	"langs": ["pl"],
	"reportDuplicates": true
}
```
npm package: @opi_pib/node-utility
Description: Node utility
Author: Dawid Lubowiecki
Latest version: 3.0.3

# Node Utility

- [Install](#install)
- [Notify](#notify)
- [HttpProxyMiddleware](#httpproxymiddleware)
- [HttpAdapters](#httpadapters)

## Install

```
npm install @opi_pib/node-utility
```

## Notify

### Usage

```javascript
Notify.success({ message: 'message' });
Notify.warning({ message: 'message' });
Notify.info({ message: 'message' });
Notify.error({ message: 'message', error: new Error('Some error') });
```

## Mock server

npm scripts

```
npm i -D @stoplight/prism-cli
```

```
"mock:server": "prism mock --port=3010 ./dist/index.json",
```

## HttpProxyMiddleware

Proxy middleware for express server

### Usage

proxy.ts

```javascript
import { HttpProxyMiddleware } from '@opi_pib/node-utility';

const handlers = [SystemInfo.processRes];

HttpProxyMiddleware.run(3010, 3011, handlers);
```

npm scripts

```
"mock:server": "ts-node proxy.ts",
```

## HttpAdapters

### HttpAdapters.replaceResponseBody()

Replace response with new value of body

#### Usage

```javascript
import {
	HttpAdapters,
	IncomingMessage,
	ProxyRequest,
	ServerResponse,
} from '@opi_pib/node-utility';

export class SystemInfo {
	static processRes(
		proxyRes: IncomingMessage,
		req: ProxyRequest,
		res: ServerResponse,
	) {
		if (Route.pathMatch(req, '^/system/info$')) {
			return HttpAdapters.replaceResponseBody(infoElementDto, proxyRes, res);
		}
	}
}
```

### HttpAdapters.replaceResponseBodyFromJsonFile()

Replace response with new value of body from json file

#### Usage

```javascript
export class SystemInfo {
	static processRes(
		proxyRes: IncomingMessage,
		req: ProxyRequest,
		res: ServerResponse,
	) {
		if (Route.pathMatch(req, '^/system/info$')) {
			return HttpAdapters.replaceResponseBodyFromJsonFile('./infoElementDto.json', proxyRes, res);
		}
	}
}
```

### HttpAdapters.replaceResponseBodyFromFile()

Replace response with content of file

#### Usage

```javascript
export class SystemInfo {
	static processRes(
		proxyRes: IncomingMessage,
		req: ProxyRequest,
		res: ServerResponse,
	) {
		if (Route.pathMatch(req, '^/system/info$')) {
			return HttpAdapters.replaceResponseBodyFromFile('./infoElementDto.pdf', proxyRes, res);
		}
	}
}
```

### HttpAdapters.toQueryString()

Convert object into queryString

#### Usage

```javascript
const result = HttpAdapters.toQueryString({
	a: 'b',
	c: 1,
	d: undefined,
	e: null
});

expect('a=b&c=1').toEqual(result);
```

### HttpAdapters.stringify()

Stringify value

#### Usage

```javascript
const result = HttpAdapters.stringify({
	a: 'b',
	c: 1,
	d: undefined,
	e: null
});

expect('{"a":"b","c":1}').toEqual(result);
```
npm package: @opi_pib/prettier-config-base
Description: Prettier config
Author: Dawid Lubowiecki
Latest version: 1.0.12

# @opi_pib/prettier-config-base

## Install

```
npm install -D @opi_pib/prettier-config-base prettier
```

## Config

### Import

#### .prettierrc.mjs

```
import { init } from '@opi_pib/prettier-config-base'; // or ng

/**
 * @type {import("prettier").Config}
 */
export default {
	...init
};

```

or

#### package.json

```
"prettier": "@opi_pib/prettier-config-base",
```

or

```
"prettier": "@opi_pib/prettier-config-base/ng",
```

### package.json

```
"lint:prettier": "prettier -u -w ."
```

### VS Code settings.json

```
{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll": "explicit"
  },
  "editor.defaultFormatter": "esbenp.prettier-vscode",
}
```
npm package: @opi_pib/stylelint-config-base
Description: Stylelint config
Author: Dawid Lubowiecki
Latest version: 1.5.12

# @opi_pib/stylelint-config-base

## Install

```
npm install -D @opi_pib/stylelint-config-base
```

## Config

### stylelint.config.mjs // or .stylelintrc.mjs

```
import { css } from '@opi_pib/stylelint-config-base'; // or scss
// cssTw, scssTw for tailwind

/** @type {import('stylelint').Config} */
export default css;
```

### package.json

```
"lint:styles": "stylelint **/*.scss --fix -i=.gitignore",
```

### .browserslistrc

```
> 5%

last 1 Chrome version
last 1 Firefox version
last 2 Edge major versions
last 1 Safari major versions
last 1 iOS major versions
```

### VS Code settings.json

```
{
  "editor.formatOnSave": true,
  "editor.codeActionsOnSave": {
    "source.fixAll": true
  },
  "[scss]": {
    "editor.defaultFormatter": "stylelint.vscode-stylelint"
  },
  "scss.validate": false,
  "stylelint.validate": ["scss"]
}
```
npm package: @opi_pib/theme
Description: Theme for web applications
Author: Dawid Lubowiecki
Latest version: 0.1.3

# Theme

## Fonts

Preconnect for performance.

```
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
```

Noto Sans and Roboto Mono

```
<link
  href="https://fonts.googleapis.com/css2?family=Noto+Sans:ital,wght@0,100..900;1,100..900&family=Roboto+Mono&display=swap"
  rel="stylesheet"
/>
```

Icons

```
<link
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@20..48,100..700,0..1,-50..200&display=swap"
  rel="stylesheet"
/>
```

You can replace these icons with your own by overriding this CSS variable:

```
--icon-font: "Material Symbols Outlined";
```

## CSS

order of layers

```
layers.css
```

variables

```
variables.css
```

normalize

```
normalize.css
```

theme

```
theme.css
```