Skip to content

Commit

Permalink
chore(repo): refactor tsconfig hierarchy
Browse files Browse the repository at this point in the history
- move the base tsconfig into the root of the workspace
- unifying tsconfig tsconfig.build tsconfig.test and tsconfig.watch settings
  • Loading branch information
HuiSF committed Jan 31, 2024
1 parent e20782e commit fa0423d
Show file tree
Hide file tree
Showing 80 changed files with 288 additions and 232 deletions.
4 changes: 2 additions & 2 deletions packages/adapter-nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
"scripts": {
"build": "npm run clean && npm run build:esm-cjs",
"build-with-test": "npm test && npm run build",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"clean": "npm run clean:size && rimraf dist",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
Expand Down
14 changes: 2 additions & 12 deletions packages/adapter-nextjs/rollup.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -18,23 +18,13 @@ const config = defineConfig([
{
input: input,
output: cjsOutput,
plugins: [
typescript({
...cjsTSOptions,
tsconfig: 'tsconfig.build.json',
}),
],
plugins: [typescript(cjsTSOptions)],
},
// ESM config
{
input: input,
output: esmOutput,
plugins: [
typescript({
...esmTSOptions,
tsconfig: 'tsconfig.build.json',
}),
],
plugins: [typescript(esmTSOptions)],
},
]);

Expand Down
8 changes: 2 additions & 6 deletions packages/adapter-nextjs/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"strict": true,
"noImplicitAny": true
},
"include": ["./src"]
"extends": "./tsconfig.json",
"exclude": ["__tests__", "coverage", "coverage-ts", "dist"]
}
17 changes: 2 additions & 15 deletions packages/adapter-nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
//WARNING: If you are manually specifying files to compile then the tsconfig.json is completely ignored, you must use command line flags
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"target": "es2020",
"noImplicitAny": true,
"lib": ["dom", "es2019", "esnext.asynciterable"],
"module": "commonjs",
"moduleResolution": "node",
"allowJs": true,
"declaration": true,
"typeRoots": ["./node_modules/@types", "../../node_modules/@types"],
"types": ["node"],
"esModuleInterop": true,
"resolveJsonModule": true,
"strict": true,
"alwaysStrict": true
},
"include": ["src/**/*"],
"exclude": ["src/setupTests.ts"]
"include": ["./src", "__tests__"]
}
3 changes: 3 additions & 0 deletions packages/adapter-nextjs/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}
6 changes: 3 additions & 3 deletions packages/analytics/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"build-with-test": "npm run clean && npm run test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 71.4"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 71.4"
},
"typesVersions": {
">=4.2": {
Expand Down
4 changes: 4 additions & 0 deletions packages/analytics/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "coverage", "coverage-ts", "dist"]
}
9 changes: 2 additions & 7 deletions packages/analytics/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"importHelpers": true,
"strict": true,
"noImplicitAny": true
},
"include": ["./src", "../core/src/utils/haveCredentialsChanged.ts"]
"extends": "../../tsconfig.json",
"include": ["./src", "__tests__"]
}
3 changes: 3 additions & 0 deletions packages/analytics/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}
6 changes: 3 additions & 3 deletions packages/api-graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"build-with-test": "npm test && npm build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 70.0"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 70.0"
},
"exports": {
".": {
Expand Down
4 changes: 4 additions & 0 deletions packages/api-graphql/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "coverage", "coverage-ts", "dist"]
}
10 changes: 3 additions & 7 deletions packages/api-graphql/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"extends": "../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"skipLibCheck": true
"strictNullChecks": true
},
"include": ["./src"]
"include": ["./src", "__tests__"]
}
7 changes: 7 additions & 0 deletions packages/api-graphql/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
// TODO(test): enable noImplicitAny for tests
"noImplicitAny": false
}
}
6 changes: 3 additions & 3 deletions packages/api-rest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
"build-with-test": "npm test && npm build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 70.0"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 70.0"
},
"exports": {
".": {
Expand Down
4 changes: 4 additions & 0 deletions packages/api-rest/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "coverage", "coverage-ts", "dist"]
}
9 changes: 2 additions & 7 deletions packages/api-rest/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"importHelpers": true,
"strict": true,
"noImplicitAny": true
},
"include": ["./src"]
"extends": "../../tsconfig.json",
"include": ["./src", "__tests__"]
}
3 changes: 3 additions & 0 deletions packages/api-rest/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}
6 changes: 3 additions & 3 deletions packages/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
"build-with-test": "npm test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 88"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 88"
},
"exports": {
".": {
Expand Down
4 changes: 4 additions & 0 deletions packages/api/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "__mocks__", "coverage", "coverage-ts", "dist"]
}
10 changes: 3 additions & 7 deletions packages/api/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
{
"extends": "../tsconfig.base.json",
"extends": "../../tsconfig.json",
"compilerOptions": {
"importHelpers": true,
"strict": true,
"noImplicitAny": true,
"strictNullChecks": true,
"skipLibCheck": true
"strictNullChecks": true
},
"include": ["./src"]
"include": ["./src", "__tests__", "__mocks__"]
}
3 changes: 3 additions & 0 deletions packages/api/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}
6 changes: 3 additions & 3 deletions packages/auth/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@
"build-with-test": "npm test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "npm run clean:size && rimraf lib-esm lib dist",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint '{src}/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 91.18"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 91.18"
},
"typesVersions": {
">=4.2": {
Expand Down
4 changes: 4 additions & 0 deletions packages/auth/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "coverage", "coverage-ts", "dist"]
}
10 changes: 2 additions & 8 deletions packages/auth/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"importHelpers": true,
"types": ["jest", "node"],
"strict": true,
"noImplicitAny": true
},
"include": ["src"]
"extends": "../../tsconfig.json",
"include": ["./src", "__tests__"]
}
7 changes: 7 additions & 0 deletions packages/auth/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
// TODO(test): enable noImplicitAny for tests
"noImplicitAny": false
}
}
6 changes: 3 additions & 3 deletions packages/aws-amplify/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -240,15 +240,15 @@
"build-with-test": "npm run clean && npm test && tsc && webpack -p",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m es6 --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m es6 --outDir dist/esm --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "rimraf lib-esm lib dist",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"generate-docs-local": "typedoc --out docs src",
"generate-docs-root": "typedoc --out ../../docs src",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 93.26"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 93.26"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions packages/aws-amplify/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "coverage", "coverage-ts", "dist"]
}
8 changes: 2 additions & 6 deletions packages/aws-amplify/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"strict": true,
"noImplicitAny": true
},
"include": ["./src"]
"extends": "../../tsconfig.json",
"include": ["./src", "__tests__"]
}
3 changes: 3 additions & 0 deletions packages/aws-amplify/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "./tsconfig.json"
}
6 changes: 3 additions & 3 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,16 @@
"build-with-test": "npm test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"build": "npm run clean && npm run generate-version && npm run build:esm-cjs && npm run build:umd",
"generate-version": "genversion src/Platform/version.ts --es6 --semi --source ../aws-amplify",
"clean": "npm run clean:size && rimraf dist lib lib-esm",
"clean:size": "rimraf dual-publish-tmp tmp*",
"format": "echo \"Not implemented\"",
"lint": "tslint 'src/**/*.ts' && npm run ts-coverage",
"prepublishOnly": "npm run build",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 92.36"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 92.36"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions packages/core/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "coverage", "coverage-ts", "dist"]
}
12 changes: 2 additions & 10 deletions packages/core/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"importHelpers": false,
"strict": true,
"noImplicitAny": true
},
"include": ["./src"],
"watchOptions": {
"excludeDirectories": ["lib*"]
}
"extends": "../../tsconfig.json",
"include": ["./src", "__tests__"]
}
8 changes: 8 additions & 0 deletions packages/core/tsconfig.test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "./tsconfig.json",
"compilerOptions": {
// TODO(test): enable noImplicitAny for tests
"noImplicitAny": false,
"types": ["node", "jest", "jsdom"]
}
}
6 changes: 3 additions & 3 deletions packages/datastore-storage-adapter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
"build-with-test": "npm test && npm run build",
"build:umd": "webpack && webpack --config ./webpack.config.dev.js",
"build:esm-cjs": "rollup -c rollup.config.mjs",
"build:cjs:watch": "rimraf dist/cjs && tsc -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -m esnext --outDir dist/esm --watch",
"build:cjs:watch": "rimraf dist/cjs && tsc -p tsconfig.watch.json -m commonjs --outDir dist/cjs --watch",
"build:esm:watch": "rimraf dist/esm && tsc -p tsconfig.watch.json -m esnext --outDir dist/esm --watch",
"build": "npm run clean && npm run build:esm-cjs && npm run build:umd",
"clean": "rimraf dist lib lib-esm",
"format": "echo \"Not implemented\"",
"lint": "tslint '{__tests__,src}/**/*.ts' && npm run ts-coverage",
"ts-coverage": "typescript-coverage-report -p ./tsconfig.json -t 94.16"
"ts-coverage": "typescript-coverage-report -p ./tsconfig.build.json -t 94.16"
},
"repository": {
"type": "git",
Expand Down
4 changes: 4 additions & 0 deletions packages/datastore-storage-adapter/tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["__tests__", "ExpoSQLiteAdapter", "SQLiteAdapter"]
}
Loading

0 comments on commit fa0423d

Please sign in to comment.