Skip to content

Commit

Permalink
Merge branch 'develop' into 'master' for 3.1.0 release
Browse files Browse the repository at this point in the history
  • Loading branch information
suschneider committed Oct 17, 2022
2 parents 46ecd6c + c1cc3f0 commit dbcce68
Show file tree
Hide file tree
Showing 283 changed files with 8,588 additions and 5,950 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@ FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT}

ENV NODE_OPTIONS=--max_old_space_size=8192 LOGGING=true TRUST_ICM=true
RUN sudo -u node npm install --ignore-scripts -g @angular/cli
COPY shellrc.sh /home/node/.shellrc
RUN echo ". /home/node/.shellrc" >> /home/node/.zshrc && echo ". /home/node/.shellrc" >> /home/node/.bashrc
26 changes: 19 additions & 7 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,38 +4,50 @@
"name": "Intershop PWA",
"build": {
"dockerfile": "Dockerfile",
// Update 'VARIANT' to pick a Node version: 10, 12, 14
"args": {
"VARIANT": "16"
}
},
// https://paulhammond.org/2020/vscode-ramdisks
"runArgs": ["--tmpfs", "${containerWorkspaceFolder}/node_modules:exec"],
// node_modules as volume
// https://code.visualstudio.com/remote/advancedcontainers/improve-performance#_use-a-targeted-named-volume
"mounts": ["target=${containerWorkspaceFolder}/node_modules,type=volume"],
"settings": {
"terminal.integrated.shell.linux": "/bin/bash"
"terminal.integrated.profiles.linux": {
"zsh": {
"path": "zsh",
"args": ["-l"]
}
},
"terminal.integrated.defaultProfile.linux": "zsh"
},
"extensions": [
// synchronize-marker:vscode-extensions:begin
// general
"eamodio.gitlens",
"vscode-icons-team.vscode-icons",
"vincaslt.highlight-matching-tag",
// code assist
"visualstudioexptteam.vscodeintellicode",
"angular.ng-template",
"mikael.angular-beastcode",
"formulahendry.auto-rename-tag",
// code style + formatting
"editorconfig.editorconfig",
"esbenp.prettier-vscode",
"stylelint.vscode-stylelint",
"dbaeumer.vscode-eslint",
"csstools.postcss",
"dbaeumer.vscode-eslint",
// testing
"andys8.jest-snippets",
// documentation
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one"
// synchronize-marker:vscode-extensions:end
],
"forwardPorts": [4200],
"postStartCommand": "sudo chown node node_modules && npm install",
// Comment out the next line to run as root instead.
// get correct nodejs version from package.json
"postCreateCommand": ". $NVM_DIR/nvm.sh && nvm install $(node -p -e 'require(\"./package.json\").engines.node')",
// install node modules
"postStartCommand": "sudo chown node node_modules eslint-rules && npm i --no-save --no-audit --prefer-offline --maxsockets 4",
"remoteUser": "node"
}
3 changes: 3 additions & 0 deletions .devcontainer/shellrc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source <(ng completion script)
ng config -g cli.warnings.versionMismatch false
ng config -g cli.completion.prompted true
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
/.nb-gradle
/nbproject/
/.nvmrc
/.vim/
/.angular/cache
**/*.log
/src/environments/environment.local.ts
Expand All @@ -35,8 +36,6 @@
!/dist/entrypoint.sh
!/dist/healthcheck.js
!/dist/robots.txt
!/dist/server.crt
!/dist/server.key

# from docs/.gitignore
/docs/compodoc
Expand Down
17 changes: 12 additions & 5 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
}
],
"@angular-eslint/sort-ngmodule-metadata-arrays": "warn",
"@ngrx/avoid-combining-selectors": "off",
"@ngrx/avoid-mapping-selectors": "off",
"@ngrx/no-store-subscription": "off",
"@ngrx/prefer-effect-callback-in-block-statement": "off",
Expand Down Expand Up @@ -218,10 +219,16 @@
"message": "use star imports only for aggregation of deeper lying imports"
},
{
"importNamePattern": "^(?!(range|uniq|memoize|once|groupBy|countBy|flatten|isEqual|intersection|pick)$).*",
"importNamePattern": "^(?!(range|uniq|memoize|once|groupBy|countBy|flatten|isEqual|intersection|pick|differenceBy|unionBy|mergeWith)$).*",
"name": "lodash.*",
"filePattern": "^(?!.*.spec.ts$).*.ts$",
"message": "importing (range|uniq|memoize|once|groupBy|countBy|flatten|isEqual|intersection|pick) from lodash is forbidden"
"filePattern": "^.*/src/app/(?!.*\\.spec\\.ts$).*\\.ts$",
"message": "importing this operator from lodash is forbidden"
},
{
"importNamePattern": "^omit$",
"name": "lodash.*",
"filePattern": "^.*/src/app/(?!.*\\.spec\\.ts$).*\\.ts$",
"message": "use omit from 'ish-core/utils/functions'"
},
{
"importNamePattern": "CookiesService",
Expand All @@ -235,9 +242,9 @@
"message": "Modules should only aggregate deeper lying artifacts."
},
{
"name": "^(?!.*\\.(module|guard)$)\\.\\..*$",
"name": "^(?!.*\\.(module|guard|service)$)\\.\\..*$",
"filePattern": ".*-routing\\.module\\.ts",
"message": "Modules should only aggregate deeper lying artifacts."
"message": "Routing modules should only aggregate deeper lying artifacts."
},
{
"name": ".*/extensions/.*",
Expand Down
33 changes: 33 additions & 0 deletions .github/scripts/docker-compose.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import sys
import easyargs
from os.path import join
from os import _exit
from typing import Dict
from yaml import load, dump
try:
from yaml import CLoader as Loader, CDumper as Dumper
except ImportError:
from yaml import Loader, Dumper

def dockerComposeFile(dir: str='.', mode: str='r'):
f = join(dir, 'docker-compose.yml');
try:
return open(f, mode)
except IOError as error:
print(error)
_exit(1)


@easyargs
def main(icm, ssrimage, nginximage):
data: Dict = load(dockerComposeFile(), Loader=Loader)
data['services']['pwa'].pop('build')
data['services']['nginx'].pop('build')
data['services']['pwa'].update({'image': ssrimage})
data['services']['pwa']['environment']['ICM_BASE_URL'] = icm
data['services']['nginx'].update({'image': nginximage})
data['services']['nginx']['environment']['CACHE'] = 1
dump(data, dockerComposeFile('./dist','w'), Dumper=Dumper)

if __name__ == "__main__":
main()
2 changes: 2 additions & 0 deletions .github/scripts/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
easyargs == 0.9.4
PyYAML == 5.4.1
47 changes: 34 additions & 13 deletions .github/workflows/demo-server-up.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,23 +29,34 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Publish Universal Image to Registry
id: universal
uses: elgohr/Publish-Docker-Github-Action@master
- name: Publish SSR image to Registry
id: ssr
uses: elgohr/Publish-Docker-Github-Action@v4
env:
serviceWorker: false
displayVersion: ${{ github.event.after }}
testing: true
NODE_OPTIONS: --max_old_space_size=8192
with:
name: universal
name: intershop-pwa-ssr
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}
buildargs: serviceWorker,configuration,displayVersion,testing
buildargs: serviceWorker,displayVersion,testing
- name: Publish NGINX image to Registry
id: nginx
uses: elgohr/Publish-Docker-Github-Action@v4
with:
name: intershop-pwa-nginx
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
registry: ${{ secrets.DOCKER_REGISTRY }}
context: nginx
- name: Set Environment
run: |
echo "DOCKER_IMAGE_UNIVERSAL=${{ steps.universal.outputs.digest }}" >> $GITHUB_ENV
echo "BRANCH_NAME=${GITHUB_REF_NAME}" >> $GITHUB_ENV
echo "DOCKER_IMAGE_SSR=${{ steps.ssr.outputs.digest }}" >> $GITHUB_ENV
echo "DOCKER_IMAGE_NGINX=${{ steps.nginx.outputs.digest }}" >> $GITHUB_ENV
printf 'AZURE_WEBAPP_NAME=%.60s' "${{ secrets.AZURE_DEMO_RESOURCEGROUP }}-$( echo ${{ github.event.ref }} | sed -e 's/refs\/heads\///' | sed -e 's/[^a-zA-Z0-9-]/-/g' )" >> $GITHUB_ENV
- name: Login via Azure CLI
run: az login --service-principal --username ${{ secrets.AZURE_SP_USERNAME }} --password ${{ secrets.AZURE_SP_PASSWORD }} --tenant ${{ secrets.AZURE_SP_TENANT }}
Expand All @@ -54,13 +65,23 @@ jobs:
APP: ${{ env.AZURE_WEBAPP_NAME }}
GROUP: ${{ secrets.AZURE_DEMO_RESOURCEGROUP }}
run: |
az webapp config container set --resource-group $GROUP --name $APP --docker-registry-server-user ${{ secrets.DOCKER_REGISTRY_USERNAME }} --docker-registry-server-password ${{ secrets.DOCKER_REGISTRY_PASSWORD }} --docker-custom-image-name $DOCKER_IMAGE_UNIVERSAL || az webapp create --resource-group $GROUP --plan ${{ secrets.AZURE_DEMO_APPSERVICEPLAN }} --name $APP --docker-registry-server-user ${{ secrets.DOCKER_REGISTRY_USERNAME }} --docker-registry-server-password ${{ secrets.DOCKER_REGISTRY_PASSWORD }} --deployment-container-image-name $DOCKER_IMAGE_UNIVERSAL
az webapp config appsettings set -g $GROUP -n $APP --settings LOGGING=true ICM_BASE_URL=$ICM_BASE_URL
az webapp deployment container config -g $GROUP -n $APP --enable-cd true
- name: Create Commit Comment
uses: peter-evans/commit-comment@v1
set -ex
pip install -r ./.github/scripts/requirements.txt
python ./.github/scripts/docker-compose.py $ICM_BASE_URL "$DOCKER_IMAGE_SSR" "$DOCKER_IMAGE_NGINX"
az webapp config container set --resource-group $GROUP --name $APP --multicontainer-config-type compose --multicontainer-config-file dist/docker-compose.yml || az webapp create --resource-group $GROUP --plan ${{ secrets.AZURE_DEMO_APPSERVICEPLAN }} --name $APP --multicontainer-config-type compose --multicontainer-config-file dist/docker-compose.yml
az webapp config container set --docker-registry-server-password ${{ secrets.DOCKER_REGISTRY_PASSWORD }} --docker-registry-server-url ${{ secrets.DOCKER_REGISTRY }} --docker-registry-server-user ${{ secrets.DOCKER_REGISTRY_USERNAME }} --name $APP --resource-group $GROUP
- name: Find Pull Request
uses: juliangruber/find-pull-request-action@v1
id: find-pull-request
with:
branch: ${{ env.BRANCH_NAME }}
- name: Found Pull Request
run: echo "Pull Request for Branch ${{ env.BRANCH_NAME }} -> ${{ steps.find-pull-request.outputs.number }} (${{ steps.find-pull-request.outputs.head-sha }})"
- name: Create Demo Server Comment
uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ steps.find-pull-request.outputs.number }}
body: |
Azure Demo Servers are available:
- [Universal B2B](http://${{ env.AZURE_WEBAPP_NAME }}.azurewebsites.net/home)
- [Universal B2C](http://${{ env.AZURE_WEBAPP_NAME }}.azurewebsites.net/home;theme=b2c)
- [Universal B2B](http://${{ env.AZURE_WEBAPP_NAME }}.azurewebsites.net/en/home)
- [Universal B2C](http://${{ env.AZURE_WEBAPP_NAME }}.azurewebsites.net/b2c/home)
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ node_modules
/.nb-gradle
/nbproject/
/.nvmrc
/.vim/

# misc
/.angular/cache
Expand Down
1 change: 0 additions & 1 deletion .husky/post-checkout
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ then

if [ "$INTERSHOP_PWA_AUTO_INSTALL" = "true" ]
then
git clean -xdf src/**/lazy-* projects/**/lazy-*
npm install
fi
fi
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
*.sh
*.py
*.bat
*.cmd
*.ps1
Expand Down
2 changes: 2 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
// synchronize-marker:vscode-extensions:begin
// general
"eamodio.gitlens",
"vscode-icons-team.vscode-icons",
Expand All @@ -23,6 +24,7 @@
// documentation
"streetsidesoftware.code-spell-checker",
"yzhang.markdown-all-in-one"
// synchronize-marker:vscode-extensions:end
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": ["eg2.tslint"]
Expand Down
12 changes: 10 additions & 2 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,19 @@
"internalConsoleOptions": "neverOpen"
},
{
"name": "Clean up Localizations",
"name": "Cleanup Localizations",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/scripts/clean-up-localizations",
"args": [],
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
},
{
"name": "Upgrade PWA",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/scripts/upgrade-pwa",
"cwd": "${workspaceFolder}",
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
Expand Down
Loading

0 comments on commit dbcce68

Please sign in to comment.