Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Remove duplicate package.json, update readme. #33

Closed
wants to merge 4 commits into from
Closed
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 {{cookiecutter.project_shortname}}/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
include {{cookiecutter.project_shortname}}/{{cookiecutter.project_shortname}}.min.js
include {{cookiecutter.project_shortname}}/{{cookiecutter.project_shortname}}.dev.js
include {{cookiecutter.project_shortname}}/metadata.json
include {{cookiecutter.project_shortname}}/package.json
include package.json
include README.md
5 changes: 3 additions & 2 deletions {{cookiecutter.project_shortname}}/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ If you have selected install_dependencies during the prompt, you can skip this p
2. Create a virtual env and activate.
```
$ virtualenv venv
$ venv/Scripts/activate
$ venv/bin/activate
```
_Note: venv\Scripts\activate for windows_

Expand All @@ -49,7 +49,8 @@ If you have selected install_dependencies during the prompt, you can skip this p
```
- Write tests for your component.
- A sample test is available in `tests/test_usage.py`, it will load `usage.py` and you can then automate interactions with selenium.
- Run the tests with `$ pytest tests`.
- Make sure you have [ChromeDriver](http://chromedriver.chromium.org/) available on your PATH.
- Run the tests with `$ pytest tests --driver Chrome`.
- The Dash team uses these types of integration tests extensively. Browse the Dash component code on GitHub for more examples of testing (e.g. https://github.com/plotly/dash-core-components)
- Add custom styles to your component by putting your custom CSS files into your distribution folder (`{{cookiecutter.project_shortname}}`).
- Make sure that they are referenced in `MANIFEST.in` so that they get properly included when you're ready to publish your component.
Expand Down
2 changes: 1 addition & 1 deletion {{cookiecutter.project_shortname}}/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"prepublish": "npm run validate-init",
"build:js-dev": "webpack --mode development",
"build:js": "webpack --mode production",
"build:py": "node ./extract-meta.js src/lib/components > {{cookiecutter.project_shortname}}/metadata.json && copyfiles package.json {{cookiecutter.project_shortname}} && %(python_path) -c \"import dash; dash.development.component_loader.generate_classes('{{cookiecutter.project_shortname}}', '{{cookiecutter.project_shortname}}/metadata.json')\"",
"build:py": "node ./extract-meta.js src/lib/components > {{cookiecutter.project_shortname}}/metadata.json && %(python_path) -c \"import dash; dash.development.component_loader.generate_classes('{{cookiecutter.project_shortname}}', '{{cookiecutter.project_shortname}}/metadata.json')\"",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see my comment in plotly/dash#451

"build:all": "npm run build:js & npm run build:js-dev & npm run build:py"
},
"author": "{{ cookiecutter.author_name }} {{ cookiecutter.author_email }}",
Expand Down
5 changes: 2 additions & 3 deletions {{cookiecutter.project_shortname}}/setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import json
import os
from setuptools import setup


with open(os.path.join('{{cookiecutter.project_shortname}}', 'package.json')) as f:
with open('package.json') as f:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

package = json.load(f)

package_name = package["name"].replace(" ", "_").replace("-", "_")
package_name = str(package["name"].replace(" ", "_").replace("-", "_"))

setup(
name=package_name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
_sys.exit(1)

_basepath = _os.path.dirname(__file__)
_filepath = _os.path.abspath(_os.path.join(_basepath, 'package.json'))
_filepath = _os.path.abspath(_os.path.join(_basepath, '..','package.json'))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm will this actually work once the package is installed via pip?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this is why that copyfile was there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add a test that will package the build and run an app with it installed as a tarball.

with open(_filepath) as f:
package = json.load(f)

Expand Down

This file was deleted.