Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
4f0710b
feat: add LLM rules
StanislavMayorov Jan 28, 2026
e129cd4
feat: init package
StanislavMayorov Jan 28, 2026
f834419
fix lint
StanislavMayorov Jan 28, 2026
07201cd
feat: update linter to match ts
StanislavMayorov Jan 28, 2026
3d23bb4
feat: add README.md
StanislavMayorov Jan 28, 2026
350994d
feat: add .npmignore
StanislavMayorov Jan 28, 2026
0bbdee8
feat: update AGENTS.md
StanislavMayorov Jan 28, 2026
bf5a67a
feat: move RN source as is
StanislavMayorov Jan 28, 2026
996a052
fix: add import resolver
StanislavMayorov Jan 29, 2026
d6faaf0
feat: add mock/replace import to fix ts errors
StanislavMayorov Jan 29, 2026
8e9bc07
feat: add DI
StanislavMayorov Jan 29, 2026
f195404
feat: add all coders to factory
StanislavMayorov Jan 29, 2026
00ef848
feat: add build:watch
StanislavMayorov Jan 30, 2026
83b2d2a
feat: add export ActivateParamsInput
StanislavMayorov Jan 30, 2026
3e2065a
feat: add Usage in Downstream SDKs to AGENTS.md
StanislavMayorov Jan 30, 2026
a2dcedc
feat: mass re-export all types from types folder
StanislavMayorov Jan 30, 2026
df216e8
refactor ArrayCoder
StanislavMayorov Jan 30, 2026
8dd9249
feat: add tsdown output from env var
StanislavMayorov Feb 2, 2026
4844798
fix ts
StanislavMayorov Feb 2, 2026
115486f
feat: add pre-commit hook with lint-staged
StanislavMayorov Feb 2, 2026
e5a1ebd
refactor: apply prettier
StanislavMayorov Feb 2, 2026
2e67451
feat: add GitHub Actions PR validation workflow
StanislavMayorov Feb 2, 2026
2be943e
fix: add fallback dependency installation in validate job
StanislavMayorov Feb 2, 2026
c334fce
ci: add github publish action. unified npm publish workflow with auto…
StanislavMayorov Feb 2, 2026
996851c
feat: export Converter and ErrorConverter types for RN SDK migration
StanislavMayorov Feb 6, 2026
c608c52
feat: export AdaptyError and AdaptyErrorInput for RN SDK consumption
StanislavMayorov Feb 6, 2026
af5dcbd
refactor: remove platform-specific AddListenerGeneric/AddListenerFn f…
StanislavMayorov Feb 9, 2026
1fe84a6
feat: export components type from api schema
StanislavMayorov Feb 9, 2026
6bdb7b7
feat: move cap logger as is
StanislavMayorov Feb 9, 2026
0d16d2b
refactor: unify logger — export Capacitor-based implementation from @…
StanislavMayorov Feb 9, 2026
e9e7b67
feat(core): add Log.setVersion() and export LogArgs type
StanislavMayorov Feb 10, 2026
2ac8578
chore: remove unused version.ts, clarify adapty-handler.ts purpose
StanislavMayorov Feb 10, 2026
fb236f0
feat: move utils from cap
StanislavMayorov Feb 10, 2026
c139e0c
feat: move utils from RN
StanislavMayorov Feb 10, 2026
3e893bb
fix(core): remove broken VERSION import in logger
StanislavMayorov Feb 10, 2026
4881b47
feat(core): add Log.setVersion() and export LogArgs type
StanislavMayorov Feb 10, 2026
6b80786
feat(core): add Log.setVersion() and export LogArgs type
StanislavMayorov Feb 10, 2026
59e53f5
feat(core): export all utils (generateId, filterUndefined, mapValues,…
StanislavMayorov Feb 10, 2026
80675b3
feat: extract UI event mappings from RN SDK (verbatim copy)
StanislavMayorov Feb 11, 2026
b84006a
refactor: use PaywallEventId constants as mapping keys, add v4 rename…
StanislavMayorov Feb 11, 2026
dafa1e0
feat: export ui/types from core public API
StanislavMayorov Feb 11, 2026
ad2fcbc
chore: remove unused version placeholder export
StanislavMayorov Feb 11, 2026
11e2c53
refactor: parse functions accept CoderFactory parameter instead of di…
StanislavMayorov Feb 11, 2026
d3bf58c
refactor: simplify DefaultPlatformAdapter, remove Platform dependency
StanislavMayorov Feb 12, 2026
4407cae
refactor: remove dead Platform singleton
StanislavMayorov Feb 12, 2026
03c4f19
docs: update AGENTS.md, remove stale platform.ts reference
StanislavMayorov Feb 12, 2026
707fa61
feat: improve typescript
StanislavMayorov Feb 12, 2026
1d86b96
refactor: rename UI folder
StanislavMayorov Feb 13, 2026
8c9f2a0
docs: improve README description, add branding header
StanislavMayorov Feb 13, 2026
b835002
chore: add .claude/settings.local.json to .gitignore
StanislavMayorov Feb 13, 2026
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
8 changes: 8 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Custom build output directory (optional)
# If not set, defaults to './dist'
# Example for building to sibling repo:
# BUILD_OUT_DIR=../AdaptySDK-React-Native-Devtools/pure-rn/node_modules/@adapty/core/dist
# Example for React Native SDK:
# BUILD_OUT_DIR=../AdaptySDK-React-Native/node_modules/@adapty/core/dist

BUILD_OUT_DIR=../AdaptySDK-React-Native/node_modules/@adapty/core/dist
18 changes: 18 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
module.exports = {
root: true,
extends: ['prettier'],
parser: '@typescript-eslint/parser',
plugins: ['@typescript-eslint'],
rules: {
'no-console': 'error',
},

"overrides": [
{
"files": ["scripts/**/*.js"],
"rules": {
"no-console": "off"
}
}
]
};
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# CODEOWNERS file for AdaptySDK-JS-Core
# These owners will be automatically requested for review when someone opens a pull request

# Default owners for everything in the repo
* @StanislavMayorov
72 changes: 72 additions & 0 deletions .github/workflows/pr-auto-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Auto-assign PR Reviewers

on:
pull_request:
types: [opened]
branches:
- master
- dev

permissions:
pull-requests: write
contents: read

jobs:
auto-assign-reviewers:
name: Auto-assign Reviewers
runs-on: ubuntu-slim
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Assign reviewers from CODEOWNERS
uses: actions/github-script@v7
with:
script: |
const fs = require('fs');
const path = '.github/CODEOWNERS';

if (!fs.existsSync(path)) {
console.log('CODEOWNERS file not found, skipping auto-assignment');
return;
}

const content = fs.readFileSync(path, 'utf8');
const lines = content.split('\n').filter(line =>
line.trim() && !line.trim().startsWith('#')
);

const reviewers = new Set();

for (const line of lines) {
const parts = line.trim().split(/\s+/);
if (parts.length > 1) {
for (let i = 1; i < parts.length; i++) {
const owner = parts[i].replace('@', '');
if (!owner.includes('/')) {
reviewers.add(owner);
}
}
}
}

const prAuthor = context.payload.pull_request.user.login;
const finalReviewers = Array.from(reviewers).filter(r => r !== prAuthor);

if (finalReviewers.length === 0) {
console.log('No reviewers found in CODEOWNERS');
return;
}

console.log(`Assigning reviewers: ${finalReviewers.join(', ')}`);

try {
await github.rest.pulls.requestReviewers({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
reviewers: finalReviewers
});
} catch (error) {
console.log(`Failed to assign reviewers: ${error.message}`);
}
99 changes: 99 additions & 0 deletions .github/workflows/pr-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: PR Validation

on:
workflow_call:
pull_request:
branches:
- master
- dev

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

jobs:
setup:
name: Setup Dependencies
runs-on: ubuntu-slim
outputs:
cache-hit: ${{ steps.cache.outputs.cache-hit }}
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache node_modules
id: cache
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-modules-${{ runner.os }}-

- name: Enable Corepack
if: steps.cache.outputs.cache-hit != 'true'
run: |
corepack enable || {
echo "Corepack not available, falling back to npm install"
npm install -g yarn@1.22.19
}

- name: Prepare Yarn
if: steps.cache.outputs.cache-hit != 'true'
run: |
if command -v corepack > /dev/null 2>&1; then
corepack prepare yarn@1.22.19 --activate
fi

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --prefer-offline

validate:
name: Validate Code Quality
runs-on: ubuntu-slim
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Enable Corepack
run: |
corepack enable || {
echo "Corepack not available, falling back to npm install"
npm install -g yarn@1.22.19
}

- name: Prepare Yarn
run: |
if command -v corepack > /dev/null 2>&1; then
corepack prepare yarn@1.22.19 --activate
fi

- name: Restore node_modules cache
id: cache-restore
uses: actions/cache/restore@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-modules-${{ runner.os }}-

- name: Install dependencies (fallback)
if: steps.cache-restore.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --prefer-offline

- name: TypeScript type check
run: yarn tsc

- name: Prettier format check
run: yarn format-check

- name: ESLint check
run: yarn lint

- name: Run tests
run: yarn test

- name: Build verification
run: yarn build
168 changes: 168 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,168 @@
name: Publish to npm

on:
# Trigger on push to dev branch (dev builds)
push:
branches:
- dev
# Trigger on git tags (production releases)
tags:
- 'v*'

# Manual workflow dispatch with options
workflow_dispatch:
inputs:
release-type:
description: 'Release type'
type: choice
required: true
default: 'dev'
options:
- 'dev'
- 'production'
dry-run:
description: 'Perform a dry run (no actual publish)'
type: choice
required: true
default: 'true'
options:
- 'true'
- 'false'

permissions:
id-token: write # Required for npm provenance (OIDC)
contents: read

concurrency:
group: publish-${{ github.ref }}-${{ github.event.inputs.release-type || 'auto' }}
cancel-in-progress: false

jobs:
# Reuse validation workflow
validation:
name: Run Validation
uses: ./.github/workflows/pr-validation.yml

# Publish job - runs after validation
publish:
name: Publish Package
runs-on: ubuntu-slim
needs: validation
environment: publish

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history needed for commit SHA

- name: Enable Corepack
run: |
corepack enable || {
echo "Corepack not available, falling back to npm install"
npm install -g yarn@1.22.19
}

- name: Prepare Yarn
run: |
if command -v corepack > /dev/null 2>&1; then
corepack prepare yarn@1.22.19 --activate
fi

- name: Cache node_modules
id: cache
uses: actions/cache@v4
with:
path: node_modules
key: node-modules-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
node-modules-${{ runner.os }}-

- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --prefer-offline

- name: Determine release type
id: release-type
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/heads/dev ]]; then
echo "type=dev" >> $GITHUB_OUTPUT
echo "📦 Detected: Dev build (push to dev branch)"
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == refs/tags/v* ]]; then
echo "type=production" >> $GITHUB_OUTPUT
echo "🚀 Detected: Production release (git tag)"
elif [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "type=${{ github.event.inputs.release-type }}" >> $GITHUB_OUTPUT
echo "🔧 Detected: Manual workflow (${{ github.event.inputs.release-type }})"
else
echo "❌ Unknown release type"
exit 1
fi

- name: Update version for dev build
if: steps.release-type.outputs.type == 'dev'
run: |
# Get base version from package.json
BASE_VERSION=$(node -p "require('./package.json').version")
echo "Base version: $BASE_VERSION"

# Get full commit SHA (40 characters)
COMMIT_SHA=$(git rev-parse HEAD)
echo "Commit SHA: $COMMIT_SHA"

# Create dev version
DEV_VERSION="${BASE_VERSION}-dev.${COMMIT_SHA}"
echo "Dev version: $DEV_VERSION"

# Update package.json (without git tag)
npm version $DEV_VERSION --no-git-tag-version

# Verify version was updated
UPDATED_VERSION=$(node -p "require('./package.json').version")
echo "Updated version: $UPDATED_VERSION"

- name: Build package
run: yarn build

- name: Verify build outputs
run: |
echo "Checking dist directory..."
ls -la dist/
echo ""
echo "Checking package files that will be published..."
npm pack --dry-run

- name: Publish to npm (dry-run mode)
if: github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run == 'true'
run: |
echo "Running in dry-run mode - no actual publish"
if [[ "${{ steps.release-type.outputs.type }}" == "dev" ]]; then
npm publish --provenance --tag dev --dry-run --ignore-scripts
else
npm publish --provenance --dry-run --ignore-scripts
fi

- name: Publish to npm (dev build)
if: |
steps.release-type.outputs.type == 'dev' &&
github.event.inputs.dry-run != 'true'
run: npm publish --provenance --tag dev --ignore-scripts

- name: Publish to npm (production release)
if: |
steps.release-type.outputs.type == 'production' &&
github.event.inputs.dry-run != 'true'
run: npm publish --provenance --ignore-scripts

- name: Output published version
if: github.event.inputs.dry-run != 'true'
run: |
PACKAGE_VERSION=$(node -p "require('./package.json').version")
echo "✅ Successfully published @adapty/core@${PACKAGE_VERSION}"
echo "Package URL: https://www.npmjs.com/package/@adapty/core/v/${PACKAGE_VERSION}"

if [[ "${{ steps.release-type.outputs.type }}" == "dev" ]]; then
echo "Install with: npm install @adapty/core@dev"
else
echo "Install with: npm install @adapty/core"
fi
Loading