From ab3ea83e86e62c73de74d45c54d8709d3143b2ea Mon Sep 17 00:00:00 2001 From: Drew Powers Date: Mon, 20 Jan 2020 13:18:38 -0700 Subject: [PATCH] Add size & coverage badge --- .github/workflow/pull_request.yaml | 2 +- .gitignore | 1 + README.md | 13 ++++++++----- package.json | 3 ++- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/.github/workflow/pull_request.yaml b/.github/workflow/pull_request.yaml index 3e6b803..b89082a 100644 --- a/.github/workflow/pull_request.yaml +++ b/.github/workflow/pull_request.yaml @@ -29,5 +29,5 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-node@v1 - run: npm install - - run: npm run test:cov + - run: npm run test - run: npx codecov diff --git a/.gitignore b/.gitignore index a001dd3..b509ee1 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ __test__/example.min.graphql +coverage node_modules pkg diff --git a/README.md b/README.md index 85a17ae..5b4235b 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,13 @@ +[![version (scoped)](https://img.shields.io/npm/v/gqlmin.svg)](https://www.npmjs.com/package/gqlmin) +[![minzip](https://badgen.net/bundlephobia/minzip/gqlmin)](https://bundlephobia.com/gqlmin) +[![codecov](https://codecov.io/gh/dangodev/gqlmin/branch/master/graph/badge.svg)](https://codecov.io/gh/dangodev/gqlmin) + # 🗜 gqlmin -4 kB (gzip) GraphQL query minifier. +`< 1 kB` GraphQL query minifier (`3.4 kB` (gzip) if you include its only dependency, [Moo][moo]). This library removes all insignificant whitespace within a GraphQL query, as well as comments. -The actual library itself is `843 bytes`; the `4 kB` includes [Moo][moo], the lexer it uses. - -### - ## Usage ### ES Modules @@ -37,6 +37,9 @@ console.log(minified); // query allProducts{products{name price … ``` +_Note: for Node.js < 13.3.0 or if ES Modules aren’t supported, use +`const gqlmin = require('gqlmin')` instead._ + ### CLI ``` diff --git a/package.json b/package.json index 87e6a63..a42c1ad 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "gqlmin", "version": "0.0.1", - "description": "4 kB (gzip) GraphQL query minifier", + "description": "< 1 kB GraphQL query minifier", "repository": { "type": "git", "url": "git+https://github.com/dangodev/gqlmin.git" @@ -34,6 +34,7 @@ "publish": "pika publish", "pretest": "npm run build && ./pkg/bin/cli.js ./__test__/example.graphql -o ./__test__/example.min.graphql", "test": "jest", + "test:coverage": "jest --coverage", "version": "npm run build" }, "@pika/pack": {