mirror of
https://github.com/Aviortheking/next-template.git
synced 2025-04-23 19:12:10 +00:00
first commit
This commit is contained in:
commit
31692dfbd4
12
.babelrc
Normal file
12
.babelrc
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"presets": [[
|
||||||
|
"next/babel",
|
||||||
|
{
|
||||||
|
"styled-jsx": {
|
||||||
|
"plugins": [
|
||||||
|
"styled-jsx-plugin-stylus"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]]
|
||||||
|
}
|
8
.editorconfig
Normal file
8
.editorconfig
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
indent_style = tab
|
||||||
|
indent_size = 4
|
||||||
|
charset = utf-8
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
7
.eslintignore
Normal file
7
.eslintignore
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
node_modules
|
||||||
|
|
||||||
|
out
|
||||||
|
.next
|
||||||
|
|
||||||
|
next-env.d.ts
|
||||||
|
*.js
|
198
.eslintrc.js
Normal file
198
.eslintrc.js
Normal file
@ -0,0 +1,198 @@
|
|||||||
|
module.exports = {
|
||||||
|
env: {
|
||||||
|
browser: true,
|
||||||
|
es6: true,
|
||||||
|
node: true
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
"eslint:recommended",
|
||||||
|
"plugin:react/recommended",
|
||||||
|
"plugin:@typescript-eslint/eslint-recommended"
|
||||||
|
],
|
||||||
|
globals: {
|
||||||
|
Atomics: "readonly",
|
||||||
|
SharedArrayBuffer: "readonly"
|
||||||
|
},
|
||||||
|
parser: "@typescript-eslint/parser",
|
||||||
|
parserOptions: {
|
||||||
|
project: "tsconfig.json",
|
||||||
|
ecmaFeatures: {
|
||||||
|
jsx: true
|
||||||
|
},
|
||||||
|
ecmaVersion: 2018,
|
||||||
|
sourceType: "module"
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
react: {
|
||||||
|
version: "detect"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
"react",
|
||||||
|
"@typescript-eslint"
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
indent: [
|
||||||
|
"error",
|
||||||
|
"tab"
|
||||||
|
],
|
||||||
|
"linebreak-style": [
|
||||||
|
"error",
|
||||||
|
"unix"
|
||||||
|
],
|
||||||
|
quotes: [
|
||||||
|
"error",
|
||||||
|
"single"
|
||||||
|
],
|
||||||
|
semi: [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/adjacent-overload-signatures": "error",
|
||||||
|
"@typescript-eslint/array-type": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
default: 'generic'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/ban-types": "error",
|
||||||
|
"@typescript-eslint/class-name-casing": "error",
|
||||||
|
"@typescript-eslint/consistent-type-assertions": "error",
|
||||||
|
"@typescript-eslint/consistent-type-definitions": "error",
|
||||||
|
"@typescript-eslint/explicit-member-accessibility": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
accessibility: "explicit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/interface-name-prefix": "off",
|
||||||
|
"@typescript-eslint/member-delimiter-style": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
multiline: {
|
||||||
|
delimiter: "none",
|
||||||
|
requireLast: true
|
||||||
|
},
|
||||||
|
singleline: {
|
||||||
|
delimiter: "semi",
|
||||||
|
requireLast: false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/member-ordering": "error",
|
||||||
|
"@typescript-eslint/no-empty-function": "error",
|
||||||
|
"@typescript-eslint/no-empty-interface": "error",
|
||||||
|
"@typescript-eslint/no-explicit-any": "off",
|
||||||
|
"@typescript-eslint/no-misused-new": "error",
|
||||||
|
"@typescript-eslint/no-namespace": "error",
|
||||||
|
"@typescript-eslint/no-parameter-properties": "off",
|
||||||
|
"@typescript-eslint/no-use-before-define": "off",
|
||||||
|
"@typescript-eslint/prefer-for-of": "error",
|
||||||
|
"@typescript-eslint/prefer-function-type": "error",
|
||||||
|
"@typescript-eslint/prefer-namespace-keyword": "error",
|
||||||
|
"@typescript-eslint/quotes": [
|
||||||
|
"error",
|
||||||
|
"single",
|
||||||
|
{
|
||||||
|
avoidEscape: true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"@typescript-eslint/semi": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"@typescript-eslint/triple-slash-reference": "error",
|
||||||
|
"@typescript-eslint/type-annotation-spacing": "error",
|
||||||
|
"@typescript-eslint/unified-signatures": "error",
|
||||||
|
"arrow-body-style": "error",
|
||||||
|
"arrow-parens": [
|
||||||
|
"error",
|
||||||
|
"as-needed"
|
||||||
|
],
|
||||||
|
camelcase: "error",
|
||||||
|
"comma-dangle": [
|
||||||
|
"error",
|
||||||
|
"always-multiline"
|
||||||
|
],
|
||||||
|
complexity: "off",
|
||||||
|
"constructor-super": "error",
|
||||||
|
curly: "error",
|
||||||
|
"dot-notation": "error",
|
||||||
|
"eol-last": "error",
|
||||||
|
eqeqeq: [
|
||||||
|
"error",
|
||||||
|
"smart"
|
||||||
|
],
|
||||||
|
"guard-for-in": "error",
|
||||||
|
"id-blacklist": [
|
||||||
|
"error",
|
||||||
|
"any",
|
||||||
|
"Number",
|
||||||
|
"number",
|
||||||
|
"String",
|
||||||
|
"string",
|
||||||
|
"Boolean",
|
||||||
|
"boolean",
|
||||||
|
"Undefined"
|
||||||
|
],
|
||||||
|
"id-match": "error",
|
||||||
|
"max-classes-per-file": [
|
||||||
|
"error",
|
||||||
|
1
|
||||||
|
],
|
||||||
|
"max-len": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
code: 120
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"new-parens": "error",
|
||||||
|
"no-bitwise": "error",
|
||||||
|
"no-caller": "error",
|
||||||
|
"no-cond-assign": "error",
|
||||||
|
"no-debugger": "error",
|
||||||
|
"no-empty": "error",
|
||||||
|
"no-eval": "error",
|
||||||
|
"no-fallthrough": "off",
|
||||||
|
"no-invalid-this": "off",
|
||||||
|
"no-multiple-empty-lines": "error",
|
||||||
|
"no-new-wrappers": "error",
|
||||||
|
"no-shadow": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
hoist: "all"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"no-throw-literal": "error",
|
||||||
|
"no-trailing-spaces": "error",
|
||||||
|
"no-undef-init": "error",
|
||||||
|
"no-underscore-dangle": "error",
|
||||||
|
"no-unsafe-finally": "error",
|
||||||
|
"no-unused-expressions": "error",
|
||||||
|
"no-unused-labels": "error",
|
||||||
|
"no-unused-vars": "off",
|
||||||
|
"no-var": "error",
|
||||||
|
"object-shorthand": "error",
|
||||||
|
"one-var": [
|
||||||
|
"error",
|
||||||
|
"never"
|
||||||
|
],
|
||||||
|
"prefer-const": "error",
|
||||||
|
"quote-props": [
|
||||||
|
"error",
|
||||||
|
"consistent-as-needed"
|
||||||
|
],
|
||||||
|
"radix": "error",
|
||||||
|
"space-before-function-paren": [
|
||||||
|
"error",
|
||||||
|
{
|
||||||
|
anonymous: "never",
|
||||||
|
asyncArrow: "always",
|
||||||
|
named: "never"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"spaced-comment": "error",
|
||||||
|
"use-isnan": "error",
|
||||||
|
"valid-typeof": "off",
|
||||||
|
}
|
||||||
|
};
|
3
.gitattributes
vendored
Normal file
3
.gitattributes
vendored
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||||
|
*.png filter=lfs diff=lfs merge=lfs -text
|
25
.gitignore
vendored
Normal file
25
.gitignore
vendored
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# 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
|
||||||
|
.env*
|
||||||
|
|
||||||
|
# debug
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
70
README.md
Normal file
70
README.md
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
# Next Template
|
||||||
|
|
||||||
|
## Folders
|
||||||
|
|
||||||
|
### Components
|
||||||
|
|
||||||
|
Folder where you put your React components
|
||||||
|
|
||||||
|
### libs
|
||||||
|
|
||||||
|
Serverside Internal libs
|
||||||
|
|
||||||
|
### pages
|
||||||
|
|
||||||
|
NextJS Pages
|
||||||
|
|
||||||
|
### public
|
||||||
|
|
||||||
|
Static files
|
||||||
|
|
||||||
|
### Scripts
|
||||||
|
|
||||||
|
Scripts used by the project
|
||||||
|
|
||||||
|
### styl
|
||||||
|
|
||||||
|
Stylus files location
|
||||||
|
|
||||||
|
## TODO list
|
||||||
|
|
||||||
|
### Typescript/Javascript
|
||||||
|
|
||||||
|
- [x] Support Typescript
|
||||||
|
- [x] Support Javascript
|
||||||
|
- [ ] Support Javascript files Linting
|
||||||
|
|
||||||
|
### Stylus
|
||||||
|
|
||||||
|
- [x] Support Stylus files
|
||||||
|
- [x] Support Stylus Styled-jsx
|
||||||
|
- [ ] Support both Stylus CSS modules and purge CSS
|
||||||
|
- [ ] Support typed stylus files
|
||||||
|
|
||||||
|
|
||||||
|
## Packages
|
||||||
|
|
||||||
|
### Dependencies
|
||||||
|
|
||||||
|
- @zeit/next-stylus: Stylus support in Nextjs
|
||||||
|
- glob: Sitemap Generation
|
||||||
|
- next: Nextjs
|
||||||
|
- next-compose-plugins: Better plugin formatting in config
|
||||||
|
- next-purgecss: PurgeCSS Plugin in config
|
||||||
|
- react: React
|
||||||
|
- react-dom: React DOM (React Dependency)
|
||||||
|
- serve: Server for static website
|
||||||
|
- styled-jsx-plugin-stylus: Styled-JSX plugin of Stylus
|
||||||
|
- stylus: Stylus
|
||||||
|
- typescript: Typescript
|
||||||
|
- webpack: Webpack
|
||||||
|
- webpack-cli: Webpack dependency
|
||||||
|
|
||||||
|
### Dev Dependencies
|
||||||
|
|
||||||
|
- @types/node: Typescript Typing
|
||||||
|
- @types/react: Typescript Typing
|
||||||
|
- @typescript-eslint/eslint-plugin: ESLint Typescript Plugin
|
||||||
|
- @typescript-eslint/parser: ESLint Typescript parser
|
||||||
|
- eslint: ESLint
|
||||||
|
- eslint-plugin-react: ESLint React Plugin
|
0
components/.gitkeep
Normal file
0
components/.gitkeep
Normal file
0
libs/.gitkeep
Normal file
0
libs/.gitkeep
Normal file
2
next-env.d.ts
vendored
Normal file
2
next-env.d.ts
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/types/global" />
|
33
next.config.js
Normal file
33
next.config.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
const stylus = require('@zeit/next-stylus')
|
||||||
|
const purgeCSS = require('next-purgecss')
|
||||||
|
const withPlugins = require('next-compose-plugins')
|
||||||
|
|
||||||
|
module.exports = withPlugins([
|
||||||
|
[stylus, {
|
||||||
|
// cssModules: true
|
||||||
|
}],
|
||||||
|
[purgeCSS, {
|
||||||
|
purgeCssPaths: [
|
||||||
|
'pages/**/*',
|
||||||
|
'components/**/*',
|
||||||
|
'styl/**/*'
|
||||||
|
],
|
||||||
|
purgeCSS: {
|
||||||
|
content: [
|
||||||
|
'components/**/*.tsx',
|
||||||
|
'pages/**/*.tsx'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}],
|
||||||
|
], {
|
||||||
|
exportTrailingSlash: true,
|
||||||
|
plugins: [
|
||||||
|
["styled-jsx/babel", {
|
||||||
|
optimizeForSpeed: true,
|
||||||
|
vendorPrefixes: true,
|
||||||
|
sourceMaps: true,
|
||||||
|
plugins: ["styled-jsx-plugin-stylus"]
|
||||||
|
}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
38
package.json
Normal file
38
package.json
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
{
|
||||||
|
"name": "@dzeio/markblog",
|
||||||
|
"version": "1.0.1",
|
||||||
|
"license": "MIT",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "next dev",
|
||||||
|
"build": "next build",
|
||||||
|
"server": "next start",
|
||||||
|
"export": "next export && node scripts/generateSitemap",
|
||||||
|
"serve": "serve out",
|
||||||
|
"prod:server": "yarn build && yarn server",
|
||||||
|
"prod:static": "yarn build && yarn export && yarn serve",
|
||||||
|
"lint": "eslint . --ext .ts,.tsx"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@zeit/next-stylus": "^1.0.1",
|
||||||
|
"glob": "^7.1.6",
|
||||||
|
"next": "^9.1.7",
|
||||||
|
"next-compose-plugins": "^2.2.0",
|
||||||
|
"next-purgecss": "^3.1.2",
|
||||||
|
"react": "^16.12.0",
|
||||||
|
"react-dom": "^16.12.0",
|
||||||
|
"serve": "^11.3.0",
|
||||||
|
"styled-jsx-plugin-stylus": "^0.0.4",
|
||||||
|
"stylus": "^0.54.7",
|
||||||
|
"typescript": "^3.7.4",
|
||||||
|
"webpack": "^4.41.5",
|
||||||
|
"webpack-cli": "^3.3.10"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^13.1.4",
|
||||||
|
"@types/react": "^16.9.17",
|
||||||
|
"@typescript-eslint/eslint-plugin": "^2.19.0",
|
||||||
|
"@typescript-eslint/parser": "^2.19.0",
|
||||||
|
"eslint": "^6.8.0",
|
||||||
|
"eslint-plugin-react": "^7.18.3"
|
||||||
|
}
|
||||||
|
}
|
21
pages/_app.tsx
Normal file
21
pages/_app.tsx
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
import App from 'next/app'
|
||||||
|
import Head from 'next/head'
|
||||||
|
import React from 'react'
|
||||||
|
|
||||||
|
import '../styl/index.styl'
|
||||||
|
|
||||||
|
export default class Index extends App {
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
const { Component, pageProps } = this.props
|
||||||
|
|
||||||
|
return(
|
||||||
|
<>
|
||||||
|
<Head>
|
||||||
|
<title>Next Template Hello World !</title>
|
||||||
|
</Head>
|
||||||
|
<Component {...pageProps} />
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
17
pages/index.tsx
Normal file
17
pages/index.tsx
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import '../styl/index.styl'
|
||||||
|
|
||||||
|
export default class Index extends React.Component {
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
return(
|
||||||
|
<>
|
||||||
|
<h1>Hello World !</h1>
|
||||||
|
<style jsx>{`
|
||||||
|
h1
|
||||||
|
font-size: 39px
|
||||||
|
`}</style>
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
0
public/.gitkeep
Normal file
0
public/.gitkeep
Normal file
25
scripts/generateSitemap.js
Normal file
25
scripts/generateSitemap.js
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
/**
|
||||||
|
* This program generate a simple sitmap.xml file
|
||||||
|
* for static exports
|
||||||
|
**/
|
||||||
|
|
||||||
|
const glob = require('glob')
|
||||||
|
const fs = require('fs')
|
||||||
|
|
||||||
|
// DOMAIN NAME WITHOUT THE LAST /
|
||||||
|
const domain = "https://www.avior.me"
|
||||||
|
|
||||||
|
const files = glob.sync('./out/**/*.html')
|
||||||
|
let res = `<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">`
|
||||||
|
|
||||||
|
for (let file of files) {
|
||||||
|
file = file.replace("./out", "").replace("index.html", "")
|
||||||
|
res += `<url><loc>${domain}${file}</loc></url>`
|
||||||
|
}
|
||||||
|
|
||||||
|
res += `</urlset>`
|
||||||
|
fs.writeFileSync('./out/sitemap.xml', res)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
console.log(res)
|
5
styl/index.styl
Normal file
5
styl/index.styl
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
h1
|
||||||
|
font-weight 600
|
||||||
|
|
||||||
|
p
|
||||||
|
font-weight 100
|
4
styl/stylus.d.ts
vendored
Normal file
4
styl/stylus.d.ts
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
declare module '*.styl' {
|
||||||
|
const content: any
|
||||||
|
export = content
|
||||||
|
}
|
31
tsconfig.json
Normal file
31
tsconfig.json
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es5",
|
||||||
|
"lib": [
|
||||||
|
"dom",
|
||||||
|
"dom.iterable",
|
||||||
|
"esnext"
|
||||||
|
],
|
||||||
|
"allowJs": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve"
|
||||||
|
},
|
||||||
|
"exclude": [
|
||||||
|
"node_modules",
|
||||||
|
"out"
|
||||||
|
],
|
||||||
|
"include": [
|
||||||
|
"next-env.d.ts",
|
||||||
|
"styl/stylus.d.ts",
|
||||||
|
"**/*.ts",
|
||||||
|
"**/*.tsx"
|
||||||
|
]
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user