Skip to content

Commit

Permalink
Merge pull request #269 from tradingview/CL-1194_update_min_library_v…
Browse files Browse the repository at this point in the history
…ersion_in_examples
  • Loading branch information
timocov committed Jan 24, 2022
2 parents ce6966b + f23f440 commit fa7bbb7
Show file tree
Hide file tree
Showing 150 changed files with 54,831 additions and 1,078 deletions.
9 changes: 8 additions & 1 deletion android/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
# TradingView Charting Library Android Integration Example

The earliest supported version of the charting library for these examples is `v20`.

## How to start

1. Copy all files from https://github.com/tradingview/charting_library/ to `app/src/main/assets/charting_library/`. The earliest supported version of the Charting Library is 17. If you get 404 then you need to [request an access to this repository](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
1. Check that you can view https://github.com/tradingview/charting_library/. If you do not have access then you can [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
1. Install dependencies `npm install`.
1. Copy the charting library files
1. If you are able to run bash scripts then the `copy_charting_library_files.sh` script can be used to copy the current stable version's files.
1. If you are not able to run bash scripts then do the following:
1. Copy all files from https://github.com/tradingview/charting_library/ to `app/src/main/assets/charting_library/`.

## What is Charting Library

Expand Down
26 changes: 26 additions & 0 deletions android/copy_charting_library_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

remove_if_directory_exists() {
if [ -d "$1" ]; then rm -Rf "$1"; fi
}

case "$1" in
"unstable")
BRANCH="unstable";;
*)
BRANCH="master";;
esac

REPOSITORY='https://github.com/tradingview/charting_library/'

LATEST_HASH=$(git ls-remote $REPOSITORY $BRANCH | grep -Eo '^[[:alnum:]]+')

remove_if_directory_exists "$LATEST_HASH"

git clone -q --depth 1 -b "$BRANCH" $REPOSITORY "$LATEST_HASH"

remove_if_directory_exists "app/src/main/assets/charting_library/charting_library"

cp -r "$LATEST_HASH/charting_library" "app/src/main/assets/charting_library/charting_library"

remove_if_directory_exists "$LATEST_HASH"
40 changes: 40 additions & 0 deletions angular/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
# For additional information regarding the format and rule options, please see:
# https://github.com/browserslist/browserslist#queries

# For the full list of supported browsers by the Angular framework, please see:
# https://angular.io/guide/browser-support

# You can see what browsers were selected by your queries by running:
# npx browserslist

# All browsers with significant market share
> 1% in US
> 1% in RU

# Desktop
last 3 Chrome versions
last 3 Edge versions
last 3 Firefox versions
last 3 Safari versions
last 3 Opera versions

# Mobile
last 3 iOS versions
last 3 ChromeAndroid versions
last 3 Android versions
last 3 FirefoxAndroid versions

# Restrict min supported versions
not Android < 66
not Chrome < 66
not ChromeAndroid < 66
not Safari < 13
not iOS < 13

# Long dead browsers
not Explorer <= 11
not ExplorerMobile <= 11
not OperaMini all # Opera mini has very limited JS support, no canvas and no websockets
not OperaMobile <= 12.1 # Opera mobile Presto

5 changes: 4 additions & 1 deletion angular5/.editorconfig → angular/.editorconfig
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Editor configuration, see http://editorconfig.org
# Editor configuration, see https://editorconfig.org
root = true

[*]
Expand All @@ -8,6 +8,9 @@ indent_size = 2
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
12 changes: 7 additions & 5 deletions angular5/.gitignore → angular/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,19 @@

# compiled output
/dist
/dist-server
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
/node_modules
src/assets/charting_library/
src/assets/datafeeds/

# profiling files
chrome-profiler-events*.json

# IDEs and editors
/.idea
.project
Expand All @@ -26,8 +30,10 @@ src/assets/datafeeds/
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.angular/cache
/.sass-cache
/connect.lock
/coverage
Expand All @@ -37,10 +43,6 @@ yarn-error.log
testem.log
/typings

