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

Preflight release #5

Merged
merged 4 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ A very simple, but limited, usage is an `.html` file that links to `urljsf` and
`bootstrap` resources on the internet.

```html
<script type="application/vnd.deathbeds.prjsf.v0+toml">
<script type="application/vnd.deathbeds.urljsf.v0+toml">
[forms.url.schema]
title = "pick an xkcd"
description = "this will redirect to `xkcd.com`"
Expand All @@ -112,7 +112,10 @@ A very simple, but limited, usage is an `.html` file that links to `urljsf` and
url = "https://xkcd.com/{{ data.url.xkcd }}"
submit_button = "see xkcd #{{ data.url.xkcd }}"
</script>
<script type="module" src="https://deathbeds.github.io/prjsf/_static/index.js"></script>
<script
type="module"
src="https://deathbeds.github.io/urljsf/_static/index.js"
></script>
```

This technique has _many_ limitations, and is **not recommended**.
Expand Down
8 changes: 5 additions & 3 deletions docs/.readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ build:
python: mambaforge-23.11
commands:
- mamba install -c conda-forge -c nodefaults pixi==0.35.0
- pixi r build
- pixi r docs-sphinx
- pixi r -v docs-rtd
- pixi run build-yarn
- pixi run build
- pixi run dist
- pixi run docs-sphinx
- pixi run docs-rtd
14 changes: 0 additions & 14 deletions docs/.readthedocs.yml

This file was deleted.

7 changes: 5 additions & 2 deletions docs/use/script.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
Include `urljsf` as a `script` tag:

```html
<script type="module" src="https://deathbeds.github.io/prjsf/_static/index.js"></script>
<script
type="module"
src="https://deathbeds.github.io/urljsf/_static/index.js"
></script>
```

... and one or more additional `script` tags that define forms:

