Skip to content

Commit

Permalink
Merge pull request #49 from waldiez/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
lazToum authored Dec 3, 2024
2 parents cd10427 + fafc781 commit ae3b560
Show file tree
Hide file tree
Showing 12 changed files with 648 additions and 262 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
- name: Lint
run: yarn lint
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
Expand All @@ -47,6 +50,7 @@ jobs:
run: yarn test:all
- name: Report to Coveralls
uses: coverallsapp/github-action@v2
if: matrix.os == 'ubuntu-latest'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: coverage/lcov.info
Expand Down
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"CODEOWNERS",
"combobox",
"compat",
"coverallsapp",
"csstree",
"dropzone",
"errorboundary",
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## [Unreleased]

## v0.1.16

- Dependency updates
- Removed unnecessary console logs

## v0.1.15

- Dependency updates
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ This project is a React application managed using yarn. To contribute, follow th
Ensure you have the following installed:

- Node.js (version 20.x or later)
- [email protected].1
- [email protected].3

### Installation

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="%BASE_URL%logo.svg" />
<link rel=”mask-icon” href="%BASE_URL%logo.svg" color="#00000000" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self' data:; connect-src 'self';" />
<meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'self' 'unsafe-inline'; worker-src 'self' blob:; script-src 'self'; font-src 'self'; img-src 'self' data:; connect-src 'self';" />
<title>Waldiez</title>
</head>
<body>
Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@waldiez/react",
"license": "MIT",
"version": "0.1.15",
"version": "0.1.16",
"type": "module",
"main": "./dist/@waldiez.umd.cjs",
"module": "./dist/@waldiez.js",
Expand Down Expand Up @@ -74,7 +74,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-error-boundary": "^4.1.2",
"react-icons": "^5.3.0",
"react-icons": "^5.4.0",
"react-select": "^5.8.3",
"zundo": "^2.3.0",
"zustand": "^5.0.1"
Expand All @@ -94,21 +94,22 @@
"@types/react": "^18.3.12",
"@types/react-dom": "^18.3.1",
"@types/tar-stream": "^3.1.3",
"@typescript-eslint/eslint-plugin": "^8.16.0",
"@typescript-eslint/parser": "^8.16.0",
"@typescript-eslint/eslint-plugin": "^8.17.0",
"@typescript-eslint/parser": "^8.17.0",
"@vitejs/plugin-react": "^4.3.4",
"@vitest/browser": "^2.1.6",
"@vitest/coverage-v8": "^2.1.6",
"@vitest/ui": "^2.1.6",
"@vitest/browser": "^2.1.8",
"@vitest/coverage-v8": "^2.1.8",
"@vitest/ui": "^2.1.8",
"ajv": "^8.17.1",
"dotenv": "^16.4.5",
"dotenv": "^16.4.6",
"eslint": "^9.16.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.3",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-react-refresh": "^0.4.14",
"eslint-plugin-react-refresh": "^0.4.16",
"eslint-plugin-tsdoc": "^0.4.0",
"fs-extra": "^11.2.0",
"gunzip-maybe": "^1.4.2",
"jsdom": "^25.0.1",
"lookpath": "^1.2.2",
Expand All @@ -128,11 +129,11 @@
"tsx": "^4.19.2",
"typedoc": "^0.27.2",
"typescript": "^5.7.2",
"typescript-eslint": "^8.16.0",
"vite": "^6.0.1",
"typescript-eslint": "^8.17.0",
"vite": "^6.0.2",
"vite-plugin-dts": "^4.3.0",
"vite-plugin-externalize-deps": "^0.8.0",
"vitest": "^2.1.6",
"vitest": "^2.1.8",
"vitest-browser-react": "^0.0.4"
},
"prettier": {
Expand Down
2 changes: 1 addition & 1 deletion schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "https://github.com/waldiez/react/tree/v0.1.15/schema.json",
"$id": "https://github.com/waldiez/react/tree/v0.1.16/schema.json",
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
Expand Down
74 changes: 64 additions & 10 deletions scripts/monaco.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// ensure monaco loader files are present in the public folder (public/vs)
import crypto from 'crypto';
import fs from 'fs';
import fs from 'fs-extra';
import https from 'https';
import path from 'path';
import tar from 'tar-stream';
Expand Down Expand Up @@ -59,16 +59,29 @@ function extractTarFile(file: string, dest: string): Promise<void> {
});
}

function keepOnlyMinVs(dir: string): void {
function keepOnlyMinVs(dir: string): Promise<void> {
const packageDir = path.join(dir, 'package');
const minVsDir = path.join(packageDir, 'min', 'vs');
const destDir = path.join(dir, 'vs');
if (fs.existsSync(minVsDir)) {
if (fs.existsSync(destDir)) {
fs.rmSync(destDir, { recursive: true });
fs.rmSync(destDir, { recursive: true, force: true });
}
fs.renameSync(minVsDir, destDir);
fs.rmSync(packageDir, { recursive: true });
return new Promise((resolve, reject) => {
// fs.rmSync gives Error: ENOTEMPTY: directory not empty
// fs.rmSync(packageDir, { recursive: true, force: true, maxRetries: 3 });
fs.promises
.rm(packageDir, { recursive: true })
.then(() => {
resolve();
})
.catch(err => {
reject(err);
});
});
} else {
return Promise.resolve();
}
}

Expand All @@ -95,6 +108,40 @@ function findLatestVersion(): Promise<[string, string, string]> {
});
}

