1.11.5 • Published 3 months ago

@lad-tech/nsc-cli v1.11.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 months ago

Генерация нового сервиса по схеме. Создана для быстрой генерации сервисов с использованием nsc-toolkit

Возможности

  • Валидация схемы
  • Генерация базового содержания сервиса
  • Уже сгенерированные методы изменяться не будут, только интерфейсы
  • Можно в корень сервиса положить .nscignore (синтаксис gitignore) и нужные вам файлы не будут перезаписаны
  • Использование $ref в контрактах методов, в service.schema.json можно описать блок Ref

Установка

npm i @lad-tech/nsc-cli -D

Пример использования

npx nsc-cli --schema ./services/myService/service.json     

Опции

npx nsc-cli -h 

Usage: nsc-cli [options]

Генерация нового сервиса по json schema

Options:
  --schema  <path>  путь до схемы
  -h, --help        display help for command

Применение .nscignore

**/service.ts
**/package.json

Схема описания сервиса (подробности)

{
  "name": "Math",
  "description": "Mathematics service",
  "methods": {
    "Sum": {
      "action": "sum",
      "description": "Addition of two numbers",
      "options": {},
      "request": {
        "type": "object",
        "properties": {
          "a": {
            "type": "number"
          },
          "b": {
            "type": "number"
          }
        },
        "required": [
          "a",
          "b"
        ]
      },
      "response": {
        "type": "object",
        "properties": {
          "result": {
            "type": "number"
          }
        },
        "required": [
          "result"
        ]
      }
    },
    "Fibonacci": {
      "action": "fibonacci",
      "description": "Return Fibonacci sequence given length",
      "options": {
        "useStream": {
          "response": true
        }
      },
      "request": {
        "type": "object",
        "properties": {
          "length": {
            "type": "number"
          }
        },
        "required": [
          "length"
        ]
      },
      "response": {
        "type": "number"
      }
    },
    "SumStream": {
      "action": "sumstream",
      "description": "Adding all the numbers of the stream",
      "options": {
        "useStream": {
          "request": true
        }
      },
      "request": {
        "type": "number"
      },
      "response": {
        "type": "object",
        "properties": {
          "result": {
            "type": "number"
          }
        },
        "required": [
          "result"
        ]
      }
    }
  }
}

code style: prettier

1.11.5

3 months ago

1.11.4

10 months ago

1.11.3

10 months ago

1.11.2

10 months ago

1.11.1

10 months ago

1.11.0

10 months ago

1.10.1

10 months ago

1.10.0

10 months ago

1.9.1

10 months ago

1.9.0

10 months ago

1.8.0

10 months ago

1.7.2

12 months ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.0

1 year ago

1.2.1

1 year ago

1.2.0

1 year ago

1.1.4

1 year ago

1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

0.7.5

1 year ago

0.7.4

1 year ago

0.7.3

1 year ago

0.7.2

1 year ago

1.0.2

1 year ago