Skip to content

Commit

Permalink
Merge pull request #234 from behrenle/dev
Browse files Browse the repository at this point in the history
Release
  • Loading branch information
behrenle committed Nov 28, 2022
2 parents 8750cab + 4749fa6 commit 89c35ca
Show file tree
Hide file tree
Showing 116 changed files with 3,417 additions and 3,418 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/deploy-development.yml
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Build
run: |
export VITE_CALCULATOR_PROFILE=$(cat profiles/default-profile.json)
npm run build:engine && npm run build:calc
npm run build:calc
- name: Test
run: npm run test:all
- name: Configure AWS Credentials
Expand Down Expand Up @@ -93,7 +93,7 @@ jobs:
- name: Build
run: |
export VITE_CALCULATOR_PROFILE=$(cat profiles/default-profile.json)
npm run build:engine && npm run build:config
npm run build:config
- name: Test
run: npm run test:all
- name: Configure AWS Credentials
Expand Down
12 changes: 7 additions & 5 deletions .github/workflows/deploy-production.yml
Expand Up @@ -48,7 +48,9 @@ jobs:
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:engine && npm run build:calc
run: |
export VITE_CALCULATOR_PROFILE=$(cat profiles/default-profile.json)
npm run build:calc
- name: Test
run: npm run test:all
- name: Configure AWS Credentials
Expand Down Expand Up @@ -126,7 +128,7 @@ jobs:
run: npm ci
- name: Build
run: |
npm run build:engine
export VITE_CALCULATOR_PROFILE=$(cat profiles/default-profile.json)
npm run build:offline -w apps/calc/
- name: Test
run: npm run test:all
Expand All @@ -139,9 +141,9 @@ jobs:
id: vars
run: |
VERSION_NUMBER=$(node -pe "require('./package.json')['version']")
echo ::set-output name=release_tag::v$VERSION_NUMBER
echo ::set-output name=release_name::Arithmico v$VERSION_NUMBER
echo ::set-output name=release_text::"Download offline version [here](https://blob.arithmico.com/calculator/offline/$(echo $VERSION_NUMBER).zip)"
echo "release_tag=v$VERSION_NUMBER" >> $GITHUB_OUTPUT
echo "release_name=Arithmico v$VERSION_NUMBER" >> $GITHUB_OUTPUT
echo release_text="Download offline version [here](https://blob.arithmico.com/calculator/offline/$(echo $VERSION_NUMBER).zip)" >> $GITHUB_OUTPUT
- name: Create Release
id: create_release
uses: actions/create-release@v1
Expand Down
25 changes: 25 additions & 0 deletions apps/blog/public/assets/markdown/01-v1-3-changelog.md
@@ -0,0 +1,25 @@
# [v1.3] Changelog
## Neue Funktionen
- Latex Eingabe
- Auswertung von Latex-Befehl `\sqrt { ... }`
- Auswertung von Latex-Befehl `\sqrt [ ... ] { ... }`
- Auswertung von Latex-Befehl `\frac { ... } { ... }`
- Unterstützung von Strings als Eingabetyp
- Primzahlen im Intervall `prime:range(n)`
- nte Primzahl `prime:nth(n)`
- Primzahlprüfung `prime:is(n)`
- Anzahl Primzahlen im Intervall `prime:pi(n)`
- Koprimprüfung `coprime(a, b)`
- Eulersche Phifunktion `euler:phi(n)`
- größter gemeinsamer Teiler `gcd(a, b)`
- größter gemeinsamer Teiler mit erweitertem euklidischen Algorithmus `gcd:extended(a, b)`
- kleinstes gemeinsames Vielfaches `lcm(a, b)`

## Fehlerbehebungen
- falsche Reihenfolge beim Kopieren von Ein- und Ausgabe

## Weitere Optimierungen
- neue Plugin Builder API
- Parser in seperates Package ausgelagert
- Parser Language Flags
- Umstrukturierung der Plugins
3 changes: 0 additions & 3 deletions apps/blog/public/assets/markdown/01.md

