diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md new file mode 100644 index 0000000..32ffb92 --- /dev/null +++ b/DEVELOPMENT.md @@ -0,0 +1,17 @@ +# Development + +## Update schema +1. Run `npm run update:schema` to generate schema and format it + +## Building +1. Run `rm -rf dist` to remove `dist` directory (if exists). +2. Run `npm run pre-build` to run TS check, linter and formatter. +3. Run `npm run build` to build. + +To use this local package, install it with `npm i path/to/this/dir`. + +## Publishing +1. Update version in `package.json` and `package-lock.json`. +Alternatively, use `npm version {VERSION}` to make version commit. +2. Run `npm run publish --dry-run` to check before publishing. +3. Run `npm run publish` to publish package. diff --git a/README.md b/README.md index 6b64188..28ed832 100644 --- a/README.md +++ b/README.md @@ -83,3 +83,6 @@ function getMaps(params: GetAllMapsApiQuery): Promise { return artifactsApi.maps.getAll(params); }; ``` + +## Develop +Refer to [DEVELOPMENT.md](./DEVELOPMENT.md). diff --git a/package.json b/package.json index a9dd2fb..4d37c43 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,13 @@ ], "scripts": { "build": "tsc", + "pre-build": "npm run ts-check && npm run lint && npm run format", "ts-check": "tsc --noEmit", "lint": "eslint --max-warnings 0 --ext .ts lib", "format": "prettier --log-level warn --write lib", - "generate-schema": "openapi-typescript https://api.artifactsmmo.com/openapi.json -o lib/api/types/api-schema.types.ts" + "update:schema": "npm run generate:schema && npm run format:schema", + "format:schema": "prettier --log-level warn --write lib/api/types/api-schema.types.ts", + "generate:schema": "openapi-typescript https://api.artifactsmmo.com/openapi.json -o lib/api/types/api-schema.types.ts" }, "author": "Kirill Gerasimenko ", "license": "MIT",