Skip to content

Commit 71d49b7

Browse files
authored
Initial commit
0 parents  commit 71d49b7

File tree

1,954 files changed

+89256
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,954 files changed

+89256
-0
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[*.js]
2+
indent_size = 2
3+
4+
[*.css]
5+
indent_size = 4

.eslintignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
helix-importer-ui
2+
scripts/acdl
3+
tools/picker
4+
tools/segments
5+
tools/pdp-metadata
6+
scripts/__dropins__
7+
scripts/commerce-events-collector.js
8+
scripts/commerce-events-sdk.js
9+
plugins/
10+
cypress/

.eslintrc.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = {
2+
root: true,
3+
extends: 'airbnb-base',
4+
env: {
5+
browser: true,
6+
},
7+
parser: '@babel/eslint-parser',
8+
parserOptions: {
9+
allowImportExportEverywhere: true,
10+
sourceType: 'module',
11+
requireConfigFile: false,
12+
},
13+
rules: {
14+
'import/extensions': ['error', { js: 'always' }], // require js file extensions in imports
15+
'import/prefer-default-export': 'off', // allow named exports for single exports
16+
'import/no-cycle': 'off', // allow circular dependencies for browser code
17+
'import/no-relative-packages': 'off', // allow relative imports for browser code
18+
'linebreak-style': ['error', 'unix'], // enforce unix linebreaks
19+
'no-param-reassign': [2, { props: false }], // allow modifying properties of param
20+
'no-use-before-define': [2, { functions: false }],
21+
'no-console': [
22+
'error',
23+
{
24+
allow: ['warn', 'error', 'info', 'debug'],
25+
},
26+
],
27+
'no-unused-vars': ['error', { argsIgnorePattern: '^_', varsIgnorePattern: '^_' }],
28+
'no-underscore-dangle': 'off', // allow all underscore properties
29+
},
30+
overrides: [
31+
{
32+
files: ['build.mjs'],
33+
rules: {
34+
'import/no-extraneous-dependencies': 'off',
35+
},
36+
},
37+
],
38+
};

.github/pull_request_template.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Please always provide the [GitHub issue(s)](../issues) your PR is for, as well as test URLs where your change can be observed (before and after):
2+
3+
Fix #<gh-issue-id>
4+
5+
Test URLs:
6+
- Before: https://main--{repo}--{owner}.aem.live/
7+
- After: https://<branch>--{repo}--{owner}.aem.live/
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This workflow will run upon repository creation and clean up
2+
# all files that are not strictly required to build an AEM Live project
3+
# but that we use to develop the project template. This includes this
4+
# particular workflow file.
5+
on:
6+
create:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
jobs:
11+
cleanup:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
actions: write
16+
# only run if commit message is "Initial commit" on main branch
17+
if: ${{ github.event_name == 'workflow_dispatch' || ( github.ref == 'refs/heads/main' && !(contains(github.event, 'head_commit') || github.event.head_commit.message == 'Initial commit' )) }}
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Use Node.js 20
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: 20
25+
- name: Remove Helper Files
26+
run: |
27+
rm -rf \
28+
.github/workflows/cleanup-on-create.yaml \
29+
.renovaterc.json \
30+
CHANGELOG.md
31+
32+
- name: Initialize README
33+
# replace {repo} and {owner} with the actual values
34+
run: |
35+
sed -i.bak "s/{repo}/$(basename ${{ github.repository }})/g" README.md
36+
sed -i.bak "s/{owner}/$(dirname ${{ github.repository }})/g" README.md
37+
- name: Initialize Pull Request Template
38+
run: |
39+
sed -i.bak "s/{repo}/$(basename ${{ github.repository }})/g" .github/pull_request_template.md
40+
sed -i.bak "s/{owner}/$(dirname ${{ github.repository }})/g" .github/pull_request_template.md
41+
42+
43+
# commit back to the repository
44+
- name: Commit changes
45+
run: |
46+
git config --local user.email "helix@adobe.com"
47+
git config --local user.name "AEM Bot"
48+
git add .
49+
git commit -m "chore: cleanup repository template"
50+
git push

