Skip to content

Commit

Permalink
Merge pull request #421 from epam/maintenance
Browse files Browse the repository at this point in the history
Maintenance update, part 1
  • Loading branch information
paulsmirnov committed Sep 12, 2022
2 parents eb19106 + bca77de commit 0f978ad
Show file tree
Hide file tree
Showing 41 changed files with 458 additions and 74 deletions.
2 changes: 1 addition & 1 deletion .appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
version: "{build}"
environment:
matrix:
- nodejs_version: "14"
- nodejs_version: "16"
cache:
- "%LOCALAPPDATA%\\Yarn"
init:
Expand Down
3 changes: 2 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"@typescript-eslint/no-var-requires": "off"
},
"env": {
"browser": true,
"jest": true,
"mocha": true
}
}
}
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://docs.github.com/en/get-started/getting-started-with-git/configuring-git-to-handle-line-endings
* text=auto

*.png binary
*.jpg binary
*.ico binary
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:

strategy:
matrix:
node-version: [14.x]
node-version: [16.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
Expand Down
3 changes: 2 additions & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = {
...require('prettier-config-standard')
...require('prettier-config-standard'),
endOfLine: 'auto'
}
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
language: node_js
version: 1.0
node_js:
- "14"
- "16"
cache:
yarn: true
directories:
Expand Down Expand Up @@ -44,15 +44,15 @@ deploy:
tag: latest
on:
tags: true
node: "14"
node: "16"
condition: $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+$
- provider: script
edge: true
cleanup: false
script: "chmod +x ./tools/deploy.sh && ./tools/deploy.sh"
on:
all_branches: true
node: "14"
node: "16"
notifications:
slack:
secure: CkwGMCqK7Liq81tnr7wMUJ893JW09caDeio5oOYQmjGwu3FBkwNU7zApRltN6NJ/a14Of97fHre0vMPga7BrNmhDH9ztvh6qafEmZXPYxiZSbOQ5JGYP3SlotIFF+z0WowCt6erXmNeRHzTBCoZKo4Sxd/2ZHLrkm3nVcCnugpIlyiFrhGnv+QIS2JbMVhai/0rYU1+CsIm6Lb/Kt4cpUgbdJGOsUizTZNKHxhgbnElFczaF0bUFbifkP7LRqdEXtsJPodLfPOezKM62BA6rBnlFGPrRKER1r3ZCHOHimAjyIWD6emUc331w2OmhXDuHGL4ZXq94joiHJVhfrnUsIzgewIxE0qKCMO7y4WcAdXCiwY+x1SoOUlUreJp6EkDI0IgiKOCfb8BnjSXV7VhqymGPjuvFvNzBxXyLjo9jceathGsKQ7usFjhVT1JBkmNYadVN8Y7PYEbyzOjWJol/f5Ol4B28pzypVMP3N6M0KKLJZ4gp6vFtobC72u7/7ThCfUfjDaPyf/yoUNmMQN6lLTRGvZnix+NU/DWVptbDrfAOm9+bBN7Z53Kdhfhpzjedr1Bb7Y+UuHSbNbQe0AvZdhzX3qCrneKDmlbIUvJfe1yzVh8981RedBFTXFcAb38wVfofnMrbZPaWw9k9L3fP1V52GYGjN6L2AX0VQZ3/arE=
Expand Down
363 changes: 363 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@ nodeLinker: node-modules
plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: "@yarnpkg/plugin-workspace-tools"
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
spec: "@yarnpkg/plugin-interactive-tools"

yarnPath: .yarn/releases/yarn-3.1.1.cjs
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:14 AS build
FROM node:16 AS build
COPY . /miew
RUN cd /miew \
&& yarn install \
Expand Down
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,10 @@
"webpack": "^4.43.0",
"webpack-cli": "^3.3.11"
},
"packageManager": "yarn@3.1.1"
"packageManager": "yarn@3.1.1",
"resolutions": {
"eventsource": "1.1.1",
"minimist": "1.2.6",
"url-parse": "1.5.10"
}
}
8 changes: 4 additions & 4 deletions packages/miew-cli/src/Miew-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class RepresentationMap {
}

