Skip to content

Instantly share code, notes, and snippets.

@alainlompo
alainlompo / README.md
Created June 26, 2023 17:44 — forked from phillipgreenii/README.md
Running NPM Scripts through maven

I am in the process of introducing single page applications to where I work. For development, using node based build tools is much easier for the single page applications. However, the build process for our organization is based upon maven. Our solution started with the maven plugin frontend-maven-plugin. It worked great at first, but then we ran into a situation that I couldn't make work with it.

As stated before, at our organization, we have the older ecosystem which is maven and the newer ecosystem which is node. Our goal was to keep the hacking to a minimum. We did this by putting all of the hacks into a single super node based build file. This is what maven calls and the reason frontend-maven-plugin wasn't sufficient. The super node based build script calls all of the other build scripts by spawning npm run. Try as I might, I could not figure out how to make the spawn work. front-end-maven-plugin downloads npm

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<?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">
<modelVersion>4.0.0</modelVersion>
<groupId>com.isogruppe.b27.dui</groupId>
<artifactId>sample-apache-webapp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
@alainlompo
alainlompo / maven-install-playbook.yml
Last active February 25, 2022 02:19
sample ansible playbook for installing maven
################################################################
# Ansible playbook for maven installation #
# ##############################################################
#
---
- hosts: all
become: true
tasks:
- name: download apache maven
version: '3.4'
services:
jira:
image: haxqer/jira
container_name: jira-srv
environment:
- TZ=Asia/Shanghai
# - JVM_MINIMUM_MEMORY=1g
# - JVM_MAXIMUM_MEMORY=12g
# - JVM_CODE_CACHE_ARGS='-XX:InitialCodeCacheSize=1g -XX:ReservedCodeCacheSize=8g'
#!/usr/bin/env bash
cat << EOF > ./common/config/trivy-adapter/env
SCANNER_LOG_LEVEL=trace
SCANNER_STORE_REDIS_URL=redis://redis:6379
SCANNER_JOB_QUEUE_REDIS_URL=redis://redis:6379
SCANNER_TRIVY_CACHE_DIR=/home/scanner/.cache/trivy
SCANNER_TRIVY_REPORTS_DIR=/home/scanner/.cache/reports
SCANNER_TRIVY_VULN_TYPE=os,library
SCANNER_TRIVY_SEVERITY=UNKNOWN,LOW,MEDIUM,HIGH,CRITICAL
SCANNER_TRIVY_IGNORE_UNFIXED=false
/// Selenium chrome driver options
case "headless_chrome":
// Ref: https://itnext.io/how-to-run-a-headless-chrome-browser-in-selenium-webdriver-c5521bc12bf0
ChromeOptions options = new ChromeOptions();
options.addArguments("--headless", "--window-size=1920,1200", "--ignore-certificate-errors",
"--disable-extensions","--no-sandbox","--disable-dev-shm-usage");
options.addArguments("disable-infobars");
options.addArguments("--verbose");
options.setExperimentalOption("excludeSwitches", Collections.singletonList("enable-automation"));

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@alainlompo
alainlompo / gist:61a55c4cdd46f0e0c59017339e1d1848
Created September 22, 2017 03:29 — forked from lttlrck/gist:9628955
rename git branch locally and remotely
git branch -m old_branch new_branch # Rename branch locally
git push origin :old_branch # Delete the old branch
git push --set-upstream origin new_branch # Push the new branch, set local branch to track the new remote
@alainlompo
alainlompo / jsxsamples.js
Created August 18, 2017 10:54
Simple jsx sample snippets to familiarize the beginner with its key concepts and syntax (Episode 1 of probably many...)
function formatName(user) {
return user.firstName + ' ' + user.lastName;
}
const user = {
firstName:'Harper',
lastName:'Perez'
};