Skip to content

Commit

Permalink
feat: add a typescript coverage report mechanism (aws-amplify#10551)
Browse files Browse the repository at this point in the history
* feat: add TS coverage report per package (aws-amplify#10379)

* feat: add tsconfig file to most of the packages

* feat: add tsconfig file per package
This change reads a tscong file per package

* chore: remove strict flag

* feat: get extends compiler options

chore: remove third parameter in build

* feat: add tsconfig file to each package

* refactor: consumes tsconfig file from packages

* refactor: add tsconfig file as a third parameter to build.js

* feat: add a defaultCompiler  to ES5 and ES6 build

* chore: remove unused code

* feat: add settings json file

* fix: remove unsued code

* chore: remove unused code

* chore: change files tag

* refactor: add the right compiler options

* chore: update tsconfig.settings file

* refactor: delete composite key

* refactor: change tsconfig name by tsconfig.build

* chore: update tsconfig file path

* chore: delete "composite" flag from compilerOptions

* feat: add tsconfig file to most of the packages

feat: add tsconfig file per package
This change reads a tscong file per package

chore: remove strict flag

feat: get extends compiler options

chore: remove third parameter in build

feat: add tsconfig file to each package

refactor: consumes tsconfig file from packages

refactor: add tsconfig file as a third parameter to build.js

feat: add a defaultCompiler  to ES5 and ES6 build

chore: remove unused code

feat: add settings json file

fix: remove unsued code

chore: remove unused code

chore: change files tag

refactor: add the right compiler options

chore: update tsconfig.settings file

refactor: delete composite key

refactor: change tsconfig name by tsconfig.build

chore: update tsconfig file path

chore: delete "composite" flag from compilerOptions

* feat: add ts-coverage-report as dev dependency

* feat: add ts-coverage script per package

* feat: add lerna command to run ts-coverage script per package

* feat: add tsconfig file to most of the packages

* feat: add tsconfig file per package
This change reads a tscong file per package

* chore: remove strict flag

* feat: get extends compiler options

chore: remove third parameter in build

* feat: add tsconfig file to each package

* refactor: consumes tsconfig file from packages

* refactor: add tsconfig file as a third parameter to build.js

* feat: add a defaultCompiler  to ES5 and ES6 build

* chore: remove unused code

* feat: add settings json file

* fix: remove unsued code

* chore: remove unused code

* chore: change files tag

* refactor: add the right compiler options

* chore: update tsconfig.settings file

* refactor: delete composite key

* refactor: change tsconfig name by tsconfig.build

* chore: update tsconfig file path

* chore: delete "composite" flag from compilerOptions

* refactor: remove composite flag

* feat: add tsconfig.build.json file to missing packages

* feat: add security check to build

* chore: delete unused code

* refactor: change ts-coverage threshold

* chore: delete composite flag

* chore: delete ui packages

* feat: add src directory for ts-coverage report

* chore: change ts-coverage script into lint script

* refactor: change ts-coverage threshold per package

* fix: add es2020.promise  target

* chore: add missing "src" flag

* feat: add ts-coverage report to notifications

* chore: change tsconfig name

* chore: add missing importHelpers flag

* chore: remove unused code on build

* chore: remove extra spacing

* chore: change extends path
  • Loading branch information
israx authored Oct 27, 2022
1 parent bfb75d4 commit 8e8df55
Show file tree
Hide file tree
Showing 42 changed files with 299 additions and 169 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ packages/**/cjs/
packages/**/cypress/videos/
yarn.lock
package-lock.json
packages/*/.watchmanconfig
packages/*/.watchmanconfig
coverage-ts/
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"publish:ui-components/main": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=ui-preview --preid=ui-preview --exact --no-verify-access",
"publish:verdaccio": "lerna publish --no-push --canary minor --dist-tag=unstable --preid=unstable --exact --force-publish --yes --no-verify-access",
"publish:geo/main": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=geo --preid=geo --exact --no-verify-access",
"publish:in-app-messaging/main": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=in-app-messaging --preid=in-app-messaging --exact --no-verify-access"
"publish:in-app-messaging/main": "lerna publish --canary --force-publish \"*\" --yes --dist-tag=in-app-messaging --preid=in-app-messaging --exact --no-verify-access",
"ts-coverage": "lerna run ts-coverage"
},
"husky": {
"hooks": {
Expand Down Expand Up @@ -60,10 +61,10 @@
"devDependencies": {
"@babel/cli": "7.17.0",
"@babel/core": "7.17.2",
"@types/lodash": "4.14.182",
"@babel/preset-env": "^7.0.0",
"@babel/preset-react": "^7.0.0",
"@types/jest": "^24.0.18",
"@types/lodash": "4.14.182",
"@types/node": "^8.9.5",
"@types/puppeteer": "1.3.0",
"babel-loader": "^8.0.0",
Expand Down Expand Up @@ -91,6 +92,7 @@
"tslint-config-airbnb": "^5.8.0",
"typedoc": "^0.16.9",
"typescript": "~3.8.3",
"typescript-coverage-report": "^0.6.4",
"uglifyjs-webpack-plugin": "^0.4.6",
"uuid-validate": "^0.0.3",
"webpack": "^4.32.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/amazon-cognito-identity-js/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
"lint": "eslint src",
"lint2": "eslint enhance-rn.js",
"test": "jest --config ./jest.config.js",
"format": "echo \"Not implemented\""
"format": "echo \"Not implemented\"",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json"
},
"main": "lib/index.js",
"react-native": {
Expand Down
5 changes: 5 additions & 0 deletions packages/amazon-cognito-identity-js/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["index.d.ts"]
}
3 changes: 2 additions & 1 deletion packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 69.26"
},
"react-native": {
"./lib/index": "./lib-esm/index.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/analytics/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/api-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 75.62"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/api-graphql/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/api-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 65.41"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/api-rest/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 91.93"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/api/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint '{__tests__,src}/**/*.ts'"
"lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 77.44"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/auth/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
5 changes: 5 additions & 0 deletions packages/aws-amplify-react-native/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["src"]
}
5 changes: 3 additions & 2 deletions packages/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"generate-docs-local": "typedoc --out docs src",
"generate-docs-root": "typedoc --out ../../docs src"
"generate-docs-root": "typedoc --out ../../docs src",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 93.26"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/aws-amplify/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/cache/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 87.74"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/cache/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
"generate-version": "genversion src/Platform/version.ts --es6 --semi",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 76.41"
},
"react-native": {
"./lib/index": "./lib-esm/index.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/datastore-storage-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
"build": "yarn clean && yarn build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint '{__tests__,src}/**/*.ts'"
"lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 94.16"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/datastore-storage-adapter/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
5 changes: 3 additions & 2 deletions packages/datastore/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@
"build:esm:watch": "rimraf lib-esm && node ./build es6 --watch",
"build": "yarn clean && yarn build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint '{__tests__,src}/**/*.ts'"
"format": "echo \"Not implemented\" && npm run ts-coverage",
"lint": "tslint '{__tests__,src}/**/*.ts'",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 92.05"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/datastore/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/geo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build": "yarn clean && yarn build:esm && yarn run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint '{__tests__,src}/**/*.ts'"
"lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 86.56"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/geo/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
3 changes: 2 additions & 1 deletion packages/interactions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88.6"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/interactions/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
4 changes: 3 additions & 1 deletion packages/notifications/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'"
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88.21"

},
"react-native": {
"./lib/index": "./lib-esm/index.js"
Expand Down
5 changes: 5 additions & 0 deletions packages/notifications/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
5 changes: 3 additions & 2 deletions packages/predictions/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
"build": "npm run clean && npm run build:esm && npm run build:cjs",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts'",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"generate-docs-local": "typedoc --out docs src",
"generate-docs-root": "typedoc --out ../../docs src"
"generate-docs-root": "typedoc --out ../../docs src",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 87.84"
},
"repository": {
"type": "git",
Expand Down
5 changes: 5 additions & 0 deletions packages/predictions/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {},
"include": ["lib*/**/*.ts", "src"]
}
Loading

0 comments on commit 8e8df55

Please sign in to comment.