Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions .github/workflows/publish_to_npm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,16 @@ jobs:
with:
node-version: 24
registry-url: 'https://registry.npmjs.org'
cache: 'npm'
cache-dependency-path: 'package-lock.json'
- name: Update NPM
run: npm install -g npm@latest
- name: Install dependencies
run: npm ci --no-audit
- name: Install pnpm and dependencies
uses: apify/workflows/pnpm-install@main
- name: Build module
run: npm run build
run: pnpm build
- name: Publish to NPM
run: |
git checkout -- .
npx lerna publish --contents dist --yes
npm i --no-audit # reinstall to have updated lock file
npx lerna ls --json | node scripts/sync-root-changelog.ts
pnpm exec lerna publish --contents dist --yes
pnpm install --no-frozen-lockfile # reinstall to have updated lock file
pnpm exec lerna ls --json | node scripts/sync-root-changelog.ts
env:
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
GIT_AUTHOR_NAME: Apify Release Bot
Expand All @@ -53,3 +49,4 @@ jobs:
author_name: Apify Release Bot
author_email: noreply@apify.com
message: 'chore: update root lock file and changelog [skip ci]'
pull: '--rebase --autostash'
53 changes: 16 additions & 37 deletions .github/workflows/test_and_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,37 @@ jobs:
strategy:
fail-fast: false
matrix:
node-version: [ 18, 20, 22 ]
node-version: [ 20, 22, 24 ]

steps:
- uses: actions/checkout@v6
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node-version }}
- name: Cache node_modules
uses: actions/cache@v5
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Update NPM
run: npm install --no-audit -g npm@9
if: matrix.node-version < 18
- name: Install Dependencies
run: npm ci --no-audit
- name: Install pnpm and dependencies
uses: apify/workflows/pnpm-install@main
- name: Run Tests
run: npm test
run: pnpm test

build:
name: Build
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v6
- name: Use Node.js
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
- name: Cache node_modules
uses: actions/cache@v5
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm ci --no-audit
- run: npm run build
- name: Install pnpm and dependencies
uses: apify/workflows/pnpm-install@main
- run: pnpm build

- name: Check build consistency
run: |
git diff --exit-code || {
echo -e "Some files changed after running npm run build! Please build the project locally and commit the changes.";
echo -e "Some files changed after running pnpm build! Please build the project locally and commit the changes.";
exit 1;
}

Expand All @@ -68,18 +55,13 @@ jobs:

steps:
- uses: actions/checkout@v6
- name: Use Node.js
- name: Use Node.js 24
uses: actions/setup-node@v6
with:
node-version: 24
- name: Cache node_modules
uses: actions/cache@v5
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
run: npm ci --no-audit
- run: npm run lint
- name: Install pnpm and dependencies
uses: apify/workflows/pnpm-install@main
- run: pnpm lint

publish:
name: Publish to NPM
Expand All @@ -93,15 +75,12 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Cache node_modules
uses: actions/cache@v5
with:
path: '**/node_modules'
key: ${{ runner.os }}-${{ matrix.node-version }}-modules-${{ hashFiles('**/package-lock.json') }}
- name: Install pnpm and dependencies
uses: apify/workflows/pnpm-install@main
- name: Check for changes
id: changed_packages
run: |
echo "changed_packages=$(npx lerna changed -p | wc -l | xargs)" | tee -a $GITHUB_OUTPUT
echo "changed_packages=$(pnpm exec lerna changed -p | wc -l | xargs)" | tee -a $GITHUB_OUTPUT
- name: Execute publish workflow
if: steps.changed_packages.outputs.changed_packages != '0'
uses: apify/workflows/execute-workflow@main
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ logs
pids
.idea
yarn.lock
.yarn
packages/*/package-lock.json
.npmrc

.npmrc
.vscode
20 changes: 10 additions & 10 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Overview

Internal Apify monorepo of shared TypeScript utilities and constants published as `@apify/*` packages on npm. Managed with Lerna (independent versioning) and npm workspaces.
Internal Apify monorepo of shared TypeScript utilities and constants published as `@apify/*` packages on npm. Managed with Lerna (independent versioning) and pnpm workspaces.

## Commands

```bash
npm install # Install all dependencies
npm run build # Build all packages (lerna run build)
npm test # Run all tests (vitest)
npm run test-cov # Run tests with coverage
npx vitest run test/consts.test.ts # Run a single test file
npx vitest run test/consts.test.ts -t "pattern" # Run specific test by name
npm run lint # Lint all source and test files
npm run lint:fix # Lint with auto-fix
npm run clean # Clean all dist/ folders
pnpm install # Install all dependencies
pnpm build # Build all packages (lerna run build)
pnpm test # Run all tests (vitest)
pnpm test-cov # Run tests with coverage
pnpm exec vitest run test/consts.test.ts # Run a single test file
pnpm exec vitest run test/consts.test.ts -t "pattern" # Run specific test by name
pnpm lint # Lint all source and test files
pnpm lint:fix # Lint with auto-fix
pnpm clean # Clean all dist/ folders
```

## Architecture
Expand Down
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ When contributing to this repository, please first discuss the change you wish t

## Submitting a pull request

- Fork the project and install NPM dependencies. **NPM 7 is needed to have support for workspaces.**
- Fork the project and install dependencies with [pnpm](https://pnpm.io/) (we use pnpm workspaces).

```sh
npm install
pnpm install
```

- Run tests before you start working, to be sure they all pass, and your setup is working correctly:

```sh
npm test
pnpm test
```

- Be sure to **include appropriate test cases**.
- Follow defined coding standard, use `npm run lint` command to check it.
- Follow defined coding standard, use `pnpm lint` command to check it.
- Commit your changes using a descriptive commit message that follows defined
[commit message conventions](#commit-message-guidelines). Adherence to these conventions is necessary because release notes are automatically generated from these messages.
- Push the code to your forked repository and create a pull request on GitHub.
Expand Down Expand Up @@ -52,7 +52,7 @@ empty line to separate subject and body).

## Adding new package

This repository is managed via `lerna` and NPM workspaces. When adding new package, be sure to include all
This repository is managed via `lerna` and pnpm workspaces. When adding new package, be sure to include all
the appropriate config files (`package.json`, `tsconfig.json` and `tsconfig.build.json`). It should be mostly
ok to just copy&paste one of the existing packages, wipe its contents and change the package name. Be sure
to clean up the dependencies as well. Keep all the scripts defined in the `package.json`, especially the `build` one.
Expand Down
1 change: 1 addition & 0 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}
},
"useNx": false,
"npmClient": "pnpm",
"ignoreChanges": [
"**/test/**",
"**/*.md"
Expand Down
Loading
Loading