UNPKG

3.94 kBMarkdownView Raw
1# @compas/lint-config
2
3[![install size lint-config](https://packagephobia.com/badge?p=@compas/lint-config)](https://packagephobia.com/result?p=@compas/lint-config)
4![lint-build-test](https://github.com/compasjs/compas/workflows/lint-build-test/badge.svg)
5[![codecov](https://codecov.io/gh/compasjs/compas/branch/main/graph/badge.svg?token=81D84CV04U)](https://codecov.io/gh/compasjs/compas)
6
7Unified backend tooling
8
9---
10
11## Features
12
13- Minimal project boilerplate
14- Script runner, can watch & reload almost anything
15- Test and benchmark runner
16- Flexible code generators supporting routers, validators, api clients, CRUD
17 queries and more in the future.
18- Opinionated structured logging
19- Common Koa middleware wrapped in a single function
20- Various utilities like loading .env files, executing other processes and a
21 basic string templating system
22
23## Requirements
24
25- Node.js >= 16
26- Yarn 1.x.x
27
28## Why
29
30My work involved doing many small projects. I had a hard time back porting
31incremental fixes to existing projects. To facilitate my needs more and to stop
32copying and pasting things around, this project was born.
33
34## Features breakdown
35
36**@compas/cli**:
37
38- Run user scripts (in watch mode)
39- Run the linter
40- A Compas based boilerplate
41- Test runner
42- Benchmark runner
43- Necessary Docker container management
44- Visualise the known database structure of @compas/code-gen
45
46**@compas/lint-config**:
47
48- All necessary ESLint and Prettier dependencies
49- Default configuration for ESLint and Prettier
50
51**@compas/stdlib**:
52
53- Various lodash inspired utilities (isNil, isPlainObject, ...)
54- Wrappers for child_process execution and spawning
55- A `mainFn` wrapper that reads `.env` and calls the provided function if the
56 file is the process entrypoint
57- Replacements for CommonJS `__dirname` and `__filename`
58- A structured logger
59 - Writing newline delimited JSON in production
60 - Pretty printing for development
61- Various utilities to get insight in the running process
62- A manual event system
63
64**@compas/server**:
65
66- Wrapper around Koa instance creation
67- 404 en error handling
68- Handle CORS
69- Send file helper
70- Session support with safe, browser readable cookies
71
72**@compas/store**:
73
74- Wrapper around the Minio S3 client
75- Wrapper around Postgres connection
76- Utilities for providing temporary databases in a test environment
77- Postgres migrations
78- Postgres and S3 combined for file storage
79- Caching files from S3 in memory or on local disk
80- Postgres powered queue implementation
81 - Supports priority, scheduling, multiple async workers and recurring jobs
82- koa-session compatible SessionStore backed by Postgres
83
84**@compas/code-gen**:
85
86- Code generators for the following:
87 - router, with wildcard and path parameter support
88 - validators, pure JavaScript implementation
89 - sql, CRUD Postgres queries and nested result support
90 - Axios based api client
91 - TypeScript or JSDoc types
92 - react-query hooks
93- An extendable set of types:
94 - boolean, number, string;
95 - object, array, any;
96 - date, uuid;
97 - generic, anyOf, reference;
98- Remote structure loader
99- OpenAPI to Compas structure converter
100
101## Docs and development
102
103See [the website](https://compasjs.com) for the changelog, all available APIs
104and various guides.
105
106For contributing see [contributing.md](https://compasjs.com/contributing.html).
107
108## New features
109
110New features added should fall under the following categories:
111
112- It improves the interface between api and client in some way. An example may
113 be to support websockets in @compas/code-gen
114- It improves the developer experience one way or another while developing an
115 api For example the `compas docker` commands or various utilities provided by
116 @compas/stdlib
117
118Although some parts heavily rely on conventions set by the packages, we
119currently aim not to be a framework. We aim to provide a good developer
120experience, useful abstractions around the basics, and a stable backend <->
121client interface.