Skip to content

Commit

Permalink
Merge pull request #47 from gunamata/fix-ci-failure
Browse files Browse the repository at this point in the history
Working configuration for local, default domain and custom domain
  • Loading branch information
jandubois authored Nov 2, 2023
2 parents aa272c1 + bf41756 commit 7a3f969
Show file tree
Hide file tree
Showing 1,364 changed files with 19,007 additions and 141,389 deletions.
Binary file removed .DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["next/babel"]
}
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_DEVELOPMENT = true
16 changes: 16 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"extends": [
"next/core-web-vitals",
"prettier",
"plugin:@typescript-eslint/eslint-recommended",
"plugin:@typescript-eslint/recommended"
],
"plugins": ["@typescript-eslint"],
"rules": {
"quotes": ["error", "single", { "avoidEscape": false, "allowTemplateLiterals": true }],
"no-trailing-spaces": 1,
"@typescript-eslint/explicit-module-boundary-types": 0,
"@typescript-eslint/no-non-null-assertion": 0,
"@typescript-eslint/no-explicit-any": "off"
}
}
68 changes: 47 additions & 21 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,55 @@
name: github pages
name: Deploy to GitHub Pages

on:
push:
branches:
- main
branches: [main]

jobs:
deploy:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: true # Fetch Hugo themes (true OR recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
hugo-version: 'latest'
extended: true

- name: Build
run: hugo --minify

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
node-version: 16.x
- name: Set Custom Domain Environment Variable
run: |
# Extract custom domain from your repository settings
CUSTOM_DOMAIN=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/pages" | jq -r '.cname')
if [ -n "$CUSTOM_DOMAIN" ] && [ "$CUSTOM_DOMAIN" != "null" ]; then
echo "NEXT_PUBLIC_CUSTOM_DOMAIN=$CUSTOM_DOMAIN" >> $GITHUB_ENV
fi
- name: Install packages
run: npm ci
- name: Build project
run: npm run build
- name: Export static files
run: npm run export
- name: Add .nojekyll file
run: touch ./out/.nojekyll
- name: Create CNAME File
run: |
# Check if NEXT_PUBLIC_CUSTOM_DOMAIN environment variable is set
if [[ -n $NEXT_PUBLIC_CUSTOM_DOMAIN ]]; then
echo "$NEXT_PUBLIC_CUSTOM_DOMAIN" > ./out/CNAME
fi
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
path: ./out
deploy:
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- id: deployment
uses: actions/deploy-pages@v2
34 changes: 34 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# 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
.env.development.local
.env.test.local
.env.production.local

# vercel
.vercel
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
node_modules
.gitignore
.gitlab-ci.yml
.sass-lint.yml
package-lock.json
package.json
.next
.code
11 changes: 11 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"trailingComma": "es5",
"tabWidth": 2,
"semi": false,
"singleQuote": true,
"jsxSingleQuote": true,
"bracketSpacing": true,
"arrowParens": "always",
"printWidth": 350,
"jsxBracketSameLine": true
}
1 change: 1 addition & 0 deletions .template.env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_PUBLIC_DEVELOPMENT = true
81 changes: 81 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@

React application built with:
[Next.JS](https://nextjs.org/) | [Tailwind CSS](https://tailwindcss.com/) | [TypeScript](https://www.typescriptlang.org/) and [Zustand](https://github.com/pmndrs/zustand)

---

## Getting Started ⭐️

For development, please run the following commands:

```bash
# This will create an env file with all the things needed for local development (rewrites paths, etc.)
cp .template.env .env.development.local
```

\*Requieres [Node](https://nodejs.org/en/) installed.

```bash
npm install
# then:
npm run dev
# or
yarn dev
```

Your changes will be reflected (live reload) at the following URL: http://localhost:3000

---

## Development 🚀
The application is an Next.JS app, using [TailwindCSS](https://tailwindcss.com) as a CSS class utility framework. To keep it simple, most of the layuot is keep in the `src/pages/index.tsx` file with the exception of some componentes that can be found in the `src/components` folder.

While working in the layout, we really recommend going through https://tailwindcss.com/docs/editor-setup for a better support of TailwindCSS & Intelisense


### Example of an element with TailwindCSS classes

If we want a blue link with some margins, we can do it like this:

```jsx
<a href="#" className="ml-2 text-blue-500">
```

Where `ml-2` (8px) is the margin-left class, and `text-blue-500` is the color class.

> NOTE: For text, background and borders colors, we recommend using the `-500` value. [See colors scheme](https://tailwindcss.com/docs/customizing-colors)

### Dark & Light theme
We're providing two themes: `dark` and `light`. To build a dark theme, we can use the `dark` prefix. [See more information](https://tailwindcss.com/docs/dark-mode).

```jsx
<div class="bg-white dark:bg-slate-800 rounded-lg">
// ...
</div>
```

On the light theme, the element will use the white background and the `dark:bg-slate-800` class will be applied on the Dark Theme.

If you only need one team, remove the toggle from the `src/components/layout/Header.tsx` file, it wil default to the `dark theme`. If you need to default to the `light theme`, edit the `src/pages/_document.tsx` file and edit the `<Html className='dark'>` to `light`.

### State management
Currently we don't need to manage a lot of application state but we do have [Zustand](https://github.com/pmndrs/zustand) as state management library if needed.


---

## Build for production 🏗

### Self hosted

You can serve the applications a Server-Side render with `npm start`. This will build the Production Ready application.


### Github Pages

If you want to generate static files to serve as Static Site on Github Pages for example you should run `npm run static`. This will generate an `/out` folder with all the static files.

*NOTE:*: You'll need to edit `next.config.js`, uncomment add replace the default `project-template` name with your repository name for `assetPrefix & basePath`, this configuration is needed to correctly render and set paths in Github Pages.

There's already an github workflow that will deploy to your repo's GH Pages, check `./github/workflows/gh-pages.deploy.yml`file.
6 changes: 0 additions & 6 deletions archetypes/default.md

This file was deleted.

21 changes: 21 additions & 0 deletions assets/animations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export const motionListItems = {
visible: {
delay: 0.5,
opacity: 1,
transition: {
when: 'beforeChildren',
staggerChildren: 0.08,
},
},
hidden: {
delay: 0.5,
opacity: 0,
transition: {
when: 'afterChildren',
},
},
exit: {
y: -10,
opacity: 0,
},
}
Loading

0 comments on commit 7a3f969

Please sign in to comment.