Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Update npm scripts used for building, testing, etc. #299

Merged
merged 36 commits into from
Oct 2, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
bbea467
Removed old build steps and replaced with new ones
valentijnnieman Sep 12, 2018
be3f77c
Renamed test command to lint, added real test command, added format c…
valentijnnieman Sep 12, 2018
18cd646
Added github pre-push hook via Husky
valentijnnieman Sep 12, 2018
3f29c40
Updated circleci test to lint command
valentijnnieman Sep 12, 2018
e4e5401
Formatted all source code and rebuild
valentijnnieman Sep 12, 2018
2036d57
npm lint to npm run lint
valentijnnieman Sep 12, 2018
3e0227e
Remove running tests pre-push
valentijnnieman Sep 12, 2018
a436282
Add boilerplate scripts and remove archetype from dependencies
valentijnnieman Sep 12, 2018
cc18989
Removed unused webpack configs and updated babel
valentijnnieman Sep 12, 2018
39fff7c
Removed old webpack configs and added eslint-plugin to deps
valentijnnieman Sep 12, 2018
3c725f4
Removed unused package.json file
valentijnnieman Sep 12, 2018
d4e629b
Removed DASH_TEST_PROCESSES flag from test
valentijnnieman Sep 12, 2018
ef19b7b
Rebuild and run formatting in CircleCI instead of with Husky
valentijnnieman Sep 12, 2018
0c21e7e
Remove formatting & linting on prepublish
valentijnnieman Sep 12, 2018
ff13335
Run linting and formatting before building JS
valentijnnieman Sep 12, 2018
20262d1
build:watch script for faster development
valentijnnieman Sep 12, 2018
681131c
Removed console.logs from Tabs component
valentijnnieman Sep 13, 2018
005353d
Fixed type in build:all script
valentijnnieman Sep 13, 2018
639fb58
Fixed typo in build:all-dev
valentijnnieman Sep 13, 2018
f3b263f
Added publish script in new scripts folder for publishing with one co…
valentijnnieman Sep 13, 2018
d1dcf14
Fixed Demo & npm start command
valentijnnieman Sep 13, 2018
0c2a36a
Updated README with new scripts
valentijnnieman Sep 13, 2018
07c04cc
Update publish scripts so it takes input if no credentials
valentijnnieman Sep 13, 2018
8ef8c0b
Remove running format & lint in build step and CircleCI
valentijnnieman Sep 14, 2018
1ac226c
Updated publish scripts with push version and 2FA
valentijnnieman Sep 18, 2018
a9c1c19
Commit prerelease version changes so I can test publishing it
valentijnnieman Sep 18, 2018
06bd4b5
Only fire error if there is one
valentijnnieman Sep 18, 2018
b838942
Revert RC version change
valentijnnieman Sep 18, 2018
66f5042
Added prettier run step to CircleCI
valentijnnieman Sep 18, 2018
46268c9
Script for running prettier --list-different so Circle can easily run it
valentijnnieman Sep 18, 2018
0c17be0
Remove space at end of line for CircleCI config
valentijnnieman Sep 18, 2018
55200cc
Fix incorrect indentation in CircleCI config
valentijnnieman Sep 18, 2018
64a492a
Merged with master & resolved conflicts
valentijnnieman Sep 21, 2018
f007208
Re-formatted Graph
valentijnnieman Sep 21, 2018
97b78e6
Version bump to 0.31.0
valentijnnieman Oct 2, 2018
d02fc53
Add mode logic to webpack config
valentijnnieman Oct 2, 2018
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
8 changes: 3 additions & 5 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
{
"extends": "./node_modules/dash-components-archetype/config/babel/babelrc",
"plugins": [
"styled-jsx/babel"
]
}
"presets": ["env", "react"],
"plugins": ["transform-object-rest-spread", "styled-jsx/babel"]
Copy link
Member

Choose a reason for hiding this comment

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

In our dash-component-boilerplate, we don't have this plugins anymore. Do we still need it? If so, should we add it to the dash-component-boilerplate?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We definitely need styled-jsx/babel here because of it's dependency in the Tabs component. transform-object-rest-spread is also needed if we want to use the object spread operator

}
13 changes: 9 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,22 @@ jobs:
paths:
- "venv"
- "node_modules"

- run:
name: prettier --list-different
command: npm run format:test

- run:
name: npm run lint
command: npm run lint

Copy link
Member

Choose a reason for hiding this comment

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

and prettier --list-different would be another run step here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could do that. That will mean that, if you haven't formatted properly, the build will fail, right? In that case, we're still running Prettier here and enforcing formatting - wouldn't it be better/nicer/friendlier to, instead of having the build fail (and forcing users to run formatting themselves), auto-format it in this step?

Copy link
Member

Choose a reason for hiding this comment

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

That will mean that, if you haven't formatted properly, the build will fail,

Correct, similar to the lint step.

auto-format it in this step?

How would it get added to the code though? Would CircleCI commit it back to this branch? I'd rather that CI didn't make any changes to the code, that the user is forced to make the changes.

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 thought that code pushed to Github would pass through CircleCI first, so whatever changes happen in CircleCI would be reflected on Github. But now that I think about it, I guess that's not how it works. Ok! I'll add the --list-different command.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, CircleCI just runs a copy of the code in the repo at each commit, CircleCI doesn't write back to GitHub at all (unless you program to do that explicitly)