# e2e
/e2e/*.js
/e2e/*.map

# System Files
.DS_Store
Thumbs.db
4 changes: 4 additions & 0 deletions angular/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=827846
"recommendations": ["angular.ng-template"]
}
20 changes: 20 additions & 0 deletions angular/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "ng serve",
"type": "pwa-chrome",
"request": "launch",
"preLaunchTask": "npm: start",
"url": "http://localhost:4200/"
},
{
"name": "ng test",
"type": "chrome",
"request": "launch",
"preLaunchTask": "npm: test",
"url": "http://localhost:9876/debug.html"
}
]
}
42 changes: 42 additions & 0 deletions angular/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
// For more information, visit: https://go.microsoft.com/fwlink/?LinkId=733558
"version": "2.0.0",
"tasks": [
{
"type": "npm",
"script": "start",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
},
{
"type": "npm",
"script": "test",
"isBackground": true,
"problemMatcher": {
"owner": "typescript",
"pattern": "$tsc",
"background": {
"activeOnStart": true,
"beginsPattern": {
"regexp": "(.*?)"
},
"endsPattern": {
"regexp": "bundle generation complete"
}
}
}
}
]
}
14 changes: 10 additions & 4 deletions angular5/README.md → angular/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# TradingView Charting Library and Angular 5 Integration Example

The earliest supported version of the charting library for these examples is `v20`.

## How to start

1. Install dependencies `npm install`.
1. Copy `charting_library` folder from https://github.com/tradingview/charting_library/ to `/src/assets`. The earliest supported version of the Charting Library is 17. If you get 404 then you need to [request an access to this repository](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
1. Copy `datafeeds` folder from https://github.com/tradingview/charting_library/ to `/src/assets`.
1. Check that you can view https://github.com/tradingview/charting_library/. If you do not have access then you can [request access to this repository here](https://www.tradingview.com/HTML5-stock-forex-bitcoin-charting-library/).
1. Install dependencies with `npm install`.
1. Copy the charting library files
1. If you are able to run bash scripts then the `copy_charting_library_files.sh` script can be used to copy the current stable version's files.
1. If you are not able to run bash scripts then do the following:
1. Copy `charting_library` folder from https://github.com/tradingview/charting_library/ to `/src/assets`.
1. Copy `datafeeds` folder from https://github.com/tradingview/charting_library/ to `/src/assets`.
1. Run `./node_modules/.bin/ng serve` (use `"./node_modules/.bin/ng" serve` in Windows) for a dev server and navigate to `http://localhost:4200/`.

## What is Charting Library
Expand All @@ -17,4 +23,4 @@ Angular is a platform that makes it easy to build applications with the web. Ang

## About This Project

This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 1.7.4.
This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 13.1.2.
106 changes: 106 additions & 0 deletions angular/angular.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"angular": {
"projectType": "application",
"schematics": {
"@schematics/angular:application": {
"strict": true
}
},
"root": "",
"sourceRoot": "src",
"prefix": "app",
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/angular",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
},
"configurations": {
"production": {
"budgets": [
{
"type": "initial",
"maximumWarning": "500kb",
"maximumError": "1mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "2kb",
"maximumError": "4kb"
}
],
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"outputHashing": "all"
},
"development": {
"buildOptimizer": false,
"optimization": false,
"vendorChunk": true,
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
}
},
"defaultConfiguration": "production"
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"configurations": {
"production": {
"browserTarget": "angular:build:production"
},
"development": {
"browserTarget": "angular:build:development"
}
},
"defaultConfiguration": "development"
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "angular:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.spec.json",
"karmaConfig": "karma.conf.js",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [
"src/styles.css"
],
"scripts": []
}
}
}
}
},
"defaultProject": "angular"
}
28 changes: 28 additions & 0 deletions angular/copy_charting_library_files.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

remove_if_directory_exists() {
if [ -d "$1" ]; then rm -Rf "$1"; fi
}

case "$1" in
"unstable")
BRANCH="unstable";;
*)
BRANCH="master";;
esac

REPOSITORY='https://github.com/tradingview/charting_library/'

LATEST_HASH=$(git ls-remote $REPOSITORY $BRANCH | grep -Eo '^[[:alnum:]]+')

remove_if_directory_exists "$LATEST_HASH"

git clone -q --depth 1 -b "$BRANCH" $REPOSITORY "$LATEST_HASH"

remove_if_directory_exists "src/assets/charting_library"
remove_if_directory_exists "src/assets/datafeeds"

cp -r "$LATEST_HASH/charting_library" src/assets
cp -r "$LATEST_HASH/datafeeds" src/assets

remove_if_directory_exists "$LATEST_HASH"
Loading

0 comments on commit fa7bbb7

Please sign in to comment.