diff --git a/.nycrc.json b/.nycrc.json new file mode 100644 index 000000000..c9bb259e2 --- /dev/null +++ b/.nycrc.json @@ -0,0 +1,13 @@ +{ + "exclude": [ + "**/node_modules/**", + "**/spec-js/test", + "**/*.d.ts" + ], + "extension": [ + ".ts" + ], + "reporter": ["html", "lcov"], + "all": true, + "cache": true +} diff --git a/circle.yml b/circle.yml index 8e4c76311..a8d5afa30 100644 --- a/circle.yml +++ b/circle.yml @@ -12,13 +12,12 @@ dependencies: - ~/.cache/yarn test: - before: + pre: - greenkeeper-lockfile-update - override: - - lerna run build_cjs && yarn test + - lerna run build_cjs post: - npm run check_circular_dependencies - - cat ./packages/*/coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js + - cat ./packages/*/coverage/lcov.info ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js - greenkeeper-lockfile-upload notify: diff --git a/package.json b/package.json index a781a5f13..ae454141d 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "scripts": { "check_circular_dependencies": "madge ./packages/*/dist/cjs --circular", "build_test": "rm -rf spec-js && tsc --project test", - "test": "lerna run test && npm run build_test && tman --mocha spec-js/app.js" + "test": "lerna run test && npm run build_test && rm -rf ./coverage && nyc tman --mocha spec-js/app.js" }, "repository": { "type": "git", @@ -62,6 +62,7 @@ "sinon": "^2.3.8", "sinon-chai": "^2.11.0", "snapper-consumer": "^1.3.6", + "source-map-support": "^0.4.16", "teambition-sdk-core": "^0.8.13", "teambition-sdk-fixture": "^0.8.13", "teambition-sdk-mock": "^0.8.13", diff --git a/packages/teambition-sdk-core/package.json b/packages/teambition-sdk-core/package.json index 5124e41d0..781205f20 100644 --- a/packages/teambition-sdk-core/package.json +++ b/packages/teambition-sdk-core/package.json @@ -14,7 +14,7 @@ "build_socket": "rm -rf dist/bundle/tbsdk.socket.js && tsc ./src/SocketApp.ts ./src/teambition.ts -m commonjs --outDir dist/socket --sourcemap --inlineSources --target ES5 -d --diagnostics --pretty --experimentalDecorators --suppressImplicitAnyIndexErrors --moduleResolution node --lib es5,es2015.iterable,es2015.collection,es2015.promise,es2015.core,dom && ts-node ./tools/tasks/bundle.socket.ts", "build_test": "rm -rf spec-js && tsc --project test", "copy_files": "cp README.md package.json ./dist/cjs/", - "cover": "npm run build_test && rm -rf ./coverage && nyc --reporter=html --reporter=lcov --exclude=node_modules --exclude=spec-js/test --exclude=spec-js/mock --exclude=spec-js/src/sockets/SocketClient.js tman --mocha spec-js/test/app.js", + "cover": "npm run build_test && rm -rf ./coverage && nyc --exclude=spec-js/src/sockets/SocketClient.js tman --mocha spec-js/test/app.js", "lint": "tslint ./src/**/*.ts ./mock/**/*.ts ./test/*.ts ./test/apis/**/*.ts ./test/mock/**/*.ts ./test/utils/**/*.ts", "publish_sdk": "npm run build_all && npm run copy_files && npm publish ./dist/cjs", "publish_all": "npm run publish_sdk && ts-node ./tools/tasks/publish.ts && cp -r ./dist/mock-cjs/** ./.tmp/mock && cp -r ./dist/socket/** ./.tmp/socket && npm publish .tmp/mock/ && npm publish .tmp/socket/", diff --git a/packages/teambition-sdk-request/package.json b/packages/teambition-sdk-request/package.json index 260d500c2..85e329bd8 100644 --- a/packages/teambition-sdk-request/package.json +++ b/packages/teambition-sdk-request/package.json @@ -7,7 +7,7 @@ "scripts": { "build_cjs": "rm -rf dist/cjs && tsc src/index.ts -m commonjs --outDir dist/cjs --sourcemap --inlineSources --target ES5 -d --diagnostics --pretty --strict --noUnusedLocals --noUnusedParameters --experimentalDecorators --suppressImplicitAnyIndexErrors --moduleResolution node --importHelpers --noEmitHelpers --lib es5,es2015.iterable,es2015.collection,es2015.promise,es2015.core,dom", "build_test": "rm -rf spec-js && tsc --project test", - "cover": "npm run build_test && tman --mocha spec-js/test/app.js", + "cover": "npm run build_test && rm -rf ./coverage && nyc tman --mocha spec-js/test/app.js", "lint": "tslint ./src/**/*.ts ./mock/**/*.ts ./test/*.ts ./test/apis/**/*.ts ./test/mock/**/*.ts ./test/utils/**/*.ts", "test": "npm run lint && npm run cover", "watch_test": "tsc --project test --watch --skipLibCheck", diff --git a/src/schemas/TapChart.ts b/src/schemas/TapChart.ts deleted file mode 100644 index b047e409d..000000000 --- a/src/schemas/TapChart.ts +++ /dev/null @@ -1,143 +0,0 @@ -import { RDBType, Relationship, SchemaDef } from 'reactivedb/interface' -import { schemas } from '../SDK' - -import { - UserId, - TapChartId, - TapDashboardId, - ExecutorOrCreator, - TapGenericFilterRequest as FilterRequest, - TapGenericFilterResponse as FilterResponse -} from 'teambition-types' - -export type TapChartType = 'bar' | 'line' - -// tapGraph definition -export type TapGraphColType = 'type/DateTime' | 'type/Integer' | 'type/String' - -export interface TapGraphCol { - name: string - baseType: TapGraphColType -} - -export type TapGraphData = { - cols: TapGraphCol[], - rows: any[][] -} - -export type TapGraphLineDisplay = { - showPointMarker: boolean, - stack: false | 'stack' -} - -export type TapGraphBarDisplay = { - stack: false | 'stack' -} - -export type TapGraphVisualizationSettings = { - type: TapChartType - dimension: number // key of cols in data - display: TapGraphLineDisplay | TapGraphBarDisplay - axes: { - x: { - visible: boolean - label: string | null - scale: 'timeseries' | 'ordinal' - }, - y: { - visible: boolean - scale: 'linear' - label: string | null - range: 'auto' - } - } -} - -// tapChart definition -export interface TapChartSchema { - _id: TapChartId - - _creatorId: UserId - creator?: ExecutorOrCreator - - _tapdashboardId: TapDashboardId - tapdashboard?: { - _id: TapDashboardId, - name: string - } - - name: string - desc: string - - created: string - updated: string - - filter: T - filterList: FilterResponse - - graphData: TapGraphData - visualizationSettings: TapGraphVisualizationSettings -} - -const schema: SchemaDef> = { - _id: { - type: RDBType.STRING, - primaryKey: true - }, - - _creatorId: { - type: RDBType.STRING - }, - creator: { - type: Relationship.oneToOne, - virtual: { - name: 'Member', - where: (memberTable: any) => ({ - _creatorId: memberTable._id - }) - } - }, - - _tapdashboardId: { - type: RDBType.STRING - }, - tapdashboard: { - type: Relationship.oneToOne, - virtual: { - name: 'TapDashboard', - where: (dashboardTable: any) => ({ - _tapdashboardId: dashboardTable._id - }) - } - }, - - name: { - type: RDBType.STRING - }, - desc: { - type: RDBType.STRING - }, - - created: { - type: RDBType.DATE_TIME - }, - updated: { - type: RDBType.DATE_TIME - }, - - filter: { - type: RDBType.OBJECT - }, - filterList: { - type: RDBType.OBJECT - }, - - graphData: { - type: RDBType.OBJECT - }, - visualizationSettings: { - type: RDBType.OBJECT - } -} - -schemas.push({ schema, name: 'TapChart' }) diff --git a/src/schemas/TapDashboard.ts b/src/schemas/TapDashboard.ts deleted file mode 100644 index a3ee97923..000000000 --- a/src/schemas/TapDashboard.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { RDBType, Relationship, SchemaDef } from 'reactivedb/interface' -import { schemas } from '../SDK' - -import { - UserId, - ProjectId, - TapDashboardId, - ExecutorOrCreator, - TapGenericFilterRequest as FilterRequest, - TapGenericFilterResponse as FilterResponse -} from 'teambition-types' - -import { - TapChartType, - TapChartSchema -} from './TapChart' - -export interface TapDashboardSchema { - _id: TapDashboardId - - _projectId: ProjectId - - _creatorId: UserId - creator?: ExecutorOrCreator - - name: string - cover: TapChartType - - filter: T - tapcharts: TapChartSchema[] -} - -const schema: SchemaDef> = { - _id: { - type: RDBType.STRING, - primaryKey: true - }, - - _projectId: { - type: RDBType.STRING - }, - - _creatorId: { - type: RDBType.STRING - }, - creator: { - type: Relationship.oneToOne, - virtual: { - name: 'Member', - where: (memberTable: any) => ({ - _creatorId: memberTable._id - }) - } - }, - - name: { - type: RDBType.STRING - }, - cover: { - type: RDBType.STRING - }, - - filter: { - type: RDBType.OBJECT - }, - tapcharts: { - type: Relationship.oneToMany, - virtual: { - name: 'TapChart', - where: (tapChartTable: any) => ({ - _id: tapChartTable._tapdashboardId - }) - } - } -} - -schemas.push({ schema, name: 'TapDashboard' }) diff --git a/src/schemas/TapQuestion.ts b/src/schemas/TapQuestion.ts deleted file mode 100644 index 2dec4e7ce..000000000 --- a/src/schemas/TapQuestion.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { TapChartType } from './TapChart' -import { TapGenericFilterResponse } from 'teambition-types' - -export interface QuestionId extends String { - kind?: 'QuestionId' -} - -export interface QuestionSchema { - _id: QuestionId - type: TapChartType - - name: string - desc: string - - filter: TapGenericFilterResponse - - [index: string]: any -} diff --git a/yarn.lock b/yarn.lock index a6fb6f650..838ae5352 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2907,6 +2907,12 @@ source-map-support@^0.4.0: dependencies: source-map "^0.5.6" +source-map-support@^0.4.16: + version "0.4.16" + resolved "https://registry.npmjs.org/source-map-support/-/source-map-support-0.4.16.tgz#16fecf98212467d017d586a2af68d628b9421cd8" + dependencies: + source-map "^0.5.6" + source-map@^0.4.4, source-map@~0.4.1: version "0.4.4" resolved "https://registry.npmjs.org/source-map/-/source-map-0.4.4.tgz#eba4f5da9c0dc999de68032d8b4f76173652036b" @@ -3085,10 +3091,6 @@ tapable@^0.2.5: version "0.2.8" resolved "https://registry.npmjs.org/tapable/-/tapable-0.2.8.tgz#99372a5c999bf2df160afc0d74bed4f47948cd22" -teambition-sdk-mock@^0.6.8: - version "0.6.9" - resolved "https://registry.npmjs.org/teambition-sdk-mock/-/teambition-sdk-mock-0.6.9.tgz#c95584d461580f053b676e8c70eea880052e463c" - temp-dir@^1.0.0: version "1.0.0" resolved "https://registry.npmjs.org/temp-dir/-/temp-dir-1.0.0.tgz#0a7c0ea26d3a39afa7e0ebea9c1fc0bc4daa011d"