Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor automaton + refactor file loading + add example projects + add recent projects #99

Merged
merged 56 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
abe0fc1
WIP refactor automaton
atjn Nov 8, 2023
27e4c7e
Reorder exports
atjn Nov 8, 2023
d2ec368
Format
atjn Nov 8, 2023
b0561ca
Merge branch 'main' into automaton-refactor
atjn Nov 9, 2023
7db0c74
Fixes
atjn Nov 13, 2023
a33e1b5
Merge branch 'main' into automaton-refactor
atjn Nov 13, 2023
c40f780
Fix merge
atjn Nov 13, 2023
ef580de
Merge branch 'main' into automaton-refactor
atjn Nov 13, 2023
f9aa453
Plumb the new automaton into components
atjn Nov 13, 2023
8f702d9
Minor fix fix
atjn Nov 13, 2023
21262f7
More plumbing
atjn Nov 13, 2023
78f421f
Plumbing lintings
atjn Nov 13, 2023
0dfa9b9
Merge branch 'main' into automaton-refactor
atjn Nov 16, 2023
42d1f03
fs load and save
TSKsmiley Nov 20, 2023
30f8233
Fix file adapter instantiation
TSKsmiley Nov 20, 2023
dad5c7f
Fix file adapter implementation
TSKsmiley Nov 20, 2023
8dd9a02
Refactor file adapter classes
TSKsmiley Nov 20, 2023
a75739d
Merge branch 'main' into automaton-refactor
atjn Nov 20, 2023
f932049
Refactor fileAdapter imports and add console log
TSKsmiley Nov 20, 2023
16e320f
Fix FileAdapter
atjn Nov 21, 2023
61532ac
Streamline automata
atjn Nov 21, 2023
7f8d87a
lintings
atjn Nov 21, 2023
b0b9899
Merge branch 'main' into automaton-refactor
atjn Nov 22, 2023
055f4cd
new file system fallback
TSKsmiley Nov 22, 2023
e2cea72
code clean up
TSKsmiley Nov 22, 2023
ceeecb0
Saving not supported error in browser
TSKsmiley Nov 23, 2023
99ec3b5
Minor automaton fixes
atjn Nov 27, 2023
5ae5e74
Improve filesystem adapters
atjn Nov 27, 2023
2ca0043
Add project examples
atjn Nov 27, 2023
652bbb3
Use file adapters in frontend
atjn Nov 27, 2023
c4bb532
Smol fix
atjn Nov 27, 2023
d98a6ed
Merge branch 'main' into automaton-refactor
atjn Nov 27, 2023
1c4dac4
Merge fix
atjn Nov 27, 2023
2db034d
submodule
TSKsmiley Nov 27, 2023
e8a85bd
Fix linting
atjn Nov 27, 2023
feda581
fix fix
atjn Nov 27, 2023
c77fad8
Remove legacy code
atjn Nov 27, 2023
f86f513
Fix type warnings in idmap
atjn Nov 27, 2023
fc367e3
Explain some regexes
atjn Nov 27, 2023
e7e60dd
Remove unnecessary raw constraint
atjn Nov 27, 2023
23e8530
Add constraint on Id input type
atjn Nov 27, 2023
a8d3b9b
Deal with undefined rawLocation
atjn Nov 27, 2023
d8565ea
lint
atjn Nov 27, 2023
a51cacb
Fix array instantiation issue
atjn Nov 29, 2023
6b02273
Fix automaton tests
atjn Nov 29, 2023
76190bb
Fix recent project type incompatibility
atjn Nov 29, 2023
a33972a
Fix lint
atjn Nov 29, 2023
dfb987c
Fixed-Testing
TSKsmiley Nov 29, 2023
d9d31ee
Merge branch 'automaton-refactor' of github.com:ECDAR-AAU-SW-P5/Ecdar…
TSKsmiley Nov 29, 2023
06f11c3
Fix unit test
atjn Nov 29, 2023
aaeddbe
Add todo's
atjn Nov 29, 2023
32d90e8
Make submodule more accessible
atjn Nov 29, 2023
b7f1229
updated to latest lts
TSKsmiley Nov 29, 2023
1ce284d
yarn does this by default
TSKsmiley Nov 29, 2023
d20ff44
changed minimum version to 20.x.x
TSKsmiley Nov 29, 2023
65207d1
Resolve review issues
atjn Nov 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
node_modules
/Ecdar-Common
/build
/.svelte-kit
/package
Expand Down
8 changes: 8 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,12 @@ module.exports = {
},
},
],
rules: {
// TODO: Enable this rule in the future. Production code should not output to console.
//"no-console": "error",
"@typescript-eslint/no-invalid-void-type": [
atjn marked this conversation as resolved.
Show resolved Hide resolved
"error",
{ allowAsThisParameter: true },
],
},
};
5 changes: 5 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand All @@ -32,5 +34,8 @@ jobs:
- name: Install dependencies
run: yarn install