if (index !== undefined) {
if (!this.representationMap.hasOwnProperty(strId)) {
if (!Object.hasOwn(this.representationMap, strId)) {
this.representationMap[strId.toString()] = index
this.representationID[index] = strId.toString()
} else {
Expand All @@ -55,14 +55,14 @@ class RepresentationMap {
}

remove(index) {
if (index && this.representationID.hasOwnProperty(index)) {
if (index && Object.hasOwn(this.representationID, index)) {
delete this.representationMap[this.representationID[index]]
delete this.representationID[index]
}

const sortedKeys = Object.keys(this.representationID).sort()
for (const i in sortedKeys) {
if (sortedKeys.hasOwnProperty(i)) {
if (Object.hasOwn(sortedKeys, i)) {
const id = sortedKeys[i]
if (id > index) {
this.representationID[id - 1] = this.representationID[id]
Expand Down Expand Up @@ -145,7 +145,7 @@ class CLIUtils {
let ret = ''

for (const k in context) {
if (context.hasOwnProperty(k)) {
if (Object.hasOwn(context, k)) {
ret += `${k} : "${context[k]}"\n`
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/miew-cli/src/MiewCLIParser.js
Original file line number Diff line number Diff line change
Expand Up @@ -2276,7 +2276,7 @@ var parser = (function () {
var lexer = Object.create(this.lexer)
var sharedState = { yy: {} }
for (var k in this.yy) {
if (Object.prototype.hasOwnProperty.call(this.yy, k)) {
if (Object.hasOwn(this.yy, k)) {
sharedState.yy[k] = this.yy[k]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/miew-cli/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ function isAlmostPlainObject(o) {
const proto = o && Object.getPrototypeOf(o)
return (
!!proto &&
!proto.hasOwnProperty('constructor') &&
!Object.hasOwn(proto, 'constructor') &&
isAlmostPlainObject(proto)
)
}
Expand Down
2 changes: 1 addition & 1 deletion packages/miew-react/src/Viewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ const Viewer = ({

const callbacks = addListeners(miew, dispatch)
return () => removeListeners(miew, callbacks)
}, [options, onInit])
}, [options, onInit, dispatch])

return (
<ThemeProvider theme={merge(muiTheme, { miew: viewerTheme })}>
Expand Down
1 change: 1 addition & 0 deletions packages/miew-react/src/typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { MiewTheme } from 'theming'

declare module '*.svg' {
import * as React from 'react'
import { ReactComponent } from 'react'

export const ReactComponent: React.FunctionComponent<
React.SVGProps<SVGSVGElement> & { title?: string }
Expand Down
3 changes: 3 additions & 0 deletions packages/miew/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
"directory": "packages/miew"
},
"license": "MIT",
"engines": {
"node": ">=16.9.0"
},
"scripts": {
"ci": "run-s clean test-cover build",
"eslint": "eslint . --ext .ts,.tsx,.js,.jsx",
Expand Down
5 changes: 3 additions & 2 deletions packages/miew/src/ComplexVisual.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ class ComplexVisual extends Visual {
if (!isEmpty(diff)) {
target.needsRebuild = true
for (const key in diff) {
if (diff.hasOwnProperty(key)) {
if (Object.hasOwn(diff, key)) {
desc[key] = diff[key]
logger.debug(`rep[${index}].${key} changed to ${diff[key]}`)
}
Expand Down Expand Up @@ -655,6 +655,7 @@ class ComplexVisual extends Visual {
}
}

/* global DEBUG:false */
if (DEBUG && !errorOccured) {
logger.debug(
`Triangles count: ${meshutils.countTriangles(repr.geo)}`
Expand Down Expand Up @@ -755,7 +756,7 @@ class ComplexVisual extends Visual {
}
if (Object.keys(residues).length > 0) {
for (const ch in residues) {
if (residues.hasOwnProperty(ch)) {
if (Object.hasOwn(residues, ch)) {
selector = selectors.and(
selectors.chain(ch),
selectors.residx(optimizeList(residues[ch]))
Expand Down
6 changes: 3 additions & 3 deletions packages/miew/src/ComplexVisualEdit.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class ComplexComponentEditor extends ComplexEditor {
reprNode = selection.children[i]
for (j = 0; j < reprNode.children.length; ++j) {
geo = reprNode.children[j]
if (geo.hasOwnProperty('_component') && geo._component === component) {
if (Object.hasOwn(geo, '_component') && geo._component === component) {
res.objects.push(geo)
}
}
Expand Down Expand Up @@ -178,7 +178,7 @@ class ComplexComponentEditor extends ComplexEditor {
reprNode = visual.children[i]
for (j = 0; j < reprNode.children.length; ++j) {
geo = reprNode.children[j]
if (geo.hasOwnProperty('_component')) {
if (Object.hasOwn(geo, '_component')) {
geo.position.set(0, 0, 0)
geo.quaternion.set(0, 0, 0, 1)
}
Expand All @@ -190,7 +190,7 @@ class ComplexComponentEditor extends ComplexEditor {
reprNode = selection.children[i]
for (j = 0; j < reprNode.children.length; ++j) {
geo = reprNode.children[j]
if (geo.hasOwnProperty('_component')) {
if (Object.hasOwn(geo, '_component')) {
geo.position.set(0, 0, 0)
geo.quaternion.set(0, 0, 0, 1)
}
Expand Down
11 changes: 6 additions & 5 deletions packages/miew/src/Miew.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global DEBUG:false, PACKAGE_VERSION:false */
// eslint-disable-next-line
//@ts-nocheck
import { Spinner } from 'spin.js'
Expand Down Expand Up @@ -1031,7 +1032,7 @@ export class Miew extends EventDispatcher {

let name = baseName
let suffix = 1
while (this._visuals.hasOwnProperty(name)) {
while (Object.hasOwn(this._visuals, name)) {
name = `${baseName} (${suffix.toString()})`
suffix++
}
Expand Down Expand Up @@ -1078,7 +1079,7 @@ export class Miew extends EventDispatcher {

if (
!obj ||
!this._visuals.hasOwnProperty(name) ||
!Object.hasOwn(this._visuals, name) ||
this._visuals[name] !== obj
) {
return
Expand All @@ -1100,7 +1101,7 @@ export class Miew extends EventDispatcher {
*/
_forEachVisual(callback) {
for (const name in this._visuals) {
if (this._visuals.hasOwnProperty(name)) {
if (Object.hasOwn(this._visuals, name)) {
callback(this._visuals[name])
}
}
Expand All @@ -1116,7 +1117,7 @@ export class Miew extends EventDispatcher {
}

for (const name in this._visuals) {
if (this._visuals.hasOwnProperty(name)) {
if (Object.hasOwn(this._visuals, name)) {
this._visuals[name].release()
}
}
Expand All @@ -1135,7 +1136,7 @@ export class Miew extends EventDispatcher {

for (const name in this._visuals) {
if (
this._visuals.hasOwnProperty(name) &&
Object.hasOwn(this._visuals, name) &&
this._visuals[name] instanceof ComplexVisual
) {
callback(this._visuals[name])
Expand Down
14 changes: 7 additions & 7 deletions packages/miew/src/chem/Complex.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ class Complex {
}

getAtomNames() {
if (this.hasOwnProperty('_atomNames')) {
if (Object.hasOwn(this, '_atomNames')) {
return this._atomNames
}

Expand All @@ -699,7 +699,7 @@ class Complex {
}

getElements() {
if (this.hasOwnProperty('_elements')) {
if (Object.hasOwn(this, '_elements')) {
return this._elements
}

Expand All @@ -713,7 +713,7 @@ class Complex {
}

getResidueNames() {
if (this.hasOwnProperty('_residueNames')) {
if (Object.hasOwn(this, '_residueNames')) {
return this._residueNames
}

Expand All @@ -727,7 +727,7 @@ class Complex {
}

getChainNames() {
if (this.hasOwnProperty('_chainNames')) {
if (Object.hasOwn(this, '_chainNames')) {
return this._chainNames
}

Expand All @@ -741,7 +741,7 @@ class Complex {
}

getAltLocNames() {
if (this.hasOwnProperty('_altlocNames')) {
if (Object.hasOwn(this, '_altlocNames')) {
return this._altlocNames
}

Expand All @@ -755,7 +755,7 @@ class Complex {
}

getVoxelWorld() {
if (!this.hasOwnProperty('_voxelWorld')) {
if (!Object.hasOwn(this, '_voxelWorld')) {
try {
this._voxelWorld = new VoxelWorld(
this.getDefaultBoundaries().boundingBox,
Expand Down Expand Up @@ -854,7 +854,7 @@ class Complex {
this.addElement(c.structures, this.structures, 0, doNothing)
// merge residue types
for (const rt in c._residueTypes) {
if (c._residueTypes.hasOwnProperty(rt)) {
if (Object.hasOwn(c._residueTypes, rt)) {
this._residueTypes[rt] = c._residueTypes[rt]
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/miew/src/chem/VoxelWorld.js
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ class VoxelWorld {

// for each marked voxel
for (voxel in voxels) {
if (voxels.hasOwnProperty(voxel)) {
if (Object.hasOwn(voxels, voxel)) {
self._forEachAtomInVoxel(voxel, processIfWithin)
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/miew/src/chem/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ selectors.InfixOperator = InfixOperator
selectors.Context = Object.create({})

selectors.GetSelector = function (key) {
if (!selectors.Context.hasOwnProperty(key)) {
if (!Object.hasOwn(selectors.Context, key)) {
const exc = { message: `selector ${key} is not registered` }
throw exc
}
Expand Down
2 changes: 1 addition & 1 deletion packages/miew/src/gfx/geometries/ChunkedObjectsGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ChunkedObjectsGeometry extends BufferGeometry {
mesh.raycast(raycaster, inters)
const facesPerChunk = this._chunkGeo.index.count / 3
for (let i = 0, n = inters.length; i < n; ++i) {
if (!inters[i].hasOwnProperty('faceIndex')) {
if (!Object.hasOwn(inters[i], 'faceIndex')) {
continue
}
inters[i].chunkIdx = Math.floor(inters[i].faceIndex / facesPerChunk)
Expand Down
2 changes: 1 addition & 1 deletion packages/miew/src/gfx/gfxutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ function _calcChunkMatrix(eye, target, up, rad) {
function _groupHasGeometryToRender(group) {
let hasGeoms = false
group.traverse((node) => {
if (node.hasOwnProperty('geometry') || node instanceof CSS2DObject) {
if (Object.hasOwn(node, 'geometry') || node instanceof CSS2DObject) {
hasGeoms = true
}
})
Expand Down
2 changes: 1 addition & 1 deletion packages/miew/src/gfx/meshutils.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function _countMeshTriangles(mesh) {
const attribs = geom.attributes
for (const property in attribs) {
if (
attribs.hasOwnProperty(property) &&
Object.hasOwn(attribs, property) &&
attribs[property] instanceof InstancedBufferAttribute
) {
const currAttr = attribs[property]
Expand Down
2 changes: 1 addition & 1 deletion packages/miew/src/gfx/modes/groups/AtomsGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class AtomsGroup extends ChemGroup {
const atomsIdc = this._chunksIdc
// process inters array - arr object references
for (let i = 0, n = inters.length; i < n; ++i) {
if (!inters[i].hasOwnProperty('chunkIdx')) {
if (!Object.hasOwn(inters[i], 'chunkIdx')) {
continue
}
const atomIdx = atomsIdc[inters[i].chunkIdx]
Expand Down
Loading

0 comments on commit 0f978ad

Please sign in to comment.