Skip to content
Merged
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
81 changes: 81 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# GitHub Actions

This directory contains GitHub Actions workflows for building and publishing the CCXT library.

## Workflows

### Build and Test (`build.yml`)
- Runs on pull requests and pushes to main/master branches
- Builds the project using TypeScript, Webpack, and Rollup
- Verifies that all build artifacts are created successfully
- Does not publish to NPM

### Build and Publish (`publish.yml`)
- Runs when a new version tag is pushed (e.g., `v0.0.4`)
- Verifies that the tag version matches the package.json version
- Builds the project and all bundles
- Publishes the package to NPM

## Setup

### NPM Token Setup

To enable automatic publishing to NPM, you need to set up an NPM authentication token:

1. **Create an NPM Access Token:**
- Go to [npmjs.com](https://www.npmjs.com) and log in
- Navigate to your profile settings
- Go to "Access Tokens" section
- Click "Generate New Token"
- Select "Automation" token type
- Copy the generated token

2. **Add the Token to GitHub Secrets:**
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name: `NPM_TOKEN`
- Value: Paste your NPM access token
- Click "Add secret"

### Publishing Process

1. **Prepare for Release:**
- Update the version in `package.json`
- Commit your changes
- Push to the repository

2. **Create and Push Version Tag:**
```bash
git tag v0.0.4
git push origin v0.0.4
```

Or create the tag via GitHub:
- Go to GitHub repository → Releases
- Click "Create a new release"
- Tag version (e.g., `v0.0.4`)
- Write release notes
- Click "Publish release"

3. **Automatic Publishing:**
- The `publish.yml` workflow will automatically trigger when the tag is pushed
- It will verify the version matches package.json
- Build the project and publish to NPM
- Check the Actions tab to monitor the process

## Build Process

The build process includes:

1. **TypeScript Compilation:** `npm run build`
2. **Browser Bundle:** Webpack creates `dist/ccxt.browser.js`
3. **CommonJS Bundle:** Rollup creates `dist/cjs/` directory
4. **Minified Bundle:** Production webpack build

## Troubleshooting

- **Build Failures:** Check the Actions tab for detailed error logs
- **NPM Publishing Issues:** Verify the NPM_TOKEN secret is correctly set
- **Version Conflicts:** The workflow will automatically fail if the tag version doesn't match package.json version
- **Tag Format:** Ensure tags follow the format `v*` (e.g., `v0.0.4`, `v1.2.3`)
40 changes: 40 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Build and Test

on:
pull_request:
branches: [ main, master ]
push:
branches: [ main, master ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install dependencies
run: npm ci

- name: Build project
run: npm run build

- name: Build browser bundle
run: npx webpack --config webpack.config.js

- name: Build CommonJS bundle
run: npx rollup --config rollup.config.js

- name: Create minified browser bundle
run: npx webpack --config webpack.config.js --mode production

- name: Verify build artifacts
run: |
ls -la dist/
echo "Build completed successfully!"
59 changes: 59 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and Publish to NPM

on:
push:
tags:
- 'v*'

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

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '18'
registry-url: 'https://registry.npmjs.org'

- name: Install dependencies
run: npm ci

- name: Verify version matches tag
run: |
# Extract version from tag (remove 'v' prefix)
TAG_VERSION=${GITHUB_REF#refs/tags/}
TAG_VERSION=${TAG_VERSION#v}

# Get version from package.json
PACKAGE_VERSION=$(node -p "require('./package.json').version")

echo "Tag version: $TAG_VERSION"
echo "Package version: $PACKAGE_VERSION"

if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then
echo "Error: Tag version ($TAG_VERSION) does not match package.json version ($PACKAGE_VERSION)"
exit 1
fi

echo "Version verification passed!"

- name: Build project
run: npm run build

- name: Build browser bundle
run: npx webpack --config webpack.config.js

- name: Build CommonJS bundle
run: npx rollup --config rollup.config.js

- name: Create minified browser bundle
run: npx webpack --config webpack.config.js --mode production

- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ tmp/
coverage
.nyc_output
travis-keys.sh
exchanges.json
ccxt.sublime-workspace
.idea
yarn.lock
Expand Down
184 changes: 184 additions & 0 deletions exchanges.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
{
"ids": [
"alpaca",
"apex",
"ascendex",
"bequant",
"bigone",
"binance",
"binancecoinm",
"binanceus",
"binanceusdm",
"bingx",
"bit2c",
"bitbank",
"bitbns",
"bitfinex",
"bitflyer",
"bitget",
"bithumb",
"bitmart",
"bitmex",
"bitopro",
"bitrue",
"bitso",
"bitstamp",
"bitteam",
"bittrade",
"bitvavo",
"blockchaincom",
"blofin",
"btcalpha",
"btcbox",
"btcmarkets",
"btcturk",
"bybit",
"cex",
"coinbase",
"coinbaseadvanced",
"coinbaseexchange",
"coinbaseinternational",
"coincatch",
"coincheck",
"coinex",
"coinmate",
"coinmetro",
"coinone",
"coinsph",
"coinspot",
"cryptocom",
"cryptomus",
"defx",
"delta",
"deribit",
"derive",
"digifinex",
"ellipx",
"exmo",
"fmfwio",
"gate",
"gateio",
"gemini",
"hashkey",
"hitbtc",
"hollaex",
"htx",
"huobi",
"hyperliquid",
"independentreserve",
"indodax",
"kraken",
"krakenfutures",
"kucoin",
"kucoinfutures",
"latoken",
"lbank",
"luno",
"mercado",
"mexc",
"modetrade",
"myokx",
"ndax",
"novadax",
"oceanex",
"okcoin",
"okx",
"okxus",
"onetrading",
"oxfun",
"p2b",
"paradex",
"paymium",
"phemex",
"poloniex",
"probit",
"timex",
"tokocrypto",
"tradeogre",
"upbit",
"vertex",
"wavesexchange",
"whitebit",
"woo",
"woofipro",
"xt",
"yobit",
"zaif",
"zonda"
],
"ws": [
"alpaca",
"apex",
"ascendex",
"bequant",
"binance",
"binancecoinm",
"binanceus",
"binanceusdm",
"bingx",
"bitfinex",
"bitget",
"bithumb",
"bitmart",
"bitmex",
"bitopro",
"bitrue",
"bitstamp",
"bittrade",
"bitvavo",
"blockchaincom",
"blofin",
"bybit",
"cex",
"coinbase",
"coinbaseadvanced",
"coinbaseexchange",
"coinbaseinternational",
"coincatch",
"coincheck",
"coinex",
"coinone",
"cryptocom",
"defx",
"deribit",
"derive",
"exmo",
"gate",
"gateio",
"gemini",
"hashkey",
"hitbtc",
"hollaex",
"htx",
"huobi",
"hyperliquid",
"independentreserve",
"kraken",
"krakenfutures",
"kucoin",
"kucoinfutures",
"lbank",
"luno",
"mexc",
"modetrade",
"myokx",
"ndax",
"okcoin",
"okx",
"okxus",
"onetrading",
"oxfun",
"p2b",
"paradex",
"phemex",
"poloniex",
"probit",
"tradeogre",
"upbit",
"vertex",
"whitebit",
"woo",
"woofipro",
"xt"
]
}
1 change: 1 addition & 0 deletions js/src/base/Exchange.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ export default class Exchange {
httpsAgent: any;
useVerity: boolean;
verityProverUrl: string;
verityMethods: string[];
minFundingAddressLength: Int;
substituteCommonCurrencyCodes: boolean;
quoteJsonNumbers: boolean;
Expand Down
Loading