Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@methodus/contracts

Package Overview
Dependencies
Maintainers
4
Versions
110
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@methodus/contracts

This package is part of the Methodus tollbelt. It's purpose is generating contract packages of the server code, to be used by JavaScript browser / server clients.

  • 8.0.9
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
24
increased by100%
Maintainers
4
Weekly downloads
 
Created
Source

@Methodus contracts builder.

This package is part of the Methodus tollbelt. It's purpose is generating contract packages of the server code, to be used by JavaScript browser / server clients.

Install

Install globally using npm i -g @methodus/contracts

usage:

In the root folder of the package execute:

Client contracts contracts-client build.json

Server contracts contracts-server build.json

To generate a contract package you'll need a build.json file to instruct the builder what to inclode in the package.

build.json instructions file

{
    "models": {
        "contractNameServer": "@server/models", //the name of the server contract package
        "contractNameClient": "@client/models", //the name of the client contract package
        "buildPath": "./build_path/", // optional, where to build the package. defaults to cwd.
        "path": "build_vars/models", // optional, the path to the source package. defaults to cwd.
        "npmrc": "./.npmrc", // optional, usefull for private registry and custom npm settings, will copy the file into the package directory
        "models": {
            // models using @Model decorators
            "UserModel": {
                "path": "./models/user.model.ts"
            },
            "GroupModel": {
                "path": "./models/group.ts"
            }
        },
        "contracts": {
            // classes using @MethodConfig decorators
            "DataController": {
                "path": "./controllers/datacontroller.ts"
            },
            "Models": {
                "path": "./controllers/models.controller.ts"
            }
        },
        "includes": {
            // any file the package may need
            "Mock": {
                "alias": "mocker",
                "path": "../../build_mocks/mock.ts"
            }
        },
        "dependencies": {}
    }
}

The build.json file can contain more than one project

{
    "models": {
        "contractNameServer": "@server/models",
        "contractNameClient": "@client/models"
    },
    "integrations": {
        "contractNameServer": "@server/integrations",
        "contractNameClient": "@client/integrations"
    }
}
** Reference **

filename

** Tests overview **

tests

Keywords

FAQs

Package last updated on 27 May 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc