-
Notifications
You must be signed in to change notification settings - Fork 10.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add "gatsby plugin" command (#27725)
* feat: Add "gatsby plugin" command * Lint * Add env flag
- Loading branch information
Showing
3 changed files
with
61 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default async function run({ plugins }: IProgram): Promise<void> { | ||
if (!plugins?.length) { | ||
console.log(`Please specify a plugin to install`) | ||
} | ||
console.log(plugins) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import add from "./plugin-add" | ||
|
||
module.exports = async (args: IProgram): Promise<void> => { | ||
const { report, cmd } = args | ||
switch (cmd) { | ||
case `docs`: | ||
console.log(` | ||
Using a plugin: | ||
- What is a Plugin? (https://www.gatsbyjs.com/docs/what-is-a-plugin/) | ||
- Using a Plugin in Your Site (https://www.gatsbyjs.com/docs/using-a-plugin-in-your-site/) | ||
- What You Don't Need Plugins For (https://www.gatsbyjs.com/docs/what-you-dont-need-plugins-for/) | ||
- Loading Plugins from Your Local Plugins Folder (https://www.gatsbyjs.com/docs/loading-plugins-from-your-local-plugins-folder/) | ||
- Plugin Library (https://www.gatsbyjs.com/plugins/) | ||
Creating a plugin: | ||
- Naming a Plugin (https://www.gatsbyjs.com/docs/naming-a-plugin/) | ||
- Files Gatsby Looks for in a Plugin (https://www.gatsbyjs.com/docs/files-gatsby-looks-for-in-a-plugin/) | ||
- Creating a Generic Plugin (https://www.gatsbyjs.com/docs/creating-a-generic-plugin/) | ||
- Creating a Local Plugin (https://www.gatsbyjs.com/docs/creating-a-local-plugin/) | ||
- Creating a Source Plugin (https://www.gatsbyjs.com/docs/creating-a-source-plugin/) | ||
- Creating a Transformer Plugin (https://www.gatsbyjs.com/docs/creating-a-transformer-plugin/) | ||
- Submit to Plugin Library (https://www.gatsbyjs.com/contributing/submit-to-plugin-library/) | ||
- Source Plugin Tutorial (https://www.gatsbyjs.com/tutorial/source-plugin-tutorial/) | ||
- Maintaining a Plugin (https://www.gatsbyjs.com/docs/maintaining-a-plugin/) | ||
- Join Discord #plugin-authoring channel to ask questions! (https://gatsby.dev/discord/) | ||
`) | ||
return void 0 | ||
|
||
case `add`: | ||
return add(args) | ||
|
||
default: | ||
report.error(`Unknown command ${cmd}`) | ||
} | ||
return void 0 | ||
} |