Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
lazToum committed Dec 23, 2024
1 parent 6cb6e5d commit 9979a5b
Show file tree
Hide file tree
Showing 8 changed files with 117 additions and 111 deletions.
9 changes: 5 additions & 4 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ labels: bug
---

<!-- markdownlint-disable MD041 -->

## Search terms

<!-- Include keywords that might help others with the same problem find this issue -->
Expand All @@ -24,8 +25,8 @@ labels: bug
## Environment

- Versions:
- @waldiez/react version:
- Node.js version:
- TypeScript version:
- ... Other related packages versions ...
- @waldiez/react version:
- Node.js version:
- TypeScript version:
- ... Other related packages versions ...
- OS:
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ labels: enhancement
---

<!-- markdownlint-disable MD041 -->

## Search Terms

<!-- Include keywords that might help others with the same problem find this issue -->
Expand Down
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ labels: question
---

<!-- markdownlint-disable MD041 -->

## Search terms

<!-- Include keywords that might help others with the same question find this issue -->
Expand Down
76 changes: 38 additions & 38 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,45 @@ name: Lint and test

# yamllint disable rule:truthy
on:
push:
branches:
- main
- dev
push:
branches:
- main
- dev

permissions:
contents: write
pages: write
id-token: write
contents: write
pages: write
id-token: write

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Lint
run: bun run lint
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Prepare Playwright
run: npx playwright install --with-deps chromium
- name: Run tests
run: bun run test
- 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
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Lint
run: bun run lint
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Setup bun
uses: oven-sh/setup-bun@v2
- name: Install dependencies
run: bun install
- name: Prepare Playwright
run: npx playwright install --with-deps chromium
- name: Run tests
run: bun run test
- 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
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
## v0.1.20

- Added optional props:
- onSave (listens for 'ctrl+s/mod+s' keypress)
- onConvert: adds two icons (python,jupyter) to the panel
- onSave (listens for 'ctrl+s/mod+s' keypress)
- onConvert: adds two icons (python,jupyter) to the panel
- Updated context: Make the flow view re-render if the flowId changes
- Added typings for 'importFlow'
- Updated react-select to 5.9.0
Expand Down
22 changes: 11 additions & 11 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ diverse, inclusive, and healthy community.
Examples of behavior that contributes to a positive environment for our
community include:

* Demonstrating empathy and kindness toward other people
* Being respectful of differing opinions, viewpoints, and experiences
* Giving and gracefully accepting constructive feedback
* Accepting responsibility and apologizing to those affected by our mistakes,
- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes,
and learning from the experience
* Focusing on what is best not just for us as individuals, but for the
- Focusing on what is best not just for us as individuals, but for the
overall community

Examples of unacceptable behavior include:

* The use of sexualized language or imagery, and sexual attention or
- The use of sexualized language or imagery, and sexual attention or
advances of any kind
* Trolling, insulting or derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or email
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email
address, without their explicit permission
* Other conduct which could reasonably be considered inappropriate in a
- Other conduct which could reasonably be considered inappropriate in a
professional setting

## Enforcement Responsibilities
Expand Down Expand Up @@ -106,7 +106,7 @@ Violating these terms may lead to a permanent ban.
### 4. Permanent Ban

**Community Impact**: Demonstrating a pattern of violation of community
standards, including sustained inappropriate behavior, harassment of an
standards, including sustained inappropriate behavior, harassment of an
individual, or aggression toward or disparagement of classes of individuals.

**Consequence**: A permanent ban from any sort of public interaction within
Expand Down
108 changes: 54 additions & 54 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,31 +21,31 @@ bun add @waldiez/react

```json
{
"@monaco-editor/react": "^4.6.0",
"@xyflow/react": "^12.3.6",
"microdiff": "^1.4.0",
"nanoid": "^5.0.9",
"rc-slider": "^11.1.7",
"react": "^18.3.1 || ^19.0.0",
"react-dom": "^18.3.1 || ^19.0.0",
"react-error-boundary": "^4.1.2",
"react-hotkeys-hook": "^4.6.1",
"react-icons": "^5.4.0",
"react-select": "^5.9.0",
"zundo": "^2.3.0",
"zustand": "^5.0.2"
"@monaco-editor/react": "^4.6.0",
"@xyflow/react": "^12.3.6",
"microdiff": "^1.4.0",
"nanoid": "^5.0.9",
"rc-slider": "^11.1.7",
"react": "^18.3.1 || ^19.0.0",
"react-dom": "^18.3.1 || ^19.0.0",
"react-error-boundary": "^4.1.2",
"react-hotkeys-hook": "^4.6.1",
"react-icons": "^5.4.0",
"react-select": "^5.9.0",
"zundo": "^2.3.0",
"zustand": "^5.0.2"
}
```

