Skip to content

Commit

Permalink
Merge branch 'prepare-master-release'
Browse files Browse the repository at this point in the history
  • Loading branch information
bitgopatmcl committed Sep 1, 2022
2 parents d4e0640 + cae737e commit 77773d3
Show file tree
Hide file tree
Showing 98 changed files with 6,156 additions and 5,993 deletions.
1 change: 1 addition & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
use flake
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @BitGo/internal-tools
* @BitGo/velocity
7 changes: 5 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ updates:
labels:
- dependencies
- github-actions
target-branch: beta
target-branch: master

# Enable npm updates
- package-ecosystem: npm
Expand All @@ -24,4 +24,7 @@ updates:
labels:
- dependencies
- npm
target-branch: beta
target-branch: master
ignore:
- dependency-name: io-ts
versions: ['2.x']
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:

strategy:
matrix:
node-version: ['12', '14', 'lts/*']
node-version: [lts/-2, lts/-1, lts/*]

name: Node.js ${{ matrix.node-version }}
steps:
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
name: Format

on:
pull_request:

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Configure Node.js
uses: actions/setup-node@v3
with:
cache: npm
node-version: lts/*

- name: Install dependencies
run: npm ci

- name: Check code formatting
run: npm run format
8 changes: 7 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
jobs:
release:
name: Release
if: github.repository_owner == 'BitGo'
runs-on: ubuntu-latest

steps:
Expand All @@ -20,7 +21,7 @@ jobs:
uses: actions/setup-node@v3
with:
cache: npm
node-version: 'lts/*'
node-version: lts/*

- name: Install dependencies
run: npm ci
Expand All @@ -33,6 +34,11 @@ jobs:
- name: Test
run: npm test

# DISCUSS: Use `jq` or just a small node script to create/modify `.npmrc` in case
# one gets added in the future
- name: Prepare Release
run: mv .npmrc-release .npmrc

- name: Release
run: npx multi-semantic-release
env:
Expand Down
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.direnv/
.drone.yml
.nyc_output/
.turbo/
coverage/
dist/
node_modules/
coverage/
.turbo/
1 change: 1 addition & 0 deletions .npmrc-release
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
workspaces-update = false
1 change: 0 additions & 1 deletion .nvmrc

This file was deleted.

2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.nyc_output/
coverage/
dist/
package-lock.json
8 changes: 7 additions & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/commit-analyzer",
{
"preset": "angular",
"releaseRules": [{ "type": "docs", "release": "patch" }]
}
],
"@semantic-release/release-notes-generator",
"@semrel-extra/npm",
[
Expand Down
32 changes: 19 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
# API-TS

**Disclaimer: This project is currently in an alpha state. Documentation is actively
being worked on.**
![Build Status](https://github.com/BitGo/api-ts/actions/workflows/ci.yml/badge.svg?branch=master)

**Disclaimer: This project is currently in beta state. Documentation is actively being
worked on.**

A collection of packages for defining and using type-checked apis with TypeScript.

TypeScript is a very powerful type system layered on top of JavaScript, but lacks type
information available at runtime. This is not likely to change because it is
[an explicit non-goal](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals#non-goals)
of TypeScript. [io-ts](https://github.com/gcanti/io-ts) fills in this functionality gap.
[io-ts-http](packages/io-ts-http/README.md) builds on top of `io-ts` to make it possible
to define codecs that translate between HTTP requests and plain JS objects.
Additionally, it provides a way to group these codecs into route definitions, and then
collect the route definitions into an api. The resulting api definitions may then be
used on the [client](packages/superagent-wrapper/README.md) and
[server](packages/express-wrapper/README.md) to have type-checked and runtime-validated
HTTP calls in a standardized manner.
TypeScript is a powerful type system layered on top of JavaScript, but lacks type
information about values received at runtime. This is [an explicit non-goal] of the
TypeScript language, so we use [io-ts] to statically type this runtime data.
[io-ts-http] builds on top of io-ts to define codecs that translate between HTTP
requests and plain old JavaScript objects. Additionally, it provides a way to group
these codecs into route definitions, and then collect the route definitions into an api.
The resulting api definitions may then be used on the [client] and [server] to have
type-checked and runtime-validated HTTP calls in a standardized manner.

[an explicit non-goal]:
https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals#non-goals
[io-ts]: https://github.com/gcanti/io-ts
[io-ts-http]: packages/io-ts-http/README.md
[client]: packages/superagent-wrapper/README.md
[server]: packages/express-wrapper/README.md

## Getting started

Expand Down
59 changes: 59 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
description = "api-ts";

inputs = {
nixpkgs.url = "github:nixos/nixpkgs";
flake-utils.url = "github:numtide/flake-utils";
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
};

outputs = {
self,
nixpkgs,
flake-utils,
flake-compat,
}: (
flake-utils.lib.eachDefaultSystem (
system: (
let
pkgs = nixpkgs.legacyPackages.${system};
in {
devShell = pkgs.mkShell {
name = "api-ts-shell";

packages = with pkgs; [
nodejs-16_x
];

shellHook = ''
export PATH="$(pwd)/node_modules/.bin:$PATH"
'';
};
}
)
)
);
}
Loading

0 comments on commit 77773d3

Please sign in to comment.