Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit ef4d3923 authored by Hugues's avatar Hugues Committed by Christophe Chaudier
Browse files

add CI lint and deploy on froggit pages

parent 8e4e196d
No related branches found
No related tags found
1 merge request!2Resolve "Create CI with deploy pages"
# Production
/build
{
"env": {
"es2021": true,
"node": true
},
"extends": [
"eslint:recommended",
"plugin:react/recommended"
],
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": [
"react"
],
"rules": {
"indent": [
"error",
2
],
"linebreak-style": [
"error",
"unix"
],
"quotes": [
"error",
"double"
],
"semi": [
"error",
"always"
]
},
"settings": {
"react": {
"createClass": "createReactClass", // Regex for Component Factory to use,
// default to "createReactClass"
"pragma": "React", // Pragma to use, default to "React"
"fragment": "Fragment", // Fragment to use (may be a property of <pragma>), default to "Fragment"
"version": "detect", // React version. "detect" automatically picks the version you have installed.
// You can also use `16.0`, `16.3`, etc, if you want to override the detected value.
// default to latest and warns if missing
// It will default to "detect" in the future
"flowVersion": "0.53" // Flow version
}}
}
image: node:14.17.1-slim
stages:
- test
- build
lint:
stage: test
tags:
- cache
script:
- npm install
- npm run lint
cache:
key:
files:
- package.json
paths:
- node_modules
pages:
stage: build
tags:
- cache
script:
- npm run build
- mv build public
artifacts:
paths:
- public
cache:
key:
files:
- package.json
paths:
- node_modules
only:
- master
.cache
package.json
package-lock.json
public
{
"arrowParens": "avoid",
"semi": true,
"tabWidth": 2
}
module.exports = { module.exports = {
presets: [require.resolve('@docusaurus/core/lib/babel/preset')], presets: [require.resolve("@docusaurus/core/lib/babel/preset")],
}; };
const lightCodeTheme = require('prism-react-renderer/themes/github'); const lightCodeTheme = require("prism-react-renderer/themes/github");
const darkCodeTheme = require('prism-react-renderer/themes/dracula'); const darkCodeTheme = require("prism-react-renderer/themes/dracula");
/** @type {import('@docusaurus/types').DocusaurusConfig} */ /** @type {import('@docusaurus/types').DocusaurusConfig} */
module.exports = { module.exports = {
title: 'My Site', title: "My Site",
tagline: 'Dinosaurs are cool', tagline: "Dinosaurs are cool",
url: 'https://your-docusaurus-test-site.com', url: "https://your-docusaurus-test-site.com",
baseUrl: '/', baseUrl: "/",
onBrokenLinks: 'throw', onBrokenLinks: "throw",
onBrokenMarkdownLinks: 'warn', onBrokenMarkdownLinks: "warn",
favicon: 'img/favicon.ico', favicon: "img/favicon.ico",
organizationName: 'facebook', // Usually your GitHub org/user name. organizationName: "facebook", // Usually your GitHub org/user name.
projectName: 'docusaurus', // Usually your repo name. projectName: "docusaurus", // Usually your repo name.
themeConfig: { themeConfig: {
navbar: { navbar: {
title: 'My Site', title: "My Site",
logo: { logo: {
alt: 'My Site Logo', alt: "My Site Logo",
src: 'img/logo.svg', src: "img/logo.svg",
}, },
items: [ items: [
{ {
type: 'doc', type: "doc",
docId: 'intro', docId: "intro",
position: 'left', position: "left",
label: 'Tutorial', label: "Tutorial",
}, },
{to: '/blog', label: 'Blog', position: 'left'}, {to: "/blog", label: "Blog", position: "left"},
{ {
href: 'https://github.com/facebook/docusaurus', href: "https://github.com/facebook/docusaurus",
label: 'GitHub', label: "GitHub",
position: 'right', position: "right",
}, },
], ],
}, },
footer: { footer: {
style: 'dark', style: "dark",
links: [ links: [
{ {
title: 'Docs', title: "Docs",
items: [ items: [
{ {
label: 'Tutorial', label: "Tutorial",
to: '/docs/intro', to: "/docs/intro",
}, },
], ],
}, },
{ {
title: 'Community', title: "Community",
items: [ items: [
{ {
label: 'Stack Overflow', label: "Stack Overflow",
href: 'https://stackoverflow.com/questions/tagged/docusaurus', href: "https://stackoverflow.com/questions/tagged/docusaurus",
}, },
{ {
label: 'Discord', label: "Discord",
href: 'https://discordapp.com/invite/docusaurus', href: "https://discordapp.com/invite/docusaurus",
}, },
{ {
label: 'Twitter', label: "Twitter",
href: 'https://twitter.com/docusaurus', href: "https://twitter.com/docusaurus",
}, },
], ],
}, },
{ {
title: 'More', title: "More",
items: [ items: [
{ {
label: 'Blog', label: "Blog",
to: '/blog', to: "/blog",
}, },
{ {
label: 'GitHub', label: "GitHub",
href: 'https://github.com/facebook/docusaurus', href: "https://github.com/facebook/docusaurus",
}, },
], ],
}, },
...@@ -86,22 +86,22 @@ module.exports = { ...@@ -86,22 +86,22 @@ module.exports = {
}, },
presets: [ presets: [
[ [
'@docusaurus/preset-classic', "@docusaurus/preset-classic",
{ {
docs: { docs: {
sidebarPath: require.resolve('./sidebars.js'), sidebarPath: require.resolve("./sidebars.js"),
// Please change this to your repo. // Please change this to your repo.
editUrl: editUrl:
'https://github.com/facebook/docusaurus/edit/master/website/', "https://github.com/facebook/docusaurus/edit/master/website/",
}, },
blog: { blog: {
showReadingTime: true, showReadingTime: true,
// Please change this to your repo. // Please change this to your repo.
editUrl: editUrl:
'https://github.com/facebook/docusaurus/edit/master/website/blog/', "https://github.com/facebook/docusaurus/edit/master/website/blog/",
}, },
theme: { theme: {
customCss: require.resolve('./src/css/custom.css'), customCss: require.resolve("./src/css/custom.css"),
}, },
}, },
], ],
......
This diff is collapsed.
...@@ -11,7 +11,9 @@ ...@@ -11,7 +11,9 @@
"clear": "docusaurus clear", "clear": "docusaurus clear",
"serve": "docusaurus serve", "serve": "docusaurus serve",
"write-translations": "docusaurus write-translations", "write-translations": "docusaurus write-translations",
"write-heading-ids": "docusaurus write-heading-ids" "write-heading-ids": "docusaurus write-heading-ids",
"lint": "eslint .",
"lint-fix": "eslint . --fix"
}, },
"dependencies": { "dependencies": {
"@docusaurus/core": "2.0.0-beta.3", "@docusaurus/core": "2.0.0-beta.3",
...@@ -36,5 +38,14 @@ ...@@ -36,5 +38,14 @@
"last 1 firefox version", "last 1 firefox version",
"last 1 safari version" "last 1 safari version"
] ]
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^4.28.1",
"@typescript-eslint/parser": "^4.28.1",
"eslint": "^7.30.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-prettier": "^3.4.0",
"eslint-plugin-react": "^7.24.0",
"prettier": "^2.3.2"
} }
} }
\ No newline at end of file
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
module.exports = { module.exports = {
// By default, Docusaurus generates a sidebar from the docs folder structure // By default, Docusaurus generates a sidebar from the docs folder structure
tutorialSidebar: [{type: 'autogenerated', dirName: '.'}], tutorialSidebar: [{type: "autogenerated", dirName: "."}],
// But you can create a sidebar manually // But you can create a sidebar manually
/* /*
......
import React from 'react'; import React from "react";
import clsx from 'clsx'; import clsx from "clsx";
import styles from './HomepageFeatures.module.css'; import styles from "./HomepageFeatures.module.css";
const FeatureList = [ const FeatureList = [
{ {
title: 'Easy to Use', title: "Easy to Use",
Svg: require('../../static/img/undraw_docusaurus_mountain.svg').default, // eslint-disable-next-line
Svg: require("../../static/img/undraw_docusaurus_mountain.svg").default,
description: ( description: (
<> <>
Docusaurus was designed from the ground up to be easily installed and Docusaurus was designed from the ground up to be easily installed and
...@@ -14,8 +15,9 @@ const FeatureList = [ ...@@ -14,8 +15,9 @@ const FeatureList = [
), ),
}, },
{ {
title: 'Focus on What Matters', title: "Focus on What Matters",
Svg: require('../../static/img/undraw_docusaurus_tree.svg').default, // eslint-disable-next-line
Svg: require("../../static/img/undraw_docusaurus_tree.svg").default,
description: ( description: (
<> <>
Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go Docusaurus lets you focus on your docs, and we&apos;ll do the chores. Go
...@@ -24,8 +26,10 @@ const FeatureList = [ ...@@ -24,8 +26,10 @@ const FeatureList = [
), ),
}, },
{ {
title: 'Powered by React', // eslint-disable-next-line
Svg: require('../../static/img/undraw_docusaurus_react.svg').default, title: "Powered by React",
// eslint-disable-next-line
Svg: require("../../static/img/undraw_docusaurus_react.svg").default,
description: ( description: (
<> <>
Extend or customize your website layout by reusing React. Docusaurus can Extend or customize your website layout by reusing React. Docusaurus can
...@@ -35,9 +39,10 @@ const FeatureList = [ ...@@ -35,9 +39,10 @@ const FeatureList = [
}, },
]; ];
// eslint-disable-next-line
function Feature({Svg, title, description}) { function Feature({Svg, title, description}) {
return ( return (
<div className={clsx('col col--4')}> <div className={clsx("col col--4")}>
<div className="text--center"> <div className="text--center">
<Svg className={styles.featureSvg} alt={title} /> <Svg className={styles.featureSvg} alt={title} />
</div> </div>
......
import React from 'react'; import React from "react";
import clsx from 'clsx'; import clsx from "clsx";
import Layout from '@theme/Layout'; import Layout from "@theme/Layout";
import Link from '@docusaurus/Link'; import Link from "@docusaurus/Link";
import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
import styles from './index.module.css'; import styles from "./index.module.css";
import HomepageFeatures from '../components/HomepageFeatures'; import HomepageFeatures from "../components/HomepageFeatures";
function HomepageHeader() { function HomepageHeader() {
const {siteConfig} = useDocusaurusContext(); const { siteConfig } = useDocusaurusContext();
return ( return (
<header className={clsx('hero hero--primary', styles.heroBanner)}> <header className={clsx("hero hero--primary", styles.heroBanner)}>
<div className="container"> <div className="container">
<h1 className="hero__title">{siteConfig.title}</h1> <h1 className="hero__title">{siteConfig.title}</h1>
<p className="hero__subtitle">{siteConfig.tagline}</p> <p className="hero__subtitle">{siteConfig.tagline}</p>
<div className={styles.buttons}> <div className={styles.buttons}>
<Link <Link
className="button button--secondary button--lg" className="button button--secondary button--lg"
to="/docs/intro"> to="/docs/intro"
>
Docusaurus Tutorial - 5min ⏱️ Docusaurus Tutorial - 5min ⏱️
</Link> </Link>
</div> </div>
...@@ -26,11 +27,12 @@ function HomepageHeader() { ...@@ -26,11 +27,12 @@ function HomepageHeader() {
} }
export default function Home() { export default function Home() {
const {siteConfig} = useDocusaurusContext(); const { siteConfig } = useDocusaurusContext();
return ( return (
<Layout <Layout
title={`Hello from ${siteConfig.title}`} title={`Hello from ${siteConfig.title}`}
description="Description will go into a meta tag in <head />"> description="Description will go into a meta tag in <head />"
>
<HomepageHeader /> <HomepageHeader />
<main> <main>
<HomepageFeatures /> <HomepageFeatures />
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment