Can I configure Styleguidist to run a script before every build / doc refresh? - react-styleguidist

I'm using Styleguidist to magically document my React Components and it's great. I have a couple of non-component utility libraries that I doc using JSDoc, and at present I compile their docs to markdown (using jsdoc2md) and tell Styleguidist to include that markdown doc as extra documentation.
I've added a npm script that builds the markdown and then runs Styleguidist, and that's working fine, but when I update a library I have to stop Styleguidist, re-run the script, then start Styleguidist again.
Styleguidist in watch mode already re-builds its docs when it detects a file change; is there some way to configure Styleguidist to run my markdown-creating script every time before it re-generates like that?

Related

How do I produce a node module using dotnet-fable

I have a project that I've created with dotnet fable new -n ProjectName and if I run it with webpack server everything works as expected. However I want to create an Express server. For that I thought I would simply create a node module and then run that. But when I look at the help text from dotnet fable --help I can't find a way to tell fable to just compile the js and to let me chose where those files should be placed. So question how do I tell dotnet-fable to produce js files (and do nothing else).
p.s. using the fable-cli results in a null reference (likely due to the project file structure) which is why I haven't just used that
I just wrestled with the same thing. When using the fable template, dotnet fable npm-run build just builds JS files for me. Try removing the devServer section from webpack.config.js, and changing your "start" script in package.json to say webpack && node bundle.js. (The devServer feature in webpack starts up its own simple express.js backend - something I just learned while building my own fable express app)

electron how to create delta file

I use electron-builder to build my app and succeed to build the first version which contains three outputs: foosetup.exe, foo-0.0.1-full.nupkg and RELEASES.Now I want to implement the auto-update and I have deployed a back-end service by using electron-release-server.
The auto-update need to set a feedURL which will be used to fetch updates,but the problem is that I don't know what the updates exactly means?Is it the foo-0.0.1-full.nupkg or the foo-0.0.1-delta.nupkg or another file?
The second problem is that I don't know how to create the delta file.I can just find an option remoteReleases in electron-builder which is a URL to your existing updates.If given,these will be downloaded to create delta file.But what's the URL exactly means?I find a example i which "remoteRelease": "https://github.com/user/repo",and it creates some releases and uploads many extra files for each release such as foosetup.exe, foo-xx-full-nupkg, RELEASES.I guess electron-builder will fetch the ${remoteReleases/release/download/some-version/xxx} to download file and then diff the two file to create delta file,but I can't upload RELEASES when I create release on github,it reports that they don't support this file type.
Is there anyone can help?There're to few docs to follow for a beginer
For electron-release-server please take a look at the docs.
The delta-file will be create automatically if you use electron-builder. But in order for this to work remoteReleases must be set to a valid (and reachable) URL plus there must at least an empty file called RELEASES. So for the very first build just create an empty file and call it RELEASES.
On every future build there will be a RELEASES file created for you. Threw all the generated files in your release server (overwrite existing RELEASES) and it'll be fine.
Attention: For electron-release-server you do not need the RELEASES generated by electron-builder. electron-release-server will create one by itself.
To get started with auto-updates I'd recommend that you set up a dead-simple release-server locally. I. e.:
Create a directory and throw an empty file RELEASES in there.
Then start a simple webserver pointing at that directory (e. g. cd into/your/dir && php -S 0.0.0.0:80).
Edit your package.json: "remoteRelease": "http://localhost"
Then build your installer: npm run dist
It should successfully build and you should see some GET requests on your local server.
Take the generated files and stuff them into the directory you created.
Now increment your version and start another build: npm run dist
You should see some GET requests again and there should be an addition delta-file being created.
Again stuff all those things into the directory (or for electron-release-server upload the assets .nupkg, .exe and delta into a new release).
Hope that helps. Feel free to comment if something is unclear.
Check out this sample app that I have created https://github.com/electron-delta/electron-sample-app
It uses two npm packages.
#electron-delta/builder
#electron-delta/updater
More details https://github.com/electron-delta/electron-delta#installation

