Skip to content

Commit

Permalink
First Touch.
Browse files Browse the repository at this point in the history
  • Loading branch information
furcan committed Jul 16, 2021
1 parent 9ffb603 commit a548977
Show file tree
Hide file tree
Showing 20 changed files with 3,770 additions and 2 deletions.
1 change: 1 addition & 0 deletions .env
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NEXT_TELEMETRY_DISABLED=1
53 changes: 53 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
{
"env": {
"browser": true,
"commonjs": true,
"es6": true,
"node": true
},
"parserOptions": {
"ecmaVersion": 2021,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"extends": [
"next",
"next/core-web-vitals",
"plugin:@typescript-eslint/recommended"
],
"rules": {
"react/react-in-jsx-scope": "off",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/prop-types": "off",
"@next/next/no-img-element": "off",
"@typescript-eslint/explicit-module-boundary-types": "warn",
"comma-dangle": [
"error",
"always-multiline"
],
"semi": [
"error",
"always"
],
"indent": [
"error",
2,
{
"ignoredNodes": [
"TemplateLiteral"
]
}
],
"quotes": [
2,
"single",
{
"avoidEscape": true,
"allowTemplateLiterals": true
}
]
}
}
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Build and Deploy on Push
on:
push:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]

- name: Install and Build 🔧
run: |
yarn
yarn deploy
- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: github-pages
folder: dist # package.json => "... next export -o dist"
37 changes: 37 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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
/dist
/.build

# misc
.DS_Store
*.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
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# notiflix.github.io
# Notiflix Documentation

test.
Coming Soon...
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module '*.md';
2 changes: 2 additions & 0 deletions next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="next" />
/// <reference types="next/types/global" />
100 changes: 100 additions & 0 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*!
* Notiflix
* Description: Next.js configuration.
* Version: 1.0.0
* Author: Furkan MT ('https://github.com/furcan')
* Copyright 2019-Present Notiflix, GPL-3.0 License ('https://opensource.org/licenses/GPL-3.0')
*/

// Dependencies
const package = require('./package.json');


// Contstants: begin
const isDev = process.env.NODE_ENV === 'development';
const isProd = process.env.NODE_ENV === 'production';
const publicUrl = isProd ? (JSON.stringify((package || {}).homepage) || '').replace(/"/gm, '') : '';
// Contstants: end

// Next Config: begin
const nextConfig = {
images: {
loader: 'imgix',
disableStaticImages: true,
},

// gzip enabled => default is true
compress: true,

// remove "x-powered-by"
poweredByHeader: false,

// remove dev tools
devIndicators: {
autoPrerender: false,
},

// add "/" to end of the pages link (true => affects all assets and pages URLs)
trailingSlash: false,

// custom environments
env: {
isDev: isDev,
isProd: isProd,
PUBLIC_URL: publicUrl,
},

// assets prefix
assetPrefix: publicUrl,

// TODO:
async redirects() {
return [
{
source: '/redirect-me',
destination: '/redirect-to',
permanent: false,
},
]
},

// TODO:
exportPathMap: async function (
defaultPathMap,
{ dev, dir, outDir, distDir, buildId }
) {
return {
'/': { page: '/' },
'/about': { page: '/about' },
}
},

// Build ID, Dir, and Ext
distDir: '.build',
pageExtensions: ['jsx', 'js', 'ts', 'tsx'],
generateBuildId: async () => {
if (process.env.BUILD_ID) {
return process.env.BUILD_ID;
} else {
return `BID-${new Date().getTime()}`;
}
},

// Webpack config
webpack: (config, { dev, isServer }) => {
// frontmatter markdown loader
config.module.rules.push(
{
test: /\.md$/,
loader: 'frontmatter-markdown-loader',
}
);

// return extended config
return config;
},

};
// Next Config: end

module.exports = nextConfig;
27 changes: 27 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "notiflix-documentation",
"homepage": "https://notiflix.github.io",
"version": "3.0.1-beta.01",
"private": true,
"scripts": {
"lint": "next lint",
"dev": "next lint && next dev",
"build": "next build",
"start": "next start",
"deploy": "next build && next export -o dist"
},
"dependencies": {
"next": "11.0.1",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@ts-stack/markdown": "^1.4.0",
"@types/react": "17.0.14",
"@typescript-eslint/eslint-plugin": "^4.22.1",
"eslint": "7.30.0",
"eslint-config-next": "11.0.1",
"frontmatter-markdown-loader": "^3.6.3",
"typescript": "4.3.5"
}
}
Empty file added public/.nojekyll
Empty file.
Binary file added public/content/images/nature.jpeg
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 public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions src/_database/pages/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
pageMeta:
title: About
description: >-
About Us Description
robots: "noindex, nofollow, noodp, noydir"
content:
- isActive: true
title: Title 1
subtitle: SubTitle 1
description: >-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
image: /content/images/nature.jpeg
- isActive: true
title: Title 2
subtitle: SubTitle 2.
description: >-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
image: /content/images/nature.jpeg
---
8 changes: 8 additions & 0 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import React from 'react';
import { AppProps } from 'next/app';

function App({ Component, pageProps }: AppProps): React.ReactNode {
return <Component {...pageProps} />;
}

export default App;
23 changes: 23 additions & 0 deletions src/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import Document, { Html, Head, Main, NextScript, DocumentContext, DocumentInitialProps } from 'next/document';

export default class CustomDocument extends Document {

static async getInitialProps(ctx: DocumentContext): Promise<DocumentInitialProps> {
const initialProps = await Document.getInitialProps(ctx);
return { ...initialProps };
}

render(): JSX.Element {
const language = this.props.head?.find(x => x?.props.name == 'content-language')?.props.content || 'en';

return (
<Html lang={language} itemScope itemType="https://schema.org/WebSite" prefix="og: http://ogp.me/ns#">
<Head />
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
}
23 changes: 23 additions & 0 deletions src/pages/_error.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { NextPageContext } from 'next';

interface ICustomError {
statusCode?: number;
}

// TODO:
function CustomError({ statusCode }: ICustomError): JSX.Element {
return (
<p>
{statusCode
? `An error ${statusCode} occurred on server`
: 'An error occurred on client'}
</p>
);
}

CustomError.getInitialProps = ({ res, err }: NextPageContext) => {
const statusCode = res ? res.statusCode : err ? err.statusCode : 404;
return { statusCode };
};

export default CustomError;
Loading

0 comments on commit a548977

Please sign in to comment.