Skip to content

Commit

Permalink
Validate email and don't add it if empty (#43)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcollonval committed Sep 18, 2023
1 parent d3fde34 commit f7b67ba
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ author_email:
help: Extension author email
default: ""
placeholder: "me@test.com"
# Allow empty email or test it against regex
validator: >-
{% if author_email and not (author_email | regex_search('^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$')) %}
author_email must be a valid email address.
{% endif %}
labextension_name:
type: str
Expand Down
4 changes: 2 additions & 2 deletions template/package.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@
"url": "{{ repository }}/issues"
},
"license": "BSD-3-Clause",
"author": {
"author": {% if author_email %}{
"name": "{{ author_name }}",
"email": "{{ author_email }}"
},
},{% else %}"{{ author_name }}",{% endif %}
"files": [
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf}",
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}"{% if has_settings %},
Expand Down
2 changes: 1 addition & 1 deletion template/pyproject.toml.jinja
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version"]
requires = ["hatchling>=1.5.0", "jupyterlab>=4.0.0,<5", "hatch-nodejs-version>=0.3.2"]
build-backend = "hatchling.build"

[project]
Expand Down

0 comments on commit f7b67ba

Please sign in to comment.