Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Docusaurus #67

Merged
merged 19 commits into from Jul 11, 2019
Merged

Add Docusaurus #67

merged 19 commits into from Jul 11, 2019

Conversation

ybiquitous
Copy link
Member

@ybiquitous ybiquitous commented Jul 7, 2019

Demo: https://stylelint-docusaurus.netlify.com/
(this demo site is updated automatically when commits are pushed)

Which issue, if any, is this issue related to?

Closes #58

Is there anything in the PR that needs further explanation?

This PR aims to add Docusaurus v1 as a new doc generator engine.

If you want to try the new website on your computer, please run the following commands (Node 8 required):

Commands
git clone https://github.com/stylelint/stylelint.io.git

cd stylelint.io

git fetch origin pull/67/head:docusaurus

git checkout docusaurus

npm install

npm run gendoc

cd website

npm install

npm start

Finally, we should remove the current engine Phenomic. But I don't want to do so in this PR, because removing it will make it hard for us to review this PR due to too many diffs.
After the migration from Phenomic to Docusaurus in the PR will work, I think it good to remove the old engine (further, update Nodejs and dependencies).

I hope any feedback! 😄

About the changes

  • Add a new script to generate .md files for the website from node_modules/stylelint directory: scripts/generate-stylelint-docs.js
    • Run npm run gendoc command if you want to run the script.
    • The command outputs the doc/ directory which Docusaurus recognizes.
    • The script does the followings:
      • Restructure files and directories. E.g., lib/rules/{rule-name}/README.md -> user-guide/rules/{rule-name}.md
      • Rewrite internal links.
      • Insert frontmatter metadata for Docusaurus.
      • Via remark.
  • Add a new website directory which Docusaurus requires. The directory is a core of the website.
  • Don't add Docker-related files and yarn.lock generated by the npx docusaurus-init command. Because I think such files may cause new confusions. Let's add them when we will need.

@hudochenkov
Copy link
Member

It looks awesome! Keep going, @ybiquitous!

@ybiquitous ybiquitous marked this pull request as ready for review July 7, 2019 14:59
@ybiquitous
Copy link
Member Author

Thanks @hudochenkov I'm ready to receive reviews! Welcome feedback!

Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow! It's super nice! Awesome work, @ybiquitous!

Finally, we should remove the current engine Phenomic. But I don't want to do so in this PR, because removing it will make it hard for us to review this PR due to too many diffs.
After the migration from Phenomic to Docusaurus in the PR will work, I think it good to remove the old engine (further, update Nodejs and dependencies).

Good plan!

Few things I would like to see fixed if possible:

  1. Add html { overflow-y: auto; } to always have scrollbar visible and avoid header jump, when page is loading.
  2. Remove “Preprocessors” from the header. We want to deprecate them, so it's good to not emphasize them in the main navigation.
  3. Make “Demo” in the header looks like other links.
  4. There is no hover state for header links.
  5. On Demo page header is much narrow and links are different (they have hover).
  6. Is it possible to improve changelog sidebar. Currently all links looks like “[10.1.0][]”.
  7. <meta name="description"> and <meta property="og:description"> has weird content. On current website they are also incorrect.
  8. Is it possible to make different title for a home page? <title> and <meta property="og:title"> is “stylelint · stylelint”. Can we do only one ”stylelint” instead? Or like Prettier does: “stylelint · A mighty, modern style linter”?
  9. Neatpick: Is it possible to configure Autoprefixer (if there any)? I see very old flexbox prefixes in CSS. It would be nice to remove them, if Docusaurus allows it.
  10. Make footer shorter. It take too much space on Demo page.

scripts/generate-stylelint-docs.js Outdated Show resolved Hide resolved
website/sidebars.json Outdated Show resolved Hide resolved
@ybiquitous
Copy link
Member Author

  1. Make “Demo” in the header looks like other links.
  2. There is no hover state for header links.

I agree to fix the strange style. But this is due to the siteNavGroupActive class name by Docusaurus internal logic, it doesn't seem that we can disable this class name… 😕
image

See core/nav/HeaderNav.js in Docusaurus code:

@ybiquitous ybiquitous added the status: wip is being worked on by someone label Jul 8, 2019
@ybiquitous
Copy link
Member Author

Current progress report:

  1. Add html { overflow-y: auto; } to always have scrollbar visible and avoid header jump, when page is loading.

Done ✅

  1. Remove “Preprocessors” from the header. We want to deprecate them, so it's good to not emphasize them in the main navigation.

Done ✅

5. On Demo page header is much narrow and links are different (they have hover).

Done ✅

@hudochenkov
Copy link
Member

I think we need to revert this change 6261253. It's very hacky. Let's find solution for header for Demo (both width and links styles) in separate PR, when this one is merged.

ybiquitous and others added 2 commits July 10, 2019 00:14
Co-Authored-By: Aleks Hudochenkov <aleks@hudochenkov.com>
@ybiquitous
Copy link
Member Author

Yes I agree, it's hacky. 😅 Reverted.

- Narrow scope of variables.
- Inline variables which are used only once.
@ybiquitous
Copy link
Member Author

6. Is it possible to improve changelog sidebar. Currently all links looks like “[10.1.0][]”.

