summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2023-06-20 08:30:11 +0000
committerCoprDistGit <infra@openeuler.org>2023-06-20 08:30:11 +0000
commitfab5838682bb49c591549ddbd98420c151fca1b3 (patch)
tree71bfe7697aff65fa174e35d95f588f821224c84f
parent5017533472a36e5234d74306963cc0546af6ff78 (diff)
automatic import of python-react-pagesopeneuler20.03
-rw-r--r--.gitignore1
-rw-r--r--python-react-pages.spec432
-rw-r--r--sources1
3 files changed, 434 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
index e69de29..d971c6a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -0,0 +1 @@
+/react-pages-0.3.2.tar.gz
diff --git a/python-react-pages.spec b/python-react-pages.spec
new file mode 100644
index 0000000..d21ef27
--- /dev/null
+++ b/python-react-pages.spec
@@ -0,0 +1,432 @@
+%global _empty_manifest_terminate_build 0
+Name: python-react-pages
+Version: 0.3.2
+Release: 1
+Summary: A zero-fuss way to create non single page apps with react.
+License: MIT
+URL: https://github.com/pycampers/react-pages
+Source0: https://mirrors.aliyun.com/pypi/web/packages/7e/ac/23aa1b45f198ac6264dfcbadf1b6046629d7f947b65c8e25e2dc21d72bab/react-pages-0.3.2.tar.gz
+BuildArch: noarch
+
+Requires: python3-click
+Requires: python3-crayons
+Requires: python3-halo
+Requires: python3-dotenv
+Requires: python3-django
+Requires: python3-ujson
+
+%description
+If you don't have node, <br>
+For bash, use [nvm](https://github.com/creationix/nvm#installation).
+For fish shell, you can use `fisher fnm`
+([get fisher](https://github.com/fisherman/fisherman)).
+Once you have npm/node, react pages will work as expected.
+*TODO: make react-pages automatically install node*
+## Commands
+```sh
+$ react-pages project my_project # create a "project"
+$ cd my_project # don't forget to do this!
+$ react-pages page my_page # create a "page"
+$ react-pages develop # development
+$ react-pages deploy # production
+# Open `./my_project/build/my_page/index.html` in browser
+$ react-pages runserver # django runserver alternative
+$ react-pages --build-cache # rebuild the cache
+$ react-pages --rm # clear the cache
+$ react-pages --cache # ouput the cache dir
+```
+## Django Integration
+### Remember to use `react-pages runserver` instead of `manage.py runserver`!
+(This was done to remove the manual build step).
+### Setup
+__settings.py__
+```
+INSTALLED_APPS = [
+ 'react_pages',
+]
+# specify the react-pages project directory
+REACT_PAGES_PROJECT_DIR = os.path.join(BASE_DIR, 'my_project')
+STATICFILES_DIRS = [
+ os.path.join(REACT_PAGES_PROJECT_DIR, 'build') # mark the build dir as a static file dir
+]
+```
+### Usage
+__template.html__
+```
+{% load react_pages %}
+{% render_react_page 'my_page' %}
+```
+That's it!<br>
+React Pages will pick-up the "my_page" page from "my_project"
+ project and do the necessary work to transpile react JSX.
+#### For production, just put `DEBUG=False` in `settings.py` and relax.
+**Note: This is not implemented yet.**
+### Django Context
+You can pass django template context varialbes like so -
+__views.py__
+```python
+context['py_var'] = [1, 2, 3]
+```
+__template.html__
+```html
+{% render_react_page 'my_page' js_var=py_var %}
+```
+__my_page/App.js__
+```js
+console.log(js_var);
+```
+**Note: These must be JSON serializable or JSON serialized.**
+### Class Based View
+__views.py__
+```python
+from react_pages.views import ReactPageView
+class MyPageView(ReactPageView):
+ page_name = 'my_page'
+```
+__urls.py__
+```
+urlpatterns = [
+ path('my_page/', views.MyPageView.as_view(), name="my page"),
+]
+```
+when you go over to 'my_page/' url,
+you'll see the react page rendered in its full glory!
+To pass the a context to JS, define a `get_js_context()` method
+__views.py__
+```python
+class MyPageView(ReactPageView):
+ page_name = 'my_page'
+ def get_js_context(self):
+ return {'js_var': 'Hello!'}
+```
+__my_page/App.js__
+```js
+console.log(js_var);
+```
+### Django Forms
+__views.py__
+```python
+from react_pages.views import ReactPagesFormView
+class MyFormView(ReactPagesFormView):
+ form_class = MyAwesomeForm # Any ol' Django Form
+ page_name = "my_page"
+```
+__my_page/App.js__
+```js
+import React, { Component } from 'react';
+# see the magic in console!
+console.log(csrf_token);
+console.log(form);
+export default class App extends Component {
+ render() {
+ return (
+ <form
+ dangerouslySetInnerHTML={{
+ __html: csrf_token.as_html + form.as_html
+ }}
+ />
+ );
+ }
+}
+```
+## Existing projects
+React Pages will automatically patch itsef into any existing project,
+that was created using `create-react-app`.
+Just run `react-pages project .` from your project directory!
+Projects not using `create-react-app` will probably work,
+ but no guarantees can be made.
+
+%package -n python3-react-pages
+Summary: A zero-fuss way to create non single page apps with react.
+Provides: python-react-pages
+BuildRequires: python3-devel
+BuildRequires: python3-setuptools
+BuildRequires: python3-pip
+%description -n python3-react-pages
+If you don't have node, <br>
+For bash, use [nvm](https://github.com/creationix/nvm#installation).
+For fish shell, you can use `fisher fnm`
+([get fisher](https://github.com/fisherman/fisherman)).
+Once you have npm/node, react pages will work as expected.
+*TODO: make react-pages automatically install node*
+## Commands
+```sh
+$ react-pages project my_project # create a "project"
+$ cd my_project # don't forget to do this!
+$ react-pages page my_page # create a "page"
+$ react-pages develop # development
+$ react-pages deploy # production
+# Open `./my_project/build/my_page/index.html` in browser
+$ react-pages runserver # django runserver alternative
+$ react-pages --build-cache # rebuild the cache
+$ react-pages --rm # clear the cache
+$ react-pages --cache # ouput the cache dir
+```
+## Django Integration
+### Remember to use `react-pages runserver` instead of `manage.py runserver`!
+(This was done to remove the manual build step).
+### Setup
+__settings.py__
+```
+INSTALLED_APPS = [
+ 'react_pages',
+]
+# specify the react-pages project directory
+REACT_PAGES_PROJECT_DIR = os.path.join(BASE_DIR, 'my_project')
+STATICFILES_DIRS = [
+ os.path.join(REACT_PAGES_PROJECT_DIR, 'build') # mark the build dir as a static file dir
+]
+```
+### Usage
+__template.html__
+```
+{% load react_pages %}
+{% render_react_page 'my_page' %}
+```
+That's it!<br>
+React Pages will pick-up the "my_page" page from "my_project"
+ project and do the necessary work to transpile react JSX.
+#### For production, just put `DEBUG=False` in `settings.py` and relax.
+**Note: This is not implemented yet.**
+### Django Context
+You can pass django template context varialbes like so -
+__views.py__
+```python
+context['py_var'] = [1, 2, 3]
+```
+__template.html__
+```html
+{% render_react_page 'my_page' js_var=py_var %}
+```
+__my_page/App.js__
+```js
+console.log(js_var);
+```
+**Note: These must be JSON serializable or JSON serialized.**
+### Class Based View
+__views.py__
+```python
+from react_pages.views import ReactPageView
+class MyPageView(ReactPageView):
+ page_name = 'my_page'
+```
+__urls.py__
+```
+urlpatterns = [
+ path('my_page/', views.MyPageView.as_view(), name="my page"),
+]
+```
+when you go over to 'my_page/' url,
+you'll see the react page rendered in its full glory!
+To pass the a context to JS, define a `get_js_context()` method
+__views.py__
+```python
+class MyPageView(ReactPageView):
+ page_name = 'my_page'
+ def get_js_context(self):
+ return {'js_var': 'Hello!'}
+```
+__my_page/App.js__
+```js
+console.log(js_var);
+```
+### Django Forms
+__views.py__
+```python
+from react_pages.views import ReactPagesFormView
+class MyFormView(ReactPagesFormView):
+ form_class = MyAwesomeForm # Any ol' Django Form
+ page_name = "my_page"
+```
+__my_page/App.js__
+```js
+import React, { Component } from 'react';
+# see the magic in console!
+console.log(csrf_token);
+console.log(form);
+export default class App extends Component {
+ render() {
+ return (
+ <form
+ dangerouslySetInnerHTML={{
+ __html: csrf_token.as_html + form.as_html
+ }}
+ />
+ );
+ }
+}
+```
+## Existing projects
+React Pages will automatically patch itsef into any existing project,
+that was created using `create-react-app`.
+Just run `react-pages project .` from your project directory!
+Projects not using `create-react-app` will probably work,
+ but no guarantees can be made.
+
+%package help
+Summary: Development documents and examples for react-pages
+Provides: python3-react-pages-doc
+%description help
+If you don't have node, <br>
+For bash, use [nvm](https://github.com/creationix/nvm#installation).
+For fish shell, you can use `fisher fnm`
+([get fisher](https://github.com/fisherman/fisherman)).
+Once you have npm/node, react pages will work as expected.
+*TODO: make react-pages automatically install node*
+## Commands
+```sh
+$ react-pages project my_project # create a "project"
+$ cd my_project # don't forget to do this!
+$ react-pages page my_page # create a "page"
+$ react-pages develop # development
+$ react-pages deploy # production
+# Open `./my_project/build/my_page/index.html` in browser
+$ react-pages runserver # django runserver alternative
+$ react-pages --build-cache # rebuild the cache
+$ react-pages --rm # clear the cache
+$ react-pages --cache # ouput the cache dir
+```
+## Django Integration
+### Remember to use `react-pages runserver` instead of `manage.py runserver`!
+(This was done to remove the manual build step).
+### Setup
+__settings.py__
+```
+INSTALLED_APPS = [
+ 'react_pages',
+]
+# specify the react-pages project directory
+REACT_PAGES_PROJECT_DIR = os.path.join(BASE_DIR, 'my_project')
+STATICFILES_DIRS = [
+ os.path.join(REACT_PAGES_PROJECT_DIR, 'build') # mark the build dir as a static file dir
+]
+```
+### Usage
+__template.html__
+```
+{% load react_pages %}
+{% render_react_page 'my_page' %}
+```
+That's it!<br>
+React Pages will pick-up the "my_page" page from "my_project"
+ project and do the necessary work to transpile react JSX.
+#### For production, just put `DEBUG=False` in `settings.py` and relax.
+**Note: This is not implemented yet.**
+### Django Context
+You can pass django template context varialbes like so -
+__views.py__
+```python
+context['py_var'] = [1, 2, 3]
+```
+__template.html__
+```html
+{% render_react_page 'my_page' js_var=py_var %}
+```
+__my_page/App.js__
+```js
+console.log(js_var);
+```
+**Note: These must be JSON serializable or JSON serialized.**
+### Class Based View
+__views.py__
+```python
+from react_pages.views import ReactPageView
+class MyPageView(ReactPageView):
+ page_name = 'my_page'
+```
+__urls.py__
+```
+urlpatterns = [
+ path('my_page/', views.MyPageView.as_view(), name="my page"),
+]
+```
+when you go over to 'my_page/' url,
+you'll see the react page rendered in its full glory!
+To pass the a context to JS, define a `get_js_context()` method
+__views.py__
+```python
+class MyPageView(ReactPageView):
+ page_name = 'my_page'
+ def get_js_context(self):
+ return {'js_var': 'Hello!'}
+```
+__my_page/App.js__
+```js
+console.log(js_var);
+```
+### Django Forms
+__views.py__
+```python
+from react_pages.views import ReactPagesFormView
+class MyFormView(ReactPagesFormView):
+ form_class = MyAwesomeForm # Any ol' Django Form
+ page_name = "my_page"
+```
+__my_page/App.js__
+```js
+import React, { Component } from 'react';
+# see the magic in console!
+console.log(csrf_token);
+console.log(form);
+export default class App extends Component {
+ render() {
+ return (
+ <form
+ dangerouslySetInnerHTML={{
+ __html: csrf_token.as_html + form.as_html
+ }}
+ />
+ );
+ }
+}
+```
+## Existing projects
+React Pages will automatically patch itsef into any existing project,
+that was created using `create-react-app`.
+Just run `react-pages project .` from your project directory!
+Projects not using `create-react-app` will probably work,
+ but no guarantees can be made.
+
+%prep
+%autosetup -n react-pages-0.3.2
+
+%build
+%py3_build
+
+%install
+%py3_install
+install -d -m755 %{buildroot}/%{_pkgdocdir}
+if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi
+if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi
+if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi
+if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi
+pushd %{buildroot}
+if [ -d usr/lib ]; then
+ find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/lib64 ]; then
+ find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/bin ]; then
+ find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+if [ -d usr/sbin ]; then
+ find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst
+fi
+touch doclist.lst
+if [ -d usr/share/man ]; then
+ find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst
+fi
+popd
+mv %{buildroot}/filelist.lst .
+mv %{buildroot}/doclist.lst .
+
+%files -n python3-react-pages -f filelist.lst
+%dir %{python3_sitelib}/*
+
+%files help -f doclist.lst
+%{_docdir}/*
+
+%changelog
+* Tue Jun 20 2023 Python_Bot <Python_Bot@openeuler.org> - 0.3.2-1
+- Package Spec generated
diff --git a/sources b/sources
new file mode 100644
index 0000000..50dcebf
--- /dev/null
+++ b/sources
@@ -0,0 +1 @@
+c657914ce14c505501e7043184a35798 react-pages-0.3.2.tar.gz