@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",
"contractNameClient": "@client/models",
"buildPath": "./build_path/",
"path": "build_vars/models",
"npmrc": "./.npmrc",
"models": {
"UserModel": {
"path": "./models/user.model.ts"
},
"GroupModel": {
"path": "./models/group.ts"
}
},
"contracts": {
"DataController": {
"path": "./controllers/datacontroller.ts"
},
"Models": {
"path": "./controllers/models.controller.ts"
}
},
"includes": {
"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