Skip to content

Commit

Permalink
Merge pull request #449 from TAMULib/staging
Browse files Browse the repository at this point in the history
September Components Sprint
  • Loading branch information
jeremythuff authored Oct 12, 2022
2 parents 9a94b6d + f90f670 commit 776fbba
Show file tree
Hide file tree
Showing 33 changed files with 246 additions and 218 deletions.
102 changes: 54 additions & 48 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,63 +1,69 @@
# See http://help.github.com/ignore-files/ for more about ignoring files.
### Git ###
!.gitkeep

# compiled output
/dist
/tmp
/out-tsc
# Only exists if Bazel was run
/bazel-out

# dependencies
node_modules
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

# profiling files
chrome-profiler-events*.json
speed-measure-plugin*.json

# IDEs and editors
/.idea
.project
.classpath
.c9/
*.launch
.settings/
*.sublime-workspace

# IDE - VSCode
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
.history/*

# misc
/.sass-cache
/connect.lock
/coverage
/libpeerconnection.log
npm-debug.log
yarn-error.log
testem.log
/typings
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr


### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/

/.nb-gradle/

# System Files

### VS Code ###
.vscode/

dump.rdb


### OS Specific ###
.DS_Store
Thumbs.db
.tmp/

tmp/


### Node / NPM ###
coverage/
development/
docs/
static/
.lighthouseci/
.vscode/
logs/
node_modules/

.npmrc

npm-debug.log
package-lock.json
yarn.lock


### Project Specific ###
src/config.json
src/config-template.json
src/assets/icons/*
!src/assets/icons/tl
!src/assets/icons/bootstrap
src/assets/tinymce/
!src/assets/icons/custom/weaver-w.svg
!src/assets/icons/feather/chevron-right.svg

.wvr-ud/static-assets/styles.css
.verdaccio

docs/
static/
development/
.lighthouseci/
81 changes: 58 additions & 23 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,38 +1,73 @@
FROM node:16-slim as npm
# Settings.
ARG USER_ID=3001
ARG USER_NAME=components
ARG SOURCE_DIR=/$USER_NAME/source
ARG NPM_REGISTRY=upstream
ARG NODE_ENV=development

COPY package.json ./
# Node stage.
FROM node:lts-slim as build
ARG USER_ID
ARG USER_NAME
ARG SOURCE_DIR
ARG NPM_REGISTRY
ARG NODE_ENV

WORKDIR /app
COPY . .
ENV NODE_ENV=$NODE_ENV

RUN npm install
RUN npm run build
# Create the user and group (use a high ID to attempt to avoid conflicts).
RUN groupadd --non-unique -g $USER_ID $USER_NAME && \
useradd --non-unique -d /$USER_NAME -m -u $USER_ID -g $USER_ID $USER_NAME

FROM httpd:2.4-alpine
# Update the system and install dependencies (iproute2 is needed for "ip").
RUN apt-get update && \
apt-get upgrade -y && \
apt install iproute2 -y && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

ARG MAJOR_VERSION=0x
ARG MAJOR_MINOR_VERSION=0.0
# Copy in files from outside of docker.
COPY . $SOURCE_DIR

# Ensure required file permissions.
RUN chown -R $USER_ID:$USER_ID $SOURCE_DIR

# Set deployment directory.
WORKDIR $SOURCE_DIR

COPY --from=npm /app/dist/bundle/ /usr/local/apache2/htdocs/tl-components/bundle
# Login as user.
USER $USER_NAME

RUN ln -s /usr/local/apache2/htdocs/tl-components/bundle /usr/local/apache2/htdocs/tl-components/latest
RUN ln -s /usr/local/apache2/htdocs/tl-components/bundle /usr/local/apache2/htdocs/tl-components/${MAJOR_VERSION}x
RUN ln -s /usr/local/apache2/htdocs/tl-components/bundle /usr/local/apache2/htdocs/tl-components/${MAJOR_MINOR_VERSION}
# Perform actions.
RUN echo $NPM_REGISTRY && \
bash build/docker-npmrc.sh $NPM_REGISTRY && \
npm install && \
npm run build

# Apache stage.
FROM httpd:2.4-alpine
ARG SOURCE_DIR
ARG MAJOR_VERSION=0x
ARG MAJOR_MINOR_VERSION=0.0

COPY --from=npm /app/src/config-template.json tmp/config-template.json
COPY docker-entrypoint /usr/local/bin/
COPY --from=build $SOURCE_DIR/dist/bundle/ /usr/local/apache2/htdocs/tl-components/bundle
COPY --from=build $SOURCE_DIR/src/config-template.json tmp/config-template.json

RUN chmod +x /usr/local/bin/docker-entrypoint
RUN ln -s /usr/local/apache2/htdocs/tl-components/bundle /usr/local/apache2/htdocs/tl-components/latest && \
ln -s /usr/local/apache2/htdocs/tl-components/bundle /usr/local/apache2/htdocs/tl-components/${MAJOR_VERSION}x && \
ln -s /usr/local/apache2/htdocs/tl-components/bundle /usr/local/apache2/htdocs/tl-components/${MAJOR_MINOR_VERSION}

ENTRYPOINT ["docker-entrypoint"]
COPY build/docker-entrypoint.sh /usr/local/bin/
RUN chmod +x /usr/local/bin/docker-entrypoint.sh

RUN apk update;
RUN apk upgrade;
ENTRYPOINT ["docker-entrypoint.sh"]

RUN echo "" >> /usr/local/apache2/conf/httpd.conf
RUN echo "###SPECIFIC CUSTOMIZATIONS###" >> /usr/local/apache2/conf/httpd.conf
RUN echo "" >> /usr/local/apache2/conf/httpd.conf
RUN apk update && \
apk upgrade

RUN printf '<Directory /usr/local/apache2/htdocs> \nOrder Allow,Deny \nAllow from all \nAllowOverride all \nHeader set Access-Control-Allow-Origin "*" \n</Directory>' >> /usr/local/apache2/conf/httpd.conf
RUN echo "" >> /usr/local/apache2/conf/httpd.conf && \
echo "###SPECIFIC CUSTOMIZATIONS###" >> /usr/local/apache2/conf/httpd.conf && \
echo "" >> /usr/local/apache2/conf/httpd.conf && \
printf '<Directory /usr/local/apache2/htdocs> \nOrder Allow,Deny \nAllow from all \nAllowOverride all \nHeader set Access-Control-Allow-Origin "*" \n</Directory>' >> /usr/local/apache2/conf/httpd.conf

CMD ["httpd", "-D", "FOREGROUND"]
File renamed without changes.
17 changes: 17 additions & 0 deletions build/docker-npmrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# Requires ip and awk, but only for docker-linux.

main() {
if [[ $1 == "docker-linux" ]] ; then
to_npmrc $(ip route | awk '/^default via/ { print $3 }')
elif [[ $1 == "docker-windows" || $1 == "docker-mac" ]] ; then
to_npmrc host.docker.internal
fi
}

to_npmrc() {
echo "Setting NPM registry to '$1'."
echo "registry=http://$1:4873" >> .npmrc
}

main "$@"
136 changes: 60 additions & 76 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"type": "git",
"url": "git+https://github.com/TAMULib/tamu-library-components.git"
},
"version": "2.0.2",
"version": "2.0.3-rc.1",
"private": false,
"license": "MIT",
"engines": {
Expand Down Expand Up @@ -59,84 +59,68 @@
"test:ci": "npm run test:audit && npm run test:coverage"
},
"dependencies": {
"@angular/animations": "^12.2.16",
"@angular/common": "^12.2.16",
"@angular/compiler": "^12.2.16",
"@angular/core": "^12.2.16",
"@angular/elements": "^12.2.16",
"@angular/forms": "^12.2.16",
"@angular/localize": "^12.2.16",
"@angular/platform-browser": "^12.2.16",
"@angular/platform-browser-dynamic": "^12.2.16",
"@angular/router": "^12.2.16",
"@ng-bootstrap/ng-bootstrap": "^10.0.0",
"@ngrx/effects": "^12.4.0",
"@ngrx/entity": "^12.4.0",
"@ngrx/store": "^12.4.0",
"@ngrx/store-devtools": "^12.4.0",
"@stomp/stompjs": "^6.1.2",
"@tinymce/tinymce-angular": "^4.2.4",
"@ungap/custom-elements": "^1.1.0",
"@wvr/elements": "2.0.2",
"bootstrap": "^4.6.2",
"css-element-queries": "^1.2.3",
"handlebars": "^4.7.7",
"jsdom": "^20.0.0",
"karma-viewport": "^1.0.9",
"ng-inline-svg": "^13.1.1",
"ng-lazyload-image": "^9.1.3",
"ngx-build-plus": "^12.2.0",
"rxjs-compat": "^6.6.7",
"sockjs-client": "^1.6.1",
"tinymce": "^6.1.2",
"tslib": "^2.4.0",
"web-animations-js": "^2.3.2",
"zone.js": "~0.11.8"
"@angular/animations": "12.2.16",
"@angular/elements": "12.2.16",
"@angular/platform-browser-dynamic": "12.2.16",
"@ng-bootstrap/ng-bootstrap": "10.0.0",
"@ngrx/effects": "12.5.1",
"@ngrx/entity": "12.5.1",
"@ngrx/store-devtools": "12.5.1",
"@stomp/stompjs": "6.1.2",
"@tinymce/tinymce-angular": "4.2.4",
"@wvr/elements": "next",
"bootstrap": "4.6.2",
"ng-lazyload-image": "9.1.3",
"ngx-build-plus": "12.2.0",
"sockjs-client": "1.6.1",
"tinymce": "6.2.0"
},
"devDependencies": {
"@angular-devkit/build-angular": "^12.2.16",
"@angular-devkit/schematics": "^12.2.16",
"@angular-eslint/eslint-plugin": "^14.0.3",
"@angular/cli": "^12.2.16",
"@angular/compiler-cli": "^12.2.16",
"@angular/language-service": "^12.2.16",
"@compodoc/compodoc": "^1.1.19",
"@lhci/cli": "^0.8.1",
"@types/jasmine": "~3.10.3",
"@types/jasminewd2": "~2.0.10",
"@types/node": "^16.11.7",
"@typescript-eslint/eslint-plugin": "^5.36.1",
"@typescript-eslint/eslint-plugin-tslint": "^5.36.1",
"@typescript-eslint/parser": "^5.36.1",
"codelyzer": "^6.0.2",
"concat": "^1.0.3",
"console-stamp": "^3.0.6",
"coveralls": "^3.1.1",
"dotenv-override-true": "^6.2.2",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
"eslint-plugin-import": "^2.26.0",
"glob": "^7.2.3",
"jasmine-core": "~3.9.0",
"jasmine-spec-reporter": "~7.0.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.1.1",
"karma-coverage": "^2.2.0",
"karma-coverage-istanbul-reporter": "~3.0.3",
"karma-jasmine": "~4.0.2",
"karma-jasmine-html-reporter": "^1.7.0",
"karma-ng-html2js-preprocessor": "^1.0.0",
"lighthouse": "^9.6.6",
"lighthouse-badges": "^1.1.26",
"ng-packagr": "^12.2.7",
"protractor": "~7.0.0",
"rimraf": "^3.0.2",
"shelljs": "^0.8.5",
"static-server": "^2.2.1",
"ts-node": "~10.2.1",
"typescript": "~4.3.5"
"@angular-devkit/build-angular": "12.2.16",
"@angular-eslint/eslint-plugin": "14.1.2",
"@angular/cli": "12.2.16",
"@compodoc/compodoc": "1.1.19",
"@lhci/cli": "0.9.0",
"@types/jasminewd2": "2.0.10",
"@typescript-eslint/eslint-plugin": "5.38.1",
"@typescript-eslint/eslint-plugin-tslint": "5.38.1",
"codelyzer": "6.0.2",
"concat": "1.0.3",
"console-stamp": "3.0.6",
"coveralls": "3.1.1",
"dotenv-override-true": "6.2.2",
"eslint": "8.24.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-import": "2.26.0",
"glob": "7.2.3",
"jasmine": "4.4.0",
"jasmine-spec-reporter": "7.0.0",
"jsdom": "20.0.0",
"karma": "6.4.1",
"karma-chrome-launcher": "3.1.1",
"karma-coverage": "2.2.0",
"karma-coverage-istanbul-reporter": "3.0.3",
"karma-jasmine": "4.0.2",
"karma-jasmine-html-reporter": "1.7.0",
"karma-ng-html2js-preprocessor": "1.0.0",
"karma-viewport": "1.0.9",
"lighthouse": "9.6.7",
"lighthouse-badges": "1.1.26",
"ng-packagr": "12.2.7",
"protractor": "7.0.0",
"shelljs": "0.8.5",
"static-server": "2.2.1",
"ts-node": "10.9.1"
},
"overrides": {
"@types/eslint": "^6.1.3"
"@angular/core": "12.2.16",
"@types/eslint": "6.8.1",
"chokidar": "3.5.3",
"fs-extra": "10.1.0",
"glob": "7.2.3",
"latest-version": "7.0.0",
"selfsigned": "2.1.1",
"terser": "5.15.0",
"tslib": "2.4.0"
}
}
3 changes: 1 addition & 2 deletions projects/tl-elements/ng-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@
"entryFile": "src/public-api.ts",
"umdModuleIds": {
"@wvr/elements": "elements",
"@tinymce/tinymce-angular": "tinymceAngular",
"ng-inline-svg": "ngInlineSvg"
"@tinymce/tinymce-angular": "tinymceAngular"
}
},
"allowedNonPeerDependencies": []
Expand Down
Loading

0 comments on commit 776fbba

Please sign in to comment.