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
20 changes: 10 additions & 10 deletions .github/workflows/generate_preview_link.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,18 @@ jobs:
issue_number: ${{github.event.number}}
head_sha: ${{github.event.pull_request.head.sha}}

- name: Checkout SmartCharts
uses: 'deriv-com/SmartCharts/.github/actions/checkout@master'
- name: Checkout smartCharts-champion
uses: 'deriv-com/smartcharts-champion/.github/actions/checkout@master'
with:
repository: ${{github.event.pull_request.user.login}}/SmartCharts
path: SmartCharts
repository: ${{github.event.pull_request.user.login}}/smartcharts-champion
path: smartcharts-champion
ref: ${{github.head_ref}}
alternate_repository: 'deriv-com/SmartCharts'
alternate_repository: 'deriv-com/smartCharts-champion'
alternate_ref: master

- name: Checkout deriv-app
id: deriv_app
uses: 'deriv-com/SmartCharts/.github/actions/checkout@master'
uses: 'deriv-com/smartcharts-champion/.github/actions/checkout@master'
with:
repository: ${{github.event.pull_request.user.login}}/deriv-app
path: deriv-app
Expand All @@ -49,7 +49,7 @@ jobs:

- name: Custom flutter-chart
id: flutter_chart
uses: 'deriv-com/SmartCharts/.github/actions/checkout@master'
uses: 'deriv-com/smartcharts-champion/.github/actions/checkout@master'
with:
repository: ${{github.event.pull_request.user.login}}/flutter-chart
path: flutter-chart
Expand Down Expand Up @@ -87,14 +87,14 @@ jobs:
- name: Setup deriv-app
run: cd deriv-app && npm i -g lerna@^5.5.1 && npm run bootstrap

- name: Remove @deriv-charts in deriv-app
run: rm -rf deriv-app/node_modules/@deriv/deriv-charts/dist
- name: Remove @smartcharts-champion in deriv-app
run: rm -rf deriv-app/node_modules/@deriv-com/smartcharts-champion/dist

- name: Setup SmartCharts
run: cd SmartCharts && npm install

- name: Build SmartCharts
run: cd SmartCharts && npm run build -- --output-path ../deriv-app/node_modules/@deriv/deriv-charts/dist
run: cd SmartCharts && npm run build -- --output-path ../deriv-app/node_modules/@deriv-com/smartcharts-champion/dist

- name: Run Tests
run: cd SmartCharts && npm run test
Expand Down
22 changes: 11 additions & 11 deletions .github/workflows/publish_deriv_charts_and_update_deriv_app.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Publish @deriv/deriv-charts and update package in deriv-app
name: Publish @deriv-com/smartcharts-champion and update package in deriv-app
on:
workflow_dispatch:

Expand All @@ -9,15 +9,15 @@ jobs:
contents: write
steps:
- name: Checkout SmartCharts
uses: 'deriv-com/SmartCharts/.github/actions/checkout@master'
uses: 'deriv-com/smartcharts-champion/.github/actions/checkout@master'
with:
repository: 'deriv-com/SmartCharts'
repository: 'deriv-com/smartcharts-champion'
path: SmartCharts
ref: master

- name: Custom flutter-chart
id: flutter_chart
uses: 'deriv-com/SmartCharts/.github/actions/checkout@master'
uses: 'deriv-com/smartcharts-champion/.github/actions/checkout@master'
with:
repository: 'regentmarkets/flutter-chart'
path: flutter-chart
Expand Down Expand Up @@ -70,7 +70,7 @@ jobs:
needs: [build_and_publish_deriv_charts]
steps:
- name: Checkout deriv-app
uses: 'deriv-com/SmartCharts/.github/actions/checkout@master'
uses: 'deriv-com/smartcharts-champion/.github/actions/checkout@master'
with:
repository: 'deriv-com/deriv-app'
path: deriv-app
Expand All @@ -87,26 +87,26 @@ jobs:
- name: Get the new chart version
id: check_new_version
run: |
new_version=$(npm show @deriv/deriv-charts version)
new_version=$(npm show @deriv-com/smartcharts-champion version)
echo "new_version=$new_version" >> $GITHUB_OUTPUT

- name: Update core package.json
run: |
cd deriv-app/packages/core
tmp=$(mktemp)
jq --indent 4 ".dependencies[\"@deriv/deriv-charts\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json
jq --indent 4 ".dependencies[\"@deriv-com/smartcharts-champion\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json

