Skip to content

Commit b2a5e19

Browse files
Merge pull request #60 from trash-and-fire/53-version-200
53 version 200
2 parents 65d7f77 + 0250c9e commit b2a5e19

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+10053
-640
lines changed

.eslintrc.js renamed to .eslintrc.cjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ function typescriptRules(annotations) {
4444
}
4545
],
4646
"@typescript-eslint/no-inferrable-types": "off",
47+
"import/extensions": ["error", "always"],
4748
};
4849
if (annotations !== false) {
4950
result["@typescript-eslint/typedef"] = [
@@ -67,20 +68,24 @@ function typescriptRules(annotations) {
6768

6869
module.exports = {
6970
root: true,
71+
plugins: [
72+
'eslint-plugin-import',
73+
],
74+
ignorePatterns: ["dist/*"],
7075
overrides: [
7176
{
7277
extends: [
7378
"eslint:recommended",
7479
"plugin:node/recommended"
7580
],
76-
files: ['.eslintrc.js', 'webpack.config.js', 'gulpfile.js', 'repl-maker.js', 'scripts/**/*.{js,cjs}'],
81+
files: ['.eslintrc.cjs', 'webpack.config.cjs', 'gulpfile.cjs', 'repl-maker.cjs', 'scripts/**/*.{js,cjs}'],
7782
parserOptions: {
78-
"ecmaVersion": 2017
83+
"ecmaVersion": 2020
7984
},
8085
env: {
8186
node: true,
8287
browser: false,
83-
es6: true
88+
es2020: true,
8489
},
8590
rules: {
8691
"node/no-unpublished-require": "off",

.github/workflows/ci.yml

Lines changed: 99 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,34 +6,117 @@ jobs:
66
lint:
77
runs-on: ubuntu-latest
88
steps:
9-
- uses: actions/checkout@v1
10-
- uses: actions/setup-node@v2
11-
- uses: bahmutov/npm-install@v1
9+
- name: Checkout
10+
uses: actions/checkout@v3
11+
12+
- name: Install Node.js
13+
uses: actions/setup-node@v3
14+
with:
15+
node-version: 16
16+
17+
- uses: pnpm/action-setup@v2
18+
name: Install pnpm
19+
id: pnpm-install
1220
with:
13-
useLockFile: false
14-
- run: npm run lint
21+
version: 7
22+
23+
- name: Get pnpm store directory
24+
id: pnpm-cache
25+
shell: bash
26+
run: |
27+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
28+
29+
- uses: actions/cache@v3
30+
name: Setup pnpm cache
31+
with:
32+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
33+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
34+
restore-keys: |
35+
${{ runner.os }}-pnpm-store-
36+
37+
- name: Install dependencies
38+
run: pnpm install
39+
40+
- name: Lint files
41+
run: pnpm run lint
1542

1643
test:
1744
runs-on: ubuntu-latest
1845

1946
steps:
20-
- uses: actions/checkout@v1
21-
- uses: actions/setup-node@v2
22-
- uses: bahmutov/npm-install@v1
47+
- name: Checkout
48+
uses: actions/checkout@v3
49+
50+
- name: Install Node.js
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version: 16
54+
55+
- uses: pnpm/action-setup@v2
56+
name: Install pnpm
57+
id: pnpm-install
2358
with:
24-
useLockFile: false
25-
- run: npm run test
59+
version: 7
60+
61+
- name: Get pnpm store directory
62+
id: pnpm-cache
63+
shell: bash
64+
run: |
65+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
66+
67+
- uses: actions/cache@v3
68+
name: Setup pnpm cache
69+
with:
70+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
71+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
72+
restore-keys: |
73+
${{ runner.os }}-pnpm-store-
74+
75+
- name: Install dependencies
76+
run: pnpm install
77+
78+
- name: Run tests
79+
run: pnpm run test
2680
env:
2781
CI: true
2882

2983
validate:
3084
runs-on: ubuntu-latest
3185

3286
steps:
33-
- uses: actions/checkout@v1
34-
- uses: actions/setup-node@v2
35-
- uses: bahmutov/npm-install@v1
87+
- name: Checkout
88+
uses: actions/checkout@v3
89+
90+
- name: Install Node.js
91+
uses: actions/setup-node@v3
92+
with:
93+
node-version: 16
94+
95+
- uses: pnpm/action-setup@v2
96+
name: Install pnpm
97+
id: pnpm-install
3698
with:
37-
useLockFile: false
38-
- run: npm run build-package
39-
- run: npm run validate
99+
version: 7
100+
101+
- name: Get pnpm store directory
102+
id: pnpm-cache
103+
shell: bash
104+
run: |
105+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
106+
107+
- uses: actions/cache@v3
108+
name: Setup pnpm cache
109+
with:
110+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
111+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
112+
restore-keys: |
113+
${{ runner.os }}-pnpm-store-
114+
115+
- name: Install dependencies
116+
run: pnpm install
117+
118+
- name: Check - build package
119+
run: npm run build-package
120+
121+
- name: Check - svelte errors
122+
run: npm run validate

.npmrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
save-exact=true
2-
package-lock=false

CHANGELOG.md

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Svelte Lightweight Charts changelog
2+
3+
## 2.0.0
4+
5+
This major release raises the required `lightweight-charts` package version to 4.0.0 providing support for new features from the package.
6+
7+
Check out `[email protected]` [release notes](https://github.com/tradingview/lightweight-charts/releases/tag/v4.0.0) first.
8+
9+
### Major updates
10+
11+
- Compatibility with SvelteKit. The package comes as ESM compatible, which provides full support for modern tools and bundlers.
12+
13+
### Breaking changes
14+
15+
- ESM only (CJS support can be added on demand in the future).
16+
- Removed deprecated chart action exports: `chart`, `ChartActionParams` and default export.
17+
- `<[Type]Series>`: removed `scaleMargins` property instead use the same property on `<PriceScale>` component.
18+
- `<PriceLine>`: `price` is required property now.
19+
- `<PriceScale>`: `drawTicks` property is renamed to `ticksVisible`.
20+
21+
### New features
22+
23+
- `<AreaSeries>`: added `invertFilledArea` property which when set to true will invert the filled area (draw above the line instead of below it).
24+
- `<PriceScale>`: added `textColor` property.

README.md

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,6 @@ npm install lightweight-charts svelte-lightweight-charts
3737
</Chart>
3838
```
3939

40-
### SSR and SvelteKit
41-
42-
`lightweight-charts` are not currently compatible with the node environment. Direct import of this module will throw an exception.
43-
44-
I made an experimental version of the package that should solve this problem. To install the next version, run:
45-
```bash
46-
npm install svelte-lightweight-charts@next
47-
```
48-
Add to your `svelte.config.js`:
49-
```
50-
vite: {
51-
ssr: {
52-
noExternal: ['svelte-lightweight-charts', 'lightweight-charts']
53-
}
54-
}
55-
```
56-
5740
## Getting reference to lightweight-chart objects
5841

5942
You can use the `ref` property to get a reference to a lightweight-chart api-instance from any component.
@@ -198,3 +181,9 @@ Package is written on TypeScript and transpiled to plain `*.js` and `*.svelte` f
198181
## Related projects
199182

200183
Need a wrapper for another framework? Check out my [lightweight-charts-react-wrapper](https://github.com/trash-and-fire/lightweight-charts-react-wrapper)
184+
185+
## Licence
186+
187+
MIT
188+
189+
Review the license [requirements](https://github.com/tradingview/lightweight-charts#license) for the required "attribution notice" in the Lightweight Chart Repository.

gulpfile.js renamed to gulpfile.cjs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const {spawn} = require('child_process');
99
const crc = require('crc-32');
1010
const {argv} = require('yargs');
1111

12-
const SvelteReplRepository = require('./repl-maker');
12+
const SvelteReplRepository = require('./repl-maker.cjs');
1313

1414
function convertToTypings(content, file) {
1515
const filename = file.basename[0].toUpperCase() + file.basename.slice(1);
@@ -30,10 +30,11 @@ function typings() {
3030
.pipe(dest('./dist'));
3131
}
3232

33-
async function applyPreprocess(content, file) {
34-
const ts = require('svelte-preprocess').typescript();
35-
ts.filename = file.basename;
36-
// TODO: remove source mapping url
33+
async function applyPreprocess(content, file, options) {
34+
const ts = require('svelte-preprocess').typescript(options ?? {
35+
tsconfigFile: './tsconfig.build.json',
36+
});
37+
ts.filename = file.path;
3738
const garbage = require('svelte-preprocess').replace([
3839
[/<!--[^]*?-->|<script(\s[^]*?)?(?:>([^]*?)<\/script>|\/>)/gi, (value, attributes) => {
3940
if (attributes !== undefined && attributes.includes('lang="ts"')) {
@@ -85,7 +86,7 @@ function typescript() {
8586
function index() {
8687
return src(['./dist/index.d.ts'])
8788
.pipe(transform('utf8', (content) => {
88-
return String(content).replace(/\.interface'/g, '.svelte\'');
89+
return String(content).replace(/\.interface.js'/g, '.svelte\'');
8990
}))
9091
.pipe(dest('./dist'));
9192
}
@@ -105,7 +106,7 @@ function samples(...args) {
105106

106107
const resolveComponents = () => src(['./src/demo/samples/components/*.svelte'])
107108
.pipe(transform('utf8', (contents, file) => {
108-
return applyPreprocess(contents, file).then((code) => {
109+
return applyPreprocess(contents, file, {}).then((code) => {
109110
components.set(`components/${file.basename}`, {
110111
hash: crc.str(contents),
111112
name: file.basename,

0 commit comments

Comments
 (0)