From aa763baec196857a93a12b76d1f2505a436adbab Mon Sep 17 00:00:00 2001 From: Juan Picado Date: Mon, 7 Sep 2020 07:07:05 +0200 Subject: [PATCH] feat: add typescript project references settings (#1933) Add two different settings for compile and develop. https://www.typescriptlang.org/docs/handbook/project-references.html --- .changeset/plenty-spiders-melt.md | 37 ++++++++++++++ .prettierignore | 1 + package.json | 3 +- packages/api/package.json | 6 +-- packages/api/tsconfig.build.json | 9 ++++ packages/api/tsconfig.json | 44 +++++++++++++++-- packages/auth/package.json | 6 +-- packages/auth/tsconfig.build.json | 9 ++++ packages/auth/tsconfig.json | 29 +++++++++-- packages/cli/package.json | 12 ++--- packages/cli/tsconfig.build.json | 9 ++++ packages/cli/tsconfig.json | 18 ++++++- packages/commons/package.json | 11 ++--- packages/commons/tsconfig.build.json | 9 ++++ packages/commons/tsconfig.json | 4 +- packages/config/package.json | 6 +-- packages/config/tsconfig.build.json | 9 ++++ packages/config/tsconfig.json | 17 +++++-- packages/core/commons-api/package.json | 5 +- packages/core/commons-api/tsconfig.build.json | 9 ++++ packages/core/commons-api/tsconfig.json | 8 ++-- packages/core/file-locking/package.json | 3 +- .../core/file-locking/tsconfig.build.json | 9 ++++ packages/core/file-locking/tsconfig.json | 4 +- packages/core/htpasswd/package.json | 13 +++-- packages/core/htpasswd/tsconfig.build.json | 9 ++++ packages/core/htpasswd/tsconfig.json | 9 +++- .../_storage/first-package/package.json | 2 +- packages/core/local-storage/package.json | 12 ++--- .../core/local-storage/tsconfig.build.json | 9 ++++ packages/core/local-storage/tsconfig.json | 15 +++++- packages/core/readme/package.json | 3 +- packages/core/readme/tsconfig.build.json | 9 ++++ packages/core/readme/tsconfig.json | 10 ++-- packages/core/streams/package.json | 4 +- packages/core/streams/tsconfig.build.json | 9 ++++ packages/core/streams/tsconfig.json | 2 +- packages/hooks/package.json | 6 +-- packages/hooks/tsconfig.build.json | 9 ++++ packages/hooks/tsconfig.json | 24 +++++++++- packages/loaders/package.json | 6 +-- packages/loaders/tsconfig.build.json | 9 ++++ packages/loaders/tsconfig.json | 29 +++++++++-- packages/logger-prettify/package.json | 5 +- packages/logger-prettify/tsconfig.build.json | 9 ++++ packages/logger-prettify/tsconfig.json | 10 ++-- packages/logger/package.json | 5 +- packages/logger/tsconfig.build.json | 9 ++++ packages/logger/tsconfig.json | 14 ++++-- packages/middleware/package.json | 6 +-- packages/middleware/tsconfig.build.json | 9 ++++ packages/middleware/tsconfig.json | 18 ++++++- packages/mock/package.json | 6 +-- packages/mock/tsconfig.build.json | 9 ++++ packages/mock/tsconfig.json | 12 ++++- packages/node-api/package.json | 9 ++-- packages/node-api/tsconfig.build.json | 9 ++++ packages/node-api/tsconfig.json | 21 +++++++- packages/proxy/package.json | 6 +-- packages/proxy/tsconfig.build.json | 9 ++++ packages/proxy/tsconfig.json | 23 +++++++-- packages/server/package.json | 11 ++--- packages/server/tsconfig.build.json | 9 ++++ packages/server/tsconfig.json | 48 +++++++++++++++++-- packages/store/package.json | 9 ++-- packages/store/tsconfig.build.json | 9 ++++ packages/store/tsconfig.json | 36 +++++++++++++- packages/utils/package.json | 9 ++-- packages/utils/src/auth-utils.ts | 2 +- packages/utils/tsconfig.build.json | 8 ++++ packages/utils/tsconfig.json | 28 +++++++++-- packages/verdaccio/package.json | 7 ++- packages/verdaccio/src/index.ts | 2 +- packages/verdaccio/tsconfig.build.json | 8 ++++ packages/verdaccio/tsconfig.json | 27 ++++++++++- packages/web/package.json | 6 +-- packages/web/tsconfig.build.json | 9 ++++ packages/web/tsconfig.json | 27 ++++++++++- tsconfig.json => tsconfig.base.json | 3 +- tsconfig.reference.json | 9 ++++ 80 files changed, 761 insertions(+), 161 deletions(-) create mode 100644 .changeset/plenty-spiders-melt.md create mode 100644 packages/api/tsconfig.build.json create mode 100644 packages/auth/tsconfig.build.json create mode 100644 packages/cli/tsconfig.build.json create mode 100644 packages/commons/tsconfig.build.json create mode 100644 packages/config/tsconfig.build.json create mode 100644 packages/core/commons-api/tsconfig.build.json create mode 100644 packages/core/file-locking/tsconfig.build.json create mode 100644 packages/core/htpasswd/tsconfig.build.json create mode 100644 packages/core/local-storage/tsconfig.build.json create mode 100644 packages/core/readme/tsconfig.build.json create mode 100644 packages/core/streams/tsconfig.build.json create mode 100644 packages/hooks/tsconfig.build.json create mode 100644 packages/loaders/tsconfig.build.json create mode 100644 packages/logger-prettify/tsconfig.build.json create mode 100644 packages/logger/tsconfig.build.json create mode 100644 packages/middleware/tsconfig.build.json create mode 100644 packages/mock/tsconfig.build.json create mode 100644 packages/node-api/tsconfig.build.json create mode 100644 packages/proxy/tsconfig.build.json create mode 100644 packages/server/tsconfig.build.json create mode 100644 packages/store/tsconfig.build.json create mode 100644 packages/utils/tsconfig.build.json create mode 100644 packages/verdaccio/tsconfig.build.json create mode 100644 packages/web/tsconfig.build.json rename tsconfig.json => tsconfig.base.json (94%) create mode 100644 tsconfig.reference.json diff --git a/.changeset/plenty-spiders-melt.md b/.changeset/plenty-spiders-melt.md new file mode 100644 index 000000000..d17992a84 --- /dev/null +++ b/.changeset/plenty-spiders-melt.md @@ -0,0 +1,37 @@ +--- +'@verdaccio/api': minor +'@verdaccio/auth': minor +'@verdaccio/cli': minor +'@verdaccio/dev-commons': minor +'@verdaccio/config': minor +'@verdaccio/commons-api': minor +'@verdaccio/file-locking': minor +'@verdaccio/htpasswd': minor +'@verdaccio/local-storage': minor +'@verdaccio/readme': minor +'@verdaccio/streams': minor +'@verdaccio/types': minor +'@verdaccio/hooks': minor +'@verdaccio/loaders': minor +'@verdaccio/logger': minor +'@verdaccio/logger-prettify': minor +'@verdaccio/middleware': minor +'@verdaccio/mock': minor +'@verdaccio/node-api': minor +'@verdaccio/proxy': minor +'@verdaccio/server': minor +'@verdaccio/store': minor +'@verdaccio/dev-types': minor +'@verdaccio/utils': minor +'verdaccio': minor +'@verdaccio/web': minor +'@verdaccio/website': minor +--- + +feat: add typescript project references settings + +Reading https://ebaytech.berlin/optimizing-multi-package-apps-with-typescript-project-references-d5c57a3b4440 I realized I can use project references to solve the issue to pre-compile modules on develop mode. + +It allows to navigate (IDE) trough the packages without need compile the packages. + +Add two `tsconfig`, one using the previous existing configuration that is able to produce declaration files (`tsconfig.build`) and a new one `tsconfig` which is enables [_projects references_](https://www.typescriptlang.org/docs/handbook/project-references.html). diff --git a/.prettierignore b/.prettierignore index f1118375f..4029e1011 100644 --- a/.prettierignore +++ b/.prettierignore @@ -13,3 +13,4 @@ CHANGELOG.md CONTRIBUTORS.md node_modules/ +packages/core/local-storage/_storage/** diff --git a/package.json b/package.json index 23a0fb85b..4f48348da 100644 --- a/package.json +++ b/package.json @@ -101,7 +101,8 @@ "verdaccio-memory": "latest" }, "scripts": { - "debug": "node debug/bootstrap.js", + "start": "node packages/verdaccio/debug/bootstrap.js", + "debug": "node --inspect packages/verdaccio/debug/bootstrap.js", "dev": "cross-env BABEL_ENV=registry babel-node --extensions \".ts,.tsx\" packages/cli/src", "clean": "pnpm recursive run clean", "build": "pnpm recursive run build", diff --git a/packages/api/package.json b/packages/api/package.json index 85bda4e2e..1a14e5a5a 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -16,9 +16,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "license": "MIT", diff --git a/packages/api/tsconfig.build.json b/packages/api/tsconfig.build.json new file mode 100644 index 000000000..fe6883ff5 --- /dev/null +++ b/packages/api/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*", "types/*.d.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/api/tsconfig.json b/packages/api/tsconfig.json index 2be65b934..0f4253dfb 100644 --- a/packages/api/tsconfig.json +++ b/packages/api/tsconfig.json @@ -1,9 +1,47 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, - "include": ["src/**/*", "types/*.d.ts"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts", "types/*.d.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../utils" + }, + { + "path": "../config" + }, + { + "path": "../commons" + }, + { + "path": "../hooks" + }, + { + "path": "../store" + }, + { + "path": "../types" + }, + { + "path": "../middleware" + }, + { + "path": "../auth" + }, + { + "path": "../server" + }, + { + "path": "../loaders" + }, + { + "path": "../logger" + }, + { + "path": "../core/commons-api" + } + ] } diff --git a/packages/auth/package.json b/packages/auth/package.json index 347c3ca3d..17ee801e9 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -16,9 +16,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "license": "MIT", diff --git a/packages/auth/tsconfig.build.json b/packages/auth/tsconfig.build.json new file mode 100644 index 000000000..db054aa8c --- /dev/null +++ b/packages/auth/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/auth/tsconfig.json b/packages/auth/tsconfig.json index 6531bd3e4..25b002f5a 100644 --- a/packages/auth/tsconfig.json +++ b/packages/auth/tsconfig.json @@ -1,9 +1,32 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../utils" + }, + { + "path": "../commons" + }, + { + "path": "../loaders" + }, + { + "path": "../logger" + }, + { + "path": "../config" + }, + { + "path": "../mock" + }, + { + "path": "../core/commons-api" + } + ] } diff --git a/packages/cli/package.json b/packages/cli/package.json index baf1ff476..d81da09be 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -21,11 +21,10 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", - "build": "pnpm run build:js && pnpm run build:types", - "bundle": "cross-env BABEL_ENV=registry webpack --config scripts/bundle.js --profile --json > compilation-stats.json" + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "build": "pnpm run build:js && pnpm run build:types" }, "dependencies": { "@verdaccio/config": "workspace:5.0.0-alpha.0", @@ -37,6 +36,5 @@ "kleur": "3.0.3", "lodash": "^4.17.20", "semver": "7.3.2" - }, - "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" + } } diff --git a/packages/cli/tsconfig.build.json b/packages/cli/tsconfig.build.json new file mode 100644 index 000000000..db054aa8c --- /dev/null +++ b/packages/cli/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/cli/tsconfig.json b/packages/cli/tsconfig.json index 6531bd3e4..baee8a25b 100644 --- a/packages/cli/tsconfig.json +++ b/packages/cli/tsconfig.json @@ -1,9 +1,23 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../config" + }, + { + "path": "../logger" + }, + { + "path": "../node-api" + }, + { + "path": "../utils" + } + ] } diff --git a/packages/commons/package.json b/packages/commons/package.json index b4eba6aed..41b4cde0a 100644 --- a/packages/commons/package.json +++ b/packages/commons/package.json @@ -1,7 +1,7 @@ { "name": "@verdaccio/dev-commons", "version": "5.0.0-alpha.0", - "description": "loaders logic", + "description": "commons utilities", "main": "./build/index.js", "types": "build/index.d.ts", "author": { @@ -19,10 +19,9 @@ }, "scripts": { "clean": "rimraf ./build", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" - }, - "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" + } } diff --git a/packages/commons/tsconfig.build.json b/packages/commons/tsconfig.build.json new file mode 100644 index 000000000..fcc453bfe --- /dev/null +++ b/packages/commons/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/commons/tsconfig.json b/packages/commons/tsconfig.json index 6531bd3e4..7ff9917e3 100644 --- a/packages/commons/tsconfig.json +++ b/packages/commons/tsconfig.json @@ -1,9 +1,9 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, - "include": ["src/**/*"], + "include": ["src/**/*.ts"], "exclude": ["src/**/*.test.ts"] } diff --git a/packages/config/package.json b/packages/config/package.json index a9300bb10..205044cfe 100644 --- a/packages/config/package.json +++ b/packages/config/package.json @@ -17,9 +17,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "devDependencies": { diff --git a/packages/config/tsconfig.build.json b/packages/config/tsconfig.build.json new file mode 100644 index 000000000..db054aa8c --- /dev/null +++ b/packages/config/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/config/tsconfig.json b/packages/config/tsconfig.json index 6531bd3e4..b6ca7a50a 100644 --- a/packages/config/tsconfig.json +++ b/packages/config/tsconfig.json @@ -1,9 +1,20 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../utils" + }, + { + "path": "../commons" + }, + { + "path": "../logger" + } + ] } diff --git a/packages/core/commons-api/package.json b/packages/core/commons-api/package.json index a3a67b7c0..a782fa880 100644 --- a/packages/core/commons-api/package.json +++ b/packages/core/commons-api/package.json @@ -36,9 +36,8 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "funding": { diff --git a/packages/core/commons-api/tsconfig.build.json b/packages/core/commons-api/tsconfig.build.json new file mode 100644 index 000000000..79f1f81e0 --- /dev/null +++ b/packages/core/commons-api/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/core/commons-api/tsconfig.json b/packages/core/commons-api/tsconfig.json index 537522270..aa2b9fa6a 100644 --- a/packages/core/commons-api/tsconfig.json +++ b/packages/core/commons-api/tsconfig.json @@ -1,9 +1,11 @@ { - "extends": "../../../tsconfig", + "extends": "../../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", - "outDir": "./build" + "outDir": "./build", + "composite": true, + "declaration": true }, - "include": ["src/**/*"], + "include": ["src/**/*.ts"], "exclude": ["src/**/*.test.ts"] } diff --git a/packages/core/file-locking/package.json b/packages/core/file-locking/package.json index 378f125b2..e3f0f811f 100644 --- a/packages/core/file-locking/package.json +++ b/packages/core/file-locking/package.json @@ -35,8 +35,7 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, diff --git a/packages/core/file-locking/tsconfig.build.json b/packages/core/file-locking/tsconfig.build.json new file mode 100644 index 000000000..79f1f81e0 --- /dev/null +++ b/packages/core/file-locking/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/core/file-locking/tsconfig.json b/packages/core/file-locking/tsconfig.json index 9af75b8b4..1073c1269 100644 --- a/packages/core/file-locking/tsconfig.json +++ b/packages/core/file-locking/tsconfig.json @@ -1,9 +1,9 @@ { - "extends": "../../../tsconfig", + "extends": "../../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./", "outDir": "./build" }, - "include": ["src/**/*", "types/*.d.ts"], + "include": ["src/**/*.ts", "types/*.d.ts"], "exclude": ["src/**/*.test.ts"] } diff --git a/packages/core/htpasswd/package.json b/packages/core/htpasswd/package.json index ed8023e8e..0ce4b28da 100644 --- a/packages/core/htpasswd/package.json +++ b/packages/core/htpasswd/package.json @@ -13,17 +13,20 @@ "homepage": "https://verdaccio.org", "repository": { "type": "git", - "url": "https://github.com/verdaccio/monorepo", - "directory": "plugins/htpasswd" + "url": "https://github.com/verdaccio/verdaccio", + "directory": "packages/core/htpasswd" }, "bugs": { - "url": "https://github.com/verdaccio/monorepo/issues" + "url": "https://github.com/verdaccio/verdaccio/issues" }, "main": "./build/index.js", "types": "./build/index.d.ts", "files": [ "build" ], + "engines": { + "node": ">=10" + }, "dependencies": { "@verdaccio/file-locking": "workspace:*", "apache-md5": "1.1.2", @@ -38,8 +41,8 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, diff --git a/packages/core/htpasswd/tsconfig.build.json b/packages/core/htpasswd/tsconfig.build.json new file mode 100644 index 000000000..79f1f81e0 --- /dev/null +++ b/packages/core/htpasswd/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/core/htpasswd/tsconfig.json b/packages/core/htpasswd/tsconfig.json index 537522270..bbaf68bd5 100644 --- a/packages/core/htpasswd/tsconfig.json +++ b/packages/core/htpasswd/tsconfig.json @@ -1,9 +1,14 @@ { - "extends": "../../../tsconfig", + "extends": "../../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../file-locking" + } + ] } diff --git a/packages/core/local-storage/_storage/first-package/package.json b/packages/core/local-storage/_storage/first-package/package.json index 0967ef424..9e26dfeeb 100644 --- a/packages/core/local-storage/_storage/first-package/package.json +++ b/packages/core/local-storage/_storage/first-package/package.json @@ -1 +1 @@ -{} +{} \ No newline at end of file diff --git a/packages/core/local-storage/package.json b/packages/core/local-storage/package.json index 60c625f4c..ac7f6e154 100644 --- a/packages/core/local-storage/package.json +++ b/packages/core/local-storage/package.json @@ -13,11 +13,11 @@ "homepage": "https://verdaccio.org", "repository": { "type": "git", - "url": "https://github.com/verdaccio/monorepo", - "directory": "plugins/local-storage" + "url": "https://github.com/verdaccio/verdaccio", + "directory": "packages/core/local-storage" }, "bugs": { - "url": "https://github.com/verdaccio/monorepo/issues" + "url": "https://github.com/verdaccio/verdaccio/issues" }, "publishConfig": { "access": "public" @@ -28,7 +28,7 @@ "build/" ], "engines": { - "node": ">=8" + "node": ">=10" }, "dependencies": { "@verdaccio/commons-api": "workspace:*", @@ -49,8 +49,8 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, diff --git a/packages/core/local-storage/tsconfig.build.json b/packages/core/local-storage/tsconfig.build.json new file mode 100644 index 000000000..79f1f81e0 --- /dev/null +++ b/packages/core/local-storage/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/core/local-storage/tsconfig.json b/packages/core/local-storage/tsconfig.json index 537522270..d5de4ec98 100644 --- a/packages/core/local-storage/tsconfig.json +++ b/packages/core/local-storage/tsconfig.json @@ -1,9 +1,20 @@ { - "extends": "../../../tsconfig", + "extends": "../../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../streams" + }, + { + "path": "../file-locking" + }, + { + "path": "../commons-api" + } + ] } diff --git a/packages/core/readme/package.json b/packages/core/readme/package.json index 65f5e0a4f..55232b44c 100644 --- a/packages/core/readme/package.json +++ b/packages/core/readme/package.json @@ -40,8 +40,7 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, diff --git a/packages/core/readme/tsconfig.build.json b/packages/core/readme/tsconfig.build.json new file mode 100644 index 000000000..79f1f81e0 --- /dev/null +++ b/packages/core/readme/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/core/readme/tsconfig.json b/packages/core/readme/tsconfig.json index 537522270..ed65c36dd 100644 --- a/packages/core/readme/tsconfig.json +++ b/packages/core/readme/tsconfig.json @@ -1,9 +1,13 @@ { - "extends": "../../../tsconfig", + "extends": "../../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", - "outDir": "./build" + "outDir": "./build", + "preserveSymlinks": true, + "composite": true, + "declaration": true, + "declarationMap": true }, - "include": ["src/**/*"], + "include": ["src/**/*.ts"], "exclude": ["src/**/*.test.ts"] } diff --git a/packages/core/streams/package.json b/packages/core/streams/package.json index 1acb75e74..b28d40c7e 100644 --- a/packages/core/streams/package.json +++ b/packages/core/streams/package.json @@ -28,8 +28,8 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, diff --git a/packages/core/streams/tsconfig.build.json b/packages/core/streams/tsconfig.build.json new file mode 100644 index 000000000..79f1f81e0 --- /dev/null +++ b/packages/core/streams/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/core/streams/tsconfig.json b/packages/core/streams/tsconfig.json index 537522270..35b3cee58 100644 --- a/packages/core/streams/tsconfig.json +++ b/packages/core/streams/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig", + "extends": "../../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" diff --git a/packages/hooks/package.json b/packages/hooks/package.json index 900de676a..2c17bcfa2 100644 --- a/packages/hooks/package.json +++ b/packages/hooks/package.json @@ -32,9 +32,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" diff --git a/packages/hooks/tsconfig.build.json b/packages/hooks/tsconfig.build.json new file mode 100644 index 000000000..db054aa8c --- /dev/null +++ b/packages/hooks/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/hooks/tsconfig.json b/packages/hooks/tsconfig.json index 6531bd3e4..f8fbd56c8 100644 --- a/packages/hooks/tsconfig.json +++ b/packages/hooks/tsconfig.json @@ -1,9 +1,29 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../config" + }, + { + "path": "../auth" + }, + { + "path": "../commons" + }, + { + "path": "../logger" + }, + { + "path": "../utils" + }, + { + "path": "../core/commons-api" + } + ] } diff --git a/packages/loaders/package.json b/packages/loaders/package.json index 106d7333b..d79d23e41 100644 --- a/packages/loaders/package.json +++ b/packages/loaders/package.json @@ -30,9 +30,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" diff --git a/packages/loaders/tsconfig.build.json b/packages/loaders/tsconfig.build.json new file mode 100644 index 000000000..db054aa8c --- /dev/null +++ b/packages/loaders/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/loaders/tsconfig.json b/packages/loaders/tsconfig.json index a9539c625..b873a1e41 100644 --- a/packages/loaders/tsconfig.json +++ b/packages/loaders/tsconfig.json @@ -1,10 +1,29 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", - "outDir": "./build", - "allowSyntheticDefaultImports": true + "outDir": "./build" }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../config" + }, + { + "path": "../logger" + }, + { + "path": "../mock" + }, + { + "path": "../node-api" + }, + { + "path": "../core/commons-api" + }, + { + "path": "../common" + } + ] } diff --git a/packages/logger-prettify/package.json b/packages/logger-prettify/package.json index 2f48625b0..24dd84fb0 100644 --- a/packages/logger-prettify/package.json +++ b/packages/logger-prettify/package.json @@ -17,8 +17,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "dependencies": { diff --git a/packages/logger-prettify/tsconfig.build.json b/packages/logger-prettify/tsconfig.build.json new file mode 100644 index 000000000..4871b1e50 --- /dev/null +++ b/packages/logger-prettify/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/logger-prettify/tsconfig.json b/packages/logger-prettify/tsconfig.json index a9539c625..64dcde9ad 100644 --- a/packages/logger-prettify/tsconfig.json +++ b/packages/logger-prettify/tsconfig.json @@ -1,10 +1,10 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference", "compilerOptions": { "rootDir": "./src", - "outDir": "./build", - "allowSyntheticDefaultImports": true + "outDir": "./build" }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [{ "path": "../commons" }, { "path": "../core/commons-api" }] } diff --git a/packages/logger/package.json b/packages/logger/package.json index d72a85afe..7ce53ed8e 100644 --- a/packages/logger/package.json +++ b/packages/logger/package.json @@ -17,8 +17,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest --runTestsByPath", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps" }, "dependencies": { diff --git a/packages/logger/tsconfig.build.json b/packages/logger/tsconfig.build.json new file mode 100644 index 000000000..fcc453bfe --- /dev/null +++ b/packages/logger/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/logger/tsconfig.json b/packages/logger/tsconfig.json index a9539c625..d4b68b3ee 100644 --- a/packages/logger/tsconfig.json +++ b/packages/logger/tsconfig.json @@ -1,10 +1,14 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", - "outDir": "./build", - "allowSyntheticDefaultImports": true + "outDir": "./build" }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../logger-prettify" + } + ] } diff --git a/packages/middleware/package.json b/packages/middleware/package.json index 2d537d506..dcc3880a1 100644 --- a/packages/middleware/package.json +++ b/packages/middleware/package.json @@ -16,9 +16,9 @@ "homepage": "https://verdaccio.org", "scripts": { "clean": "rimraf ./build", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "dependencies": { diff --git a/packages/middleware/tsconfig.build.json b/packages/middleware/tsconfig.build.json new file mode 100644 index 000000000..fcc453bfe --- /dev/null +++ b/packages/middleware/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/middleware/tsconfig.json b/packages/middleware/tsconfig.json index 2be65b934..41d71fa18 100644 --- a/packages/middleware/tsconfig.json +++ b/packages/middleware/tsconfig.json @@ -1,9 +1,23 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*", "types/*.d.ts"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../core/commons-api" + }, + { + "path": "../commons" + }, + { + "path": "../logger" + }, + { + "path": "../utils" + } + ] } diff --git a/packages/mock/package.json b/packages/mock/package.json index 97349e10a..e5cffb6fd 100644 --- a/packages/mock/package.json +++ b/packages/mock/package.json @@ -17,9 +17,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "dependencies": { diff --git a/packages/mock/tsconfig.build.json b/packages/mock/tsconfig.build.json new file mode 100644 index 000000000..4871b1e50 --- /dev/null +++ b/packages/mock/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/mock/tsconfig.json b/packages/mock/tsconfig.json index 6531bd3e4..d5f1419d6 100644 --- a/packages/mock/tsconfig.json +++ b/packages/mock/tsconfig.json @@ -1,9 +1,17 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../commons" + }, + { + "path": "../utils" + } + ] } diff --git a/packages/node-api/package.json b/packages/node-api/package.json index aab62edb9..9686847fc 100644 --- a/packages/node-api/package.json +++ b/packages/node-api/package.json @@ -15,9 +15,9 @@ "homepage": "https://verdaccio.org", "scripts": { "clean": "rimraf ./build", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest" }, @@ -36,6 +36,5 @@ }, "publishConfig": { "access": "public" - }, - "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" + } } diff --git a/packages/node-api/tsconfig.build.json b/packages/node-api/tsconfig.build.json new file mode 100644 index 000000000..fcc453bfe --- /dev/null +++ b/packages/node-api/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/node-api/tsconfig.json b/packages/node-api/tsconfig.json index 6531bd3e4..eadda02f4 100644 --- a/packages/node-api/tsconfig.json +++ b/packages/node-api/tsconfig.json @@ -1,9 +1,26 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../commons" + }, + { + "path": "../logger" + }, + { + "path": "../server" + }, + { + "path": "../mock" + }, + { + "path": "../utils" + } + ] } diff --git a/packages/proxy/package.json b/packages/proxy/package.json index 267edcde8..a79a703b7 100644 --- a/packages/proxy/package.json +++ b/packages/proxy/package.json @@ -17,9 +17,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "dependencies": { diff --git a/packages/proxy/tsconfig.build.json b/packages/proxy/tsconfig.build.json new file mode 100644 index 000000000..fcc453bfe --- /dev/null +++ b/packages/proxy/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/proxy/tsconfig.json b/packages/proxy/tsconfig.json index 6531bd3e4..7ebe04fc9 100644 --- a/packages/proxy/tsconfig.json +++ b/packages/proxy/tsconfig.json @@ -1,9 +1,26 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*", "types/*.d.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../core/local-storage" + }, + { + "path": "../core/streams" + }, + { + "path": "../commons" + }, + { + "path": "../logger" + }, + { + "path": "../utils" + } + ] } diff --git a/packages/server/package.json b/packages/server/package.json index 79ebe063d..eeae1f26b 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@verdaccio/server", "version": "5.0.0-alpha.0", - "description": "verdaccio server logic", + "description": "server logic", "main": "./build/index.js", "types": "build/index.d.ts", "author": { @@ -42,10 +42,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" - }, - "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" + } } diff --git a/packages/server/tsconfig.build.json b/packages/server/tsconfig.build.json new file mode 100644 index 000000000..6e5370e90 --- /dev/null +++ b/packages/server/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts", "types/*.d.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/server/tsconfig.json b/packages/server/tsconfig.json index 0cedf65b8..9f462d146 100644 --- a/packages/server/tsconfig.json +++ b/packages/server/tsconfig.json @@ -1,10 +1,50 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", - "outDir": "./build", - "allowSyntheticDefaultImports": true + "outDir": "./build" }, "include": ["src/**/*", "types/*.d.ts"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../api" + }, + { + "path": "../auth" + }, + { + "path": "../config" + }, + { + "path": "../commons" + }, + { + "path": "../loaders" + }, + { + "path": "../logger" + }, + { + "path": "../middleware" + }, + { + "path": "../store" + }, + { + "path": "../utils" + }, + { + "path": "../web" + }, + { + "path": "../core/commons-api" + }, + { + "path": "../proxy" + }, + { + "path": "../mock" + } + ] } diff --git a/packages/store/package.json b/packages/store/package.json index 15a944ec1..d419ca3f3 100644 --- a/packages/store/package.json +++ b/packages/store/package.json @@ -17,9 +17,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "dependencies": { @@ -42,6 +42,5 @@ "@verdaccio/dev-types": "workspace:5.0.0-alpha.0", "@verdaccio/mock": "workspace:5.0.0-alpha.0", "@verdaccio/types": "workspace:*" - }, - "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" + } } diff --git a/packages/store/tsconfig.build.json b/packages/store/tsconfig.build.json new file mode 100644 index 000000000..fcc453bfe --- /dev/null +++ b/packages/store/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/store/tsconfig.json b/packages/store/tsconfig.json index 6531bd3e4..6176db087 100644 --- a/packages/store/tsconfig.json +++ b/packages/store/tsconfig.json @@ -1,9 +1,41 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../core/commons-api" + }, + { + "path": "../commons" + }, + { + "path": "../loaders" + }, + { + "path": "../core/local-storage" + }, + { + "path": "../logger" + }, + { + "path": "../proxy" + }, + { + "path": "../core/streams" + }, + { + "path": "../utils" + }, + { + "path": "../config" + }, + { + "path": "../mock" + } + ] } diff --git a/packages/utils/package.json b/packages/utils/package.json index 45824da2a..b9bf23596 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -32,10 +32,9 @@ "scripts": { "clean": "rimraf ./build", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "type-check": "tsc --noEmit", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" - }, - "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" + } } diff --git a/packages/utils/src/auth-utils.ts b/packages/utils/src/auth-utils.ts index 74adf189c..c6e40b721 100644 --- a/packages/utils/src/auth-utils.ts +++ b/packages/utils/src/auth-utils.ts @@ -1,7 +1,7 @@ import _ from 'lodash'; import { API_ERROR, ROLES, TIME_EXPIRATION_7D, DEFAULT_MIN_LIMIT_PASSWORD } from '@verdaccio/dev-commons'; -import { CookieSessionToken, AuthTokenHeader, BasicPayload } from '@verdaccio/dev-types'; +import { CookieSessionToken } from '@verdaccio/dev-types'; import { RemoteUser, AllowAccess, PackageAccess, Callback, Config, Security, APITokenOptions, JWTOptions, IPluginAuth } from '@verdaccio/types'; import { VerdaccioError } from '@verdaccio/commons-api'; diff --git a/packages/utils/tsconfig.build.json b/packages/utils/tsconfig.build.json new file mode 100644 index 000000000..46552d620 --- /dev/null +++ b/packages/utils/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/utils/tsconfig.json b/packages/utils/tsconfig.json index a9539c625..d66874fa2 100644 --- a/packages/utils/tsconfig.json +++ b/packages/utils/tsconfig.json @@ -1,10 +1,30 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build", - "allowSyntheticDefaultImports": true + "preserveSymlinks": true, + "composite": true, + "declaration": true, + "declarationMap": true }, - "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "include": ["src/**/*.ts"], + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../core/commons-api" + }, + { + "path": "../core/readme" + }, + { + "path": "../commons" + }, + { + "path": "../logger" + }, + { + "path": "../core/commons-api" + } + ] } diff --git a/packages/verdaccio/package.json b/packages/verdaccio/package.json index 3ae5c4159..a2a6ac714 100644 --- a/packages/verdaccio/package.json +++ b/packages/verdaccio/package.json @@ -19,11 +19,10 @@ "clean": "rimraf ./build", "lint": "eslint . --ext .js,.ts", "test": "cross-env NODE_ENV=test jest --config ./test/jest.config.functional.js --testPathPattern ./test/functional/index* --passWithNoTests", - "format": "prettier --single-quote --trailing-comma none --write \"{src,test}/**/*.ts\"", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types", - "code:build": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps inline", "code:docker-build": "cross-env BABEL_ENV=registry-docker babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\"", "build:docker": "docker build -t verdaccio/verdaccio:local . --no-cache" }, diff --git a/packages/verdaccio/src/index.ts b/packages/verdaccio/src/index.ts index 2968d5931..1e709e80d 100644 --- a/packages/verdaccio/src/index.ts +++ b/packages/verdaccio/src/index.ts @@ -1,3 +1,3 @@ // @verdaccio-cli is only accesible via .bin/ folder -export { default } from '@verdaccio/node-api'; +export { listenDefaultCallback, startVerdaccio } from '@verdaccio/node-api'; diff --git a/packages/verdaccio/tsconfig.build.json b/packages/verdaccio/tsconfig.build.json new file mode 100644 index 000000000..46552d620 --- /dev/null +++ b/packages/verdaccio/tsconfig.build.json @@ -0,0 +1,8 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts"] +} diff --git a/packages/verdaccio/tsconfig.json b/packages/verdaccio/tsconfig.json index 6531bd3e4..93dc17e57 100644 --- a/packages/verdaccio/tsconfig.json +++ b/packages/verdaccio/tsconfig.json @@ -1,9 +1,32 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../hooks" + }, + { + "path": "../utils" + }, + { + "path": "../mocks" + }, + { + "path": "../node-api" + }, + { + "path": "../cli" + }, + { + "path": "../core/htpasswd" + }, + { + "path": "../commons" + } + ] } diff --git a/packages/web/package.json b/packages/web/package.json index 65aed712f..b69e81464 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -25,10 +25,10 @@ }, "scripts": { "clean": "rimraf ./build", - "type-check": "tsc --noEmit", "test": "cross-env NODE_ENV=test BABEL_ENV=test jest", - "build:types": "tsc --emitDeclarationOnly --declaration true", - "build:js": "cross-env BABEL_ENV=registry babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", + "type-check": "tsc --noEmit -p tsconfig.build.json", + "build:types": "tsc --emitDeclarationOnly -p tsconfig.build.json", + "build:js": "babel src/ --out-dir build/ --copy-files --extensions \".ts,.tsx\" --source-maps", "build": "pnpm run build:js && pnpm run build:types" }, "gitHead": "7c246ede52ff717707fcae66dd63fc4abd536982" diff --git a/packages/web/tsconfig.build.json b/packages/web/tsconfig.build.json new file mode 100644 index 000000000..a4481aad2 --- /dev/null +++ b/packages/web/tsconfig.build.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "rootDir": "./src", + "outDir": "./build" + }, + "include": ["src/**/*.ts", "types/*.d.ts"], + "exclude": ["src/**/*.test.ts"] +} diff --git a/packages/web/tsconfig.json b/packages/web/tsconfig.json index 2be65b934..0c603e1e4 100644 --- a/packages/web/tsconfig.json +++ b/packages/web/tsconfig.json @@ -1,9 +1,32 @@ { - "extends": "../../tsconfig", + "extends": "../../tsconfig.reference.json", "compilerOptions": { "rootDir": "./src", "outDir": "./build" }, "include": ["src/**/*", "types/*.d.ts"], - "exclude": ["src/**/*.test.ts"] + "exclude": ["src/**/*.test.ts"], + "references": [ + { + "path": "../auth" + }, + { + "path": "../commons" + }, + { + "path": "../loaders" + }, + { + "path": "../logger" + }, + { + "path": "../middleware" + }, + { + "path": "../store" + }, + { + "path": "../utils" + } + ] } diff --git a/tsconfig.json b/tsconfig.base.json similarity index 94% rename from tsconfig.json rename to tsconfig.base.json index a5557bf46..e7d00b9d2 100644 --- a/tsconfig.json +++ b/tsconfig.base.json @@ -3,10 +3,9 @@ "compilerOptions": { "target": "esnext", "module": "commonjs", - "declaration": true, "noImplicitAny": false, - "incremental": false, "strict": true, + "declaration": true, "strictNullChecks": true, "resolveJsonModule": true, "allowSyntheticDefaultImports": true, diff --git a/tsconfig.reference.json b/tsconfig.reference.json new file mode 100644 index 000000000..fef24b3c5 --- /dev/null +++ b/tsconfig.reference.json @@ -0,0 +1,9 @@ +{ + "extends": "./tsconfig.base.json", + "compilerOptions": { + "preserveSymlinks": true, + "composite": true, + "incremental": true, + "declarationMap": true + } +}