Yes, it's strange. When I research it, I find that the behavior is due to the internal code of docusaurus and markdown-toc. See below:

Currently, I can't find a solution yet. 😖

@ybiquitous
Copy link
Member Author

7. <meta name="description"> and <meta property="og:description"> has weird content. On current website they are also incorrect.

It seems to be a Docusaurus's bug. A description of doc pages is generated from the first line of the markdown content. See below:

website/siteConfig.js Outdated Show resolved Hide resolved
@ybiquitous
Copy link
Member Author

10. Make footer shorter. It take too much space on Demo page.

Done ✅

@hudochenkov
Copy link
Member

I think the following would be good enough for browserslist. Our audience is developers, and developers always have latest versions of browsers :)

> 0.5%, last 1 major versions, Firefox ESR, not dead

https://browserl.ist/?q=%3E+0.5%25%2C+last+1+major+versions%2C+Firefox+ESR%2C+not+dead

@hudochenkov
Copy link
Member

I've created issues for unsolved problems, which we could tackle after this PR is merged.

@stylelint/contributors what do you think about new website?

@alexander-akait
Copy link
Member

👍

@ybiquitous
Copy link
Member Author

  1. Neatpick: Is it possible to configure Autoprefixer (if there any)? I see very old flexbox prefixes in CSS. It would be nice to remove them, if Docusaurus allows it.

Done ✅

See #67 (comment)

@ybiquitous
Copy link
Member Author

NOTE: I left some notices below.

@hudochenkov
Copy link
Member

Is it possible for Docusaurus to keep file name case? I would like to move to Netlify as well, but migrating engine, hosting, and DNS at the same time is a little bit risky.

@ybiquitous
Copy link
Member Author

Sure, Docusaurus outputs CHANGELOG.html. When this file is deployed to GitHub Pages, the /CHANGELOG access returns 200 status instead of 400, doesn't it?

$ cd website

$ npm run build

$ ls build/stylelint/*.html
build/stylelint/CHANGELOG.html       build/stylelint/VISION.html          build/stylelint/developer-guide.html build/stylelint/user-guide.html
build/stylelint/CONTRIBUTING.html    build/stylelint/demo.html            build/stylelint/index.html

@hudochenkov
Copy link
Member

I think I see the problem. Docusaurus generates CHANGELOG.html, while Phenomic CHANGELOG/index.html so for Github Pages all three links are working:

/CHANGELOG
/CHANGELOG/

But non of this will be working with Github Pages and Docusaurus :(

What we can do is migrate to Netlify with current setup and use https://github.com/stylelint/stylelint.github.io as source for deployment. Then migrate this to Docusaurus completely (with removing Phenomic) and then change Netlify to run on this repository.

@ybiquitous
Copy link
Member Author

It looks a good idea to me! 👍

@hudochenkov hudochenkov mentioned this pull request Jul 10, 2019
@ntwb
Copy link
Member

ntwb commented Jul 11, 2019

Awesome progress here, thanks a whole bunch @ybiquitous and @hudochenkov for jumping in

Copy link
Member

@hudochenkov hudochenkov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work, @ybiquitous! Now let's remove Phenomic :)

@hudochenkov hudochenkov merged commit b05a27c into stylelint:master Jul 11, 2019
@ybiquitous ybiquitous removed the status: wip is being worked on by someone label Jul 11, 2019
@ybiquitous ybiquitous deleted the docusaurus branch July 11, 2019 23:49
@ybiquitous
Copy link
Member Author

Thank you for the review!

@ntwb
Copy link
Member

ntwb commented Jul 12, 2019

ybiquitous added a commit to ybiquitous/stylelint.io that referenced this pull request Jul 13, 2019
The migration to Docusaurus has worked (see stylelint#67), so this deletes Phenomic code as the old engine.

- Delete unused directories and files.
- Update dependencies.
- Use Node 12 (latest) in Travis CI.
hudochenkov pushed a commit that referenced this pull request Jul 14, 2019
* Delete Phenomic and update dependencies

The migration to Docusaurus has worked (see #67), so this deletes Phenomic code as the old engine.

- Delete unused directories and files.
- Update dependencies.
- Use Node 12 (latest) in Travis CI.

* Set Node version via `.nvmrc`

Travis CI and Netlify recognize a `.nvmrc` file to detect needed Node version.

* Update README for new npm-run scripts

* Use Node v10 LTS instead of v12

* Arrange npm scripts

* Fix warning of `eslint-plugin-react`

> Warning: React version not specified in eslint-plugin-react settings. See https://github.com/yannickcr/eslint-plugin-react#configuration .

* Set `NODE_ENV=production` to prevent PostCSS warning

> Without `from` option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to `undefined` to prevent this warning.
@jeddy3
Copy link
Member

jeddy3 commented Jul 24, 2019

Fantastic work!

@hudochenkov
Copy link
Member

@jeddy3 you're back! Happy to see you :) Even if we don't see each other actually :)

@jeddy3
Copy link
Member

jeddy3 commented Jul 24, 2019

Thanks! It's nice to be back. It's brilliant to see all this good work on the stylelint website. It's looking great!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Design/engine
5 participants