-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Feat: (gatsby-cli) Add a CLI command for listing plugins #28018
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
cad1fba
initial commit
fe5086d
initial gatsby list functionality
df749b4
fix linter
a1fbf26
use all, but pass a flag
cdbe1a5
add tests
77ca911
Update integration-tests/gatsby-cli/gatsby-sites/gatsby-plugin/packag…
887065c
fix log destructure
7453908
use different not syntax
46990d1
Refactor to move plugin commands out of gatsby package
0a2cbba
linter
859ab96
Merge remote-tracking branch 'upstream/master' into plugin-list
898ab10
Merge branch 'master' into plugin-solve
881d727
instead of showing the whole error let's show a more helpful message
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { GatsbyCLI } from "../test-helpers" | ||
|
||
|
||
const MAX_TIMEOUT = 2147483647 | ||
jest.setTimeout(MAX_TIMEOUT) | ||
|
||
describe(`gatsby plugin`, () => { | ||
const cwd = `gatsby-sites/gatsby-plugin` | ||
|
||
beforeAll(() => GatsbyCLI.from(cwd).invoke(`clean`)) | ||
afterAll(() => GatsbyCLI.from(cwd).invoke(`clean`)) | ||
|
||
it(`lists plugins`, async () => { | ||
const [code, logs] = GatsbyCLI.from(cwd).invoke([`plugin`, `ls`]) | ||
|
||
logs.should.contain(`gatsby-source-filesystem`) | ||
logs.should.contain(`gatsby-plugin-offline`) | ||
expect(logs).toEqual(expect.not.stringContaining(`ignore comments`)) | ||
expect(code).toBe(0) | ||
|
||
}) | ||
}) | ||
|
1 change: 1 addition & 0 deletions
1
integration-tests/gatsby-cli/gatsby-sites/gatsby-plugin/.eslintrc
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 @@ | ||
// Disable eslint-loader |
69 changes: 69 additions & 0 deletions
69
integration-tests/gatsby-cli/gatsby-sites/gatsby-plugin/.gitignore
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,69 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (http://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# Typescript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# dotenv environment variable files | ||
.env* | ||
|
||
# gatsby files | ||
.cache/ | ||
public | ||
|
||
# Mac files | ||
.DS_Store | ||
|
||
# Yarn | ||
yarn-error.log | ||
.pnp/ | ||
.pnp.js | ||
# Yarn Integrity file | ||
.yarn-integrity |
14 changes: 14 additions & 0 deletions
14
integration-tests/gatsby-cli/gatsby-sites/gatsby-plugin/gatsby-config.js
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,14 @@ | ||
module.exports = { | ||
plugins: [ | ||
{ | ||
resolve: "gatsby-source-filesystem", | ||
options: { | ||
"name": "pages", | ||
"path": "./src/pages/" | ||
} | ||
|
||
}, | ||
`gatsby-plugin-offline`, | ||
// ignore comments | ||
] | ||
} |
39 changes: 39 additions & 0 deletions
39
integration-tests/gatsby-cli/gatsby-sites/gatsby-plugin/package.json
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,39 @@ | ||
{ | ||
"name": "gatsby-starter-default-plugin", | ||
"private": true, | ||
"description": "A simple starter to get up and developing quickly with Gatsby", | ||
"version": "0.1.0", | ||
"author": "Kyle Mathews <[email protected]>", | ||
"dependencies": { | ||
"gatsby": "^2.19.45", | ||
"prop-types": "^15.7.2", | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react-helmet": "^5.2.1", | ||
"gatsby-source-filesystem": "^2.5.0", | ||
"gatsby-plugin-offline": "^3.4.0" | ||
}, | ||
"devDependencies": { | ||
"prettier": "2.0.4" | ||
}, | ||
"keywords": [ | ||
"gatsby" | ||
], | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "gatsby build", | ||
"develop": "gatsby develop", | ||
"format": "prettier --write \"**/*.{js,jsx,json,md}\"", | ||
"start": "npm run develop", | ||
"serve": "gatsby serve", | ||
"clean": "gatsby clean", | ||
"test": "echo \"Write tests! -> https://gatsby.dev/unit-testing\" && exit 1" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/gatsbyjs/gatsby-starter-default" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/gatsbyjs/gatsby/issues" | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
integration-tests/gatsby-cli/gatsby-sites/gatsby-plugin/src/pages/index.js
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,2 @@ | ||
import React from "react" | ||
export default () => <div>Hi</div> |
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
2 changes: 1 addition & 1 deletion
2
packages/gatsby-cli/src/plugin-add.ts → ...ges/gatsby-cli/src/handlers/plugin-add.ts
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not needed now, but I wonder if we should add
list
as an alias forls
. Windows people might not know whatls
meansThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough and easy to do. Let’s get this in and we can add it in the next pass.