npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, πŸ‘‹, I’m Ryan HefnerΒ  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you πŸ™

Β© 2026 – Pkg Stats / Ryan Hefner

ethers-wallet-ts-package

v0.1.14

Published

πŸš€ TypeScript β†’ npm Package CI/CD (Full Step-by-Step Guide)

Downloads

43

Readme

πŸš€ TypeScript β†’ npm Package CI/CD (Full Step-by-Step Guide)

This guide explains from scratch how to:

Create a TypeScript library project.

Build & test it locally.

Publish it manually to npm.

Automate publishing with GitHub Actions when you push a vX.Y.Z tag.

By the end, you’ll have a professional workflow:

npm version patch β†’ git push --follow-tags β†’ package automatically builds & publishes to npm.

0 β€” Prerequisites

βœ… Node.js v18+ and npm installed (node -v && npm -v) βœ… GitHub account + repository created βœ… npm account (https://www.npmjs.com/ ) βœ… Basic terminal knowledge

1 β€” Project Setup

Create project folder

mkdir ethers-wallet-ts-package && cd ethers-wallet-ts-package

Initialize Git

git init git branch -M main

Initialize npm project

npm init -y

Project structure ethers-wallet-ts-package/ β”œβ”€ src/ β”‚ β”œβ”€ index.ts β”‚ β”œβ”€ wallet.ts β”‚ └─ types.ts β”œβ”€ dist/ # compiled output (ignored in git) β”œβ”€ .github/workflows/ # GitHub Actions workflows β”‚ └─ publish-on-tag.yml β”œβ”€ .gitignore β”œβ”€ package.json β”œβ”€ tsconfig.json └─ README.md

2 β€” Install Dependencies npm install ethers npm install --save-dev typescript

3 β€” Configure TypeScript

Create tsconfig.json:

{ "compilerOptions": { "target": "ES2020", "module": "NodeNext", "moduleResolution": "NodeNext", "outDir": "./dist", "declaration": true, "declarationMap": true, "esModuleInterop": true, "forceConsistentCasingInFileNames": true, "strict": true, "skipLibCheck": true }, "include": ["src"], "exclude": ["node_modules", "dist"] }

4 β€” Source Files src/types.ts import { ethers } from "ethers";

export interface WalletData { address: string; privateKey: string; publicKey: string; wallet: ethers.Wallet; }

src/wallet.ts import { ethers } from "ethers"; import { WalletData } from "./types.js";

/** Create a new random wallet */ export function createWallet(): WalletData { const wallet = ethers.Wallet.createRandom(); return { address: wallet.address, privateKey: wallet.privateKey, publicKey: wallet.publicKey, wallet, }; }

/** Fetch ETH balance */ export async function fetchAccountBalance(address: string, providerUrl: string): Promise { const provider = new ethers.JsonRpcProvider(providerUrl); const balance = await provider.getBalance(address); return ethers.formatEther(balance); }

/** Send ETH transaction */ export async function sendTransaction( privateKey: string, providerUrl: string, to: string, amountEth: string ): Promise<ethers.TransactionResponse> { const provider = new ethers.JsonRpcProvider(providerUrl); const wallet = new ethers.Wallet(privateKey, provider); return wallet.sendTransaction({ to, value: ethers.parseEther(amountEth), }); }

src/index.ts export { createWallet, fetchAccountBalance, sendTransaction } from "./wallet.js"; export type { WalletData } from "./types.js";

5 β€” .gitignore node_modules/ dist/ *.tgz .env .DS_Store

6 β€” package.json

Edit to look like this:

{ "name": "ethers-wallet-ts-package", "version": "0.1.0", "type": "module", "main": "dist/index.js", "types": "dist/index.d.ts", "files": ["dist", "README.md", "LICENSE"], "scripts": { "build": "tsc", "test": "echo "No tests" && exit 0", "prepublishOnly": "npm run build && npm test" }, "dependencies": { "ethers": "^6.15.0" }, "devDependencies": { "typescript": "^5.9.2" }, "publishConfig": { "access": "public" } }

7 β€” Local Build & Check

Install dependencies

npm install

Build project

npm run build

Preview publish contents

npm pack tar -tzf ethers-wallet-ts-package-0.1.0.tgz

Test installing locally:

mkdir /tmp/pkg-test && cd /tmp/pkg-test npm init -y npm i ../ethers-wallet-ts-package/ethers-wallet-ts-package-0.1.0.tgz node -e "import('ethers-wallet-ts-package').then(m => console.log(Object.keys(m)))"

8 β€” Manual Publish (optional) Login & publish npm login npm publish --access public

9 β€” GitHub Actions CI/CD Step 1 β€” Create npm Automation Token

Go to npmjs.com β†’ Profile β†’ Access Tokens.

Generate new Automation token.

Copy it (you won’t see it again).

Step 2 β€” Add token to GitHub

Repo β†’ Settings β†’ Secrets and variables β†’ Actions β†’ New repository secret

Name: NPM_TOKEN

Value: paste token

Step 3 β€” Create workflow file

Create .github/workflows/publish-on-tag.yml:

name: CI/CD for ethers-wallet-ts-package

on: push: tags: - "v*.."

jobs: build-and-publish: runs-on: ubuntu-latest

steps:
  - uses: actions/checkout@v4
    with:
      fetch-depth: 0

  - uses: actions/setup-node@v4
    with:
      node-version: 18
      registry-url: "https://registry.npmjs.org"
      cache: npm

  - run: npm ci
  - run: npm run build
  - run: npm test

  - run: npm publish --access public
    env:
      NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

10 β€” Release & Auto-Publish

Ensure clean working tree

git status

Commit changes

git add . git commit -m "Initial release"

Bump version & create tag

npm version patch # or minor / major

Push with tags

git push origin main --follow-tags

This triggers the GitHub Action. Check GitHub β†’ Actions β†’ workflow run.

11 β€” Verify on npm npm info ethers-wallet-ts-package

12 β€” Daily Release Workflow

Make changes β†’ commit

Run:

npm version patch git push origin main --follow-tags

GitHub Actions builds & publishes automatically πŸŽ‰

13 β€” Troubleshooting

403 Forbidden β†’ Check NPM_TOKEN is Automation type.

Tag not triggering workflow β†’ Must be vX.Y.Z.

Already published version β†’ Run npm version patch again.

Missing dist/ β†’ Ensure "prepublishOnly": "npm run build && npm test" in package.json.

14 β€” Quick Commands Cheat-Sheet

Build & pack

npm ci && npm run build && npm pack

Publish manually

npm publish --access public

Automated release

npm version patch git push origin main --follow-tags

βœ… Done! Now your package auto-publishes on every version tag.