Automatic refresh the page when changes while running pub serve (dart)

I'm using pub serve to run my page. I noticed that there are tools like lite-server for npm, that make sure that after file contents are changed, the web page is automatically refreshed.
Anyone got something like that working for dart using pub serve? I thought maybe some grinder script with the watcher package could make that work?
Pub should handle monitoring and autodeployment of changes itself when run in debug or release mode.
You can verify this works correctly by issuing from your project root
pub serve
then make a change to a html or dart file and verify that the project is automatically rebuilt.
If this is not working, you might try experimenting with the --force-poll option when running pub serve. Per documentation:
--[no-]force-poll Force the use of a polling filesystem watcher.

Execute a Script When XCode Runs My App

I have an iOS application that relies on a web server to keep track of information like players and games. Is there some way I can have XCode restart the server every time I start the app in the simulator? I am using Django so starting the server involves one terminal command.
Go to you target settings and add a Build Phase.
You can set an arbitrary script that runs at every build.
Here's an example taken from one of my projects:
Simply click on the Add Build Phase icon on the bottom right and select Add Run Script.
As you can easily find out by yourself, you can specify the shell to run the script into, as well as other handy options.
In your specific case a simple oneliner
python manage.py runserver
would probably do the trick

Trigger.io continuous development

I'd like to know if there is any way to develop continuously with Trigger.io and avoid the forge build step with every file change I want to test in my browser or simulator.
I was faced with the same problem and I've got a working solution that uses watchr and watch to automatically rebuild each time I make a change to a source file. If you are running a "web" version of your app you can make a change to a source file and go directly to your browser and see the effect of your changes fairly quickly depending on how long the build takes.
Prerequisites: Ruby, watchr, Unix 'watch', and a terminal.
gem install watchr.
create a new ruby file for watchr to know what files to monitor and what to do when it sees a change. I named my file 'my_watch.rb': https://gist.github.com/3153167
open two terminals. Terminal 1 will run watchr and Terminal two will run 'forge build ...'.
In terminal 1 run 'watchr my_watch.rb' making sure the path to my_watch.rb is correct and make sure you've edited my_watch.rb according to your setup so that the path inside watch(...) reflects the files to be watched. My example watches all files in the same directory (and beneath) as the my_watch.rb script. You can place my_watch.rb in the 'src' folder of your Trigger.io app if you want to match my example and run watchr my_watch.rb directly from the src folder. Also not the shell command and path in the block need to be updated to reflect your environment. Again, in my example 'my_watch.rb' is inside 'src/' so when a change is detected we go up one directory and call 'forge build'.
I tend to develop actively with the 'web' version of my app so I can just open terminal 2 to my forge project directory and 'forge run web'. When I am testing in simulators and on devices, yes I have to run forge build every time I want to see a change. However, I typically don't have to wait for forge build to finish because watchr kicked off the build as soon as I made a change and it happens pretty quickly.
I know this is not an ideal solution but so far developing new features in the 'web' version first and then implementing in mobile versions has been very smooth for me. I've never needed to kill the 'web' version after a build but I maybe just lucky. As for running build each time you want to test the mobile versions if you are good with your keyboard shortcuts it really isn't bad at all. XCode makes you build and run after changes are made to source code when creating native iOS apps so I don't think Trigger is unique in requiring this build step.
I hope this helps and that my answer isn't too specific to me and my setup.
The build phase makes some changes to your source to enable the forge.* APIs - therefore, trying to just use the raw files in your src directory won't work.
You may be tempted to change files directly in the development directory, but this is a pretty bad idea: we delete those files with impunity when we need to!
We have plans on our medium-term roadmap to add a file-system watcher to start builds automatically when changes have occurred.
In the meantime, I just use forge build && forge run PLATFORM which tends to only take a few seconds...
while not perfect... this works for me.
go into development/web
rm src
link to your root src, ie ln -s ../../src src
copy the all.js from the web/forge and add to your index.html
ie
start nodemon web.js
open in browser.
note you will need to comment out the all.js script tag for non web builds.

Resources