.github/workflows/main.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Build
2+
on: [push]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v4
9+
- name: Use Node.js 20
10+
uses: actions/setup-node@v4
11+
with:
12+
node-version: 20
13+
- run: npm ci
14+
- run: npm run lint
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Block Unauthorized AEM Edits
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'scripts/aem.js'
7+
8+
jobs:
9+
check-aem-js:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout PR
13+
uses: actions/checkout@v4
14+
15+
- name: Download upstream scripts/aem.js
16+
run: |
17+
curl -sSL https://raw.githubusercontent.com/adobe/aem-boilerplate/main/scripts/aem.js -o upstream_aem.js
18+
19+
- name: Compare with upstream version
20+
id: check_diff
21+
run: |
22+
if ! diff -q scripts/aem.js upstream_aem.js; then
23+
echo "changed=true" >> $GITHUB_OUTPUT
24+
else
25+
echo "changed=false" >> $GITHUB_OUTPUT
26+
fi
27+
28+
- name: Comment on PR if file differs
29+
if: steps.check_diff.outputs.changed == 'true'
30+
env:
31+
GH_TOKEN: ${{ github.token }}
32+
run: |
33+
PR_NUMBER=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH")
34+
35+
COMMENT_BODY="❌ **\`scripts/aem.js\` must match the upstream version exactly.**
36+
37+
This file is protected and cannot be modified unless its content is identical to the upstream reference:
38+
🔗 https://github.com/adobe/aem-boilerplate/blob/main/scripts/aem.js
39+
40+
If you believe the change is necessary, please coordinate with the maintainers.
41+
42+
🛠️ To fix:
43+
- Revert local changes to \`scripts/aem.js\`, or
44+
- Copy the exact contents from the upstream link above."
45+
46+
# Try GitHub CLI first, fallback to API if it fails
47+
if ! gh pr comment $PR_NUMBER --body "$COMMENT_BODY"; then
48+
echo "GitHub CLI failed, trying API directly..."
49+
# Properly escape the JSON for the API call
50+
ESCAPED_BODY=$(echo "$COMMENT_BODY" | jq -Rs .)
51+
curl -s -H "Authorization: token ${{ github.token }}" \
52+
-H "Content-Type: application/json" \
53+
-X POST \
54+
-d "{\"body\": $ESCAPED_BODY}" \
55+
"https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments"
56+
fi
57+
58+
echo "❌ Failing due to unauthorized modification to scripts/aem.js"
59+
exit 1
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Cypress E2E SaaS Tests
2+
on: push
3+
jobs:
4+
cypress-saas-run:
5+
# If you want this job to run on your fork, remove the below "if" line.
6+
# You will need to "fix" the tests as they are specific to Adobe Commmerce's
7+
# demo backend.
8+
if: github.repository == 'hlxsites/aem-boilerplate-commerce'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Install root dependencies
13+
run: npm ci
14+
- name: Install adobe aem cli dependencies
15+
run: npm install -g @adobe/aem-cli
16+
- name: Start server in the background
17+
run: aem up --url https://main--boilerplate-accs--adobe-commerce.aem.live/ &
18+
- name: Install Cypress and run tests
19+
uses: cypress-io/github-action@v6
20+
with:
21+
working-directory: cypress
22+
wait-on: 'http://localhost:3000'
23+
command: npm run cypress:saas:run
24+
env:
25+
AEM_ASSETS_PRIVATE_USER: ${{ secrets.AEM_ASSETS_PRIVATE_USER }}
26+
- uses: actions/upload-artifact@v4
27+
if: failure()
28+
with:
29+
name: cypress-screenshots
30+
path: cypress/screenshots
31+
if-no-files-found: ignore
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Cypress E2E Tests
2+
on: push
3+
jobs:
4+
cypress-paas-run:
5+
# If you want this job to run on your fork, remove the below "if" line.
6+
# You will need to "fix" the tests as they are specific to Adobe Commmerce's
7+
# demo backend.
8+
if: github.repository == 'hlxsites/aem-boilerplate-commerce'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- name: Install root dependencies
13+
run: npm ci
14+
- name: Install adobe aem cli dependencies
15+
run: npm install -g @adobe/aem-cli
16+
- name: Start server in the background
17+
run: aem up --url https://main--boilerplate-paas--adobe-commerce.aem.live &
18+
- name: Install Cypress and run tests
19+
uses: cypress-io/github-action@v6
20+
with:
21+
working-directory: cypress
22+
wait-on: 'http://localhost:3000'
23+
command: npm run cypress:run
24+
env:
25+
AEM_ASSETS_PRIVATE_USER: ${{ secrets.AEM_ASSETS_PRIVATE_USER }}
26+
- uses: actions/upload-artifact@v4
27+
if: failure()
28+
with:
29+
name: cypress-screenshots
30+
path: cypress/screenshots
31+
if-no-files-found: ignore

.gitignore

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
.hlx/*
2+
coverage/*
3+
logs/*
4+
node_modules
5+
.parcel-cache
6+
7+
helix-importer-ui
8+
.DS_Store
9+
*.bak
10+
.idea
11+
# Ignore .map files in scripts/__dropins__/ directory and all its subdirectories
12+
scripts/__dropins__/**/*.map

0 commit comments

Comments
 (0)