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

Basic code setup for Adobe-Students pages #3

Merged
merged 12 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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/*',
],
};
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--adobe-students--adobecom.hlx.live/
- After: https://<branch>--adobe-students--adobecom.hlx.live/
**Test URLs:**
- Before: https://main--adobe-students--adobecom.hlx.live/?martech=off
- After: https://<branch>--adobe-students--adobecom.hlx.live/?martech=off
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: 'STUDENTS-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 }}
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
8 changes: 5 additions & 3 deletions .hlxignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
*.json
!*/**/*.json
.*
*.md
karma.config.js
LICENSE
package.json
package-lock.json
test/*
web-test-runner.config.mjs
codecov.yaml
!tools/sidekick/config.json
31 changes: 31 additions & 0 deletions .kodiak/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
version: 1.0

snow:
- id: 545562 # Milo CC

notifications:
jira:
default:
project: MWPW # Mandatory
filters:
include:
risk_rating: R5
fields:
assignee:
name: sumanh
sivasadobe marked this conversation as resolved.
Show resolved Hide resolved
customfield_11800: MWPW-140779 #epic link
customfield_12900:
value: Brahmos
watchers:
- casalino
- jmichnow
- mauchley
- saljain
- mathuria
- dstrong
sivasadobe marked this conversation as resolved.
Show resolved Hide resolved
labels:
- "OriginatingProcess=Kodiak"
- "security"
- "kodiak-ticket"
components:
- name: "DevOps Security"
3 changes: 0 additions & 3 deletions .renovaterc.json

This file was deleted.

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"]
}
9 changes: 9 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"recommendations": [
"stylelint.vscode-stylelint",
"dbaeumer.vscode-eslint",
"editorconfig.editorconfig",
"ryanluker.vscode-coverage-gutters",
"eamodio.gitlens",
]
}
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 @aishwaryamathuria @suhjainadobe @drashti1712
1 change: 1 addition & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,4 @@ One of the maintainers will look at the pull request within one week. Feedback o
The project's committers will release to the [Adobe organization on npmjs.org](https://www.npmjs.com/org/adobe).
Please contact the [Adobe Open Source Advisory Board](https://git.corp.adobe.com/OpenSourceAdvisoryBoard/discuss/issues) to get access to the npmjs organization.

The release process is fully automated using `semantic-release`, increasing the version numbers, etc. based on the contents of the commit messages found.
55 changes: 39 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,49 @@
# Your Project's Title...
Your project's description...
# Adobe Students x Milo
The Franklin based project for adobe student pages on www.adobe-students.com. Based off of milo-college.

## Environments
- Preview: https://main--adobe-students--adobecom.hlx.page/
- Live: https://main--adobe-students--adobecom.hlx.live/
## Developing
1. Install the [AEM CLI](https://github.com/adobe/helix-cli): `sudo npm install -g @adobe/aem-cli`
2. Run `aem up` this repo's folder. (opens your browser at `http://localhost:3000`)
3. Open this repo's folder in your favorite editor and start coding.

## Installation
## Testing Milo Changes on Adobe Students Pages
1. Run 'aem up' in this folder to ensure the adobe-students site is running locally.
2. Make changes in milo, and then from the milo folder, run `npm run libs`.
3. Milo will run at:
```
http://localhost:6456
```
4. On your `localhost:3000/` or the `main-<project>-<owner>` versions of your site, add the URL params: `?milolibs=local`
5. You should see milo changes occurring on adobe-students pages.
6. When needing to test on a adobe-students page while making a PR for milo, add the URL params: `?milolibs=<name-of-milo-branch>`to your test URLs.

## Creating New Blocks
When creating new blocks, first vet any requirements/author-experience in milo-community. There may be a way to achieve your goals with what currently exists in milo.

## Testing
```sh
npm i
npm run test
```
or:
```sh
npm run test:watch
```
This will give you several options to debug tests. Note: coverage may not be accurate.

## Linting

To run the linter run:
```sh
npm run lint
```

## Local development

1. Create a new repository based on the `aem-boilerplate` template and add a mountpoint in the `fstab.yaml`
1. Add the [AEM Code Sync GitHub App](https://github.com/apps/aem-code-sync) to the repository
1. Install the [AEM CLI](https://github.com/adobe/helix-cli): `npm install -g @adobe/aem-cli`
1. Start AEM Proxy: `aem up` (opens your browser at `http://localhost:3000`)
1. Open the `adobe-students` directory in your favorite IDE and start coding :)
To lint just js or css files, run
```sh
npm run lint:css
```
or:
```sh
npm run lint:js
```
If you need to lint just one file, you can run:
```sh
npx eslint file1.js
```
Binary file added adobe-students/img/favicons/favicon-180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added adobe-students/img/favicons/favicon-192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added adobe-students/img/favicons/favicon-512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added adobe-students/img/favicons/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions adobe-students/img/favicons/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions adobe-students/img/favicons/favicon.webmanifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "Adobe Students",
"display": "standalone",
"icons": [
{ "src": "/img/favicons/favicon-192.png", "sizes": "192x192", "type": "image/png" },
{ "src": "/img/favicons/favicon-512.png", "sizes": "512x512", "type": "image/png" }
]
}
Loading
Loading