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

WIP: Adobe Students implementation #2

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all 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
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[*]
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 2
quote_type = single
31 changes: 25 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
module.exports = {
root: true,
extends: 'airbnb-base',
env: {
browser: true,
},
env: { browser: true, mocha: true },
parser: '@babel/eslint-parser',
parserOptions: {
allowImportExportEverywhere: true,
sourceType: 'module',
requireConfigFile: false,
},
rules: {
'import/extensions': ['error', { js: 'always' }], // require js file extensions in imports
'linebreak-style': ['error', 'unix'], // enforce unix linebreaks
'no-param-reassign': [2, { props: false }], // allow modifying properties of param
// allow reassigning param
'no-param-reassign': [2, { props: false }],
'linebreak-style': ['error', 'unix'],
'import/extensions': ['error', { js: 'always' }],
'object-curly-newline': ['error', {
ObjectExpression: { multiline: true, minProperties: 6 },
ObjectPattern: { multiline: true, minProperties: 6 },
ImportDeclaration: { multiline: true, minProperties: 6 },
ExportDeclaration: 'never',
}],
'no-unused-expressions': 0,
'chai-friendly/no-unused-expressions': 2,
},
overrides: [
{
files: ['test/**/*.js'],
rules: { 'no-console': 'off' },
},
],
plugins: [
'chai-friendly',
],
ignorePatterns: [
'/adobe-students/deps/*',
],
};
4 changes: 4 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
name: "CC CodeQL Config"

paths-ignore:
- node_modules
10 changes: 5 additions & 5 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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):
* Add your specific features or fixes

