Skip to content

Commit

Permalink
first release
Browse files Browse the repository at this point in the history
  • Loading branch information
devjmetivier committed Dec 27, 2024
1 parent 4c2cef0 commit f205365
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 18 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-boats-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"typekey": major
---

Initial release
20 changes: 6 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Publish to NPM
name: CI

on:
push:
branches:
- master
- "**"

jobs:
build:
Expand All @@ -15,21 +15,13 @@ jobs:
- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 8
version: 9
run_install: false

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Install, build and test
run: |
pnpm install
pnpm build
pnpm test
- name: publish
env:
NODE_AUTH_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
run: |
pnpm run deploy
cache: "pnpm"
- run: pnpm install --frozen-lockfile
- run: pnpm run test && pnpm run build
37 changes: 37 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Publish to NPM
on:
push:
branches:
- master

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v4
name: Install pnpm
with:
version: 9
run_install: false

- name: Use Node.js 20.x
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: "pnpm"

- run: pnpm install --frozen-lockfile

- name: Create PR or Publish
id: changesets
uses: changesets/action@v1
with:
publish: pnpm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
8 changes: 4 additions & 4 deletions test/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createKeyDictionary } from '../src/index';
import { KeyDictionary } from '../src/index';

describe('createKeyDictionary', () => {
const keyDictionary = createKeyDictionary({
const keyDictionary = new KeyDictionary({
alphabet: [
'a',
'b',
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('createKeyDictionary', () => {

describe('createKeyDictionary with maxKeyLength', () => {
test.each([8, 16, 32, 64, 128, 256])('should truncate the key if it exceeds the maxKeyLength: %s', (maxKeyLength) => {
const keyDictionary = createKeyDictionary({ string: ['value'] as const }, { maxKeyLength });
const keyDictionary = new KeyDictionary({ string: ['value'] as const }, { maxKeyLength });

const value = Array.from({ length: maxKeyLength }, (_, i) => i + 1).join('');

Expand All @@ -110,7 +110,7 @@ describe('createKeyDictionary with throwOnMaxLengthViolation', () => {
test.each([8, 16, 32, 64, 128, 256])(
'should throw an error if the key exceeds the maxKeyLength: %s',
(maxKeyLength) => {
const keyDictionary = createKeyDictionary(
const keyDictionary = new KeyDictionary(
{ string: ['value'] as const },
{
maxKeyLength,
Expand Down

0 comments on commit f205365

Please sign in to comment.