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

fix(docs): hide hidden command flags from docs #1190

Merged
merged 1 commit into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions scripts/generateCommandData.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
const path = require('path')
// This dependency is installed in `site/package.json`
// eslint-disable-next-line node/no-extraneous-require
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we add some override in .eslintrc.json to omit that ESLint rule inside site/**?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we should move this script to site/scripts, then we won't need the override/disable comment.

I'll open a new issue for that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

const filterObj = require('filter-obj')
const globby = require('markdown-magic').globby

module.exports = function generateCommandData() {
Expand All @@ -8,16 +11,18 @@ module.exports = function generateCommandData() {
const commands = globby.sync([`${commandsPath}/**/**.js`, `${netlifyDevPath}/**/**.js`])

const allCommands = commands.map(file => {
const cmd = require(file)
const data = require(file)
const command = commandFromPath(file)
const parentCommand = command.split(':')[0]
const parent = command === parentCommand ? true : false
// remove hidden flags
const flags = data.flags && filterObj(data.flags, (_, value) => value.hidden !== true)
return {
command,
commandGroup: parentCommand,
isParent: parent,
path: file,
data: cmd,
data: { ...data, flags },
}
})

Expand Down
33 changes: 32 additions & 1 deletion site/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions site/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"styled-components": "^3.4.10"
},
"devDependencies": {
"filter-obj": "^2.0.1",
"fs-extra": "^9.0.1",
"npm-run-all": "^4.1.5",
"rimraf": "^3.0.0",
Expand Down