Skip to content

Commit

Permalink
Merge pull request #58 from vizzuhq/update-yarn-and-depends
Browse files Browse the repository at this point in the history
Update yarn and dependencies
  • Loading branch information
veghdev authored Oct 7, 2024
2 parents ff80e59 + a2087f6 commit d1ae346
Show file tree
Hide file tree
Showing 36 changed files with 3,405 additions and 3,927 deletions.
9 changes: 0 additions & 9 deletions .eslintignore

This file was deleted.

893 changes: 0 additions & 893 deletions .yarn/releases/yarn-4.0.2.cjs

This file was deleted.

925 changes: 925 additions & 0 deletions .yarn/releases/yarn-4.5.0.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
nodeLinker: node-modules

yarnPath: .yarn/releases/yarn-4.0.2.cjs
yarnPath: .yarn/releases/yarn-4.5.0.cjs
29 changes: 29 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { EslintTypeScriptConfig } from '@vizzu/eslint-config'

export default [
...EslintTypeScriptConfig,
{
files: ['**/*.ts', '**/*.tsx', '**/*.mts', '**/*.cts'],
languageOptions: {
parserOptions: {
ecmaVersion: 2022,
project: './tsconfig.eslint.json',
projectService: false
}
}
},
{
ignores: [
'**/node_modules/**',
'**/build/**',
'**/dist/**',
'**/.vscode/**',
'**/.yarn/**',
'**/tmp/**',
'**/demo/**',
'**/tests/**',
'**/.pnp*',
'**/*.d.ts'
]
}
]
61 changes: 19 additions & 42 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,63 +1,40 @@
{
"private": true,
"packageManager": "yarn@4.0.2",
"packageManager": "yarn@4.5.0",
"workspaces": [
"plugins/**/*"
],
"scripts": {
"postinstall": "husky install",
"format": "prettier -c .",
"lint": "eslint --ext .js,.mjs,.cjs,.ts,.tsx .",
"lint": "eslint",
"ci": "yarn format && yarn lint",
"fix": "yarn fix-format && yarn fix-lint",
"fix-format": "prettier -w .",
"fix-lint": "eslint --fix --ext .js,.mjs,.cjs,.ts,.tsx .",
"fix-lint": "eslint --fix .",
"update-vizzu": "node ./tools/updateVizzuMinorVersion.cjs"
},
"devDependencies": {
"@types/jest": "^29.5.12",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"@typescript-eslint/parser": "^7.2.0",
"@vizzu/eslint-config": "^0.2.0",
"@types/jest": "^29.5.13",
"@typescript-eslint/eslint-plugin": "^8.8.0",
"@typescript-eslint/parser": "^8.8.0",
"@vizzu/eslint-config": "^1.0.0",
"@vizzu/prettier-config": "^0.1.0",
"esbuild": "^0.20.1",
"esbuild": "^0.24.0",
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-polyfill-node": "^0.3.0",
"eslint": "^8.57.0",
"eslint": "^9.11.1",
"eslint-config-prettier": "^9.1.0",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-promise": "^6.1.1",
"glob": "^10.3.10",
"husky": "^9.0.11",
"lint-staged": "^15.2.2",
"prettier": "^3.2.5",
"typescript": "^5.4.2",
"vizzu": "~0.13.0"
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-n": "^17.10.3",
"eslint-plugin-promise": "^7.1.0",
"glob": "^11.0.0",
"husky": "^9.1.6",
"lint-staged": "^15.2.10",
"prettier": "^3.3.3",
"typescript": "^5.5.2",
"vizzu": "~0.14.0"
},
"prettier": "@vizzu/prettier-config",
"eslintConfig": {
"overrides": [
{
"files": [
"*.ts",
"*.tsx"
],
"extends": [
"@vizzu/eslint-config/typescript"
]
},
{
"files": [
"*.js",
"*.mjs",
"*.cjs"
],
"extends": [
"@vizzu/eslint-config/standard"
]
}
]
}
"prettier": "@vizzu/prettier-config"
}
5 changes: 5 additions & 0 deletions plugins/csv-parser/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [Unreleased]

## [0.6.0]

- Set vizzu-0.14.x as a peer dependency
- Update yarn and used packages

## [0.5.0]

