How to steal build an app of two html files with shared dependencies in JavascriptMVC - javascriptmvc

I have an application with two html files:
app/page1.html
app/page2.html
These pages share dependencies, i.e -jquery / plugins and I want to use the "steal build" script to build them efficiently.
I found some examples and questions that describe this issue and give examples on multiple apps, but didn't give a solution for this problem.
But when I try to build with this line for example I'm getting errors:
js steal/buildjs app/page1.html app/page2.html -to app
Anyone had experience with this scenario?
Thanks,
Shai

A good soul (asavoy) created a pull request that deals with this issue, apparently it was a bug in the new version:
https://github.com/jupiterjs/steal/pull/83
I'll post an update once I'll test it out myself.

Related

Create screenshot of react app when running the build script

I have recently picked up web development again after a few years and am currently learning React as well as other node functionalities.
I currently am working to revise my portfolio and was curious if there might be an existing method or practice so that when running the build command a screenshot of the app would be taken and saved to the build folder.
In essence I would like to automate the creation of screenshots for projects I'm currently working on or have worked on that would then be placed into the portfolio.
I imagine the process would be similar to the following
Write your source,
Build the app from script,
Once build has finished initiate the serve script
Take screenshot and save to build folder.
I'm aware I can do this manually with little to no effort but wanted to check for an automated solution.
Any suggestions or helpful comments are greatly welcomed, thank you in advance.

Angular 2 web app in Azure returning system is not defined error

I am new to Angular2 and just published a very basic app to Azure web app. I searched before posting this question and found couple of references
http://abusanad.net/2016/07/24/publish-angular-2-app-from-visual-studio-to-azure/
Deploy Angular 2 App to Azure
After following the steps in these articles, I accessed my WebApp and I see errors in browser console with 404 not found files.
System.import('main.js').catch(function(err){ console.error(err); });
Image of Exception details attached here
I also checked the versions of npm(3.10.8) & nodejs(v6.9.1) in my webapp. Seems like its good.
Any help is appreciated ! Thanks.
After adding the engines version to package.json, the issue got fixed :)
"engines":{"node":6.9.1} (In my case, this is the version)
Link for reference on how to specify the engines version:
https://learn.microsoft.com/en-us/azure/nodejs-specify-node-version-azure-apps
It looks like your server can't find the external libraries that your website is referencing, such as System.js. The list of files in your screenshot seems to have been flattened out - the original directory structure of your node_modules folder has been lost. Did you perform some step which caused this? Did you run npm install in your wwwroot folder like the tutorial advised?
Looking a bit further in the future, you will want to investigate a build process for your front-end code using a tool such as Webpack or Rollup, to stop you from deploying tons of separate source files.
Edit: Just noticed that the directory in your screenshot is (probably) wwwroot/core-js/client. Can you show us wwwroot instead?

Check if nw.js application is running on built version (prod) or development

I am using grunt to build my application, I want to use different configurations when the application is being run from built version and when I run it as a developer using simply nw.
Is there any such option which helps distinguish this behaviour?
You will need to set the desired configuration IN the processed source. There are many ways to accomplish this. Check out this blog post for some ideas http://addyosmani.com/blog/environment-specific-builds-with-grunt-gulp-or-broccoli/

Cucumber JS and actually getting something done

After being completely confused and googling tutorial after tutorial, reading books about cucumber that do not cover the JS implementation, I got over the fear of flames and decided to post my question here.
I have setup Cucumber-JS on my box, running fine. I use CoffeeScript, because I am lazy. I got my features folder, have my .feature written. Got my step definition and figured out that Cucumber JS requires a 'World' thingie to be anything near useful. I also discovered just moments ago, there can be some env.js tweaking to make this setup find the rest of my app.
I am not building a web based app, as I want some core logic to be worked out first. Where my trouble starts is the part how I am supposed to continue now.
I have a folder called 'lib' in the project root. Inside it, it is going to have my JS app, which I will eventually be running through NodeJS.
What changes do I have to make to env.js, world.coffee and mystep definition to be able to test my code I am developing in lib/myapp.coffee?
Thank you!
Eventually, I found out this is no Cucumber thing. It has to do with NodeJS and the way it handles modules. I eventually ended here:
http://www.sitepoint.com/understanding-module-exports-exports-node-js/

using nodegit within angularjs app

I am building an app in AngularJS that needs to clone GitHub wikis attached to GitHub repos. The GitHub API does not have functionality to do anything with the GitHub wikis and GitHub support suggested I could use libgit2. With that in mind, I found nodegit.
So, now I have nodegit installed, and I made a basic javascript file out of the code example they have for Cloning a repository and reading a file. I have that file, called nodegit.js, working and by navigating to the folder containing it and typing
node ./nodegit.js
The script runs great and clones the repo into the temp folder.
Fantastic.
Now...how can I use this script in my angularjs app?
Is there a way to run a node script from angular?
Is there a way to use nodegit from angular itself?
Is there some other angular->github non-GitHub API script out there?
Any help greatly appreciated. I've gotten stuck on this one.
thank you,
Scott
Thanks shaunhusain. I ended up setting up an ExpressJS server via NodeJS and putting my code there and calling the ExpressJS server from my Angular app.
thanks, scott
Just wanted to add that I currently have a strong focus on getting the library running in the browser to address this use case. I'll update this comment once the code has landed. An issue to track the status is here:
https://github.com/nodegit/nodegit/issues/142

Resources