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

@compas/stdlib

Package Overview
Dependencies
Maintainers
1
Versions
196
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@compas/stdlib - npm Package Compare versions

Comparing version 0.0.206 to 0.0.207

2

package.json
{
"name": "@compas/stdlib",
"version": "0.0.206",
"version": "0.0.207",
"description": "All kinds of utility functions",

@@ -5,0 +5,0 @@ "main": "./index.js",

# @compas/stdlib
[![install size stdlib](https://packagephobia.com/badge?p=@compas/stdlib)](https://packagephobia.com/result?p=@compas/stdlib)
[![install size @compas/stdlib](https://packagephobia.com/badge?p=@compas/stdlib)](https://packagephobia.com/result?p=@compas/stdlib)
![lint-build-test](https://github.com/compasjs/compas/workflows/lint-build-test/badge.svg)

@@ -11,13 +11,13 @@ [![codecov](https://codecov.io/gh/compasjs/compas/branch/main/graph/badge.svg?token=81D84CV04U)](https://codecov.io/gh/compasjs/compas)

All common components for creating backends, tooling and more in opinionated
packages; from describing the api structure to testing the end result.
## Features
- Minimal project boilerplate
- Script runner, can watch & reload almost anything
- Test and benchmark runner
- Flexible code generators supporting routers, validators, api clients, CRUD
queries and more in the future.
- Opinionated structured logging
- Common Koa middleware wrapped in a single function
- Various utilities like loading .env files, executing other processes and a
basic string templating system
- Code generators for routers, validators, SQL queries, API clients and more
- Logging, body parser and error handling out of the box
- Persistence layer with Postgres for files, jobs and sessions
- An extendable CLI that comes with a test runner and is able to run your
database migrations.
- Structured logging all throughout, giving you insight in the running system.

@@ -31,83 +31,7 @@ ## Requirements

My work involved doing many small projects. I had a hard time back porting
incremental fixes to existing projects. To facilitate my needs more and to stop
copying and pasting things around, this project was born.
I had a time when I was mostly creating small backends and tools back to back.
Always trying to improve them by choosing packages that align better with my
views, new features or more opinionated defaults. To capture this flow and
making those backends and tools easier to maintain, Compas was created.
## Features breakdown
**@compas/cli**:
- Run user scripts (in watch mode)
- Run the linter
- A Compas based boilerplate
- Test runner
- Benchmark runner
- Necessary Docker container management
- Visualise the known database structure of @compas/code-gen
**@compas/eslint-plugin**:
- All necessary ESLint and Prettier dependencies
- Default configuration for ESLint and Prettier
- Handy rules for things like the event system from @compas/stdlib
**@compas/stdlib**:
- Various lodash inspired utilities (isNil, isPlainObject, ...)
- Wrappers for child_process execution and spawning
- A `mainFn` wrapper that reads `.env` and calls the provided function if the
file is the process entrypoint
- Replacements for CommonJS `__dirname` and `__filename`
- A structured logger
- Writing newline delimited JSON in production
- Pretty printing for development
- Various utilities to get insight in the running process
- A manual event system
**@compas/server**:
- Wrapper around Koa instance creation
- 404 en error handling
- Handle CORS
- Send file helper
**@compas/store**:
- Wrapper around the Minio S3 client
- Wrapper around Postgres connection
- Session support via JSON Web tokens
- Utilities for providing temporary databases in a test environment
- Postgres migrations
- Postgres and S3 combined for file storage
- Caching files from S3 in memory or on local disk
- Postgres powered queue implementation
- Supports priority, scheduling, multiple async workers and recurring jobs
- koa-session compatible SessionStore backed by Postgres
**@compas/code-gen**:
- Code generators for the following:
- router, with wildcard and path parameter support
- validators, pure JavaScript implementation
- sql, CRUD Postgres queries and nested result support
- Axios based api client
- TypeScript or JSDoc types
- react-query hooks
- An extendable set of types:
- boolean, number, string;
- object, array, any;
- date, uuid;
- generic, anyOf, reference;
- Remote structure loader
- OpenAPI to Compas structure converter
## Docs and development
See [the website](https://compasjs.com) for the changelog, all available APIs
and various guides.
For contributing see [contributing.md](https://compasjs.com/contributing.html).
## New features
New features added should fall under the following categories:

@@ -125,1 +49,9 @@

client interface.
## Docs and development
See [the website](https://compasjs.com) for the
[changelog](https://compasjs.com/changelog.html), all available APIs and various
guides.
For contributing see [contributing.md](https://compasjs.com/contributing.html).
import { pino } from "pino";
import { environment, isProduction } from "../env.js";
import { AppError } from "../error.js";
import { merge } from "../lodash.js";
import { noop } from "../utils.js";

@@ -115,3 +114,6 @@ import { writeGithubActions, writePretty } from "./writer.js";

const context = merge({}, globalContext, options?.ctx ?? {});
const context = {
...globalContext,
...(options?.ctx ?? {}),
};

@@ -118,0 +120,0 @@ if (printer === "ndjson") {

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