Skip to content

Commit 17cd104

Browse files
feat: added the whole codebase after re-write
0 parents  commit 17cd104

File tree

160 files changed

+21300
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

160 files changed

+21300
-0
lines changed

.dockerignore

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules

.eslintrc.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const tsconfig = require("./tsconfig.node.json");
2+
require("ts-node").register(tsconfig);
3+
const { default: config } = require("./eslintrc.ts");
4+
5+
module.exports = config;

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @borys-malinowski @KrzysztofZawisla @ShootGan
+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Bug Report
2+
description: File a bug report
3+
title: "[Bug]: "
4+
labels: ["bug", "triage"]
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: |
9+
Thanks for taking the time to fill out this bug report!
10+
- type: textarea
11+
id: what-happened
12+
attributes:
13+
label: What happened?
14+
description: Also tell us, what did you expect to happen?
15+
placeholder: Tell us what you see!
16+
value: "A bug happened!"
17+
validations:
18+
required: true
19+
- type: input
20+
id: contact
21+
attributes:
22+
label: Version
23+
description: What version you use?
24+
placeholder: ex. 1.0.0
25+
validations:
26+
required: true
27+
- type: textarea
28+
id: logs
29+
attributes:
30+
label: Relevant log output
31+
description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks.
32+
render: shell
33+
- type: textarea
34+
id: how-to-reproduce
35+
attributes:
36+
label: How to reproduce?
37+
description: Tell us how to reproduce this issue.
38+
placeholder: What are you clicking!
39+
value: "Click chrome.exe"
40+
- type: checkboxes
41+
id: terms
42+
attributes:
43+
label: Code of Conduct
44+
description: By submitting this issue, you agree to follow our Code of Conduct
45+
options:
46+
- label: "I agree to follow this project's Code of Conduct"
47+
required: true

.github/dependabot.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "npm"
4+
directory: "/"
5+
open-pull-requests-limit: 1000
6+
schedule:
7+
interval: "daily"
8+
target-branch: "development"

.github/worflows/deploy.yaml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy PyScriptReact
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout repository
12+
uses: actions/checkout@v3
13+
14+
- name: Setup Node
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: "lts/*"
18+
registry-url: "https://registry.npmjs.org"
19+
20+
- name: Install dependencies
21+
run: yarn --ignore-engines
22+
23+
- name: Run tests
24+
run: yarn run test
25+
26+
- name: Build project
27+
run: yarn run build --target npm
28+
29+
- name: Create zip lib
30+
uses: vimtor/action-zip@v1
31+
with:
32+
files: library/
33+
dest: pyscript-react.zip
34+
35+
- name: Get current tag
36+
run: |
37+
echo "current_tag=v`grep version package.json | sed 's/.*"version": "\(.*\)".*/\1/'`" >> $GITHUB_ENV
38+
39+
- name: Create new tag
40+
uses: rickstaa/action-create-tag@v1
41+
id: "tag_create"
42+
with:
43+
tag: "${{ env.current_tag }}"
44+
tag_exists_error: true
45+
message: "Latest release"
46+
47+
- name: Create GitHub realese
48+
uses: "marvinpinto/action-automatic-releases@latest"
49+
with:
50+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
51+
automatic_release_tag: "${{ env.current_tag }}"
52+
prerelease: false
53+
files: |
54+
LICENSE.txt
55+
pyscript-react.zip
56+
57+
- name: Publish to npm 🚀
58+
run: yarn publish
59+
env:
60+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules
2+
tsconfig.tsbuildinfo
3+
yarn-error.log
4+
coverage
5+
.docusaurus
6+
bundle-analyzes
7+
library/
8+
.webpackCache/
9+
!source/library/

.husky/post-merge

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn --ignore-engines

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
yarn run lint && yarn run test

.prettierignore

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
destination/
2+
yarn.lock
3+
.husky/
4+
bundle-analyzes/
5+
coverage/

.prettierrc.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "all",
4+
"singleQuote": false,
5+
"printWidth": 80,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"bracketSpacing": true,
9+
"endOfLine": "auto"
10+
}

.storybook/main.ts

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import type { StorybookConfig } from "@storybook/core-common";
2+
3+
type Config = StorybookConfig & {
4+
docs: {
5+
autodocs: boolean;
6+
};
7+
};
8+
9+
const config: Config = {
10+
stories: ["../**/*.story.@(js|jsx|ts|tsx|mdx)"],
11+
addons: [
12+
"@storybook/addon-links",
13+
"@storybook/addon-essentials",
14+
"@storybook/addon-interactions",
15+
"@storybook/addon-mdx-gfm",
16+
],
17+
core: {
18+
builder: "@storybook/builder-vite",
19+
},
20+
staticDirs: ["../source/tests_data"],
21+
framework: {
22+
name: "@storybook/react-vite",
23+
options: {},
24+
},
25+
features: {
26+
storyStoreV7: true,
27+
},
28+
docs: {
29+
autodocs: true,
30+
},
31+
};
32+
33+
export default config;

.storybook/preview-head.html

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<script>
2+
window.global = window;
3+
</script>

.storybook/preview.ts

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
export const parameters = {
2+
actions: { argTypesRegex: "^on[A-Z].*" },
3+
controls: {
4+
matchers: {
5+
color: /(background|color)$/i,
6+
date: /Date$/,
7+
},
8+
},
9+
};