- name: Update trader package.json
run: |
cd deriv-app/packages/trader
tmp=$(mktemp)
jq --indent 4 ".dependencies[\"@deriv/deriv-charts\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json
jq --indent 4 ".dependencies[\"@deriv-com/smartcharts-champion\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json

- name: Update bot-web-ui package.json
run: |
cd deriv-app/packages/bot-web-ui
tmp=$(mktemp)
jq --indent 4 ".dependencies[\"@deriv/deriv-charts\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json
jq --indent 4 ".dependencies[\"@deriv-com/smartcharts-champion\"] = \"^${{ steps.check_new_version.outputs.new_version }}\"" package.json > "$tmp" && mv "$tmp" package.json

- name: Update root package-lock.json
run: |
Expand All @@ -120,9 +120,9 @@ jobs:
uses: peter-evans/create-pull-request@76c6f5c20e2111bfee3cd30fae52a25e410f5efc
with:
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}
commit-message: 'chore: update @deriv/deriv-charts to ${{ steps.check_new_version.outputs.new_version }}'
commit-message: 'chore: update @deriv-com/smartcharts-champion to ${{ steps.check_new_version.outputs.new_version }}'
title: 'Update deriv-charts to ${{ steps.check_new_version.outputs.new_version }}'
body: 'This PR updates @deriv/deriv-charts to ${{ steps.check_new_version.outputs.new_version }}'
body: 'This PR updates @deriv-com/smartcharts-champion to ${{ steps.check_new_version.outputs.new_version }}'
branch: 'chore/update-deriv-charts-to-${{ steps.check_new_version.outputs.new_version }}'
base: 'master'
path: 'deriv-app'
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

