Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Scheduler-UI-NEXT from develop to master Code push regarding CI Build Configurations and some fixes #39

Merged
merged 24 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from 20 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,36 @@
"extractLicenses": false,
"sourceMap": true,
"namedChunks": true
},
"ci": {
"budgets": [
{
"type": "initial",
"maximumWarning": "5mb",
"maximumError": "6mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "1mb",
"maximumError": "2mb"
}
],
"outputHashing": "all",
"optimization": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.ci.ts"
}
]
},
"test":{
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.test.ts"
}
]
}
},
"defaultConfiguration": "production"
Expand Down
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"test": "ng test",
"lint": "ng lint",
"lint:fix": "ng lint --fix",
"prepare": "husky install"
"prepare": "husky install",
"build-dev": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=development --aot",
"build-prod": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=production --aot",
"build-ci": "chmod +x ./scripts/*.js && ./scripts/ci-prebuild.js && node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=ci --aot",
"build-test": "node --max_old_space_size=5048 ./node_modules/@angular/cli/bin/ng build --configuration=test --aot"
},
"lint-staged": {
"src/**/*.{ts,html}": [
Expand Down
192 changes: 192 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<!-- @Author : Sunil K Sundaram @Date : 21-May-17 @Email : [email protected] -->
<modelVersion>4.0.0</modelVersion>
<groupId>com.iemr.scheduler-ui-next</groupId>
<artifactId>SCHEDULER-UI-NEXT</artifactId>
<version>1.0</version>
<name>SCHEDULER-UI-NEXT</name>
<description>Piramal - scheduler: Module ui</description>
<packaging>war</packaging>
<profiles>
<profile>
<id>dev</id>
<properties>
<old-api-url>10.208.122.38</old-api-url>
<new-api-url>10.208.122.38</new-api-url>
<environment>dev</environment>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>uat</id>
<properties>
<old-api-url>10.208.122.38</old-api-url>
<new-api-url>deviemr.piramalswasthya.org</new-api-url>
<environment>uat</environment>
</properties>
</profile>
<profile>
<id>local</id>
<properties>
<old-api-url>10.208.122.38</old-api-url>
<new-api-url>localhost</new-api-url>
<environment>local</environment>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<old-api-url>10.208.122.38</old-api-url>
<new-api-url>10.208.122.32</new-api-url>
<environment>test</environment>
</properties>
</profile>
<profile>
<id>ci</id>
<properties>
<environment>ci</environment>
</properties>
</profile>
</profiles>

<!-- we could create individual properties similar to variables -->
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<final-name>scheduler-ui-next-v1.0</final-name>
<hostname-dev>10.208.122.32</hostname-dev>
<port-dev>9990</port-dev>
<hostname-local>localhost</hostname-local>
<port-local>9990</port-local>
<hostname-test>10.208.122.38</hostname-test>
<port-test>9990</port-test>
<hostname-uat>deviemr.piramalswasthya.org</hostname-uat>
<port-uat>9990</port-uat>
<server-id>wildfly-${environment}</server-id>
<server-hostname>{hostname-${environment}}</server-hostname>
<server-port>{port-${environment}}</server-port>
</properties>

<!-- install the necessary node_modules & compile in prod mode -->
<build>
<finalName>scheduler-ui-next-v1.0</finalName>
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<filesets>
<fileset>
<directory>dist</directory>
<!-- if any that needs to be included or excluded -->
<!-- using name in both would be a crime - pls avoid! -->
<!-- <includes><include>**/*.tmp</include><include>**/*.log</include></includes><excludes><exclude>**/important.log</exclude><exclude>**/another-important.log</exclude></excludes> -->
<followSymlinks>false</followSymlinks>
</fileset>
</filesets>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>npm-install</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>install</argument>
<argument>--legacy-peer-deps</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>ng-build</id>
<phase>compile</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>npm</executable>
<arguments>
<argument>run</argument>
<argument>build-${environment}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>default-copy-resources</id>
<phase>prepare-package</phase>
<configuration>
<overwrite>true</overwrite>
<outputDirectory>${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/dist</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<webResources>
<resource>
<!-- this is relative to the pom.xml directory -->
<directory>dist</directory>
</resource>
<resource>
<filtering>true</filtering>
<directory>src/packaging/</directory>
</resource>
</webResources>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>properties-updated</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<target>
<echo>replacing/updating urls ${project.basedir} 2</echo>
<replaceregexp match="${old-api-url}"
replace="${new-api-url}" flags="ig">
<fileset dir="${project.basedir}/dist"
includes="main.*.bundle.js" />
</replaceregexp>
</target>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
52 changes: 52 additions & 0 deletions scripts/ci-prebuild.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env node

/*
* AMRIT – Accessible Medical Records via Integrated Technology
* Integrated EHR (Electronic Health Records) Solution
*
* Copyright (C) "Piramal Swasthya Management and Research Institute"
*
* This file is part of AMRIT.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see https://www.gnu.org/licenses/.
*/

const fs = require('fs');
const path = require('path');

const ejs = require('ejs');

const environmentFilesDirectory = path.join(__dirname, '../src/environments');
const targetEnvironmentTemplateFileName = 'environment.ci.ts.template';
const targetEnvironmentFileName = 'environment.ci.ts';

// Load template file
const environmentTemplate = fs.readFileSync(
path.join(environmentFilesDirectory, targetEnvironmentTemplateFileName),
{encoding: 'utf-8'}
);

const defaultEnvValues = {
COMMON_API_BASE: '',
COMMON_API_OPEN_SYNC: '',
TM_API_BASE: '',
SCHEDULER_API_BASE: '',
};

// Generate output data
const output = ejs.render(environmentTemplate, Object.assign({}, defaultEnvValues, process.env));
// Write environment file
fs.writeFileSync(path.join(environmentFilesDirectory, targetEnvironmentFileName), output);

process.exit(0);
8 changes: 4 additions & 4 deletions src/environments/environment.ci.ts.template
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const COMMON_API_OPEN = '<%= COMMON_API_BASE %>';
const COMMON_API = '<%= COMMON_API_BASE %>';
const SCHEDULER_API = '<%= SCHEDULER_API_BASE %>';
const TM_API = '<%= TM_API_BASE %>';

const MMU_API = `http://${IP}:8080/mmuapi-v1.0/`;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't look right.
http and port numbers shouldn't be here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even the version of the mmu API

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@drtechie HI Mithun, updated as per comments, Please check

export const environment = {
production: true,

Expand Down Expand Up @@ -78,7 +78,7 @@ export const environment = {
getFullSMSTemplateUrl: `${COMMON_API}sms/getFullSMSTemplate`,
saveSMSTemplateUrl: `${COMMON_API}sms/saveSMSTemplate`,
updateSMSTemplateUrl: `${COMMON_API}sms/updateSMSTemplate`,
getSwymedLogoutUrl: `${TM_API}swymed/logout`,
getSwymedLogoutUrl: `${TM_API}videoConsultation/logout`,
getChiefComplaintReportUrl: `${TM_API}TMReport/chiefcomplaintreport`,
getTotalConsultationReportsUrl: `${TM_API}TMReport/TotalConsultationReport`,
getConsultantReportUrl: `${TM_API}TMReport/ConsultationReport`,
Expand All @@ -87,6 +87,6 @@ export const environment = {
licenseUrl: `${COMMON_API}license.html`,
apiVersionUrl: `${SCHEDULER_API}version`,

// Language List
getLanguageList: `${COMMON_API}beneficiary/getLanguageList`
// Language List
getLanguageList: `${COMMON_API}beneficiary/getLanguageList`
};
2 changes: 2 additions & 0 deletions src/packaging/version.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
build.version=${project.version}
build.dateTime=${build.timestamp}
Loading