mirror of
https://github.com/sharevb/it-tools.git
synced 2026-11-20 21:23:08 +03:00
Merge branch 'feat/nginx-formatter' into chore/all-my-stuffs
# Conflicts: # components.d.ts # package.json # pnpm-lock.yaml # src/tools/index.ts # vite.config.ts
This commit is contained in:
commit
0e1cc039ab
5 files changed
+62
-11
No files matched your search
@@ -161,6 +161,7 @@
|
||||
"monaco-editor": "^0.43.0",
|
||||
"naive-ui": "^2.35.0",
|
||||
"netmask": "^2.0.2",
|
||||
"nginx-config-formatter": "^1.4.5",
|
||||
"node-forge": "^1.3.1",
|
||||
"openpgp": "^5.11.1",
|
||||
"oui-data": "^1.0.10",
|
||||
|
||||
Generated
+20
-11
@@ -335,6 +335,9 @@ dependencies:
|
||||
netmask:
|
||||
specifier: ^2.0.2
|
||||
version: 2.0.2
|
||||
nginx-config-formatter:
|
||||
specifier: ^1.4.5
|
||||
version: 1.4.5
|
||||
node-forge:
|
||||
specifier: ^1.3.1
|
||||
version: 1.3.1
|
||||
@@ -601,7 +604,6 @@ packages:
|
||||
/@aashutoshrathi/word-wrap@1.2.6:
|
||||
resolution: {integrity: sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/@ampproject/remapping@2.2.1:
|
||||
resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==}
|
||||
@@ -5990,6 +5992,12 @@ packages:
|
||||
safe-buffer: 5.2.1
|
||||
dev: false
|
||||
|
||||
/citty@0.1.6:
|
||||
resolution: {integrity: sha512-tskPPKEs8D2KPafUypv2gxwJP8h/OaJmC82QQGGDQcHvXX43xF2VDACcJVmZ0EuSxkpO9Kc4MlrA3q0+FG58AQ==}
|
||||
dependencies:
|
||||
consola: 3.2.3
|
||||
dev: false
|
||||
|
||||
/clean-regexp@1.0.0:
|
||||
resolution: {integrity: sha512-GfisEZEJvzKrmGWkvfhgzcz/BllN1USeqD2V6tg14OAOgaCD2Z/PUEuxnAZ/nPvmaHRG7a8y77p1T/IRQ4D1Hw==}
|
||||
engines: {node: '>=4'}
|
||||
@@ -6184,7 +6192,6 @@ packages:
|
||||
/consola@3.2.3:
|
||||
resolution: {integrity: sha512-I5qxpzLv+sJhTVEoLYNcTW+bThDCPsit0vLNKShZx6rLtpilNpmmeTPaeqJb9ZE9dV3DGaeby6Vuhrw38WjeyQ==}
|
||||
engines: {node: ^14.18.0 || >=16.10.0}
|
||||
dev: true
|
||||
|
||||
/console-browserify@1.2.0:
|
||||
resolution: {integrity: sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==}
|
||||
@@ -6779,7 +6786,6 @@ packages:
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
path-type: 4.0.0
|
||||
dev: true
|
||||
|
||||
/discontinuous-range@1.0.0:
|
||||
resolution: {integrity: sha512-c68LpLbO+7kP/b1Hr1qs8/BJ09F5khZGTxqxZuhzxpmwJKOgRFHJWIb9/KmqnqHhLdO55aOxFH/EGBvUQbL/RQ==}
|
||||
@@ -8023,7 +8029,6 @@ packages:
|
||||
ignore: 5.2.4
|
||||
merge2: 1.4.1
|
||||
slash: 4.0.0
|
||||
dev: true
|
||||
|
||||
/globrex@0.1.2:
|
||||
resolution: {integrity: sha512-uHJgbwAMwNFf5mLst7IWLNg14x1CkeqglJb/K3doi4dw6q2IvAAmM/Y81kevy83wP+Sst+nutFTYOGg3d1lsxg==}
|
||||
@@ -8376,7 +8381,6 @@ packages:
|
||||
/ignore@5.2.4:
|
||||
resolution: {integrity: sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==}
|
||||
engines: {node: '>= 4'}
|
||||
dev: true
|
||||
|
||||
/image-in-browser@3.2.1:
|
||||
resolution: {integrity: sha512-QIhRnkz7ikwtu+U5Q2IkyUeC+7MtiIg0xATF4i72/hxaWjqOPm+VurD7ekCv+dwREmf19nwCurDDeHDayoIgZw==}
|
||||
@@ -9138,7 +9142,6 @@ packages:
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
dev: true
|
||||
|
||||
/libheif-js@1.18.2:
|
||||
resolution: {integrity: sha512-4Nk0dKhhRfVS4mECcX2jSDpNU6gcHQLneJjkGQq61N8COGtjSpSA3CI+1Q3kUYv5Vf+SwIqUtaDSdU6JO37c6w==}
|
||||
@@ -9739,6 +9742,17 @@ packages:
|
||||
engines: {node: '>= 0.4.0'}
|
||||
dev: false
|
||||
|
||||
/nginx-config-formatter@1.4.5:
|
||||
resolution: {integrity: sha512-gN2hbtL0eRtNBrD0SbiRBZ9nHNRu4qrfwuvOYWMBHHeBgeX0GsnSj38pt3Epb7+ZDIWm1ebbF359JLwQqZTYaA==}
|
||||
engines: {node: '>=14.18.0'}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
citty: 0.1.6
|
||||
globby: 13.1.4
|
||||
optionator: 0.9.3
|
||||
pathe: 1.1.1
|
||||
dev: false
|
||||
|
||||
/no-case@2.3.2:
|
||||
resolution: {integrity: sha512-rmTZ9kz+f3rCvK2TD1Ue/oZlns7OGoIWP4fc3llxxRXlOkHKoWPPWJOfFYpITabSow43QJbRIoHQXtt10VldyQ==}
|
||||
dependencies:
|
||||
@@ -10022,7 +10036,6 @@ packages:
|
||||
levn: 0.4.1
|
||||
prelude-ls: 1.2.1
|
||||
type-check: 0.4.0
|
||||
dev: true
|
||||
|
||||
/ora@5.4.1:
|
||||
resolution: {integrity: sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ==}
|
||||
@@ -10234,7 +10247,6 @@ packages:
|
||||
/path-type@4.0.0:
|
||||
resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==}
|
||||
engines: {node: '>=8'}
|
||||
dev: true
|
||||
|
||||
/pathe@1.1.1:
|
||||
resolution: {integrity: sha512-d+RQGp0MAYTIaDBIMmOfMwz3E+LOZnxx1HZd5R18mmCZY0QBlK0LDZfPc8FW8Ed2DlvsuE6PRjroDY+wg4+j/Q==}
|
||||
@@ -10423,7 +10435,6 @@ packages:
|
||||
/prelude-ls@1.2.1:
|
||||
resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==}
|
||||
engines: {node: '>= 0.8.0'}
|
||||
dev: true
|
||||
|
||||
/prepin@1.0.3:
|
||||
resolution: {integrity: sha512-0XL2hreherEEvUy0fiaGEfN/ioXFV+JpImqIzQjxk6iBg4jQ2ARKqvC4+BmRD8w/pnpD+lbxvh0Ub+z7yBEjvA==}
|
||||
@@ -11373,7 +11384,6 @@ packages:
|
||||
/slash@4.0.0:
|
||||
resolution: {integrity: sha512-3dOsAHXXUkQTpOYcoAxLIorMTp4gIQr5IW3iVb7A7lFIp0VHhnynm9izx6TssdrIcVIESAlVjtnO2K8bg+Coew==}
|
||||
engines: {node: '>=12'}
|
||||
dev: true
|
||||
|
||||
/snake-case@2.1.0:
|
||||
resolution: {integrity: sha512-FMR5YoPFwOLuh4rRz92dywJjyKYZNLpMn1R5ujVpIYkbA9p01fq8RMg0FkO4M+Yobt4MjHeLTJVm5xFFBHSV2Q==}
|
||||
@@ -12028,7 +12038,6 @@ packages:
|
||||
engines: {node: '>= 0.8.0'}
|
||||
dependencies:
|
||||
prelude-ls: 1.2.1
|
||||
dev: true
|
||||
|
||||
/type-detect@4.0.8:
|
||||
resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==}
|
||||
|
||||
@@ -66,6 +66,7 @@ import { tool as imageToCss } from './image-to-css';
|
||||
import { tool as jsonToGo } from './json-to-go';
|
||||
import { tool as jsonToSchema } from './json-to-schema';
|
||||
import { tool as markdownToHtml } from './markdown-to-html';
|
||||
import { tool as nginxFormatter } from './nginx-formatter';
|
||||
import { tool as pdfSignatureChecker } from './pdf-signature-checker';
|
||||
import { tool as numeronymGenerator } from './numeronym-generator';
|
||||
import { tool as macAddressGenerator } from './mac-address-generator';
|
||||
@@ -275,6 +276,7 @@ export const toolsByCategory: ToolCategory[] = [
|
||||
jsonpathMemo,
|
||||
jsonToSchema,
|
||||
mongoObjectidConverter,
|
||||
nginxFormatter,
|
||||
],
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
import { Braces } from '@vicons/tabler';
|
||||
import { defineTool } from '../tool';
|
||||
|
||||
export const tool = defineTool({
|
||||
name: 'Nginx formatter',
|
||||
path: '/nginx-formatter',
|
||||
description: 'Format/prettify Nginx configuration files',
|
||||
keywords: ['nginx', 'formatter', 'prettier'],
|
||||
component: () => import('./nginx-formatter.vue'),
|
||||
icon: Braces,
|
||||
createdAt: new Date('2024-03-30'),
|
||||
});
|
||||
@@ -0,0 +1,27 @@
|
||||
<script setup lang="ts">
|
||||
import { formatContent } from 'nginx-config-formatter';
|
||||
import type { UseValidationRule } from '@/composable/validation';
|
||||
import { withDefaultOnError } from '@/utils/defaults';
|
||||
|
||||
const defaultValue = '{\n\t"hello": [\n\t\t"world"\n\t]\n}';
|
||||
const transformer = (value: string) => withDefaultOnError(() => formatContent(value), '');
|
||||
|
||||
const rules: UseValidationRule<string>[] = [
|
||||
{
|
||||
validator: (v: string) => v === '' || formatContent(v),
|
||||
message: 'Provided Nginx config is not valid.',
|
||||
},
|
||||
];
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<format-transformer
|
||||
input-label="Your Nginx config"
|
||||
:input-default="defaultValue"
|
||||
input-placeholder="Paste your Nginx config here..."
|
||||
output-label="Prettified Nginx config"
|
||||
output-language="json"
|
||||
:input-validation-rules="rules"
|
||||
:transformer="transformer"
|
||||
/>
|
||||
</template>
|
||||
Reference in new issue
Block a user