Dockerfile

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM node:latest
2+
ADD . /home/pyscript-react
3+
WORKDIR /home/pyscript-react
4+
RUN yarn --ignore-engines
5+
CMD ["yarn", "build"]

README.md

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# PyScript-React 🐍⚛️
2+
3+
![GitHub](https://img.shields.io/github/license/Py4Js/PyScript-React)
4+
[![Total alerts](https://img.shields.io/lgtm/alerts/g/ShootGan/PyAnalize-React.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ShootGan/PyAnalize-React/alerts/)
5+
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/ShootGan/PyAnalize-React.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/ShootGan/PyAnalize-React/context:javascript)
6+
![GitHub issues](https://img.shields.io/github/issues/Py4Js/PyScript-React)
7+
![GitHub last commit](https://img.shields.io/github/last-commit/Py4Js/PyScript-React)
8+
9+
![Alt](https://repobeats.axiom.co/api/embed/cba6dcd58ac96f5fd18faccbc3276dd30427e64b.svg "Repobeats analytics image")
10+
11+
## PyScript-React integrates [PyScript](https://github.com/pyscript/pyscript) library into react components. Making it easier to use inside your react projects 😊
12+
13+
## Peer dependencies
14+
15+
Required by whole library: react, prop-types
16+
Required by PyScriptProvider, and PyScriptProviderZustandWrapper: react-helmet-async
17+
Required by PyScriptProviderZustandWrapper: zustand
18+
19+
## Try it
20+
21+
```sh
22+
yarn add pyscript-react # installation with yarn (preferred node package manager)
23+
npm i pyscript-react # installation with npm
24+
pnpm add pyscript-react # installation with pnpm
25+
```
26+
27+
### Example hello world
28+
29+
```tsx
30+
<PyScriptProvider>
31+
<PyScript>print("Hello world!")</PyScript>
32+
</PyScriptProvider>
33+
```
34+
35+
### Example integration with folium
36+
37+
```tsx
38+
<PyScriptProvider>
39+
<PyScript
40+
output="folium"
41+
generateOutputTag
42+
pyEnvContent={["folium"]}
43+
src="./folium_map.py"
44+
/>
45+
</PyScriptProvider>
46+
```
47+
48+
```py
49+
# folium_map.py
50+
from folium import Map
51+
52+
variable = Map(location=[45.5236, -122.6750])
53+
variable
54+
```
55+
56+
## Documentation
57+
58+
[Documentation](https://py4js.github.io/pyscript-react)
59+
60+
`we are working on it... 🐢`
61+
62+
## Related implementations/libraries
63+
64+
### Libraries
65+
66+
[PyScript-React-Folium]()
67+
68+
### Implementations
69+
70+
[PyScript-Solid]()
71+
72+
## Contributing
73+
74+
Look here: [CONTRIBUTING.md](https://github.com/Py4Js/PyScript-React/blob/main/CONTRIBUTING.md)
75+
76+
## Contributors
77+
78+
![(https://github.com/Py4Js/PyScript-React/graphs/contributors)](https://contrib.rocks/image?repo=Py4Js/PyScript-React)

audit-ci.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"high": true,
3+
"package-manager": "auto",
4+
"report-type": "summary"
5+
}

documentation/.gitignore

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Dependencies
2+
/node_modules
3+
4+
# Production
5+
/build
6+
/src
7+
8+
# Generated files
9+
.docusaurus
10+
.cache-loader
11+
12+
# Misc
13+
.DS_Store
14+
.env.local
15+
.env.development.local
16+
.env.test.local
17+
.env.production.local
18+
19+
npm-debug.log*
20+
yarn-debug.log*
21+
yarn-error.log*

documentation/README.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Website
2+
3+
This website is built using [Docusaurus 2](https://docusaurus.io/), a modern static website generator.
4+
5+
### Installation
6+
7+
```
8+
$ yarn
9+
```
10+
11+
### Local Development
12+
13+
```
14+
$ yarn start
15+
```
16+
17+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
18+
19+
### Build
20+
21+
```
22+
$ yarn build
23+
```
24+
25+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
26+
27+
### Deployment
28+
29+
Using SSH:
30+
31+
```
32+
$ USE_SSH=true yarn deploy
33+
```
34+
35+
Not using SSH:
36+
37+
```
38+
$ GIT_USER=<Your GitHub username> yarn deploy
39+
```
40+
41+
If you are using GitHub pages for hosting, this command is a convenient way to build the website and push to the `gh-pages` branch.

documentation/babel.config.js

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
const tsconfig = require("../tsconfig.node.json");
2+
require("ts-node").register(tsconfig);
3+
const { default: config } = require("./babel.config.ts");
4+
5+
module.exports = config;

documentation/babel.config.ts

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const newConfig = {
2+
presets: [
3+
require.resolve("@docusaurus/core/lib/babel/preset"),
4+
[
5+
"@babel/preset-react",
6+
{
7+
runtime: "automatic",
8+
},
9+
],
10+
],
11+
plugins: ["inline-react-svg", "@emotion"],
12+
};
13+
14+
export default newConfig;

documentation/docs/intro.mdx

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
sidebar_position: 1
3+
---
4+
5+
123

0 commit comments

Comments
 (0)