Skip to content

Commit

Permalink
refactor: 2.0 ⛵ (#935)
Browse files Browse the repository at this point in the history
  • Loading branch information
ssalbdivad authored Apr 28, 2024
1 parent 4302dd4 commit a1627a7
Show file tree
Hide file tree
Showing 1,132 changed files with 42,337 additions and 53,467 deletions.
30 changes: 15 additions & 15 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,24 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall
community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting
- The use of sexualized language or imagery, and sexual attention or advances of
any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address,
without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities

Expand Down
32 changes: 16 additions & 16 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

ArkType values the time of its users and contributors as much as its maintainers, so our goal is for the process to be as efficient and straightforward as possible. Whether this is your first pull request or you're a seasoned open source contributor, this guide is the perfect place to start. If you have any other questions, please don't hesitate to [create an issue on GitHub](https://github.com/arktypeio/arktype/issues/new) or reach out [on our Discord](https://discord.gg/WSNF3Kc4xh).
ArkType values the time of its users and contributors as much as its maintainers, so our goal is for the process to be as efficient and straightforward as possible. Whether this is your first pull request or you're a seasoned open source contributor, this guide is the perfect place to start. If you have any other questions, please don't hesitate to [create an issue on GitHub](https://github.com/arktypeio/arktype/issues/new) or reach out [on our Discord](https://arktype.io/discord).

## Sending a Pull Request

Expand Down Expand Up @@ -48,27 +48,27 @@ git checkout -b amazing-feature

6. Do your best to write code that is stylistically consistent with its context. The linter will help with this, but it won't catch everything. Here's a few general guidelines:

- Favor functions over classes
- Favor arrow functions outside of classes
- Favor types over interfaces
- Favor mutation over copying objects in perf-sensitive contexts
- Favor clarity in naming with the following exceptions:
- Ubiquitous variables/types. For example, use `s` over `dynamicParserState` for a variable of type DynamicParserState that is used in the same way across many functions.
- Ephemeral variables whose contents can be trivially inferred from context. For example, prefer `rawKeyDefinitions.map(_ => _.trim())` to `rawKeyDefinitions.map(rawKeyDefinition => rawKeyDefinition.trim())`.
- Favor functions over classes
- Favor arrow functions outside of classes
- Favor types over interfaces
- Favor mutation over copying objects in perf-sensitive contexts
- Favor clarity in naming with the following exceptions:
- Ubiquitous variables/types. For example, use `s` over `dynamicParserState` for a variable of type DynamicParserState that is used in the same way across many functions.
- Ephemeral variables whose contents can be trivially inferred from context. For example, prefer `rawKeyDefinitions.map(_ => _.trim())` to `rawKeyDefinitions.map(rawKeyDefinition => rawKeyDefinition.trim())`.

We also have some unique casing rules for our TypeScript types to making writing isomorphic code easier:

- Use `CapitalCase` for...
- Use `CapitalCase` for...

- Non-generic types (e.g. `SomeData`)
- Generic types with noun names, like `Array<t>`. As a rule of thumb, your generic should be named this way if all its parameters have defaults (unfortunately TS's builtin `Array` type doesn't have a default parameter, but it should have been `unknown`!)
- Non-generic types (e.g. `SomeData`)
- Generic types with noun names, like `Array<t>`. As a rule of thumb, your generic should be named this way if all its parameters have defaults (unfortunately TS's builtin `Array` type doesn't have a default parameter, but it should have been `unknown`!)

- Use `camelCase` for...
- Use `camelCase` for...

- Generic types with verb names like `inferDomain<t>`. Types named this way should always have at least one required parameter.
- Parameter names, e.g. `t` in `Array<t>`
- Generic types with verb names like `inferDomain<t>`. Types named this way should always have at least one required parameter.
- Parameter names, e.g. `t` in `Array<t>`

7. Once you've made the changes you want to and added corresponding unit tests, run the `prChecks` command in the project root and address any problems:
7. Once you've made the changes you want to and added corresponding unit tests, run the `prChecks` command in the project root and address any errors:

```sh
pnpm prChecks
Expand All @@ -77,7 +77,7 @@ pnpm prChecks
You can also run any of these commands individually:

```sh @lineFrom:package.json:scripts/prChecks
"pnpm install && pnpm lint && pnpm checkFormat && pnpm testRepo && pnpm buildRepo"
"pnpm install && pnpm lint && pnpm testRepo && pnpm buildRepo"
```

All of these commands will run as part of our CI process and must succeed in order for us to accept your Pull Request.
Expand Down
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ assignees: "ssalbdivad"

### 🧩 Context

- ArkType version:
- TypeScript version (4.8+):
- Other context you think may be relevant (Node version, OS, etc.):
- ArkType version:
- TypeScript version (4.8, 4.9, or 5.0):
- Other context you think may be relevant (Node version, OS, etc.):

### 🧑‍💻 Repro

Expand All @@ -31,7 +31,7 @@ assignees: "ssalbdivad"
5. Copy the source code you used to repro the bug and paste it into the code block below.
-->

https://stackblitz.com/edit/arktype-repro?devToolsHeight=33&file=demo.ts
https://stackblitz.com/edit/arktype-bug?devToolsHeight=33&file=demo.ts

```ts
import { type, scope } from "arktype"
Expand Down
19 changes: 11 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,21 @@ assignees: ""

# Request a feature

<!--
The maintainers of ArkType will do our best to provide prompt feedback for any feature requests- especially those that are concise and persuasive!
-->

### 🤷 Motivation

What problem are you having?

Why should we prioritize solving it?
<!--
- What problem are you having?
- Why should we prioritize solving it?
-->

### 💡 Solution

How do you think we should solve the problem?

Why do you think this is the best solution?

Did you consider any alternatives?
<!--
- How do you think we should solve the problem?
- Why do you think this is the best solution?
- Did you consider any alternatives?
-->
36 changes: 18 additions & 18 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,26 @@ name: Setup repo
description: Install dependencies and perform setup for https://github.com/arktypeio/arktype

inputs:
node:
default: 18
node:
default: lts/*

runs:
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.3.1
using: composite
steps:
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.3.1

- name: Setup Node (${{ inputs.node }})
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node }}
- name: Setup Node (${{ inputs.node }})
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node }}

- name: Install dependencies
shell: bash
run: pnpm install
- name: Install dependencies
shell: bash
run: pnpm install

- name: Build
shell: bash
run: pnpm buildRepo
- name: Build
shell: bash
run: pnpm build
9 changes: 7 additions & 2 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
titleOnly: true
scopes:
- attest
- arktype.io
- attest
- dark
- fs
- repo
- schema
- type
- utils
114 changes: 61 additions & 53 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,68 @@
name: pr

on:
pull_request:
branches: [main]
pull_request:
branches: [main]

defaults:
run:
shell: bash
run:
shell: bash

jobs:
core:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup repo
uses: ./.github/actions/setup

- name: prChecks
run: pnpm prChecks

compatibility:
needs: core
timeout-minutes: 20
strategy:
matrix:
# https://github.com/arktypeio/arktype/issues/738
node: [16, 18]
os: [windows-latest, macos-latest]
include:
- os: ubuntu-latest
node: 16
fail-fast: false

runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup repo
uses: ./.github/actions/setup
with:
node: ${{ matrix.node }}

- name: Test
run: pnpm testRepo

prChecks:
needs: compatibility
timeout-minutes: 1
runs-on: ubuntu-latest
steps:
- run: echo All checks succeeded! ⛵
core:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup repo
uses: ./.github/actions/setup

- name: prChecks
run: pnpm prChecks

- name: TSC Diagnostics Diff
uses: beerose/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
leave-comment: true

compatibility:
needs: core
timeout-minutes: 20
strategy:
matrix:
node: [lts/*]
os: [windows-latest, macos-latest]
include:
- os: ubuntu-latest
node: lts/-1
# https://github.com/arktypeio/arktype/issues/738
# - os: ubuntu-latest
# node: latest
fail-fast: false

runs-on: ${{ matrix.os }}
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup repo
uses: ./.github/actions/setup
with:
node: ${{ matrix.node }}

# - name: Test
# run: pnpm testRepo

prChecks:
needs: compatibility
timeout-minutes: 1
runs-on: ubuntu-latest
steps:
- run: echo All checks succeeded! ⛵
Loading

0 comments on commit a1627a7

Please sign in to comment.