Skip to content

Commit

Permalink
HWE: Fix build for TypeScript
Browse files Browse the repository at this point in the history
  • Loading branch information
tanas80 committed Jun 25, 2024
1 parent 196bdcd commit 086e0ca
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 30 deletions.
6 changes: 6 additions & 0 deletions HELM/source/.npmignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
src/**/*.ts
!src/**/*.d.ts

helm/**/*.ts
!helm/**/*.d.ts

# Developer keys
upload.keys.json

Expand Down
4 changes: 4 additions & 0 deletions HELM/source/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# HELMWebEditor changelog

## 1.1.5 (2024-06-25)

Fix build for TypeScript

## 1.1.4 (2024-06-21)

### Features
Expand Down
8 changes: 4 additions & 4 deletions HELM/source/helm/MonomerExplorer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {DojoType} from '@datagrok-libraries/js-draw-lite/src/types/dojo';

import type {JSDraw2ModuleType, ScilModuleType} from '@datagrok-libraries/js-draw-lite/src/types';
import type {HweHelmType, IExplorerMonomer, IMonomerExplorerOptions, OrgType, TabDescType} from '../src/types/org-helm';
import type {HelmType, HelmTypes, IOrgMonomer, IOrgWebEditorMonomer} from '@datagrok-libraries/js-draw-lite/src/types/org';
import type {HelmType, HelmTypes, IOrgMonomer, IWebEditorMonomer} from '@datagrok-libraries/js-draw-lite/src/types/org';
import type {StyleType} from '@datagrok-libraries/js-draw-lite/src/types/common';
import type {IDnD} from '@datagrok-libraries/js-draw-lite/src/types/scil';
import type {Editor} from '@datagrok-libraries/js-draw-lite/src/JSDraw.Editor';
Expand Down Expand Up @@ -220,7 +220,7 @@ export class MonomerExplorerInt {
const type = d.getAttribute('helm');
const set = type == org.helm.webeditor.MonomerExplorer.kNucleotide ? org.helm.webeditor.MonomerExplorer.nucleotides : org.helm.webeditor.Monomers.getMonomerSet(type);
const m = set[scil.helm.symbolCase(name)];
const monomer = m as IOrgWebEditorMonomer;
const monomer = m as IWebEditorMonomer;
if (monomer != null && monomer.n != null) {
if (scil.Utils.startswith(monomer.n.toLowerCase(), s))
f = 1;
Expand Down Expand Up @@ -490,7 +490,7 @@ export class MonomerExplorerInt {
}

for (const k in set) {
const m: IOrgWebEditorMonomer = set[k];
const m: IWebEditorMonomer = set[k];
let na: string = m.na!;
if (aa) {
if (m.at.R1 == null)
Expand Down Expand Up @@ -532,7 +532,7 @@ export class MonomerExplorerInt {
* Get monomer names (internal use)
* @function getMonomerNames
*/
getMonomerNames(list: IOrgWebEditorMonomer[], addnull?: boolean | null): string[] {
getMonomerNames(list: IWebEditorMonomer[], addnull?: boolean | null): string[] {
const ret: string[] = [];
//if (addnull)
// ret.push("null");
Expand Down
20 changes: 11 additions & 9 deletions HELM/source/helm/Monomers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@

// @ts-nocheck

import type {HelmType, IMonomerColors, IOrgMonomers, IOrgWebEditorMonomer, MonomerType, PolymerType} from '@datagrok-libraries/js-draw-lite/src/types/org';
import type {
HelmType, IMonomerColors, IOrgMonomers, MonomerType, PolymerType, MonomerSetType, IWebEditorMonomer
} from '@datagrok-libraries/js-draw-lite/src/types/org';
import type {IOrgHelmMonomers, OrgType} from '../src/types/org-helm';
import type {JSDraw2ModuleType, ScilModuleType} from '@datagrok-libraries/js-draw-lite/src/types';
import type {Atom} from '@datagrok-libraries/js-draw-lite/src/Atom';
Expand All @@ -44,7 +46,7 @@ export class Monomers implements IOrgHelmMonomers {
public readonly defaultmonomers: { [type: string]: any } = {
HELM_BASE: null, HELM_SUGAR: null, HELM_LINKER: null, HELM_AA: null, HELM_CHEM: null
};
public readonly blobs: { [name: string]: IOrgWebEditorMonomer } = {
public readonly blobs: { [name: string]: IWebEditorMonomer } = {
blob: {n: 'Blob', id: "Blob", na: 'B', rs: 0, at: {}, m: ''},
group: {n: 'Group', id: "Group", na: 'G', rs: 0, at: {}, m: ''}
};
Expand Down Expand Up @@ -396,7 +398,7 @@ export class Monomers implements IOrgHelmMonomers {
* Get a monomer by an object or its name (internal use)
* @function getMonomer
*/
getMonomer(a: Atom<HelmType> | HelmType, name?: string): IOrgWebEditorMonomer {
getMonomer: GetMonomerFunc = (a: Atom<HelmType> | HelmType, name?: string): IWebEditorMonomer => {
if (a == null && name == null)
return null;

Expand Down Expand Up @@ -436,7 +438,7 @@ export class Monomers implements IOrgHelmMonomers {
m = set[scil.helm.symbolCase(s)];
if (m != null)
return m;
}
};

/**
* Check if the monomer have a R group (internal use)
Expand All @@ -453,7 +455,7 @@ export class Monomers implements IOrgHelmMonomers {
*/
getColor(a: Atom<HelmType> | HelmType): IMonomerColors {
const aa = a as Atom<HelmType>;
let m: IOrgWebEditorMonomer = this.getMonomer(aa, aa.elem);
let m: IWebEditorMonomer = this.getMonomer(aa, aa.elem);
if (m == null)
m = {};

Expand Down Expand Up @@ -509,7 +511,7 @@ export class Monomers implements IOrgHelmMonomers {
* Convert XML type to HELM Editor type (internal use)
* @function helm2Type
*/
helm2Type(m: IOrgWebEditorMonomer): HelmType {
helm2Type(m: IWebEditorMonomer): HelmType {
if (m.type == "PEPTIDE")
return org.helm.webeditor.HELM.AA;
else if (m.type == "CHEM")
Expand Down Expand Up @@ -547,7 +549,7 @@ export class Monomers implements IOrgHelmMonomers {
if (this.smilesmonomers[smiles] != null)
return this.smilesmonomers[smiles];

const m: IOrgWebEditorMonomer = {at: {}, smiles: smiles, issmiles: true};
const m: IWebEditorMonomer = {at: {}, smiles: smiles, issmiles: true};
m.id = "#" + (++this.smilesmonomerid);
m.name = "SMILES Monomer #" + this.smilesmonomerid;
for (let i = 0; i < ss.length; ++i)
Expand Down Expand Up @@ -683,7 +685,7 @@ export class Monomers implements IOrgHelmMonomers {
* Read one monomer from XML (internal use)
* @function readOne
*/
readOne(e): IOrgWebEditorMonomer {
readOne(e): IWebEditorMonomer {
const s = this.readValue(e, "MonomerMolFile");
let m = null;
let mz = null;
Expand All @@ -694,7 +696,7 @@ export class Monomers implements IOrgHelmMonomers {
mz = s; // compressed molfile
}

const mon: IOrgWebEditorMonomer = {
const mon: IWebEditorMonomer = {
type: this.readValue(e, "PolymerType") as PolymerType,
mt: this.readValue(e, "MonomerType") as MonomerType,
id: this.readValue(e, "MonomerID"),
Expand Down
16 changes: 7 additions & 9 deletions HELM/source/package-lock.json

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

8 changes: 4 additions & 4 deletions HELM/source/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "@datagrok-libraries/helm-web-editor",
"friendlyName": "HELMWebEditor",
"version": "1.1.4",
"version": "1.1.5",
"description": "HELMWebEditor forked from Pistoia Alliance",
"devDependencies": {
"@datagrok-libraries/js-draw-lite": "^0.0.2",
"@datagrok-libraries/js-draw-lite": "^0.0.3",
"@types/node": "^18.11.18",
"@typescript-eslint/eslint-plugin": "latest",
"@typescript-eslint/parser": "latest",
Expand All @@ -21,8 +21,8 @@
"webpack-cli": "^4.9.1"
},
"scripts": {
"build": "webpack",
"build-prod": "cross-env NODE_ENV=production webpack",
"build": "tsc && webpack",
"build-prod": "cross-env NODE_ENV=production \"tsc && webpack\"",
"lint": "eslint src --ext .ts",
"lint-fix": "eslint src --ext .ts --fix"
},
Expand Down
2 changes: 1 addition & 1 deletion HELM/source/src/types/org-helm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ export type TabDescType = {
tabkey: string;
}

export interface IOrgHelmWebEditor extends Omit<IOrgWebEditor<HelmType>, 'Interface' | 'Plugin'> {
export interface IOrgHelmWebEditor extends Omit<IOrgWebEditor<HelmType>, 'Interface' | 'Plugin' | 'Monomers'> {
ambiguity: boolean;
kCaseSensitive: boolean;
defaultbondratio: number;
Expand Down
7 changes: 4 additions & 3 deletions HELM/source/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', 'react', 'react-jsx' or 'react-jsxdev'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"declaration": true, /* Generates corresponding '.d.ts' file. */
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
"sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
// "outDir": "./", /* Redirect output structure to the directory. */
Expand Down Expand Up @@ -67,5 +67,6 @@
/* Advanced Options */
"skipLibCheck": true, /* Skip type checking of declaration files. */
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
}
},
"include": ["**/*.ts"]
}

0 comments on commit 086e0ca

Please sign in to comment.