small improvements, including giving a more explicit error message about NoNestedFolder. fixed a bug where --custom-domain --domain wasn't working
This commit is contained in:
17
README.md
17
README.md
@@ -19,9 +19,24 @@ the site is published: http://6426ed336771f2380224fb84--scintillating-mochi-760b
|
|||||||
```bash
|
```bash
|
||||||
> pub --root-dir mysite --custom-domain dude.helpers.fun
|
> pub --root-dir mysite --custom-domain dude.helpers.fun
|
||||||
the site is published: http://6426ee6a10e4e43866b46a42--startling-gingersnap-425138.netlify.app
|
the site is published: http://6426ee6a10e4e43866b46a42--startling-gingersnap-425138.netlify.app
|
||||||
the custom domain was set to dude.helpers.fun.
|
the site is published at dude.helpers.fun.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you only have one domain set up with Netlify, there's no need to include anything but the subdomain part:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> pub --root-dir mysite --custom-domain dudette
|
||||||
|
the site is published: http://642718842cb34f02bc6b0137--cheery-daifuku-f3417f.netlify.app
|
||||||
|
the site is published at dudette.helpers.fun.
|
||||||
|
```
|
||||||
|
|
||||||
|
## Add A Custom Domain To An Already Published Site!
|
||||||
|
|
||||||
|
```bash
|
||||||
|
> pub --custom-domain hey.helpers.fun --domain startling-gingersnap-425138.netlify.app
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
# But First, a Bit of Configuration
|
# But First, a Bit of Configuration
|
||||||
|
|
||||||
To do this magic, you have to first
|
To do this magic, you have to first
|
||||||
|
|||||||
@@ -51,7 +51,9 @@ def make_a_zip_file(dirpath: pl.Path) -> pl.Path:
|
|||||||
|
|
||||||
def make_sure_theres_a_nested_folder_and_index_html(dirpath: pl.Path) -> None:
|
def make_sure_theres_a_nested_folder_and_index_html(dirpath: pl.Path) -> None:
|
||||||
if "folder" not in [d.name for d in list(dirpath.iterdir())]:
|
if "folder" not in [d.name for d in list(dirpath.iterdir())]:
|
||||||
raise NoNestedFolder
|
raise NoNestedFolder(
|
||||||
|
"Please create a folder in the root of the site's directory, and put all the files in there."
|
||||||
|
)
|
||||||
|
|
||||||
if "index.html" not in [i.name for i in list((dirpath / "folder").iterdir())]:
|
if "index.html" not in [i.name for i in list((dirpath / "folder").iterdir())]:
|
||||||
raise NoIndexHtml
|
raise NoIndexHtml
|
||||||
@@ -233,12 +235,12 @@ def delete_site(site_id: str) -> None:
|
|||||||
def display_help() -> None:
|
def display_help() -> None:
|
||||||
print(
|
print(
|
||||||
"""Usage:
|
"""Usage:
|
||||||
netlify.py --help
|
pub --help
|
||||||
netlify.py --root-dir <path> --custom-domain <domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)>
|
pub --root-dir <path> --custom-domain <domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)>
|
||||||
netlify.py --list-sites
|
pub --list-sites
|
||||||
netlify.py --custom-domain <custom_domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)> --domain <existing_domain>
|
pub --custom-domain <custom_domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)> --domain <existing_domain>
|
||||||
netlify.py --remove-custom-domain <custom_domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)>
|
pub --remove-custom-domain <custom_domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)>
|
||||||
netlify.py --delete-site <domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)>
|
pub --delete-site <domain (or subdomain prefix if there's only one domain in NETLIFY_DOMAINS)>
|
||||||
"""
|
"""
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -306,7 +308,7 @@ def cli_list_sites() -> None:
|
|||||||
|
|
||||||
|
|
||||||
def main() -> None:
|
def main() -> None:
|
||||||
if "--help" in sys.argv:
|
if "--help" in sys.argv or len(sys.argv) == 1:
|
||||||
display_help()
|
display_help()
|
||||||
sys.exit()
|
sys.exit()
|
||||||
elif "--list-sites" in sys.argv:
|
elif "--list-sites" in sys.argv:
|
||||||
@@ -330,7 +332,7 @@ def main() -> None:
|
|||||||
if len(NETLIFY_DOMAINS) == 0:
|
if len(NETLIFY_DOMAINS) == 0:
|
||||||
print("No custom domains configured in NETLIFY_DOMAINS")
|
print("No custom domains configured in NETLIFY_DOMAINS")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
if "--domain" in sys.argv:
|
if "--domain" not in sys.argv:
|
||||||
print("Please supply a --domain")
|
print("Please supply a --domain")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
try:
|
try:
|
||||||
@@ -342,7 +344,7 @@ def main() -> None:
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
deploy_site()
|
deploy_site()
|
||||||
except (NoCustomDomains, DomainInUse) as e:
|
except (NoCustomDomains, DomainInUse, NoNestedFolder) as e:
|
||||||
print(str(e))
|
print(str(e))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
2
setup.py
2
setup.py
@@ -3,7 +3,7 @@ from setuptools import setup
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="publify",
|
name="publify",
|
||||||
version="0.1.4",
|
version="0.1.5",
|
||||||
description="A CLI for publishing sites to Netlify and assigning custom domains to them.",
|
description="A CLI for publishing sites to Netlify and assigning custom domains to them.",
|
||||||
author="Zev Averbach",
|
author="Zev Averbach",
|
||||||
author_email="zev@averba.ch",
|
author_email="zev@averba.ch",
|
||||||
|
|||||||
Reference in New Issue
Block a user