Skip to content

Commit

Permalink
feat: add initial package boilerplate
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandermendes committed Nov 6, 2024
0 parents commit ea21982
Show file tree
Hide file tree
Showing 20 changed files with 8,274 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
node_modules/
coverage/
dist/
3 changes: 3 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@aurora-is-near/eslint-config"
}
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
registries:
npm-npmjs:
type: npm-registry
url: https://registry.npmjs.org
token: ${{ secrets.NPM_TOKEN }}
updates:
- package-ecosystem: npm
directory: /
schedule:
interval: monthly
allow:
- dependency-type: direct

- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: CI

on:
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/test.yml
secrets: inherit
44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Release

on:
push:
branches:
- main
- canary/*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
uses: ./.github/workflows/test.yml
secrets: inherit

release:
runs-on: ubuntu-latest
needs: test
permissions:
contents: write
issues: write
pull-requests: write
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Setup NPM token
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: Install
run: yarn install --frozen-lockfile --non-interactive
- name: Release
run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GH_SEMANTIC_RELEASE_TOKEN }}
NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22 changes: 22 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on: workflow_call

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version-file: package.json
- name: Setup NPM token
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.GITHUB_TOKEN }}" >> .npmrc
- name: Install
run: yarn install --frozen-lockfile --non-interactive
- name: Lint
run: yarn lint
- name: Check types
run: yarn typecheck
- name: Test
run: yarn test
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Packages
.yalc
yalc.lock
node_modules/

# Build
dist/
*.tsbuildinfo

# Logs
*.log

# OS
.DS_Store

# IDE
.idea/

# Tests
coverage/
.jest/
spec.json

# Vi
*.swp
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@aurora-is-near:registry=https://npm.pkg.github.com
5 changes: 5 additions & 0 deletions .prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
jsxBracketSameLine: true,
singleQuote: true,
trailingComma: 'all',
};
3 changes: 3 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@aurora-is-near/semantic-release-config"
}
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodejs 20.9.0
7 changes: 7 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"dbaeumer.vscode-eslint",
"esbenp.prettier-vscode",
"davidanson.vscode-markdownlint"
]
}
21 changes: 21 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"typescript.preferences.importModuleSpecifier": "relative",
"files.trimFinalNewlines": true,
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"editor.formatOnSave": false,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit",
"source.fixAll.markdownlint": "explicit"
},
"[prisma]": {
"editor.defaultFormatter": "Prisma.prisma",
"editor.formatOnSave": true
},
"editor.rulers": [80],
"eslint.validate": [
"javascript",
"typescript"
],
"typescript.tsdk": "node_modules/typescript/lib",
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Aurora Staking SDK
20 changes: 20 additions & 0 deletions babel.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"presets": [
"@babel/preset-typescript",
[
"@babel/preset-env",
{
"targets": {
"node": "current"
}
}
]
],
"env": {
"test": {
"plugins": [
"@babel/plugin-transform-runtime"
]
}
}
}
4 changes: 4 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: { 'body-max-line-length': [0] },
};
7 changes: 7 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = {
reporters: ['default', 'github-actions'],
clearMocks: true,
preset: 'ts-jest/presets/js-with-babel',
testPathIgnorePatterns: ['/dist/', '/node_modules/'],
modulePathIgnorePatterns: ['/dist/'],
};
43 changes: 43 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"name": "@aurora-is-near/staking",
"version": "1.0.0",
"description": "Contains logic for staking and unstaking Aurora",
"main": "dist/index.js",
"author": "Alex Mendes",
"license": "UNLICENSED",
"scripts": {
"lint": "eslint . --ext .js,.ts",
"test": "jest",
"typecheck": "tsc --noEmit",
"clean": "rimraf dist",
"prebuild": "yarn clean",
"build": "tsc"
},
"engines": {
"node": ">=20.9.0"
},
"husky": {
"hooks": {
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
}
},
"devDependencies": {
"@aurora-is-near/eslint-config": "^1.0.0",
"@aurora-is-near/semantic-release-config": "^1.1.1",
"@babel/core": "^7.17.10",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-typescript": "^7.16.7",
"@commitlint/config-conventional": "^19.2.2",
"@types/jest": "^29.0.0",
"@types/node": "^17.0.31",
"eslint": "^8.57.0",
"husky": "^9.0.11",
"jest": "^29.0.0",
"prettier": "^3.2.5",
"rimraf": "^3.0.2",
"semantic-release": "^24.0.0",
"ts-jest": "^29.1.0",
"typescript": "^5.1.0"
}
}
22 changes: 22 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"include": ["src/*"],
"compilerOptions": {
"baseUrl": ".",
"outDir": "./dist",
"target": "es2020",
"module": "commonjs",
"declaration": true,
"strict": true,
"moduleResolution": "node",
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"declarationMap": true,
"allowJs": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"resolveJsonModule": true,
"strictPropertyInitialization": false,
"noUncheckedIndexedAccess": true
}
}
Loading

0 comments on commit ea21982

Please sign in to comment.