diff --git a/.github/autobump.txt b/.github/autobump.txt index f6ea7de8643c9..3a0b12cdaec7b 100644 --- a/.github/autobump.txt +++ b/.github/autobump.txt @@ -1214,6 +1214,7 @@ grails grap graph-tool graphicsmagick +graphql-inspector graphqurl graphqxl graphviz diff --git a/Formula/g/graphql-inspector.rb b/Formula/g/graphql-inspector.rb new file mode 100644 index 0000000000000..27249b452794e --- /dev/null +++ b/Formula/g/graphql-inspector.rb @@ -0,0 +1,37 @@ +class GraphqlInspector < Formula + desc "Validate schema, get schema change notifications, validate operations, and more" + homepage "https://the-guild.dev/graphql/inspector" + url "https://registry.npmjs.org/@graphql-inspector/cli/-/cli-5.0.8.tgz" + sha256 "738d81999b8c2851ce264112d2a773b225794f21aee3c555f9bdb0f78bc79aab" + license "MIT" + head "https://github.com/kamilkisiela/graphql-inspector.git", branch: "master" + + depends_on "node" + + def install + system "npm", "install", *std_npm_args + bin.install_symlink Dir["#{libexec}/bin/*"] + end + + test do + (testpath/"oldSchema.graphql").write <<~GRAPHQL + type Query { + hello: String + } + GRAPHQL + + (testpath/"newSchema.graphql").write <<~GRAPHQL + type Query { + hello: String + world: String + } + GRAPHQL + + diff_output = shell_output("#{bin}/graphql-inspector diff oldSchema.graphql newSchema.graphql") + assert_match "Field world was added to object type Query", diff_output + assert_match "No breaking changes detected", diff_output + + system bin/"graphql-inspector", "introspect", "oldSchema.graphql" + assert_path_exists "graphql.schema.json" + end +end