// eslint-disable-next-line max-statements
function removeUnneededFiles(dir: string): void {
// only keep python for language, remove
const rootDir = path.join(dir, 'vs');
const basicLanguagesDir = path.join(rootDir, 'basic-languages');
const basicLanguages = fs.readdirSync(basicLanguagesDir);
for (const language of basicLanguages) {
if (language !== 'python') {
fs.rmSync(path.join(basicLanguagesDir, language), {
recursive: true,
force: true
});
}
}
const rootFiles = fs.readdirSync(rootDir);
for (const entry of rootFiles) {
// remove all files except loader.js, keep folders
if (entry === 'loader.js') {
continue;
}
const entryPath = path.join(rootDir, entry);
const stat = fs.statSync(entryPath);
if (stat.isFile()) {
fs.rmSync(entryPath, { force: true });
}
if (entry === 'language' && stat.isDirectory()) {
fs.rmSync(path.join(rootDir, 'language'), {
recursive: true,
force: true
});
}
}
}

function handleDownload(
tempDir: string,
tempFile: string,
Expand All @@ -107,12 +154,19 @@ function handleDownload(
if (isValid) {
extractTarFile(tempFile, publicPath)
.then(() => {
keepOnlyMinVs(publicPath);
fs.unlinkSync(tempFile);
fs.rmSync(tempDir, {
recursive: true
});
resolve();
keepOnlyMinVs(publicPath)
.then(() => {
removeUnneededFiles(publicPath);
fs.unlinkSync(tempFile);
fs.rmSync(tempDir, {
recursive: true,
force: true
});
resolve();
})
.catch(err => {
reject(err);
});
})
.catch(err => {
reject(err);
Expand Down
1 change: 0 additions & 1 deletion src/waldiez/store/nodes/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class NodesStore {
// first, make sure there is no `<dialog .. open>` in the flow
const openDialogs = document.querySelectorAll('dialog[open]');
if (openDialogs.length > 0) {
console.log('openDialogs', Array.from(openDialogs));
return;
}
const flowRoot = getFlowRoot(flowId);
Expand Down
12 changes: 6 additions & 6 deletions tests/browser/__snapshots__/waldiez.test.tsx.snap
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ exports[`All > should render Waldiez components 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M320 0c17.7 0 32 14.3 32 32V96H472c39.8 0 72 32.2 72 72V440c0 39.8-32.2 72-72 72H168c-39.8 0-72-32.2-72-72V168c0-39.8 32.2-72 72-72H288V32c0-17.7 14.3-32 32-32zM208 384c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16H208zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16H304zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16H400zM264 256a40 40 0 1 0 -80 0 40 40 0 1 0 80 0zm152 40a40 40 0 1 0 0-80 40 40 0 1 0 0 80zM48 224H64V416H48c-26.5 0-48-21.5-48-48V272c0-26.5 21.5-48 48-48zm544 0c26.5 0 48 21.5 48 48v96c0 26.5-21.5 48-48 48H576V224h16z"
d="M320 0c17.7 0 32 14.3 32 32l0 64 120 0c39.8 0 72 32.2 72 72l0 272c0 39.8-32.2 72-72 72l-304 0c-39.8 0-72-32.2-72-72l0-272c0-39.8 32.2-72 72-72l120 0 0-64c0-17.7 14.3-32 32-32zM208 384c-8.8 0-16 7.2-16 16s7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0zM264 256a40 40 0 1 0 -80 0 40 40 0 1 0 80 0zm152 40a40 40 0 1 0 0-80 40 40 0 1 0 0 80zM48 224l16 0 0 192-16 0c-26.5 0-48-21.5-48-48l0-96c0-26.5 21.5-48 48-48zm544 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-16 0 0-192 16 0z"
/>
</svg>
Agents
Expand Down Expand Up @@ -193,7 +193,7 @@ exports[`All > should render Waldiez components 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M128 64c0-35.3 28.7-64 64-64H352V128c0 17.7 14.3 32 32 32H512V448c0 35.3-28.7 64-64 64H192c-35.3 0-64-28.7-64-64V336H302.1l-39 39c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l39 39H128V64zm0 224v48H24c-13.3 0-24-10.7-24-24s10.7-24 24-24H128zM512 128H384V0L512 128z"
d="M128 64c0-35.3 28.7-64 64-64L352 0l0 128c0 17.7 14.3 32 32 32l128 0 0 288c0 35.3-28.7 64-64 64l-256 0c-35.3 0-64-28.7-64-64l0-112 174.1 0-39 39c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l39 39L128 288l0-224zm0 224l0 48L24 336c-13.3 0-24-10.7-24-24s10.7-24 24-24l104 0zM512 128l-128 0L384 0 512 128z"
/>
</svg>
Import
Expand All @@ -214,7 +214,7 @@ exports[`All > should render Waldiez components 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V288H216c-13.3 0-24 10.7-24 24s10.7 24 24 24H384V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM384 336V288H494.1l-39-39c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l80 80c9.4 9.4 9.4 24.6 0 33.9l-80 80c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l39-39H384zm0-208H256V0L384 128z"
d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 128-168 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l168 0 0 112c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zM384 336l0-48 110.1 0-39-39c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l80 80c9.4 9.4 9.4 24.6 0 33.9l-80 80c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l39-39L384 336zm0-208l-128 0L256 0 384 128z"
/>
</svg>
Export
Expand Down Expand Up @@ -566,7 +566,7 @@ exports[`All > should render Waldiez components 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M320 0c17.7 0 32 14.3 32 32V96H472c39.8 0 72 32.2 72 72V440c0 39.8-32.2 72-72 72H168c-39.8 0-72-32.2-72-72V168c0-39.8 32.2-72 72-72H288V32c0-17.7 14.3-32 32-32zM208 384c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16H208zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16H304zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16h32c8.8 0 16-7.2 16-16s-7.2-16-16-16H400zM264 256a40 40 0 1 0 -80 0 40 40 0 1 0 80 0zm152 40a40 40 0 1 0 0-80 40 40 0 1 0 0 80zM48 224H64V416H48c-26.5 0-48-21.5-48-48V272c0-26.5 21.5-48 48-48zm544 0c26.5 0 48 21.5 48 48v96c0 26.5-21.5 48-48 48H576V224h16z"
d="M320 0c17.7 0 32 14.3 32 32l0 64 120 0c39.8 0 72 32.2 72 72l0 272c0 39.8-32.2 72-72 72l-304 0c-39.8 0-72-32.2-72-72l0-272c0-39.8 32.2-72 72-72l120 0 0-64c0-17.7 14.3-32 32-32zM208 384c-8.8 0-16 7.2-16 16s7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0zm96 0c-8.8 0-16 7.2-16 16s7.2 16 16 16l32 0c8.8 0 16-7.2 16-16s-7.2-16-16-16l-32 0zM264 256a40 40 0 1 0 -80 0 40 40 0 1 0 80 0zm152 40a40 40 0 1 0 0-80 40 40 0 1 0 0 80zM48 224l16 0 0 192-16 0c-26.5 0-48-21.5-48-48l0-96c0-26.5 21.5-48 48-48zm544 0c26.5 0 48 21.5 48 48l0 96c0 26.5-21.5 48-48 48l-16 0 0-192 16 0z"
/>
</svg>
Agents
Expand Down Expand Up @@ -677,7 +677,7 @@ exports[`All > should render Waldiez components 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M128 64c0-35.3 28.7-64 64-64H352V128c0 17.7 14.3 32 32 32H512V448c0 35.3-28.7 64-64 64H192c-35.3 0-64-28.7-64-64V336H302.1l-39 39c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l39 39H128V64zm0 224v48H24c-13.3 0-24-10.7-24-24s10.7-24 24-24H128zM512 128H384V0L512 128z"
d="M128 64c0-35.3 28.7-64 64-64L352 0l0 128c0 17.7 14.3 32 32 32l128 0 0 288c0 35.3-28.7 64-64 64l-256 0c-35.3 0-64-28.7-64-64l0-112 174.1 0-39 39c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l80-80c9.4-9.4 9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0s-9.4 24.6 0 33.9l39 39L128 288l0-224zm0 224l0 48L24 336c-13.3 0-24-10.7-24-24s10.7-24 24-24l104 0zM512 128l-128 0L384 0 512 128z"
/>
</svg>
Import
Expand All @@ -698,7 +698,7 @@ exports[`All > should render Waldiez components 1`] = `
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M0 64C0 28.7 28.7 0 64 0H224V128c0 17.7 14.3 32 32 32H384V288H216c-13.3 0-24 10.7-24 24s10.7 24 24 24H384V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V64zM384 336V288H494.1l-39-39c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l80 80c9.4 9.4 9.4 24.6 0 33.9l-80 80c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l39-39H384zm0-208H256V0L384 128z"
d="M0 64C0 28.7 28.7 0 64 0L224 0l0 128c0 17.7 14.3 32 32 32l128 0 0 128-168 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l168 0 0 112c0 35.3-28.7 64-64 64L64 512c-35.3 0-64-28.7-64-64L0 64zM384 336l0-48 110.1 0-39-39c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l80 80c9.4 9.4 9.4 24.6 0 33.9l-80 80c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l39-39L384 336zm0-208l-128 0L256 0 384 128z"
/>
</svg>
Export
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export default defineConfig(({ command }) => ({
environment: 'jsdom',
coverage: {
provider: 'v8',
reporter: ['lcov', 'text', 'json', 'html'],
reporter: ['lcov', 'text', 'text-summary', 'html'],
include: ['src/**/*'],
exclude: ['**/types.ts'],
ignoreEmptyLines: true,
Expand Down
Loading

0 comments on commit ae3b560

Please sign in to comment.