Skip to content

Commit

Permalink
Initial Summer
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Apr 2, 2024
0 parents commit 49f12b6
Show file tree
Hide file tree
Showing 224 changed files with 36,709 additions and 0 deletions.
18 changes: 18 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# See https://next-drupal.org/docs/environment-variables
NEXT_PUBLIC_DRUPAL_BASE_URL=https://dev.next-drupal.org

# Required for On-demand Revalidation.
#DRUPAL_REVALIDATE_SECRET=DRUPAL_REVALIDATE_SECRET

# Draft mode credentials.
#DRUPAL_PREVIEW_SECRET=DRUPAL_PREVIEW_SECRET
#DRUPAL_DRAFT_CLIENT=DRUPAL_DRAFT_CLIENT
#DRUPAL_DRAFT_SECRET=DRUPAL_DRAFT_SECRET

# Change this to 'true' to fetch all pages and build each one.
# Recommended to enable this for production environment.
#BUILD_COMPLETE=false

# Set this environment variable on the production environment only at launch. This will be used for the
# /sitemap.xml and allow search indexing on the site.
#NEXT_PUBLIC_DOMAIN=http://localhost:3000
24 changes: 24 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2020,
"sourceType": "module",
"project": "./tsconfig.json"
},
"extends": [
"next/core-web-vitals",
"plugin:storybook/recommended",
"plugin:deprecation/recommended"
],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"warn",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
],
"no-console": ["error", { "allow": ["warn"] }]
},
"plugins": ["unused-imports"],
"ignorePatterns": ["**/__generated__/**/*"]
}
66 changes: 66 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# NOT READY FOR REVIEW
- (Edit the above to reflect status)

# Summary
- TL;DR - what's this PR for?

# Review By (Date)
- When does this need to be reviewed by?