## Usage

```tsx
// npm|yarn|pnpm|bun|whatever add|install @waldiez/react
import React from 'react';
import ReactDOM from 'react-dom/client';
import React from "react";
import ReactDOM from "react-dom/client";

import { Waldiez } from '@waldiez/react';
import '@waldiez/react/dist/@waldiez.css';
import { Waldiez } from "@waldiez/react";
import "@waldiez/react/dist/@waldiez.css";

const isProd = import.meta.env.PROD;

Expand All @@ -67,7 +67,7 @@ const onChange = null;
* the action should be handled by the parent component
*/
const onSaveDev = (flowString: string) => {
console.info('saving', flowString);
console.info("saving", flowString);
};
const onSave = isProd ? null : onSaveDev;
/**
Expand Down Expand Up @@ -109,7 +109,7 @@ const onUserInput = null;
* the flow string is the JSON stringified flow
*/
const onRunDev = (flowString: string) => {
console.info(flowString);
console.info(flowString);
};
const onRun = isProd ? null : onRunDev;

Expand All @@ -122,8 +122,8 @@ const onRun = isProd ? null : onRunDev;
* the conversion happens in the python part / backend
*/

const onConvertDev = (_flowString: string, to: 'py' | 'ipynb') => {
console.info('converting to', to);
const onConvertDev = (_flowString: string, to: "py" | "ipynb") => {
console.info("converting to", to);
};
const onConvert = isProd ? null : onConvertDev;

Expand All @@ -138,21 +138,21 @@ const onConvert = isProd ? null : onConvertDev;
* (the docsPath will have to be updated accordingly if needed on the backend)
*/
const onUploadDev = (files: File[]) => {
return new Promise<string[]>(resolve => {
const uploadedFiles: string[] = [];
const promises = files.map(file => {
// simulate uploading files
return new Promise<string>(resolve => {
setTimeout(() => {
uploadedFiles.push(`path/to/${file.name}`);
resolve(`path/to/${file.name}`);
}, 2000);
});
return new Promise<string[]>(resolve => {
const uploadedFiles: string[] = [];
const promises = files.map(file => {
// simulate uploading files
return new Promise<string>(resolve => {
setTimeout(() => {
uploadedFiles.push(`path/to/${file.name}`);
resolve(`path/to/${file.name}`);
}, 2000);
});
});
Promise.all(promises).then(() => {
resolve(uploadedFiles);
});
});
Promise.all(promises).then(() => {
resolve(uploadedFiles);
});
});
};
const onUpload = isProd ? null : onUploadDev;

Expand All @@ -164,10 +164,10 @@ const onUpload = isProd ? null : onUploadDev;
// either served and `VITE_VS_PATH` is set to the path, or
// use the default cdn (jsdelivr) that monaco loader uses
// make sure the csp allows the cdn
let vsPath = !isProd ? 'vs' : (import.meta.env.VITE_VS_PATH ?? null);
let vsPath = !isProd ? "vs" : (import.meta.env.VITE_VS_PATH ?? null);
if (!vsPath) {
// if set to empty string, make it null
vsPath = null;
// if set to empty string, make it null
vsPath = null;
}
/**
* Other props:
Expand All @@ -186,22 +186,22 @@ if (!vsPath) {
*/

const startApp = () => {
ReactDOM.createRoot(document.getElementById('root')!).render(
<React.StrictMode>
<Waldiez
monacoVsPath={vsPath}
onUserInput={onUserInput}
flowId="flow-0"
storageId="storage-0"
inputPrompt={inputPrompt}
onRun={onRun}
onConvert={onConvert}
onChange={onChange}
onUpload={onUpload}
onSave={onSave}
/>
</React.StrictMode>
);
ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<Waldiez
monacoVsPath={vsPath}
onUserInput={onUserInput}
flowId="flow-0"
storageId="storage-0"
inputPrompt={inputPrompt}
onRun={onRun}
onConvert={onConvert}
onChange={onChange}
onUpload={onUpload}
onSave={onSave}
/>
</React.StrictMode>,
);
};

startApp();
Expand Down
7 changes: 5 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="%BASE_URL%logo.svg" />
<link rel=”mask-icon” href="%BASE_URL%logo.svg" color="#00000000" />
<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'; worker-src 'self' blob:; script-src 'self'; font-src 'self'; img-src 'self' data:; connect-src *; worker-src 'self' blob:;" />
<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 *; worker-src 'self' blob:;"
/>
<title>Waldiez</title>
</head>
<body>
Expand Down

0 comments on commit 9979a5b

Please sign in to comment.