diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index d5e66fd..4ffc4d6 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -3,11 +3,7 @@ name: Node.js CI -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: ["push", "pull_request"] jobs: build: @@ -16,7 +12,7 @@ jobs: strategy: matrix: - node-version: [12.x, 14.x, 15.x] + node-version: [12.x] # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ steps: @@ -28,4 +24,8 @@ jobs: - name: Install dependencies run: yarn --frozen-lockfile - run: yarn build - - run: yarn test + - run: yarn test --coverage + - name: Coverage Report + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.npmignore b/.npmignore new file mode 100644 index 0000000..bd9e360 --- /dev/null +++ b/.npmignore @@ -0,0 +1,3 @@ +.github +*.ts +tsconfig* diff --git a/README.md b/README.md index b7a65df..e535312 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,5 @@ +[![Coverage Status](https://coveralls.io/repos/github/nohmad/graql/badge.svg?branch=master)](https://coveralls.io/github/nohmad/graql?branch=master) + # Graql graql is a light-weight graphql client depends on nothing but 'node-fetch'. diff --git a/index.ts b/index.ts index ac846fd..33c08c0 100644 --- a/index.ts +++ b/index.ts @@ -2,7 +2,7 @@ import fetch from 'node-fetch'; const APPLICATION_JSON = 'application/json'; -interface Options { +interface FetchOptions { method?: string, headers?: {[key: string]: string}, body?: string, @@ -18,9 +18,9 @@ class Graql { endpoint: string; headers: {[key: string]: string}; debug: boolean; - options: Options; + options: FetchOptions; - constructor(endpoint: string, options: Options = {debug: false}) { + constructor(endpoint: string, options: FetchOptions = {debug: false}) { this.endpoint = endpoint; this.debug = options.debug; delete options.debug; @@ -32,7 +32,7 @@ class Graql { this.options = {method: 'POST', ...options}; } - async fetch(request: GraphqlRequest, options: Options = {}) { + async fetch(request: GraphqlRequest, options: FetchOptions = {}) { const body = JSON.stringify(request); const headers = {...this.headers, ...options.headers}; const _options = {...this.options, ...options, headers}; diff --git a/package.json b/package.json index d86f3c2..5e36c03 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "graql", - "version": "0.3.0", + "version": "0.3.4", "author": "Gyoung-Yoon Noh ", "repository": { "type": "git", diff --git a/tsconfig-cjs.json b/tsconfig-cjs.json index 3c1fb55..6c3026c 100644 --- a/tsconfig-cjs.json +++ b/tsconfig-cjs.json @@ -3,8 +3,5 @@ "compilerOptions": { "module": "CommonJS", "outDir": "dist/cjs" - }, - "exclude": [ - "node_modules", "dist", "**/*.spec.ts" - ] + } } diff --git a/tsconfig.json b/tsconfig.json index 0b36d3e..836c599 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "module": "es2020", "moduleResolution": "node", "esModuleInterop": true, + "declaration": true, "outDir": "dist/esm" }, "exclude": [