Copy link
Member

Choose a reason for hiding this comment

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

Yes and that would be too magical. I would expect the code I write to be the code that ends up in Github :)

- run:
name: Build
command: |
. venv/bin/activate
npm run build:js
npm run build:py

- run:
name: npm test
command: npm test

- run:
name: Run tests
command: |
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).

## [0.31.0] - 2018-09-21
### Changed
- Updated NPM scripts:
- `test` now runs Selenium integration tests
- `format` runs Prettier formatter
- There are new `build` scripts, most notably `build:watch` runs a watcher and rebuilds upon changes
- There's a new `publish-all` script that publishes to NPM and PyPi
### Fixed
- The `start` script will now run the `Demo` application

## [0.30.2] - 2018-09-21
### Fixed
- Fixed regression in Graph component where it wouldn't resize correctly [#256](https://github.com/plotly/dash-core-components/issues/256)
Expand Down
67 changes: 19 additions & 48 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,12 @@ $ npm i
2. Build the code:

```
$ npm run build-dev
$ npm run build-all
```

3. Install the library

```
$ cd dash-core-components
$ npm run copy-lib
$ python setup.py install
```

Expand All @@ -51,57 +49,34 @@ You can start up a demo development server to see a demo of the rendered
components:

```sh
$ builder run demo
$ open http://localhost:9000
$ npm start
```

You have to maintain the list of components in `demo/Demo.react.js`.

### Code quality and tests

### To run integration tests (test_integration.py)
We run our integration tests on CircleCI with help from Tox. There’s a tox.ini file which holds the configuration, refer to [tox's documentation](http://tox.readthedocs.io/en/latest/index.html) for help. You may need to set environment variables in your terminal, like `TOX_PYTHON_27` to my version of python that I wanted tox to use. So running:

```sh
export TOX_PYTHON_27=python2
```

set the `TOX_PYTHON_27` env variable to point to `python2`, which is Python 2.7 running on my machine.
You could also look in `tox.ini` and see which tests it runs, and run those commands yourself:

You can run the unit tests with the
```sh
python -m unittest test.test_integration
npm test
```
command.

### Testing your components in Dash
1. Run the build watcher by running
$ npm run build:watch

1. Build development bundle to `lib/` and watch for changes

# Once this is started, you can just leave it running.
$ npm start

2. Install module locally (after every change)

# Generate metadata, and build the JavaScript bundle
$ npm run install-local

# Now you're done. For subsequent changes, if you've got `npm start`
# running in a separate process, it's enough to just do:
$ python setup.py install

3. Run the dash layout you want to test
2. Run the dash layout you want to test

# Import dash_core_components to your layout, then run it:
$ python my_dash_layout.py

## Installing python package locally

Before publishing to PyPi, you can test installing the module locally:

```sh
# Install in `site-packages` on your machine
$ npm run install-local
```
You can run
$ python setup.py install
to install the package locally, so you can test it out in your current environment.

## Uninstalling python package locally

Expand All @@ -111,23 +86,19 @@ $ npm run uninstall-local

## Publishing

See the [Publishing New Components/Features](CONTRIBUTING.md#publishing-new-componentsfeatures) section of the Contributing guide for step-by-step instructions on publishing new components.

## Builder / Archetype

We use [Builder][] to centrally manage build configuration, dependencies, and
scripts.

To see all `builder` scripts available:
There's an npm script that will handle publish, provided you have the right credentials. You can run it by running

```sh
$ builder help
$ npm run publish-all
```

See the [dash-components-archetype][] repo for more information.
See the [Publishing New Components/Features](CONTRIBUTING.md#publishing-new-componentsfeatures) section of the Contributing guide for step-by-step instructions on publishing new components.

## Dash Component Boilerplate

See the [dash-component-boilerplate](https://github.com/plotly/dash-component-boilerplate) repo for more information.

[Builder]: https://github.com/FormidableLabs/builder
[Dash]: https://plot.ly/dash
[Dash Component Boilerplate]: (https://github.com/plotly/dash-component-boilerplate)
[NPM package authors]: https://www.npmjs.com/package/dash-core-components/access
[PyPi]: https://pypi.python.org/pypi
[dash-components-archetype]: https://github.com/plotly/dash-components-archetype
16 changes: 0 additions & 16 deletions config/webpack/infer-namespace.js

This file was deleted.

26 changes: 0 additions & 26 deletions config/webpack/partials/babel.js

This file was deleted.

31 changes: 0 additions & 31 deletions config/webpack/partials/babelHot.js

This file was deleted.

23 changes: 0 additions & 23 deletions config/webpack/partials/defineEnv.js

This file was deleted.

11 changes: 0 additions & 11 deletions config/webpack/partials/entryDev.js

This file was deleted.

15 changes: 0 additions & 15 deletions config/webpack/partials/entryHot.js

This file was deleted.

11 changes: 0 additions & 11 deletions config/webpack/partials/entryProd.js

This file was deleted.

20 changes: 0 additions & 20 deletions config/webpack/partials/optimizeProd.js

This file was deleted.

22 changes: 0 additions & 22 deletions config/webpack/partials/outputDev.js

This file was deleted.

20 changes: 0 additions & 20 deletions config/webpack/partials/outputProd.js

This file was deleted.

6 changes: 0 additions & 6 deletions config/webpack/partials/sourceMapDev.js

This file was deleted.

Loading