```html
<script type="application/vnd.deathbeds.prjsf.v0+toml">
<script type="application/vnd.deathbeds.urljsf.v0+toml">
[forms.url.schema]
title = "pick an xkcd"
description = "this will redirect to `xkcd.com`"
Expand Down
4 changes: 2 additions & 2 deletions js/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h2 id="example-xkcd">
<a href="#example-xkcd">#</a>
XKCD
</h2>
<script type="application/vnd.deathbeds.prjsf.v0+toml">
<script type="application/vnd.deathbeds.urljsf.v0+toml">
[forms.url.schema]
title = "pick an xkcd"
description = "this will redirect to `xkcd.com`"
Expand All @@ -50,7 +50,7 @@ <h2 id="example-<%= fmt %>">
<%= fmt.toUpperCase() %>
</h2>
<script
type="application/vnd.deathbeds.prjsf.v0+<%= fmt %>"
type="application/vnd.deathbeds.urljsf.v0+<%= fmt %>"
src="./<%= fmt %>/urljsf.<%= fmt %>"
></script>
</section>
Expand Down
8 changes: 4 additions & 4 deletions js/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// Copyright (C) urljsf contributors.
// Distributed under the terms of the Modified BSD License.

export const MIME_FRAGMENT = 'application/vnd.deathbeds.prjsf.v0+';
export const MIME_FRAGMENT = 'application/vnd.deathbeds.urljsf.v0+';
export const SELECTOR = `script[type^="${MIME_FRAGMENT}"]`;

export async function main() {
const urjsfScripts = [...document.querySelectorAll(SELECTOR)] as HTMLScriptElement[];
const urljsfScripts = [...document.querySelectorAll(SELECTOR)] as HTMLScriptElement[];

/* istanbul ignore else */
if (urjsfScripts.length) {
if (urljsfScripts.length) {
const { makeOneForm } = await import('./components/form.js');
urjsfScripts.forEach(makeOneForm);
urljsfScripts.forEach(makeOneForm);
}
}

Expand Down
30 changes: 19 additions & 11 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -87,20 +87,23 @@ prettier-- = '''yarn prettier
"{docs,tests,src,js,.github}/**/*.{md,json,yml,yaml,css,ts,tsx,ts,mjs}"'''
markdownlint-- = 'yarn markdownlint-cli2 "*.md" "{docs,tests,src,js,.github}/**/*.md"'
py-static-- = """rm -rf src/urljsf/_static/
&& cp -r js/dist/urljsf src/urljsf/_static/urljsf
&& cp -r js/schema src/urljsf/_static/schema
&& rm -rf src/urljsf/_static/urljsf/demo/ src/urljsf/_static/schema/*.toml"""
&& cp -r js/dist/urljsf src/urljsf/_static/urljsf"""
platform-- = '''mkdir -p build
&& python -c 'import platform; u = platform.uname(); print(f"{u.system}-{u.machine}".lower())'
> build/platform.txt'''
pip-- = """python -m pip install
-vv
--no-deps
--no-build-isolation
--disable-pip-version-check
--ignore-installed"""
pip-e-- = """pixi r pip-- -e ."""
pip-whl-- = """pixi r pip-- urljsf --find-links=dist --no-index"""
pip-- = """rm -rf build/pip-freeze/$PIXI_ENVIORNMENT_NAME.txt
&& python -m pip install
-vv
--no-deps
--no-build-isolation
--disable-pip-version-check
--ignore-installed"""
pip-check-- = """python -m pip check
&& mkdir -p build/pip-freeze
&& python -m pip list --format=freeze
> build/pip-freeze/$PIXI_ENVIRONMENT_NAME"""
pip-e-- = """pixi r pip-- -e . && pixi r pip-check--"""
pip-whl-- = """pixi r pip-- urljsf --find-links=dist --no-index && pixi r pip-check--"""
schema-vars-- = '''echo
PROPS_TS=$PIXI_PROJECT_ROOT/js/src/_props.ts
PROPS_JSON=$PIXI_PROJECT_ROOT/js/schema/v0/props.schema.json
Expand Down Expand Up @@ -131,27 +134,32 @@ outputs = ["node_modules/.yarn-state.yml"]
description = "- install the editable python package for development"
cmd = "pixi r -e dev pip-e--"
inputs = ["pyproject.toml"]
outputs = ["build/pip-freeze/dev.txt"]

[feature.tasks-lint.tasks.lint-pip]
description = "- install the editable python package for linting"
cmd = "pixi r -e lint pip-e--"
inputs = ["pyproject.toml"]
outputs = ["build/pip-freeze/lint.txt"]

[feature.tasks-test.tasks.test-pip]
description = "- install the built python package for testing"
cmd = "pixi r -e test pip-whl--"
inputs = ["dist/*.whl"]
outputs = ["build/pip-freeze/test.txt"]

[feature.tasks-test-min.tasks.test-min-pip]
description = "- install the built python package for testing (oldest)"
cmd = "pixi r -e test-min pip-whl--"
inputs = ["dist/*.whl"]
outputs = ["build/pip-freeze/test-min.txt"]

[feature.tasks-docs.tasks.docs-pip]
description = "- install the built python package for docs"
cmd = "pixi r -e docs pip-whl--"
inputs = ["dist/*.whl"]
depends-on = ["dist-pypi"]
outputs = ["build/pip-freeze/docs.txt"]

# build ########################################################################
[feature.tasks-build.tasks.build-demo]
Expand Down
4 changes: 0 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,6 @@ Source = "https://github.com/deathbeds/urljsf"
[tool.flit.sdist]
include = ["LICENSE"]

# check-wheel-contents #########################################################
[tool.check-wheel-contents]
ignore = ["W002"]

# coverage #####################################################################
[tool.coverage.run]
disable_warnings = [
Expand Down
2 changes: 1 addition & 1 deletion src/urljsf/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
STATIC = HERE / "_static"

SCHEMA_VERSION = "v0"
MIME_PREFIX = f"application/vnd.deathbeds.prjsf.{SCHEMA_VERSION}"
MIME_PREFIX = f"application/vnd.deathbeds.urljsf.{SCHEMA_VERSION}"


EXTENSION_FORMAT: dict[str, FileFormat] = {
Expand Down
2 changes: 1 addition & 1 deletion src/urljsf/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

HERE = Path(__file__).parent
STATIC = HERE / "_static"
SCHEMA = STATIC / "schema"
SCHEMA = STATIC / "urljsf/schema"
CURRENT_SCHEMA = SCHEMA / SCHEMA_VERSION

FORM_SCHEMA = CURRENT_SCHEMA / "form.schema.json"
Expand Down