Skip to content

Commit

Permalink
Merge pull request #11 from Exabyte-io/feature/SOF-6385
Browse files Browse the repository at this point in the history
chore: update package*.json (appl-flavors)
  • Loading branch information
timurbazhirov authored Nov 11, 2022
2 parents c5ef6b3 + afcad57 commit 2b10ae1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 137 deletions.
122 changes: 3 additions & 119 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@babel/preset-react": "7.16.7",
"@babel/register": "^7.16.0",
"@babel/runtime-corejs3": "7.16.8",
"@exabyte-io/application-flavors.js": "2022.7.24-0",
"@exabyte-io/application-flavors.js": "2022.11.10-0",
"@exabyte-io/periodic-table.js": "2022.6.8-0",
"lodash": "^4.17.21",
"mixwith": "^0.1.1",
Expand Down
11 changes: 8 additions & 3 deletions src/context/providers/espresso/providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from "@exabyte-io/code.js/dist/context";
import { Made } from "@exabyte-io/made.js";
import { PERIODIC_TABLE } from "@exabyte-io/periodic-table.js";
import _ from "lodash";
import lodash from "lodash";
import { mix } from "mixwith";
import s from "underscore.string";

Expand Down Expand Up @@ -122,7 +122,9 @@ export class QEPWXContextProvider extends mix(ExecutableContextProvider).with(

static symbolToAtomicSpecie(symbol, pseudo) {
const el = PERIODIC_TABLE[symbol];
const filename = pseudo ? _.get(pseudo, "filename", s.strRightBack(pseudo.path, "/")) : "";
const filename = pseudo
? lodash.get(pseudo, "filename", s.strRightBack(pseudo.path, "/"))
: "";
return el ? s.sprintf("%s %f %s", symbol, el.atomic_mass, filename) : undefined;
}
}
Expand All @@ -146,7 +148,10 @@ export class QENEBContextProvider extends mix(ExecutableContextProvider).with(
});

return {
..._.omit(PWXContexts[0], ["ATOMIC_POSITIONS", "ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS"]),
...lodash.omit(PWXContexts[0], [
"ATOMIC_POSITIONS",
"ATOMIC_POSITIONS_WITHOUT_CONSTRAINTS",
]),
FIRST_IMAGE: PWXContexts[0].ATOMIC_POSITIONS,
LAST_IMAGE: PWXContexts[PWXContexts.length - 1].ATOMIC_POSITIONS,
INTERMEDIATE_IMAGES: PWXContexts.slice(1, PWXContexts.length - 1).map(
Expand Down
24 changes: 10 additions & 14 deletions src/executable.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import { mix } from "mixwith";
import { NamedDefaultableInMemoryEntity, RuntimeItemsMixin } from "@exabyte-io/code.js/dist/entity";
import { mix } from "mixwith";

import { Flavor } from "./flavor";

export class Executable extends mix(NamedDefaultableInMemoryEntity).with(RuntimeItemsMixin) {
static Flavor = Flavor;

constructor(config) {
super(config);
}

toJSON(exclude) {
return super.toJSON(["flavors"].concat(exclude));
}
Expand All @@ -18,18 +15,18 @@ export class Executable extends mix(NamedDefaultableInMemoryEntity).with(Runtime
}

get flavors() {
return Object.keys(this.flavorsTree).map(key => {
return this.constructor.Flavor.create(
Object.assign({}, this.flavorsTree[key], {name: key, executable: this})
);
return Object.keys(this.flavorsTree).map((key) => {
return this.constructor.Flavor.create({
...this.flavorsTree[key],
name: key,
executable: this,
});
});
}

get flavorsFromTree() {
return Object.keys(this.flavorsTree).map(key => {
return new this.constructor.Flavor(
Object.assign({}, this.flavorsTree[key], {name: key})
);
return Object.keys(this.flavorsTree).map((key) => {
return new this.constructor.Flavor({ ...this.flavorsTree[key], name: key });
});
}

Expand All @@ -44,5 +41,4 @@ export class Executable extends mix(NamedDefaultableInMemoryEntity).with(Runtime
getFlavorByConfig(config) {
return config ? this.getFlavorByName(config.name) : this.defaultFlavor;
}

}

0 comments on commit 2b10ae1

Please sign in to comment.