Angular 4 ng build with one environment file for different environments - angularjs

In our project ng build run 4-5 minutes at least. For creation builds for 5 environments we need wait 20-25 minutes.
ng build command create dist directory.
If it possible to run ng build for one environment, but in the environment. ts file gets properties from a JSON file.
In this way, I will create one build and will add for each environment only JSON file. This needs to be more quickly because I only create zip files from dist directory with different JSON file. and not make build 5 times.
Any idias?
Thanks

Related

Sencha Cmd: direct build output to multiple folders

sencha app build command has an option --destination, -des:
--destination, -des - The directory to which the build output is written
Is there a convenient way to direct the build output into two (or more) separate folders?
It's possible to copy all build artifacts into desired location(s), but if there're multiple apps being built and assembled in the same output folder, one will have to selectively choose artifacts .html, .js, app.json, CSS files in resources, etc. that belong to a particular app.

Managing multiple projects in circleCI

I'm currently writing a circleCI script for a project. This folder has multiple projects within it, each with their respective build and deploy scripts.
My question is, how do I manage the multiple projects, do I need a .circleci folder within each project or can I use a single yml script to handle the sub directories.
My current script cd into the sub directory in each run step.
You can do it all in one, by having multiple items under jobs. The default job must be called build but you can call the others whatever you like. Then you can cd into the appropriate directory inside each job, or add the directory name to your command arguments as you see fit. From the docs:
A run is comprised of one or more named jobs. Jobs are specified in the jobs map, see Sample 2.0 config.yml for two examples of a job map. The name of the job is the key in the map, and the value is a map describing the job.
...
If you are not using workflows, the jobs map must contain a job named build. This build job is the default entry-point for a run that is triggered by a push to your VCS provider. It is possible to then specify additional jobs and run them using the CircleCI API.
Elsewhere, a repo I contribute to has a working example of this:
jobs:
build:
steps:
# ...
build-oauth:
steps:
# ...

easing the gradle build process in deploying spring boot and angular js application

I am working on gradle based spring boot and angularjs project. I have all my angularjs code in static folder which is committed to Git. We need to deploy it into a server which does not have access to internet. So I have generated dist contents using gulp serve:dist and replaced the contents in the static folder with the contents of dist folder. Then I have generated jar file and deployed in server.
So it is becoming manually cumbersome every time to replace the contents of static folder with the contents of dist generating jar file then removing the dist folder contents from static folder and then replacing it with original angular js code.
Is there any possibility to generate the jar file directly using the contents from dist folder instead using the contents in static folder?
I am not sure whether I made the problem clear or not. Please update me if you need any further clarification.
If you are using Spring Boot with standalone JAR deployment, you just need to output front-end assets into src/main/resources/static and Spring Boot will serve them via embedded container.
You can use Gradle Gulp Plugin to execute Gulp build as task within main Gradle build.
Reaction on comment:
Mentioned static folder of course contains only assets you intend to serve by Spring Boot. It wouldn't contain code or anything else. You can have your code in e.g. [projectRoot]/jsSrc. Just Gulp needs to know where to find these files.
We are using such directory structure without any problems (with CI build running on every commit). If manual action is needed to build project, your build is fundamentally broken. In this case your issue is misplaced JS source files.

git deploy minified assets only

How can I create a simple deployment process using git where only my minified/concatenated js/css files are on the production server?
I am building an angularjs/laravel app with bootstrap-sass and ideally don't want to deploy any un-minified (source) files if possible. I am using bower and gulp tools as well if that helps.
The idea is to have 2 sections in your code base:
All the files you use for development - js, css, htmls etc (with their folder structure)
A folder called 'Dist' (stand for distributed)
And have a grunt task (let's call it 'grunt build') that perform set of tasks over your development code base: minified, uglified, image compression, removes unnecessary file and put the output in Dist.
Once grunt build is done, you need to deploy the Dist folder to production, that can be done in many ways (holding a separate git repo for production is and every new commit is a new version is a good option)

Maven Plugin Working Directory Not Constant

I wrote a Maven Plugin that creates some XML files on the classpath of my project. The Maven Project is fairly complex and has one master project with many sub projects (think services for a larger application).
The plugin takes a directory argument in the pom.xml, which is something relative to the classpath like this:
<docDestination>src/main/webapp/static/</docDestination>
However, when I try to access this folder via new File(docDestination), the resulting directory depends on the project (or sub-project) from which I ran the mvn install command that triggered the plugin.
The plugin is only specified in the pom.xml of one of the sub-projects, but if I run mvn-install from the parent it creates the XML files in the src/main/... folder of the parent application. How do I get the plugin to use the filesystem of the project in which it is declared rather than the filesystem of the parent project?
I should note that if I navigate to the sub-project in Terminal and run mvn install in that directory the files are created in the right place, which explains the title of my post.
Use the ${basedir} variable:
<docDestination>${basedir}/src/main/webapp/static</docDestination>
This should use the basedir currently used by the respective module (regardless of whether this is the top-level or a sub-module).

Resources