Skip to content

Commit

Permalink
Initial
Browse files Browse the repository at this point in the history
  • Loading branch information
pookmish committed Mar 5, 2024
0 parents commit f52f9da
Show file tree
Hide file tree
Showing 215 changed files with 36,038 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# 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
23 changes: 23 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"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": "^_" }
]
},
"plugins": ["unused-imports"],
"ignorePatterns": ["**/__generated__/**/*"]
}
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:18
env:
NEXT_PUBLIC_DRUPAL_BASE_URL: ${{ secrets.NEXT_PUBLIC_DRUPAL_BASE_URL }}
steps:
- uses: actions/checkout@v2
- name: Restore Cache
uses: actions/cache@v3
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
93 changes: 93 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@

additionalRepositories:
- url: https://github.com/SU-SWS/acsf-cardinalsites-public
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 &&
cp .gitpod/global.settings.php docroot/sites/settings/global.settings.php &&
cp .gitpod/default.local.services.yml docroot/sites/local.services.yml &&
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 -n &&
cd /workspace/front &&
cp .env.example .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://"} &&
blt blt:telemetry:disable --no-interaction &&
echo 'Establishing Settings' &&
blt settings &&
echo 'Logging Into Drupal' &&
drush uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL &&
drush uli --uri=$NEXT_PUBLIC_DRUPAL_BASE_URL | xargs gp preview --external &&
git config core.fileMode false &&
echo 'Connecting Drupal to Frontend' &&
cd /workspace/front &&
yarn install &&
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
command: |
rm -rf ~/.ssh/id_rsa &&
rm -rf ~/.ssh/id_rsa.pub &&
eval $(command gp env -e) &&
mkdir -p ~/.ssh &&
[[ ! -z $SSH_PUBLIC_KEY ]] &&
echo $SSH_PUBLIC_KEY | base64 -d > ~/.ssh/id_rsa.pub &&
chmod 644 ~/.ssh/id_rsa.pub &&
[[ ! -z $SSH_PRIVATE_KEY ]] &&
echo $SSH_PRIVATE_KEY | base64 -d > ~/.ssh/id_rsa &&
chmod 600 ~/.ssh/id_rsa &&
cd /workspace/front &&
[[ ! -z $GITCONFIG ]] &&
echo $GITCONFIG | base64 -d > ~/.gitconfig &&
chmod 644 ~/.gitconfig
git remote set-url origin $(echo $GITPOD_WORKSPACE_CONTEXT | jq -r .repository.cloneUrl | sed -E 's|^.*.com/(.*)$|[email protected]:\1|')
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 f52f9da

Please sign in to comment.