- name: Build site
run: yarn build

- name: Run lint
run: yarn lint
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true

- name: Set up Node ${{ matrix.node-version }}
uses: actions/setup-node@v3
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ yarn-error.log
vite.config.js.timestamp-*
vite.config.ts.timestamp-*

#### Project examples ###
/src/lib/projectExamples.ts
/src/lib/projectExamples

### macOS ###
*.DS_Store
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Ecdar-Common"]
path = Ecdar-Common
url = https://github.com/ECDAR-AAU-SW-P5/Ecdar-Common.git
2 changes: 0 additions & 2 deletions .npmrc

This file was deleted.

1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.DS_Store
node_modules
/Ecdar-Common
/build
/.svelte-kit
/package
Expand Down
1 change: 1 addition & 0 deletions Ecdar-Common
Submodule Ecdar-Common added at 3a88b1
81 changes: 81 additions & 0 deletions bundleProjectExamples.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import fs from "fs-extra";
import path from "node:path";
import { resolveConfig, format } from "prettier";
import type { RawProject } from "./src/lib/classes/automaton/raw/RawProject";
import { DirectoryHandleNodejs } from "./src/lib/classes/fileSystem/FileSystemNodejs";
import { FileStructureProject } from "./src/lib/classes/projectHandler/FileStructure";
import { serializeRaw } from "./src/lib/classes/projectHandler/zodSerializers";

const sourcePath = "./Ecdar-Common/Project-Examples/examples/";
const bundlePath = "./src/lib/projectExamples";

export const bundleProjectExamples = {
name: "Bundle project examples",
async buildStart() {
try {
await fs.emptyDir(bundlePath);
await fs.remove(`${bundlePath}.ts`);
} catch (error) {
throw new Error(
`Could not remove old project example bundle: ${
(error as Error).message
}`,
);
}
const projects: RawProject[] = [];
try {
const projectNames = await fs.readdir(sourcePath);
await Promise.all(
projectNames.map(async (name) => {
const directoryHandle = new DirectoryHandleNodejs(
name,
path.join(sourcePath, name),
);
const project = await new FileStructureProject().toRaw(
directoryHandle,
);
project.name = name;
projects.push(project);
}),
);
} catch (error) {
throw new Error(
`Could not load project examples: ${(error as Error).message}`,
);
}

try {
projects.sort((a, b): number =>
(a.name ?? "").localeCompare(b.name ?? "", "en"),
);
for (const project of projects) {
const filepath = path.join(bundlePath, `${project.name}.ts`);
const projectCode = `export default ${serializeRaw(project)}`;
await fs.writeFile(filepath, projectCode);
}

let projectsCode = `export const projectExamples = {`;
for (const project of projects) {
projectsCode += `"${project.name}": async () => {return (await import("./projectExamples/${project.name}")).default},`;
}
projectsCode += `}`;
const filepath = `${bundlePath}.ts`;
const prettierConfig = await resolveConfig(filepath, {
editorconfig: true,
});
projectsCode = await format(projectsCode, {
filepath,
...prettierConfig,
});

await fs.writeFile(filepath, projectsCode);
} catch (error) {
throw new Error(
`Writing project example bundle to lib: ${
(error as Error).message
}`,
);
}
console.log("✔ bundled project examples");
},
};
113 changes: 0 additions & 113 deletions examples/AGTest/Components/A_Good.json

This file was deleted.

113 changes: 0 additions & 113 deletions examples/AGTest/Components/G.json

This file was deleted.

Loading