Does `donejs develop` command have syntax to specify the livereload port

For efficiently running code meetups I have adopted c9 dot io as our collaborative workspace which literally puts every participant on the same page and in the same project. If there is a problem, tip or trick, it is the same for all of us and we can work on it together.

Anyway, I am trying a fresh donejs add app my-app following the chat app example in the guide. The command donejs develop default port is 8080, which works, and Live-reload server listening on port 8012 is printed on the command line, however in the browser I see an error Firefox can’t establish a connection to the server at wss://try-donejs-install-northdecoder.c9users.io:8012/. The c9 dot io guidelines list available ports as 8080, 8081, 8082, which explains the browser error finding port 8012, it is prohibited by c9.io.

  • Is there a syntax to specify the livereload port within the donejs develop command?

Edit:
Short answer: NO, edit the package.json script object.


The long version to answer my own question here is what I have so far.

Search for develop on github dot com/donejs/donejs/ and see that the develop command is referenced inside various scripts objects. Go back to my demo project and look inside the package.json file to find the scripts object and I do find the develop command there. Note that I could just run donejs start and that indeed runs done-serve --port 8080 without the --develop argument and no live reload.

Following the clues to the done-serve package usage at npmjs dot com I see that the --develop argument starts the live-reload server. The link there takes me to the StealJs LiveReload documentation at stealjs dot com/docs/steal.live-reload.options.html which recommends a configuration setting in the steal object.

Adding "liveReloadPort": "8081" inside the steal object in package.json and then restarting the server with donejs develop provides response Live-reload server listening on port 8012 in the command line, however it does add the live reload code to the page under test and after a few ms the console says: Firefox can’t establish a connection to the server at wss://try-donejs-install-northdecoder.c9users.io:8081/., which means the change to the configuration file worked but there is no change server running at that port. Hmmm. Notice that develop command says it is starting at a different port than where the page under test has been instructed to look. Port 8012 vs 8081.

Since this is my first attempt at bashing around in the donejs inner workings, I am just guessing I should be able to:

npm ls | grep live-reload

to get a list of matches in the node_modules directory. This listing request returns empty, therefor I am not sure what to do next.

EDIT: 11/8/2017
@chasen Thank you for taking the time to look at this and make an issue of it :blush: I have looked further and I see my incorrect assumption above that live-reload was an npm package required in donejs. The done-serve package handles that functionality using similar terminology in the arguments. It also appears in the documentation at StealJS > steal-tools > command line > steal-tools live-reload that the steal-tools package has a live reload server starter that defaults to port 8012 if the configDependencies in package.json is

{
  "steal": {
    "configDependencies": [
      "live-reload"
    ]
  }
}

However deleting that from my package.json does not seem to change the way the server loads.

Here are some of my results…

northdecoder:~/workspace/my-app $ donejs develop

> my-app@0.0.0 develop /home/ubuntu/workspace/my-app
> done-serve --develop --port 8080

done-serve starting on http://localhost:8080
Live-reload server listening on port 8012

#and


northdecoder:~/workspace/my-app $ donejs develop --live-reload-port 8081

  error: unknown option `--live-reload-port'

Looking further in package.json following your suggestion I changed the object:

  "scripts": {
    //...
    "develop": "done-serve --develop --port 8080 ", // FROM
    "develop": "done-serve --develop --port 8080 --live-reload-port 8081", // TO
    //...
  },

(Remember above I added "liveReloadPort": "8081" to the steal object in package.json)
The result from the command line is.

northdecoder:~/workspace/my-app $ donejs develop

> my-app@0.0.0 develop /home/ubuntu/workspace/my-app
> done-serve --develop --port 8080 --live-reload-port 8081

done-serve starting on http://localhost:8080
Received client connection
Live-reload server listening on port 8081
Received client connection

Saving a small change in index.stache causes a log in the terminal console

Reloading my-app@0.0.0#index.stache!done-autorender@1.3.2#src/autorender

The web page does auto-update with the change shortly thereafter :sunglasses:

Conclusion
The DoneJS & StealJS - Quick start guide assumes using localhost as the test server. While most developers probably work on localhost, it does not necessarily accurately represent what port use will be allowed on a virtual server. IMO an addition to the guidelines describing the above usage would be helpful.

Hi @northdecoder, thanks for all the info you provided in your post.

You should be able to use the --live-reload-port flag to set the port, but I think there might be a bug preventing the provided port from being used. I just filed this issue about it: https://github.com/donejs/done-serve/issues/70