Skip to content

Commit

Permalink
Cleanup project configuration and Travis setup (#116)
Browse files Browse the repository at this point in the history
* Travis: add SonarCloud, fix codecov uploads
  • Loading branch information
nebolsin authored Feb 18, 2019
1 parent 4391afa commit a370688
Show file tree
Hide file tree
Showing 14 changed files with 150 additions and 100 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ pids
lib-cov

# Coverage directory used by tools like istanbul
coverage
reports

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand Down
23 changes: 16 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
dist: xenial
language: node_js
node_js:
- "8"
env:
- DB=astrograph_test DBUSER=postgres DBHOST=localhost
addons:
postgresql: 10
sonarcloud:
organization: astroband
services:
- postgresql

node_js:
- 10
env:
global:
- DB=astrograph_test DBUSER=postgres DBHOST=localhost

before_script:
- psql -c 'create database astrograph_test;' -U postgres
- psql -U postgres -c 'create database astrograph_test;'
script:
- yarn run test:unit --coverage
- yarn test:coverage
- sonar-scanner
after_success:
- codecov -f coverage/*.json
- yarn test:codecov
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
coverage:
status:
project:
default:
threshold: 1%
patch:
default:
target: 0%

comment: off
7 changes: 0 additions & 7 deletions jest.config.js

This file was deleted.

35 changes: 25 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,36 +61,51 @@
"apollo-client": "^2.4.1",
"apollo-link-http": "^1.5.4",
"apollo-link-ws": "^1.0.8",
"codecov": "^3.1.0",
"jest": "^23.6.0",
"jest-sonar-reporter": "^2.0.0",
"nodemon": "^1.18.7",
"prettier": "1.13.3",
"rosie": "^2.0.1",
"subscriptions-transport-sse": "^0.9.2",
"subscriptions-transport-ws": "^0.9.14",
"ts-jest": "^23.10.1",
"ts-jest": "^23.10.5",
"ts-node": "^6.0.5",
"tslint": "^5.10.0",
"tslint-config-prettier": "^1.14.0",
"tslint-plugin-prettier": "^1.3.0",
"typescript": "^3.0.3",
"typescript": "^3.3.3",
"ws": "^6.0.0"
},
"scripts": {
"build": "tsc",
"build-prod": "tsc -p tsconfig.production.json",
"build": "tsc --build tsconfig.build.json",
"start": "nodemon ./src/graphql.ts",
"start-prod": "nodemon ./dist/graphql.js",
"dev": "nodemon --watch src && tslint-check",
"bench": "ts-node ./benchmark/index.ts",
"prod": "yarn build && yarn tslint && yarn start-prod",
"tslint": "tslint -c tslint.json -p tsconfig.json --fix",
"tslint-check": "tslint-config-prettier-check ./tslint.json",
"test:unit": "NODE_ENV=test yarn run jest tests/unit",
"test:integration": "NODE_ENV=test yarn run jest tests/integration",
"test": "NODE_ENV=test yarn run jest",
"export": "ts-node ./src/export.ts",
"test": "jest",
"test:codecov": "codecov -f reports/coverage/*.json",
"test:coverage": "jest --coverage",
"test:unit": "jest tests/unit",
"test:integration": "jest tests/integration",
"bench": "ts-node ./benchmark/index.ts",
"export": "yarn build && node ./dist/export.js",
"dgraph-migrate": "ts-node ./src/migrate.ts"
},
"license": "MIT",
"private": true
"private": true,
"jest": {
"preset": "ts-jest",
"testEnvironment": "node",
"coverageDirectory": "reports/coverage",
"testResultsProcessor": "jest-sonar-reporter",
"roots": [
"<rootDir>/tests/"
]
},
"jestSonar": {
"reportPath": "reports"
}
}
15 changes: 15 additions & 0 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
sonar.organization=astroband
sonar.projectKey=astroband_astrograph

sonar.sources=src
sonar.tests=tests

sonar.typescript.lcov.reportPaths=reports/coverage/lcov.info
sonar.testExecutionReportPaths=reports/test-report.xml

sonar.links.homepage=https://astrograph.xyz
sonar.links.ci=https://travis-ci.org/astroband/astrograph
sonar.links.scm=https://github.com/astroband/astrograph
sonar.links.issue=https://github.com/astroband/astrograph/issues

sonar.host.url=https://sonarcloud.io
1 change: 1 addition & 0 deletions src/@types/object-dig.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "object-dig";
1 change: 1 addition & 0 deletions src/@types/stellar-base.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
declare module "stellar-base";
14 changes: 14 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"extends": "./tsconfig",
"compilerOptions": {
"noEmit": false,
"rootDir": "src",
"outDir": "dist",
"declaration": false,
"sourceMap": false,
"inlineSources": true,
"inlineSourceMap": true,
"sourceRoot": "/"
},
"include": ["src/**/*"]
}
31 changes: 9 additions & 22 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,36 +1,28 @@

{
"compilerOptions": {
"target": "es6",
"noEmit": true,
"noEmitOnError": true,
"pretty": true,
"target": "es2017",
"module": "commonjs",
"outDir": "dist",
"lib": ["es2017", "esnext", "dom"],
"lib": ["es2018", "esnext.asynciterable"],
"declaration": true,
"sourceMap": true,
"suppressImplicitAnyIndexErrors": true,
"noEmitOnError": false,

/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
"strictNullChecks": true, /* Enable strict null checks. */
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
"alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */

/* Additional Checks */
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedParameters": false, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
"forceConsistentCasingInFileNames": true,

/* Module Resolution Options */
"moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
"paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
"rootDirs": ["src", "tests"], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": [ /* List of folders to include type definitions from. */
"./node_modules/@types",
"./types"
],
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
"esModuleInterop": true,

Expand All @@ -40,12 +32,7 @@

},
"include": [
"src/**/*.ts",
"tests/**/*.ts",
"types/**/*.d.ts",
"dgraph/import.ts"
],
"exclude": [
"node_modules"
"src/**/*",
"tests/**/*"
]
}
8 changes: 0 additions & 8 deletions tsconfig.production.json

This file was deleted.

3 changes: 0 additions & 3 deletions types/object-dig.d.ts

This file was deleted.

33 changes: 0 additions & 33 deletions types/stellar-base.d.ts

This file was deleted.

Loading

0 comments on commit a370688

Please sign in to comment.