Skip to content
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

add some automatic watch/build/serve goodness #654

Merged
merged 1 commit into from
Oct 19, 2015
Merged

add some automatic watch/build/serve goodness #654

merged 1 commit into from
Oct 19, 2015

Conversation

jgravois
Copy link
Contributor

resolves #650

added a new script npm run serve which:

  • spins up a local webserver
  • automatically rebuilds when a change is made inside the src directory
  • launches debug/sample.html automagically

if anyone has any better ideas than this approach, they'd be warmly received. whatever we end up shipping, i can lay down another commit later to make sure the README includes documentation.

cc/ @paulcpederson

@@ -91,6 +95,11 @@
"pretest": "npm run build",
"test": "npm run lint && karma start",
"release": "./scripts/release.sh",
"start": "grunt"
"serve": "./scripts/open.js && parallelshell 'npm run watch' 'http-server -p 5678'",
Copy link
Contributor

Choose a reason for hiding this comment

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

You can actually make this a lot simpler. npm run watch & http-server -p 5678 -c-1 -o

-c-1 turns off caching. -o tells http-server to just open up the root of the web server which I think is fine I would rather have less dependencies.

You also don't need parallelshell. If you need to run multiple commands at once. Just separate them with & it works on both Mac and Windows.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

not sure what i was doing wrong, but for some reason in my initial testing watch and http-server both needed their own shell. perhaps because i was using a double ampersand? either way, your suggestion is much cleaner.

Copy link
Contributor

Choose a reason for hiding this comment

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

the watcher and the server both need their own shell because they block subsequent commands from finishing so using && doesn't work but & does. Here is a handy reference:

  • thing-1 && thing-2 - run thing-1 then run thing-2
  • thing-1 & thing-2 - run thing-1 and thing-2 at the same time and combine the output

Copy link
Contributor Author

Choose a reason for hiding this comment

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

both need their own shell because they block subsequent commands

word. thanks for taking the time to explain!

@jgravois
Copy link
Contributor Author

thx for the feedback @patrickarlt. i had a feeling my initial proposal was a bit dependency heavy and i appreciate the help cleaning it up. i've incorporated your feedback in a new commit and squashed everything down.

i'll be happy to see #655 resolved after this gets merged.

patrickarlt added a commit that referenced this pull request Oct 19, 2015
add some automatic watch/build/serve goodness
@patrickarlt patrickarlt merged commit c5da8c5 into master Oct 19, 2015
@patrickarlt
Copy link
Contributor

@jgravois jgravois deleted the watch branch October 19, 2015 16:05
jgravois pushed a commit to jgravois/esri-leaflet that referenced this pull request Apr 23, 2022
add some automatic watch/build/serve goodness
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

start 'watching' raw source
2 participants