Skip to content

Commit

Permalink
Add typescript library (#12)
Browse files Browse the repository at this point in the history
* Add npm package helper

* fix linter

* Add ci job

* bundling

* changeset
  • Loading branch information
grod220 authored Apr 16, 2024
1 parent 22ca536 commit fc2ec74
Show file tree
Hide file tree
Showing 15 changed files with 5,264 additions and 1 deletion.
39 changes: 39 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Publish to Npm

on:
workflow_call:
workflow_dispatch:
push:
branches:
- main

jobs:
publish:
name: Publish to npm
runs-on: ubuntu-latest
defaults:
run:
working-directory: npm

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build

# If there are changesets, this action will create a PR on the repo to version packages
# If there are none, it will publish newer-versioned public packages to npm
- name: Create Release Pull Request or Publish to npm
id: changesets
uses: changesets/action@v1
with:
publish: pnpm changeset:publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
name: Rust CI

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

jobs:
check_fmt:
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/typescript-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Typescript CI

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

jobs:
lint:
name: Lint and check formatting
runs-on: ubuntu-latest
defaults:
run:
working-directory: npm

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Run eslint
run: pnpm lint

- name: Check formatting
run: pnpm format-check

build:
name: Build
runs-on: ubuntu-latest
defaults:
run:
working-directory: npm

steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v3
with:
version: 8

- name: Install dependencies
run: pnpm install

- name: Build
run: pnpm build
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
/tools/compiler/target
.DS_Store
/.idea
node_modules
**/dist
8 changes: 8 additions & 0 deletions npm/.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 npm/.changeset/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
"changelog": "@changesets/cli/changelog",
"commit": false,
"fixed": [],
"linked": [],
"access": "restricted",
"baseBranch": "main",
"updateInternalDependencies": "patch",
"ignore": []
}
7 changes: 7 additions & 0 deletions npm/.prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"jsxSingleQuote": true,
"printWidth": 100,
"trailingComma": "all",
"arrowParens": "avoid"
}
7 changes: 7 additions & 0 deletions npm/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# @penumbra-labs/registry

## 1.0.0

### Major Changes

- Initial publish
24 changes: 24 additions & 0 deletions npm/eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import eslint from '@eslint/js';
import tseslint from 'typescript-eslint';

export default tseslint.config(
eslint.configs.recommended,
...tseslint.configs.strictTypeChecked,
...tseslint.configs.stylisticTypeChecked,
{
languageOptions: {
parserOptions: {
project: true,
tsconfigDirName: import.meta.dirname,
},
},
},
{
rules: {
'@typescript-eslint/no-non-null-assertion': 'off',
},
},
{
ignores: ['dist', 'eslint.config.mjs'],
},
);
31 changes: 31 additions & 0 deletions npm/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"name": "@penumbra-labs/registry",
"version": "1.0.0",
"description": "Chain and asset registry for Penumbra",
"main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts",
"scripts": {
"format": "prettier . --write",
"format-check": "prettier --check .",
"lint": "eslint . --max-warnings=0",
"build": "tsup src/index.ts --format cjs,esm --dts",
"changeset": "changeset",
"changeset:publish": "changeset publish"
},
"devDependencies": {
"@buf/penumbra-zone_penumbra.bufbuild_es": "1.8.0-20240415223544-c0a709144747.2",
"@eslint/eslintrc": "^3.0.2",
"@changesets/cli": "^2.27.1",
"@eslint/js": "^9.0.0",
"eslint": "^9.0.0",
"prettier": "^3.2.5",
"tsup": "^8.0.2",
"typescript": "^5.4.5",
"typescript-eslint": "^7.7.0"
},
"files": [
"dist",
"CHANGELOG.md"
]
}
Loading

0 comments on commit fc2ec74

Please sign in to comment.