Skip to content

Skip building js assets if they already exist #81

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

Merged
merged 3 commits into from
Dec 18, 2020
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["jupyter_packaging~=0.7.0", "jupyterlab>=3.0.0rc10,==3.*", "setuptools>=40.8.0", "wheel"]
requires = ["jupyter_packaging~=0.7.9", "jupyterlab>=3.0.0rc10,==3.*", "setuptools>=40.8.0", "wheel"]
build-backend = "setuptools.build_meta"
16 changes: 9 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import os
from glob import glob

import setuptools
from jupyter_packaging import combine_commands
from jupyter_packaging import create_cmdclass
from jupyter_packaging import ensure_targets
from jupyter_packaging import get_version
from jupyter_packaging import install_npm
from jupyter_packaging import skip_if_exists

# The directory containing this file
HERE = os.path.abspath(os.path.dirname(__file__))
Expand All @@ -20,10 +19,7 @@
nb_path = os.path.join(HERE, PACKAGE_NAME, "static")

# Representative files that should exist after a successful build
jstargets = [
os.path.join(src_path, "lib", "index.js"),
os.path.join(lab_path, "package.json"),
]
jstargets = [os.path.join(lab_path, "package.json")]

package_data_spec = {PACKAGE_NAME: ["*"]}

Expand Down Expand Up @@ -55,11 +51,17 @@
"jsdeps", package_data_spec=package_data_spec, data_files_spec=data_files_spec
)

cmdclass["jsdeps"] = combine_commands(
js_command = combine_commands(
install_npm(src_path, build_cmd="build:prod", npm=["jlpm"]),
ensure_targets(jstargets),
)

is_repo = os.path.exists(os.path.join(HERE, ".git"))
if is_repo:
cmdclass["jsdeps"] = js_command
else:
cmdclass["jsdeps"] = skip_if_exists(jstargets, js_command)

with open("README.md", "r") as fh:
long_description = fh.read()

Expand Down