Skip to content

Commit

Permalink
commit built JS to allow Python builds without NPM
Browse files Browse the repository at this point in the history
  • Loading branch information
sheppard committed Feb 20, 2020
1 parent 980a24a commit 50bb895
Show file tree
Hide file tree
Showing 3 changed files with 208 additions and 7 deletions.
3 changes: 1 addition & 2 deletions data_wizard/static/data_wizard/js/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
*.*
!.gitignore
*.js.map
195 changes: 195 additions & 0 deletions data_wizard/static/data_wizard/js/progress.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,29 @@
from setuptools.command.build_py import build_py
import subprocess
import shutil
import warnings


LONG_DESCRIPTION = """
Interactive web-based wizard to facilitate importing structured data into Django models.
Interactive web-based wizard for importing structured data into Django models.
"""

JS_FILES = [
'packages/progress/dist/progress.js',
'packages/progress/dist/progress.js.map',
]


class BuildJS(build_py):
def run(self):
subprocess.check_call(['npm', 'install'])
subprocess.check_call(['npm', 'run', 'build'])
for path in JS_FILES:
shutil.copy(path, 'data_wizard/static/data_wizard/js')
try:
subprocess.check_call(['npm', 'install'])
subprocess.check_call(['npm', 'run', 'build'])
except BaseException as e:
warnings.warn("Skipping JS build: {}".format(e))
else:
for path in JS_FILES:
shutil.copy(path, 'data_wizard/static/data_wizard/js')
super().run()


Expand All @@ -30,6 +36,7 @@ def readme():
else:
return readme.read()


setup(
name='data-wizard',
use_scm_version=True,
Expand Down

0 comments on commit 50bb895

Please sign in to comment.