1.0.0 • Published 7 months ago

@coliveravenegas/add-two-number v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@coliveravenegas/add-two-number

A simple TypeScript package that adds two numbers together.

Installation

npm install @coliveravenegas/add-two-number

Usage

import { add } from '@coliveravenegas/add-two-number';

const sum = add(1, 2); // 3

Development

  1. Clone the repository
  2. Install dependencies:
    npm install
  3. Build the project:
    npm run build
  4. Run tests:
    npm test

Testing GitHub Actions Locally with Act

This project includes support for testing GitHub Actions workflows locally using act.

Prerequisites

  1. Install Docker Desktop (or equivalent)
  2. Install act:

    # 1. First, install Docker Desktop (required for act)
    #    Download from: https://www.docker.com/products/docker-desktop/
    
    # 2. Install act:
    # macOS (using Homebrew)
    brew install act
    
    # Windows (using Chocolatey)
    choco install act-cli
    
    # Linux
    curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
    
    # 3. Start Docker Desktop and make sure it's running
    # 4. Add your user to the docker group (Linux only)
    #    sudo usermod -aG docker $USER
    #    newgrp docker

Available Scripts

  • npm run act:test - Run the test workflow locally
  • npm run act:publish - Run the publish workflow locally (requires NPM_TOKEN)

Setting Up Secrets

  1. Create a .act.secrets file in the project root:

    NPM_TOKEN=your-npm-token-here
  2. Make sure .act.secrets is in your .gitignore (it should be already)

Running Tests

# Run the test workflow
npm run act:test

# Run a specific job
act -j test

# Run with more verbose output
act -v

Running Publish Workflow

To test the publish workflow locally:

# Set your NPM token as an environment variable
export NPM_TOKEN=your-npm-token-here

# Run the publish workflow
npm run act:publish

Troubleshooting

  • If you get Docker permission errors, you might need to run with sudo
  • For large repositories, you might need to increase Docker's memory limit
  • Use act -l to list all available workflows
  • If you need to use a different image, try one of these:
    • node:18-bullseye (default in this project)
    • node:18-buster-slim (smaller image)
    • ghcr.io/catthehacker/ubuntu:act-latest (if you have Docker authentication set up)

License

MIT

1.0.0

7 months ago