Fix #<gh-issue-id>
Resolves: [MWPW-NUMBER](https://jira.corp.adobe.com/browse/MWPW-NUMBER)

Test URLs:
- Before: https://main--{repo}--{owner}.hlx.live/
- After: https://<branch>--{repo}--{owner}.hlx.live/
**Test URLs:**
- Before: https://main--cc--adobecom.hlx.page/?martech=off
- After: https://<branch>--cc--adobecom.hlx.page/?martech=off
67 changes: 67 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "stage", "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "stage", "main" ]
schedule:
# Scheduled to run at 06:18 every Friday
- cron: '18 6 * * 5'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript' ]

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
27 changes: 27 additions & 0 deletions .github/workflows/run-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Lint
on:
pull_request:
types: [opened, synchronize, reopened]
paths:
- '**.js'

jobs:
run-lint:
name: Running eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- uses: actions/setup-node@v2
with:
node-version: 18

- name: Install dependencies
run: npm ci

- name: Run eslint on changed files
uses: tj-actions/eslint-changed-files@v20
with:
config_path: ".eslintrc.js"
# ignore_path: "/path/to/.eslintignore"
# extra_args: "--max-warnings=0"
30 changes: 30 additions & 0 deletions .github/workflows/run-nala.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Nala Tests

on:
pull_request:
types: [ labeled, opened, synchronize, reopened ]

jobs:
action:
name: Running E2E & IT
if: contains(github.event.pull_request.labels.*.name, 'run-nala')
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Run Nala
uses: adobecom/nala@main
env:
WORKFLOW_NAME: 'CC-PR-RUN'
PR_RUN: 'true'
labels: ${{ join(github.event.pull_request.labels.*.name, ' ') }}
branch: ${{ github.event.pull_request.head.ref }}
repoName: ${{ github.repository }}
prUrl: ${{ github.event.pull_request.head.repo.html_url }}
prOrg: ${{ github.event.pull_request.head.repo.owner.login }}
prRepo: ${{ github.event.pull_request.head.repo.name }}
prBranch: ${{ github.event.pull_request.head.ref }}
prBaseBranch: ${{ github.event.pull_request.base.ref }}
IMS_EMAIL: ${{ secrets.IMS_EMAIL }}
IMS_PASS: ${{ secrets.IMS_PASS }}
43 changes: 43 additions & 0 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Unit Tests
on:
push:
branches:
- stage
- main
pull_request:
types: [opened, synchronize, reopened, edited]
branches:
- stage
- main
jobs:
run-tests:
name: Running tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install XVFB
run: sudo apt-get install xvfb

- name: Install dependencies
run: npm install

- name: Run the tests
run: xvfb-run -a npm test

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage/lcov.info
3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,5 @@
coverage/*
logs/*
node_modules/*

helix-importer-ui
.DS_Store
*.bak
.idea
4 changes: 1 addition & 3 deletions .hlxignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.*
*.md
karma.config.js
LICENSE
package.json
package-lock.json
test/*
!tools/sidekick/config.json
26 changes: 26 additions & 0 deletions .kodiak/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: 1.0

snow:
- id: 546348 # Milo Genuine https://adobe.service-now.com/service_registry_portal.do#/service/546348

notifications:
jira:
default:
project: MWPW # Mandatory
filters:
include:
risk_rating: R5
fields:
assignee:
name: blaishram
customfield_11800: MWPW-140779 #epic link
watchers:
- casalino
- jmichnow
- mauchley
labels:
- "OriginatingProcess=Kodiak"
- "security"
- "kodiak-ticket"
components:
- name: "DevOps Security"
2 changes: 1 addition & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
"extends": ["stylelint-config-standard"]
"extends": ["stylelint-config-standard", "stylelint-config-prettier"]
}
10 changes: 10 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"recommendations": [
"stylelint.vscode-stylelint",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"ryanluker.vscode-coverage-gutters",
"eamodio.gitlens",
"virtual-comments.virtual-comments"
]
}
15 changes: 15 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"type": "chrome",
"request": "launch",
"name": "Debug on Helix",
"url": "http://localhost:3000",
"webRoot": "${workspaceFolder}"
}
]
}
2 changes: 2 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{
}
65 changes: 10 additions & 55 deletions 404.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,65 +2,20 @@
<html>

<head>
<title>Page not found</title>
<script type="text/javascript">
window.isErrorPage = true;
window.errorCode = '404';
</script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta property="og:title" content="Page not found">
<script src="/scripts/scripts.js" type="module" crossorigin="use-credentials"></script>
<script type="module">
window.addEventListener('load', () => {
if (document.referrer) {
const { origin, pathname } = new URL(document.referrer);
if (origin === window.location.origin) {
const backBtn = document.createElement('a');
backBtn.classList.add('button', 'error-button-back');
backBtn.href = pathname;
backBtn.textContent = 'Go back';
backBtn.title = 'Go back';
const btnContainer = document.querySelector('.button-container');
btnContainer.append(backBtn);
}
}
});
</script>
<script type="module">
import { sampleRUM } from '/scripts/aem.js';
sampleRUM('404', { source: document.referrer });
</script>
<link rel="stylesheet" href="/styles/styles.css">
<style>
main.error {
min-height: calc(100vh - var(--nav-height));
display: flex;
align-items: center;
}

main.error .error-number {
width: 100%;
}

main.error .error-number text {
font-family: monospace;
}
</style>
<link rel="stylesheet" href="/styles/lazy-styles.css">
<title>404</title>
<meta name="template" content="404" />
<meta name="404" content="feds" />
<meta name="header" content="global-navigation" />
<meta name="footer" content="global-footer" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<script src="/adobe-students/scripts/scripts.js" type="module"></script>
<link rel="icon" href="data:," />
</head>

<body>
<header></header>
<main class="error">
<div class="section">
<svg viewBox="1 0 38 18" class="error-number">
<text x="0" y="17">404</text>
</svg>
<h2 class="error-message">Page Not Found</h2>
<p class="button-container">
<a href="/" class="button secondary error-button-home">Go home</a>
</p>
</div>
<main>
<div></div>
</main>
<footer></footer>
</body>
Expand Down
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @salonijain3 @bandana147 @amitbikram @raga-adbe-gh
Loading
Loading