SmartCharts is both the name of the app ([charts.binary.com](https://charts.binary.com/)) and the charting library.

[![npm](https://img.shields.io/badge/npm->=9-blue)](https://www.npmjs.com/package/@deriv/deriv-charts) ![node](https://img.shields.io/badge/node-%3E%3D18-blue.svg)
[![npm](https://img.shields.io/badge/npm->=9-blue)](https://www.npmjs.com/package/@deriv-com/smartcharts-champion) ![node](https://img.shields.io/badge/node-%3E%3D18-blue.svg)

## In this document:

Expand Down Expand Up @@ -33,7 +33,7 @@ Before running or contribute to this project, you need to have the setup of the
2. **Clone using SSH**

```sh
git clone git@github.com:deriv-com/SmartCharts.git
git clone git@github.com:deriv-com/smartcharts-champion.git
```

3. **Enter project directory**
Expand Down Expand Up @@ -75,26 +75,26 @@ You can install the library using one of the following commands:
Using npm:

```bash
$ npm install @deriv/deriv-chart
$ npm install @deriv-com/smartcharts-champion
```

Using yarn:

```bash
$ yarn add @deriv/deriv-chart
$ yarn add @deriv-com/smartcharts-champion
```

**Important Note:** the license for the library is tied to the `binary.com` domain name; it will not work in github pages.

You can add the library to your project using the following commands:

yarn add @deriv/deriv-chart # Release
yarn add @deriv/deriv-chart@beta # Beta
yarn add @deriv-com/smartcharts-champion # Release
yarn add @deriv-com/smartcharts-champion@beta # Beta

You can refer to library usage inside `app/index.jsx`:

```jsx
import { SmartChart } from '@deriv/deriv-chart';
import { SmartChart } from '@deriv-com/smart-charts';

class App extends React.Component {
render() {
Expand All @@ -120,7 +120,7 @@ Some important notes on your webpack.config.js (refer to `app/webpack.config.js`
- smartcharts consist of a few chunks (which has filenames `*.smartcharts.*`), which it downloads asynchronously during runtime. Therefore, it needs to know where the library user places its chunks via the `setSmartChartsPublicPath` function:

```js
import { setSmartChartsPublicPath } from "@deriv/deriv-chart";
import { setSmartChartsPublicPath } from "@deriv-com/smartcharts-champion";

// SmartCharts chunk are deployed to https://mysite.com/dist/*
setSmartChartsPublicPath("/dist/");
Expand All @@ -130,8 +130,8 @@ We can use the `copy-webpack-plugin` webpack plugin to copy over SmartCharts chu

```js
new CopyWebpackPlugin([
{ from: "./node_modules/@deriv/deriv-chart/dist/*.smartcharts.*" },
{ from: "./node_modules/@deriv/deriv-chart/dist/smartcharts.css" },
{ from: "./node_modules/@deriv-com/smartcharts-champion/dist/*.smartcharts.*" },
{ from: "./node_modules/@deriv-com/smartcharts-champion/dist/smartcharts.css" },
]);
```
### API
Expand Down Expand Up @@ -255,7 +255,7 @@ Attributes marked with `*` are **mandatory**:
Use `FastMarker` to render given components inside the chart.
Markers provide a way for developers to place DOM elements that are positioned based on date, values or tick location inside the chart. Also, please note that this `FastMarker` implementation does not factor the width and height of the marker: this is expensive to calculate, so we expect you to offset this in CSS.
`FastMarker` will keep the marker position on the chart.
It can be imported from `@deriv/deriv-chart` package either as `FastMarker`, or simply as `Marker`.
It can be imported from `@deriv-com/smartcharts-champion` package either as `FastMarker`, or simply as `Marker`.

```jsx
<SmartChart>
Expand Down Expand Up @@ -509,7 +509,7 @@ We organise the development in Trello. Here is the standard workflow of how a fe

Some issues only show up for library users, so it is helpful to test the NPM package before deploying it to library users. You can do this by building the library directly into the node_modules directory of an app that uses the SmartCharts library. For example to test the library build on binary-static you can execute:

npm run watch '../binary-static/node_modules/@deriv/deriv-chart/dist'
npm run watch '../binary-static/node_modules/@deriv-com/smartcharts-champion/dist'

Now each time you make any change, it will overwrite the SmartCharts library inside the `node_modules` folder.

Expand Down Expand Up @@ -548,7 +548,7 @@ This has much less freedom compared to [inline SVG](https://github.com/MoOx/reac

SmartCharts uses a variation of [Mobdux](https://medium.com/@cameronfletcher92/mobdux-combining-the-good-parts-of-mobx-and-redux-61bac90ee448) to assist with state management using Mobx.

Each component consists of 2 parts: a **template** (`*.jsx` file), and a **store** (`*Store.js` file). There are 3 scenarios in which the [`connect`](https://github.com/deriv-com/SmartCharts/blob/dev/src/store/Connect.js) method is used:
Each component consists of 2 parts: a **template** (`*.jsx` file), and a **store** (`*Store.js` file). There are 3 scenarios in which the [`connect`](https://github.com/deriv-com/smartcharts-champion/blob/dev/src/store/Connect.js) method is used:

##### 1. Main Components: The component is tied directly to the main store.

Expand Down
11 changes: 6 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
{
"name": "@deriv/deriv-charts",
"name": "@deriv-com/smartcharts-champion",
"version": "0.0.0-semantic",
"main": "dist/smartcharts.js",
"author": "amin@binary.com",
"author": "henry@deriv.com",
"config": {
"commitizen": {
"path": "@commitlint/cz-commitlint"
}
},
"contributors": [
"Lee Zhen Yong <bruce@binary.com>",
"Mahboobeh Mohammadi <mahboobeh@binary.com>",
"Shayan Yazdanpanah <shayan@binary.com>"
"Henry Hein <henry@deriv.com>",
"Matin Shafei <matin@deriv.com>",
"Jim Daniels <jim@deriv.com>"
],
"license": "ISC",
"repository": {
"type": "git",
"url": "git+ssh://git@github.com/deriv-com/SmartCharts.git"
"url": "git+ssh://git@github.com/deriv-com/smartcharts-champion.git"
},
"homepage": "https://github.com/deriv-com/SmartCharts#readme",
"homepage": "https://github.com/deriv-com/smartcharts-champion#readme",
"keywords": [
"charts",
"binary.com"
"deriv.com"
],
"nyc": {
"sourceMap": false,
Expand Down
2 changes: 1 addition & 1 deletion release.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ module.exports = {
{ name: 'beta', prerelease: true },
{ name: 'alpha', prerelease: true },
],
repositoryUrl: 'git@github.com:deriv-com/SmartCharts.git',
repositoryUrl: 'git@github.com:deriv-com/smartcharts-champion.git',
plugins: [
[
'@semantic-release/commit-analyzer',
Expand Down
Loading