Skip to content

Commit

Permalink
Initial implementation
Browse files Browse the repository at this point in the history
This is extracted from work being done for a new version of
@kineticcafe/app-identity, with tests and infrastructure setup. This is
ready to be used, but the API should be considered in flux as some of
the names that Rust uses do not seem to make sense in a JavaScript or
Typescript context.

In addition to the package itself, there are some project experiments
with this:

- We are using Biome instead of prettier and eslint.
- We are running [publint](https://publint.dev) to make sure we are
  ready for publishing.
- We are using [reviewdog](https://github.com/reviewdog/reviewdog) to
  add comments to the PR from various linting tools (biome, misspell,
  actionlint).
- We are using pkgroll to build the distribution package.

Signed-off-by: Austin Ziegler <[email protected]>
  • Loading branch information
halostatue committed Feb 26, 2024
1 parent b6ca3b8 commit 3832145
Show file tree
Hide file tree
Showing 22 changed files with 3,704 additions and 328 deletions.
11 changes: 11 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: 2
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: monthly

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
10 changes: 10 additions & 0 deletions .github/workflows/dco-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Check DCO

on:
pull_request:

jobs:
check-dco:
runs-on: ubuntu-latest
steps:
- uses: KineticCafe/[email protected]
17 changes: 17 additions & 0 deletions .github/workflows/dependabot-automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Dependabot auto-merge

on:
pull_request:

permissions:
contents: write
pull-requests: write

jobs:
dependabot-automerge:
runs-on: ubuntu-latest

steps:
- uses: KineticCafe/actions/[email protected]
with:
update-type: minor
95 changes: 95 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: TypeScript CI

on:
pull_request:
push:
branches:
- main
workflow_dispatch:

jobs:
typescript-ci:
name: Typescript (Node ${{ matrix.node }}, pnpm ${{ matrix.pnpm }}) - ${{ matrix.os }}

strategy:
fail-fast: true
matrix:
os:
- ubuntu-latest
node:
- 20
pnpm:
- 8 # latest

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: ${{ matrix.pnpm }}
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- run: pnpm test
- run: pnpm lint
- name: pnpm format:check
run: |
pnpm format:check || {
pnpm format
git diff
exit 1
}
- run: pnpm build:all
- run: pnpm exec publint

biome:
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
name: Biome
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm
cache-dependency-path: pnpm-lock.yaml
- run: pnpm install --frozen-lockfile
- uses: mongolyy/reviewdog-action-biome@v1

misspell:
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
name: Misspell
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-misspell@v1
with:
path: |
src
test
*.md
licenses
actionlint:
if: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}
name: Actionlint
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-actionlint@v1
136 changes: 11 additions & 125 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,130 +1,16 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*
*.tgz
*.tsbuildinfo
.node_repl_history
.pnpm-debug.log*
coverage/
coverage/
dist/
docs/
logs/
node_modules/
*-debug.log*
*-error.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Optional stylelint cache
.stylelintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variable files
.env
.env.development.local
.env.test.local
.env.production.local
.env.local

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# vuepress v2.x temp and cache directory
.temp
.cache

# Docusaurus cache and generated files
.docusaurus

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
auto-install-peers=false
8 changes: 8 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# @kineticcafe/result

## 0.5.0 / 2024-02-27

- Initial release. The APIs are heavily based on the Rust interface, but it does
not feel entirely correct for JavaScript / Typescript APIs. Until the final
shape of the APIs have been resolved, this is considered a pre-release
version.
30 changes: 30 additions & 0 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Contributing

We value contributions to @kineticcafe/result—bug reports, feature
requests, and code contributions.

Before contributing patches, please read the [Licence.md](./Licence.md).

App Identity is governed under the Kinetic Commerce Open Source [Code of
Conduct][].

## Code Guidelines

Our usual code contribution guidelines apply:

- Code changes _will not_ be accepted without tests. The test suite is written
with [vitest][].
- Match our coding style. We use Biome to assist with this.
- Use a thoughtfully-named topic branch that contains your change. Rebase your
commits into logical chunks as necessary.
- Use [quality commit messages][].
- The version number must not be changed except as part of the release process.
- Submit a pull request with your changes.
- New or changed behaviours require new or updated documentation.

There are code quality checks performed in GitHub Actions that must pass for any
pull request to be accepted.

[code of conduct]: https://github.com/KineticCafe/code-of-conduct
[quality commit messages]: http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html
[vitest]: https://vitest.dev/
Loading

0 comments on commit 3832145

Please sign in to comment.