electron-packager from a different angular build output path - javascript

I fail to build an electron application from an angular application built in a custom path.
I know electron-packager expect that you have already run the angular build process (ng-build --prod).
That's why I'm running the following command:
ng build --prod && electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src --overwrite
But I would like to build angular application into a different output path like this:
ng build --prod --output-path "D:\output"
How to tell to electron-packager to use this output path?
I tried this command:
ng build --prod --output-path "D:\output" && electron-packager . --no-prune --ignore=/node_modules --ignore=/e2e --ignore=/src --overwrite
But it doesn't seem to work.

Related

Unable to serve angular application with ng serve --open

here is the error showing in my powershell
this is the error when I run this command ng serve --open
Angular CLI: 9.0.6
Node: 12.16.1
OS: win32 x64
This is my angular cli version:
I'm not sure why this error comes. I think you should try to run Angular application by : ng serve instead of ng serve --open .
I think the issue is because of an environment variable of your system path is missing . Add "C:\Windows\System32\" value to your system PATH variable.

What is the right way of production deployment of nestjs application

I've developed simple nestjs rest services. Now I am planning to deploy my app. Please help me with efficient way of production deployment of nestjs app.
Own server
1) Checkout your project's repository on your server and run npm install.
2) Run npm run build which compiles your project to javascript:
rimraf dist && tsc -p tsconfig.build.json
3) Start your application with:
node dist/main.js
Serverless
zeit now
See this answer.
Heroku
1) Add the file Procfile to your project's root directory:
web: npm run start:prod
2) Add this line to your package.json's scripts:
"heroku-postbuild": "echo Skip builds on Heroku"
3) Set the port in your main.ts (or in your ConfigService)
await app.listen(process.env.PORT || 3000);
If you create a new NestJS project via nest new project-name it will come with the needed scripts in package.json.
yarn build
yarn start:prod
The rest depends on where you want to host the app. NestJS will run on any generic-purpose hosting (Heroku, Vercel, AWS, etc).
If you want to get started with low-config and for free you could try Heroku with the following Dockerized setup:
Dockerfile.prod
FROM node:14-alpine
WORKDIR /app
COPY package.json yarn.lock ./
RUN yarn install
COPY . /app
RUN yarn build
heroku.yml
build:
docker:
web: Dockerfile.prod
run:
web: yarn start:prod
Once the app is created run
heroku git:remote --app <app-name>
heroku stack:set container
In your bootstrap function (main.ts) use the PORT env var:
await app.listen(process.env.PORT || 3000);
If you're using a DB you have to set that up as well.

Packaging NodeJS along with electron application

I have an electron desktop application running.Is it possible to package it with nodejs server set up and make it as an complete application or and .exe file?
Electron is already bundled with NodeJS. To package the app, install the electron-packager module:
npm install -g electron-packager
And then package your app with:
electron-packager <sourcedir> --platform=<platform> --arch=<arch>
See the linked docs above for more details on how to do this.
Or you can save it to your package.json file and create a gulp task to run the packager.

"npm install -g generator-angular-fullstack " in OSX

I tried to setup MEAN stack where I required angular to be installed. When I tried this command "npm install -g generator-angular-fullstack", I ended up with following error in terminal.enter image description here
No Need to install fullstack for angular js. you can simply go with installation of angular like npm install angular and include dependency in your respective index.html file
You can use this link for refernace

How to run vue-cli build command when specified files modified?

I can build my js file with this command
vue build main.js --dist dist --prod --lib
It is ok but I want to do it automaticaly when I change js or vue files. I don't want to use browserify, webpack, gulp, vuify etc.
I installed watch-run via npm and run this command.
watch-run -p '/Users/User/Data/root/vue/js/*.js' echo "hello"
It is working and saying hello when I change the js file. But when I change echo "hello" as vue build /Users/User/Data/root/vue/js/main.js --dist dist --prod --lib it does not work. There is nothing in terminal. No warning, no error nothing.
Do you have any idea how to do it for my minimal setup?
we will add a --watch mode to it, stay tuned!
btw, why do you need this?
I ended up with installing nodemon via npm.
npm install -g nodemon
Then this command to monitor file changes and build the js.
nodemon -w /Users/User/Data/root/vue/assets/comp -w /Users/User/Data/root/vue/assets/js -x "cd /Users/User/Data/root/vue/assets/js/; vue build main.js --dist ../dist --prod --lib" -e vue,js
I hope this helps someone looking for a similar solution

Categories