- Set vizzu-0.13.x as a peer dependency
Expand Down
2 changes: 1 addition & 1 deletion plugins/csv-parser/demo/demo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Vizzu from 'https://cdn.jsdelivr.net/npm/vizzu@0.13/dist/vizzu.min.js'
import Vizzu from 'https://cdn.jsdelivr.net/npm/vizzu@0.14/dist/vizzu.min.js'
import { CSVParser } from '../dist/mjs/index.js'
let chart

Expand Down
23 changes: 11 additions & 12 deletions plugins/csv-parser/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@vizzu/csv-parser",
"description": "Vizzu plugin for CSV parsing",
"version": "0.5.0",
"version": "0.6.0",
"type": "module",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/mjs/index.js",
"default": "./dist/mjs/index.js",
"require": "./dist/cjs/index.js"
"default": "./dist/mjs/index.js"
}
},
"files": [
Expand Down Expand Up @@ -41,22 +40,22 @@
},
"homepage": "https://github.com/vizzuhq/vizzu-lib-ext/tree/main/plugins/csv-parser#readme",
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/core": "^7.25.7",
"@types/csv-parse": "^1.2.2",
"@types/node": "^20.11.26",
"esbuild": "^0.20.1",
"@types/node": "^22.7.4",
"esbuild": "^0.24.0",
"esbuild-plugin-copy": "^2.1.1",
"esbuild-plugin-polyfill-node": "^0.3.0",
"glob": "^10.3.10",
"glob": "^11.0.0",
"ts-standard": "^12.0.2",
"typescript": "^5.4.2",
"vitest": "^1.3.1",
"vizzu": "~0.13.0"
"typescript": "^5.5.2",
"vitest": "^2.1.2",
"vizzu": "~0.14.0"
},
"dependencies": {
"csv-parse": "^5.5.5"
"csv-parse": "^5.5.6"
},
"peerDependencies": {
"vizzu": "~0.13.0"
"vizzu": "~0.14.0"
}
}
11 changes: 5 additions & 6 deletions plugins/csv-parser/src/dataParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class DataParser implements Plugin {

meta = {
name: 'csvParser',
version: '0.13.0',
version: '0.14.0',
depends: []
}

Expand Down Expand Up @@ -144,7 +144,7 @@ export class DataParser implements Plugin {

return {
prepareAnimation: Object.assign(
async (ctx: PrepareAnimationContext, next: () => void) => {
async (ctx: PrepareAnimationContext, next: () => void): void => {
if (!Array.isArray(ctx.target)) {
next()
return
Expand Down Expand Up @@ -284,14 +284,13 @@ export class DataParser implements Plugin {
skip_records_with_error: true,
skip_records_with_empty_values: true,
...this.parserOptions
})
}) as string[][]
this._data = this._buildData(parsedInput)
} catch (error: unknown) {
if (error instanceof Error) {
console.error(error.message)
}
this._data = null
return
}
}

Expand Down Expand Up @@ -319,7 +318,7 @@ export class DataParser implements Plugin {
? this._headers
: this.detected.headers
this._log(['header', header])
const series = []
const series: DataSeries[] = []
for (let column = 0; column < records[0].length; column++) {
const headerName =
header[column] && header[column].length > 0
Expand All @@ -331,7 +330,7 @@ export class DataParser implements Plugin {
values: records.map((record) => record[column].trim() || '')
})
}
return { series: series }
return { series }
}

private _getHeader(records: string[][]): string[] {
Expand Down
34 changes: 20 additions & 14 deletions plugins/csv-parser/src/headerDetect.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { parse } from 'csv-parse/sync'

export enum Type {
NUMBER = 'number',
STRING = 'string',
UNDEFINED = 'undefined'
}

const IMPORTANCEWEIGHT = {
uniqueHeaderProbalility: 1,
headerTypesProbability: 5,
headerFrequencyProbability: 5,
dataTypesDifference: 5
}

const getType = (value: string | number): string => {
if (!value || value === '') return 'undefined'
if (typeof value === 'number') return 'number'
if (typeof value !== 'string') return 'string'
const getType = (value: string | number): Type => {
if (!value || value === '') return Type.UNDEFINED
if (typeof value === 'number') return Type.NUMBER
if (typeof value !== 'string') return Type.STRING

try {
// remove special langue number formatters (e.g. 1 000 000,01)
Expand All @@ -21,21 +27,21 @@ const getType = (value: string | number): string => {
.replace(/^[−–—]/, '-')
.replace(/[\u2012\u2013\u2014\u2015]/g, '-')

return !isNaN(Number(formattedValue)) ? 'number' : 'string'
} catch (e) {
return 'string'
return !isNaN(Number(formattedValue)) ? Type.NUMBER : Type.STRING
} catch {
return Type.STRING
}
}

const simpleParseData = (data: string, delimiter = ','): string[][] => {
return parse(data, {
delimiter: delimiter,
delimiter,
skip_empty_lines: true,
columns: false,
relax_column_count: true,
skip_records_with_error: true,
trim: true
})
}) as string[][]
}

const percentOfUniqueItems = (clearedHeader: string[]): number => {
Expand All @@ -50,8 +56,8 @@ const percentOfUniqueItems = (clearedHeader: string[]): number => {
return (uniqueValueCount / totalValues) * 100
}

const percentOfTypes = (rowValues: string[]): number => {
const filteredItems = rowValues.filter((element) => element && element === 'string')
const percentOfTypes = (rowValues: Type[]): number => {
const filteredItems = rowValues.filter((element) => element && element === Type.STRING)

if (filteredItems.length === 0) return 0

Expand Down Expand Up @@ -94,7 +100,7 @@ const convertValuesToTypes = (
return rowData.map((element, dataIndex) => {
const currentType = getType(element)

if (currentType === 'undefined' && rowKey > 0) {
if (currentType === Type.UNDEFINED && rowKey > 0) {
return getType(filteredValues[rowKey - 1][dataIndex])
}

Expand All @@ -110,7 +116,7 @@ export const headerDetect = (data: string, delimiter = ','): number => {
const headers = parsedData.shift()
if (!headers) return 0

const missingHeaderElements = []
const missingHeaderElements: number[] = []
for (let headerKey = 0; headerKey < headers.length; headerKey++) {
const header = headers[headerKey]
if (!header) {
Expand All @@ -128,7 +134,7 @@ export const headerDetect = (data: string, delimiter = ','): number => {
probabilitesCount += IMPORTANCEWEIGHT.uniqueHeaderProbalility | 1

const headerTypes = clearedHeader.map((header) => getType(header))
const clearHeaderTypes = headerTypes.filter((header) => header !== 'undefined')
const clearHeaderTypes = headerTypes.filter((header) => header !== Type.UNDEFINED)

const headerTypesProbability = percentOfTypes(
clearHeaderTypes.length > 0 ? clearHeaderTypes : headerTypes
Expand Down
1 change: 1 addition & 0 deletions plugins/csv-parser/src/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class CSVParser extends DataParser {
await this.setSource(input)
return this.convertNumbers(this.data)
}

public readCSVFile(fileName: string): string {
if (!fileName) {
return ''
Expand Down
5 changes: 5 additions & 0 deletions plugins/data-types/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [Unreleased]

## [0.5.0]

- Set vizzu-0.14.x as a peer dependency
- Update yarn and used packages

## [0.4.1]

- Added stricter rules for unit checking.
Expand Down
17 changes: 8 additions & 9 deletions plugins/data-types/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{
"name": "@vizzu/data-types",
"description": "Vizzu plugin for data types",
"version": "0.4.1",
"version": "0.5.0",
"type": "module",
"exports": {
".": {
"types": "./dist/types/index.d.ts",
"import": "./dist/mjs/index.js",
"default": "./dist/mjs/index.js",
"require": "./dist/cjs/index.js"
"default": "./dist/mjs/index.js"
}
},
"files": [
Expand Down Expand Up @@ -41,14 +40,14 @@
},
"homepage": "https://github.com/vizzuhq/vizzu-lib-ext/tree/main/plugins/data-types#readme",
"devDependencies": {
"@babel/core": "^7.24.0",
"esbuild": "^0.20.1",
"@babel/core": "^7.25.7",
"esbuild": "^0.24.0",
"esbuild-plugin-babel": "^0.2.3",
"esbuild-plugin-polyfill-node": "^0.3.0",
"glob": "^10.3.10",
"glob": "^11.0.0",
"ts-standard": "^12.0.2",
"typescript": "^5.4.2",
"vitest": "^1.3.1",
"vizzu": "~0.13.0"
"typescript": "^5.5.2",
"vitest": "^2.1.2",
"vizzu": "~0.14.0"
}
}
Loading

0 comments on commit d1ae346

Please sign in to comment.