Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Most of this code is by @korsvanloon
  • Loading branch information
mvantellingen committed Feb 17, 2024
0 parents commit e25c54a
Show file tree
Hide file tree
Showing 22 changed files with 6,678 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .changeset/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changesets

Hello and welcome! This folder has been automatically generated by `@changesets/cli`, a build tool that works
with multi-package repos, or single-package repos to help you version and publish your code. You can
find the full documentation for it [in our repository](https://github.com/changesets/changesets)

We have a quick list of common questions to get you started engaging with this project in
[our documentation](https://github.com/changesets/changesets/blob/main/docs/common-questions.md)
11 changes: 11 additions & 0 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/config@3.0.0/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
root = true

# Set up tabs as indent style for a11y reasons
# This will be the default for prettier in >=v3
[*]
indent_style = tab
indent_size = 2

# Yaml does not support tabs
[*.{yml,yaml}]
indent_style = space
indent_size = 2
21 changes: 21 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
module.exports = {
extends: ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
plugins: ["unused-imports"],
rules: {
"@typescript-eslint/no-unused-vars": [
"warn",
{
args: "none",
argsIgnorePattern: "^_",
},
],
"unused-imports/no-unused-imports": "error",
"arrow-body-style": ["error", "as-needed"],
"no-console": [
"error",
{
allow: ["warn", "error", "info"],
},
],
},
};
91 changes: 91 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: CI/CD
on: [push]

jobs:
validate:
name: Validate codebase for node ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
node: ["18.x", "20.x"]
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: true

- name: Check formatting
run: pnpm lint

- name: Check typing
run: pnpm tsc

- name: Test
run: pnpm run test:ci

- name: "Report Coverage"
if: always()
uses: davelosert/vitest-coverage-report-action@v2

- name: Build
run: pnpm build

release:
timeout-minutes: 15
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: validate
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install node.js
uses: actions/setup-node@v4
with:
node-version: 18

- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
version: 8
run_install: true

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT

- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Create and publish versions
uses: changesets/action@v1
with:
title: "Release new version"
commit: "update version"
publish: pnpm publish:ci
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
dist/
test-reports/
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
dist/
test-reports/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Lab Digital B.V.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# @labdigital/toolkit

This package contains a set of common utility functions we use for most of our
typescript projects. It is unopinionated, should have almost no dependencies and
is meant to be used in any project.
45 changes: 45 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"name": "@labdigital/toolkit",
"version": "0.0.1",
"description": "A set of utilities for building typescript applications",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"type": "module",
"keywords": [],
"author": "Lab Digital <opensource@labdigital.nl>",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/labd/js-toolkit"
},
"publishConfig": {
"access": "public"
},
"scripts": {
"build": "tsup",
"publish:ci": "pnpm build && pnpm changeset publish",
"test": "vitest run",
"test:ci": "vitest run --coverage",
"tsc": "tsc --noEmit",
"format": "eslint src --fix && pnpm prettier --write .",
"lint": "eslint src && pnpm prettier --check ."
},
"files": [
"dist",
"src"
],
"devDependencies": {
"@changesets/cli": "^2.27.1",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@vitest/coverage-v8": "1.3.0",
"eslint": "^8.56.0",
"eslint-plugin-unused-imports": "^3.1.0",
"prettier": "3.2.5",
"prettier-plugin-organize-imports": "3.2.4",
"prettier-plugin-packagejson": "2.4.11",
"tsup": "^8.0.2",
"typescript": "^5.3.3",
"vitest": "1.3.0"
}
}
Loading

0 comments on commit e25c54a

Please sign in to comment.