How to reduce build time for Angular 11.1.1? - javascript

Initial build time i.e. ng serve takes around ~1mins or more.
While compiler is running, Additional changes takes around ~30sec to compile and reflect.
I tried to update to Angular 11.2.5 which has official fix but that's throwing some errors so I could not update.
Is there any other tested workaround to reduce compile time?
pls advise.

I found a way to do it, you just need an npx command this method claims to make your angular CLI 10 times Faster.. you should check it out.
> npx make-angular-cli-faster
Use These links for some details:
https://blog.nrwl.io/discover-how-to-make-the-angular-cli-faster-by-up-to-10-times-more-2d51d59decb9
https://www.npmjs.com/package/make-angular-cli-faster

Related

How do I add a custom watch step to webpack in a vue app?

I'm surprised I can't find an example of this, but perhaps I'm looking in the wrong places.
I have a pretty standard Vue 2 app created with vue-cli (that is, the way to start the dev server is vue-cli-service serve). Webpack is configured in the vue.config.js file.
I want to run a script every time a particular file changes. That is, when /path/to/file/x.js changes, first run ./my-script.sh before doing the regular webpack compilation.
I'm hoping there is a built in way to do this. I'm starting to wonder if I need to create a webpack plugin, though.
(Also, I hope this doesn't complicate it but I'll be converting to Vue 3 sometime this year.)

how to increase memory heap in nest.js application ? how to use --max-old-space-size in cli?

I am working on node.js project with nest.js framework and I had the error "JavaScript heap out of memory"
my question is how to allocate more memory to my app?. Also I found some people say that I should use
[--max-old-space-size] to allocate memory so I tried to add this option to package.json scripts to have "start" : "nest start --max-old-space-size=4096" but it didn't work
Nest passes some, but not all, flags through to node. This is one of the flags that it does not. Instead, you can use node dist/main --max-old-space-size=4096 and get the server to start that way.
Jay McDoniel was right about this, however the argument is in the wrong order, you must pass like this node --max-old-space-size=4096 dist/main
Make sure you do a npm run build if you haven't before.

Cypress E2E tests not running in CI mode on gitlab.com

Intro
We struggle to setup cypress in the CI runners of gitlab.com. We use the default blueprint from vue-cli to scaffold the project. We tried various of different gitlab.yml configurations. Currently we run out of CI minutes because we tried so many different combinations.
We tried different docker images (from here: https://github.com/cypress-io/cypress-docker-images/) and also followed the best practices from Crypress which we found here: https://gitlab.com/cypress-io/cypress-example-docker-gitlab/
We just had no luck getting it running. After spending hours of hours we are not sure if it's even possible to get Cypress running with the default setup from vue-cli.
We also created an issue on vue repo but it got closed, for reference you can see here: https://github.com/vuejs/vue/issues/10944
We filled out the default vue template for an issue report but since it's not a real "JavaScript" issue it was hard to properly fill it out. But we tried to provide as much information as possible. In the codepen you find our results. The HTML column is the output and the JS column is the YML file. I hope you can use this information somehow
Version
2.6.10
Reproduction link
https://codepen.io/usamahamed/pen/WNbpdPE
Steps to reproduce
this this the gitlab CI pipeline result including in codepen
it give this
CypressError: cy.visit() failed trying to load:
We failed looking for this file at the path:
/builds/room/web/room-ui/
Checking your .yaml file, I think your application is not running.
There is not log of application running
There is no build stage implementation
There is no start application task on the stage test-e2e > before_script
So I would like to suggest:
Check your build stage. Where you make your application start running?
Check your before_script, adding a step "npm ci" like this:
https://gitlab.com/cypress-io/cypress-example-docker-gitlab/blob/master/.gitlab-ci.yml
or
https://github.com/cypress-io/cypress-example-kitchensink/blob/master/.gitlab-ci.yml
You should also wait for your application to be running to start testing. You can use the wait-on module for this: https://github.com/jeffbski/wait-on

Update Jest Snapshot Tests within IntelliJ IDEA

Recent versions of IntelliJ IDEA support the execution of Jest tests.
I couldn't find an option (or even better a shortcut) to update snapshot tests within IntelliJ IDEA.
Is there an option/shortcut to update snapshots within IntelliJ IDEA?
What I have been doing is to right click on the failing Jest test and select the Create option in the pop-up menu to create a new run configuration for just that failing test.
I then add -u to the Jest options and run that specific test (once) to update the snapshot.
It is far from ideal, but you can keep them around for later, if you like, to re-run them with the -u option when needed.
I was wondering the same thing and I asked Jetbrains. They said this feature was requested and you can track the status of it here: https://youtrack.jetbrains.com/issue/WEB-26008
I'm not sure when it will be complete but looks like it is on their radar.
The -u option can be applied as a Jest run config default if you want it to be active for all Jest tests.

How to run callback with jest --watch

I started to learn ReactJS yesterday (to be used in my next product), I am willing to set up my dev environment but now I'm stuck with Jest...
Having a bluetooth lightbulb on my desk (already op with scripts etc..), I want to get a red light when my tests launched with jest --watch fail (see create-react-app from FB devs here)
The problem is, I don't know how to run a callback after the tests, it seems like no one ran into this issue on the interwebz, no solution found yet for me.
Update:
I am currently using a log file to grep:
lamp.rb
def ci
if File.readlines("path/jest.log").grep(/failed/).any?
File.truncate('path/jest.log', 0)
fail_jest # This method updates my lightbulb :) (red blink)
end
rescue
puts 'No jest log found :('
end
Launching my jest tests like this: unbuffer npm run test |& tee tmp/jest.log
I am still looking for a better solution !
Thanks for your help
Your problem is not specific to React or Jest. When your run jest tests, you are basically running a Node/npm command and when the tests fail the process exists with an unsuccessful exit code. This is the same mechanism used to make automated CI builds fail when tests don't pass. So I'd suggest you start your research from there and depending on your lightbulb's API, it should be straight forward to make it fire events whenever the process fails regardless of the reason.

Categories

Resources