# Criticality
- How critical is this PR on a 1-10 scale? Also see [Severity Assessment](https://stanfordits.atlassian.net/browse/D8CORE-1705).
- E.g., it affects one site, or every site and product?

# Urgency
- How urgent is this? (Normal, High)

# Review Tasks

## Setup tasks and/or behavior to test

1. Check out this branch
2. Rebuild Cache and import config `drush cr ; drush ci`
3. Navigate to...
4. Verify...

### Site Configuration Sync

- Is there a config:export in this PR that changes the config sync directory?

## Front End Validation
- [ ] Design is approved by @ user?
- [ ] HTML validation: Is the markup using the appropriate semantic tags and [passes validation](https://validator.w3.org/nu/)? Or, [QA request ticket created](https://github.com/SU-SWS/template_warehouse/blob/master/jira_templates/QA_request_template.txt)?
- [ ] Cross-browser testing: Has been performed? Or, [QA request ticket created](https://github.com/SU-SWS/template_warehouse/blob/master/jira_templates/QA_request_template.txt)?
- [ ] Automated accessibility: Scans performed? Or, [QA request ticket created](https://github.com/SU-SWS/template_warehouse/blob/master/jira_templates/QA_request_template.txt)?
- [ ] Manual accessibility: Manually tested? Or, [QA request ticket created](https://github.com/SU-SWS/template_warehouse/blob/master/jira_templates/QA_request_template.txt)?

## Backend / Functional Validation
### Code
- [ ] Are the naming conventions following our standards?
- [ ] Does the code have sufficient inline comments?
- [ ] Is there anything in this code that would be hidden or hard to discover through the UI?
- [ ] Are there any [code smells](https://blog.codinghorror.com/code-smells/)?
- [ ] Are tests provided? eg (unit, behat, or codeception)

### Code security
- [ ] Are all [forms properly sanitized](https://www.drupal.org/docs/8/security/drupal-8-sanitizing-output)?
- [ ] Any obvious [security flaws or new areas for attack](https://www.drupal.org/docs/8/security)?

## General
- [ ] Is there anything included in this PR that is not related to the problem it is trying to solve?
- [ ] Is the approach to the problem appropriate?

# Affected Projects or Products
- Does this PR impact any particular projects, products, or modules?

# Associated Issues and/or People
- JIRA ticket(s)
- Other PRs
- Any other contextual information that might be helpful (e.g., description of a bug that this PR fixes, new functionality that it adds, etc.)
- Anyone who should be notified? (`@mention` them here)

# Resources
- [AMP Tool](https://stanford.levelaccess.net/index.php)
- [Accessibility Manual Test Script](https://docs.google.com/document/d/1ZXJ9RIUNXsS674ow9j3qJ2g1OAkCjmqMXl0Gs8XHEPQ/edit?usp=sharing)
- [HTML Validator](https://validator.w3.org/)
- [Browserstack](https://live.browserstack.com/dashboard) and link to [Browserstack Credentials](https://asconfluence.stanford.edu/confluence/display/SWS/External+Account+Credentials)
30 changes: 30 additions & 0 deletions .github/workflows/build_lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

name: Build & Lint
on: [push]
jobs:
lint:
name: Lint & TS Check
runs-on: ubuntu-latest
container:
image: node:20
env:
NEXT_PUBLIC_DRUPAL_BASE_URL: ${{ secrets.NEXT_PUBLIC_DRUPAL_BASE_URL }}
steps:
- uses: actions/checkout@v4
- name: Restore Cache
uses: actions/cache@v4
with:
path: |
node_modules
key: 1.x-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
1.x-${{ hashFiles('package.json') }}-${{ hashFiles('yarn.lock') }}
1.x-${{ hashFiles('package.json') }}-
1.x-
- name: Lint
run: |
yarn
yarn lint
- name: Build
run: |
yarn build
45 changes: 45 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
.idea

# Yarn files. See https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored.
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
94 changes: 94 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@

additionalRepositories:
- url: https://github.com/SU-SWS/ace-stanfordlagunita/
checkoutLocation: back
checkoutLocation: front
ports:
- name: database
description: Mysql database
port: 3306
onOpen: ignore
visibility: private
- port: 33060
onOpen: ignore
visibility: private
- name: drupal
description: Drupal backend
port: 8001
onOpen: ignore
visibility: public
- name: frontend
description: NextJS frontend
port: 3000
onOpen: ignore
visibility: public
- port: 8002-9999
onOpen: ignore
image: pookmish/drupal8ci:gitpod
tasks:
- name: Drupal Prep
init: >
eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) &&
cd /workspace/back &&
rm -rf config/default &&
mkdir -p config/default &&
touch config/default/core.extension.yml &&
composer install --no-interaction &&
mkdir -p blt &&
cp .gitpod/blt.yml blt/local.blt.yml &&
find docroot/sites/ -name 'local*' | xargs rm -rf &&
export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` &&
export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} &&
blt blt:telemetry:disable --no-interaction &&
blt settings &&
blt drupal:install --site=supress -n &&
drush @supress.local cset system.theme default stanford_profile_admin_theme -y &&
cd /workspace/front &&
cp .env.example .env.local &&
sed -i 's/#DRUPAL_REVALIDATE_SECRET/DRUPAL_REVALIDATE_SECRET/' .env.local &&
sed -i 's/#DRUPAL_PREVIEW_SECRET/DRUPAL_PREVIEW_SECRET/' .env.local &&
yarn install
command: |
cd /workspace/back &&
echo 'Restarting Apache' &&
eval $(gp env -e APACHE_DOCROOT_IN_REPO=../back/docroot) &&
apache2ctl restart &&
gp ports await 8001 &&
find docroot -name 'local.drush.yml' | xargs rm &&
export NEXT_PUBLIC_DRUPAL_BASE_URL=`gp url 8001` &&
export PREVIEW_URL=${NEXT_PUBLIC_DRUPAL_BASE_URL#"https://"} &&
echo "<?php \$sites['$PREVIEW_URL'] = 'supress';" > docroot/sites/local.sites.php &&
blt blt:telemetry:disable --no-interaction &&
echo 'Establishing Settings' &&
blt settings &&
echo 'Logging Into Drupal' &&
drush @supress.local uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL &&
drush @supress.local uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL | xargs gp preview --external &&
git config core.fileMode false &&
echo 'Connecting Drupal to Frontend' &&
drush @supress.local su-next-connect "$(gp url 3000)" --preview-secret=DRUPAL_PREVIEW_SECRET --revalidation-secret=DRUPAL_REVALIDATION_SECRET &&
cd /workspace/front &&
yarn install &&
yarn config set --home enableTelemetry 0 &&
yarn next telemetry disable &&
sed -i -r "s|NEXT_PUBLIC_DRUPAL_BASE_URL.*|NEXT_PUBLIC_DRUPAL_BASE_URL=$NEXT_PUBLIC_DRUPAL_BASE_URL|g" .env.local &&
yarn dev &
gp ports await 3000 &&
gp url 3000 | xargs gp preview --external
- name: SSH Keys
before: |
git remote set-url origin $(echo $GITPOD_WORKSPACE_CONTEXT | jq -r .repository.cloneUrl | sed -E 's|^.*.com/(.*)$|[email protected]:\1|')
mkdir -p ~/.ssh
if [[ ! -z $SSH_PUBLIC_KEY ]]; then
echo $SSH_PUBLIC_KEY | base64 -d > ~/.ssh/id_rsa.pub && chmod 644 ~/.ssh/id_rsa.pub
fi
if [[ ! -z $SSH_PRIVATE_KEY ]]; then
echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa && chmod 600 ~/.ssh/id_rsa
fi
if [[ ! -z $GITCONFIG ]]; then
echo $GITCONFIG | base64 -d > ~/.gitconfig && chmod 644 ~/.gitconfig
fi
vscode:
extensions:
- bradlc.vscode-tailwindcss
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20
44 changes: 44 additions & 0 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { TsconfigPathsPlugin } from "tsconfig-paths-webpack-plugin";
import path from "path";
import type {StorybookConfig} from "@storybook/nextjs";

const config: StorybookConfig = {
framework: {
name: "@storybook/nextjs",
options: {
builder: {
useSWC: true,
},
},
},
typescript: {
reactDocgen: 'react-docgen',
check: false,
},
stories: [
"./stories/**/*.mdx",
"./stories/**/*.stories.@(js|jsx|ts|tsx)"
],
addons: [
"@storybook/addon-links",
"@storybook/addon-essentials",
"@storybook/addon-interactions",
'@storybook/addon-styling',
{
name: '@storybook/addon-styling',
options: {
// Check out https://github.com/storybookjs/addon-styling/blob/main/docs/api.md
// For more details on this addon's options.
postCss: true,
},
},
],
docs: {
autodocs: "tag",
},
webpackFinal: async (config) => {
if (config.resolve) config.resolve.plugins = [new TsconfigPathsPlugin()];
return config
},
};
export default config;
16 changes: 16 additions & 0 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import type { Preview } from "@storybook/react";
import '../src/styles/index.css';
import './storybook.css';

const preview: Preview = {
parameters: {
actions: { argTypesRegex: "^on[A-Z].*" },
controls: {
matchers: {
date: /date/,
},
},
},
};

export default preview;
45 changes: 45 additions & 0 deletions .storybook/stories/config-pages/GlobalMessage.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import type {Meta, StoryObj} from '@storybook/react';
import GlobalMessage from "@components/config-pages/global-message";
import {ComponentProps} from "react";
import {Link, Text} from "@lib/gql/__generated__/drupal";

type ComponentStoryProps = ComponentProps<typeof GlobalMessage> & {
messageText?: Text["processed"]
linkUrl?: Link["url"]
linkTitle?: Link["title"]
}

// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction
const meta: Meta<ComponentStoryProps> = {
title: 'Design/Config Pages/Global Message',
component: GlobalMessage,
tags: ['autodocs'],
argTypes: {
suGlobalMsgType: {
options: ['info', 'success', 'warning', 'error', 'plain'],
control: {type: 'select'}
},
suGlobalMsgEnabled: {control: "boolean"}
}
};

export default meta;
type Story = StoryObj<ComponentStoryProps>;

// More on writing stories with args: https://storybook.js.org/docs/react/writing-stories/args
export const SuccessMessage: Story = {
render: ({linkUrl, linkTitle, messageText, ...args}) => {
if (messageText) args.suGlobalMsgMessage = {processed: messageText}
if (linkUrl && linkTitle) args.suGlobalMsgLink = {url: linkUrl, title: linkTitle, internal: false}
return <GlobalMessage {...args}/>
},
args: {
suGlobalMsgType: 'success',
messageText: '<p>Rutrum nec ipsum lacus portaest cursus orci dolor gravida gravida eget nulla ipsum elementum leo enim vivamus quam lorem tempus quis cursus sem nec pellentesque. <a href="#">Link text</a></p><p><a class="su-button" href="#">Button text</a></p><p><a class="su-button--secondary" href="#">Secondary text</a></p>',
suGlobalMsgLabel: 'Placerat lacus ut eget leo.',
suGlobalMsgHeader: 'Accumsan eget amet id sollicitudin.',
linkTitle: 'Sem quisque placerat quis suspendisse.',
linkUrl: '#',
suGlobalMsgEnabled: true,
},
};
Loading

0 comments on commit 49f12b6

Please sign in to comment.