This file was deleted.

3 changes: 0 additions & 3 deletions apps/blog/public/assets/markdown/02.md

This file was deleted.

4 changes: 4 additions & 0 deletions apps/blog/src/components/blog-entry/blog-entry.tsx
Expand Up @@ -56,6 +56,10 @@ const Section = styled.section`
margin: 0;
padding: 0;
}
& ul > li {
margin: 1rem 0;
}
`;

interface BlogEntryProps {
Expand Down
5 changes: 1 addition & 4 deletions apps/blog/src/entries.json
@@ -1,4 +1 @@
[
"assets/markdown/02.md",
"assets/markdown/01.md"
]
["assets/markdown/01-v1-3-changelog.md"]
3 changes: 1 addition & 2 deletions libs/engine/.gitignore
@@ -1,3 +1,2 @@
coverage/
lib/
src/parse
lib/
1 change: 0 additions & 1 deletion libs/engine/.prettierignore

This file was deleted.

7 changes: 4 additions & 3 deletions libs/engine/package.json
Expand Up @@ -4,13 +4,14 @@
"types": "lib/index.d.ts",
"type": "module",
"scripts": {
"build-parser": "node parser/build.js",
"test": "npm run build && NODE_OPTIONS=--experimental-vm-modules jest --coverage",
"install": "npm run build",
"test": "NODE_OPTIONS=--experimental-vm-modules jest",
"test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --coverage",
"lint": "eslint 'src/**/*.{js,ts,tsx}' --fix --max-warnings 0",
"pretty": "prettier 'src/**/*' --check",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"build": "rm -rf lib && npm run build-parser && npm run build:types && npm run build:js",
"build": "rm -rf lib && npm run build:types && npm run build:js",
"build:types": "tsc --emitDeclarationOnly",
"build:js": "babel src --out-dir lib --extensions \".js,.ts,.tsx\" --source-maps inline"
},
Expand Down
17 changes: 0 additions & 17 deletions libs/engine/parser/build.js

This file was deleted.

8 changes: 8 additions & 0 deletions libs/engine/src/create/create-string-node.ts
@@ -0,0 +1,8 @@
import { StringNode } from '../types/SyntaxTreeNodes';

export default function createStingNode(value: string): StringNode {
return {
type: 'string',
value,
};
}
4 changes: 4 additions & 0 deletions libs/engine/src/eval/index.ts
Expand Up @@ -19,6 +19,7 @@ import evaluateSymbol from './nodes/eval-symbol';
import evaluateTimes from './nodes/eval-times';
import evaluateVector from './nodes/eval-vector';
import evaluateDefine from './nodes/eval-define';
import evaluateString from './nodes/eval-string';

export default function evaluate(node: SyntaxTreeNode, context: Context) {
switch (node.type) {
Expand All @@ -31,6 +32,9 @@ export default function evaluate(node: SyntaxTreeNode, context: Context) {
case 'symbol':
return evaluateSymbol(node, context);

case 'string':
return evaluateString(node);

case 'or':
return evaluateOr(node, context);

Expand Down
5 changes: 5 additions & 0 deletions libs/engine/src/eval/nodes/eval-string.ts
@@ -0,0 +1,5 @@
import { StringNode, SyntaxTreeNode } from '../../types/SyntaxTreeNodes';

export default function evaluateString(node: StringNode): SyntaxTreeNode {
return node;
}
65 changes: 18 additions & 47 deletions libs/engine/src/index.ts
@@ -1,61 +1,34 @@
import { GlobalDocumentationItem } from './types/Plugin';
import { parse } from './parse/parser';
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore
import { parse } from '@arithmico/parser';
import evaluateNode from './eval';
import serialize from './serialize';
import { Context, Profile } from './types';
import trigonometryPlugin from './plugins/core/trigonometry/trigonometry';
import { insertStackObject } from './utils/context-utils';
import nsolvePlugin from './plugins/core/nsolve/nsolve';
import lsolvePlugin from './plugins/core/lsolve/lsolve';
import nintegratePlugin from './plugins/core/nintegrate/nintegrate';
import nderivePlugin from './plugins/core/nderive/nderive';
import expPlugin from './plugins/core/exp/exp';
import minmaxPlugin from './plugins/core/minmax/minmax';
import absPlugin from './plugins/core/abs/abs';
import fractionPlugin from './plugins/core/fraction/fraction';
import crossPlugin from './plugins/core/cross/cross';
import { transformEnglish2German, transformGerman2English } from './language-transform';
import statisticsPlugin from './plugins/core/statistics/statistics';
import rootsPlugin from './plugins/core/roots/roots';
import physicalConstantsPlugin from './plugins/core/physical-constants/physical-constants';
import ifThenElsePlugin from './plugins/core/if-then-else/if-then-else';
import tablePlugin from './plugins/core/table/table';
import moduloPlugin from './plugins/core/modulo/modulo';
import inverseMatrixPlugin from './plugins/core/inverse-matrix/inverse-matrix';
import load from './load';
import loadPluginStructures from './load/load-plugin-structure';
import { createProfile } from './utils/profile-utils';
import fibPlugin from './plugins/core/fibonacci/fib';
import polynomialPlugin from './plugins/core/polynomials/polynomial';
import tensorPlugin from './plugins/core/tensor/tensor-plugin';
import roundPlugin from './plugins/core/round/round-plugin';
import listmodPlugin from './plugins/core/listmod/listmod-plugin';
import analysisPlugin from './plugins/core/analysis/analysis';
import discreteMathPlugin from './plugins/core/discrete-math/discrete-math';
import numericMethodsPlugin from './plugins/core/numerics/numerics';
import physicsPlugin from './plugins/core/physics/physics';
import algebraPlugin from './plugins/core/algebra/algebra';

export { serializeStack } from './utils/context-utils';

const plugins = [
trigonometryPlugin,
expPlugin,
nsolvePlugin,
lsolvePlugin,
nintegratePlugin,
nderivePlugin,
minmaxPlugin,
absPlugin,
fractionPlugin,
crossPlugin,
statisticsPlugin,
rootsPlugin,
physicalConstantsPlugin,
ifThenElsePlugin,
tablePlugin,
moduloPlugin,
inverseMatrixPlugin,
fibPlugin,
polynomialPlugin,
tensorPlugin,
roundPlugin,
listmodPlugin,
analysisPlugin,
discreteMathPlugin,
numericMethodsPlugin,
physicsPlugin,
algebraPlugin,
];

let defaultContext: Context;
Expand Down Expand Up @@ -109,11 +82,9 @@ export default function evaluate(input: string, context: Context = defaultContex
let nodeTree;

try {
if (context.options.decimalSeparator === ',') {
nodeTree = parse(transformGerman2English(input));
} else {
nodeTree = parse(input);
}
nodeTree = parse(input, {
language: context.options.decimalSeparator === ',' ? 'de' : 'en',
});
} catch (syntaxError) {
throw syntaxError.message;
}
Expand All @@ -124,13 +95,13 @@ export default function evaluate(input: string, context: Context = defaultContex
if (result.type === 'define') {
const value = result.value;
return {
result: context.options.decimalSeparator === ',' ? transformEnglish2German(resultString) : resultString,
result: resultString,
context: insertStackObject(result.name, value, context),
};
}

return {
result: context.options.decimalSeparator === ',' ? transformEnglish2German(resultString) : resultString,
result: resultString,
context,
};
}
13 changes: 0 additions & 13 deletions libs/engine/src/language-transform.ts

This file was deleted.

56 changes: 0 additions & 56 deletions libs/engine/src/plugins/core/abs/abs.ts

This file was deleted.

0 comments on commit 89c35ca

Please sign in to comment.