From 6627dbc957477aa32e21ed1bdc8cd72b928cd616 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Dec 2021 10:18:15 +0100 Subject: [PATCH] Move types package in packages/ --- .github/workflows/test.yml | 2 +- .gitignore | 4 +++- client/tsconfig.types.json | 4 ++-- package.json | 2 +- {types => packages/types}/README.md | 0 {types => packages/types}/generate-package.ts | 6 +++--- {types => packages/types}/src/client/index.ts | 0 {types => packages/types}/src/client/tsconfig.json | 4 ++-- {types => packages/types}/src/index.ts | 0 {types => packages/types}/tests/test.ts | 0 {types => packages/types}/tsconfig.dist.json | 0 {types => packages/types}/tsconfig.json | 12 ++++++------ scripts/ci.sh | 4 ++-- server/tsconfig.types.json | 2 +- shared/tsconfig.types.json | 2 +- 15 files changed, 22 insertions(+), 20 deletions(-) rename {types => packages/types}/README.md (100%) rename {types => packages/types}/generate-package.ts (94%) rename {types => packages/types}/src/client/index.ts (100%) rename {types => packages/types}/src/client/tsconfig.json (73%) rename {types => packages/types}/src/index.ts (100%) rename {types => packages/types}/tests/test.ts (100%) rename {types => packages/types}/tsconfig.dist.json (100%) rename {types => packages/types}/tsconfig.json (57%) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a59d13d7..8ba2c549d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -39,7 +39,7 @@ jobs: strategy: fail-fast: false matrix: - test_suite: [ types, client, api-1, api-2, api-3, api-4, cli-plugin, lint, external-plugins ] + test_suite: [ types-package, client, api-1, api-2, api-3, api-4, cli-plugin, lint, external-plugins ] env: PGUSER: peertube diff --git a/.gitignore b/.gitignore index 0ec17217d..5e06248f1 100644 --- a/.gitignore +++ b/.gitignore @@ -53,4 +53,6 @@ yarn-error.log # TypeScript *.tsbuildinfo -/types/dist/ + +# Packages +/packages/types/dist/ diff --git a/client/tsconfig.types.json b/client/tsconfig.types.json index c6ed64100..99d96d413 100644 --- a/client/tsconfig.types.json +++ b/client/tsconfig.types.json @@ -4,11 +4,11 @@ "stripInternal": true, "removeComments": false, "declaration": true, - "outDir": "../types/dist/client/", + "outDir": "../packages/types/dist/client/", "emitDeclarationOnly": true, "composite": true, "rootDir": "src/", - "tsBuildInfoFile": "../types/dist/tsconfig.client.tsbuildinfo" + "tsBuildInfoFile": "../packages/types/dist/tsconfig.client.tsbuildinfo" }, "references": [ { "path": "../shared/tsconfig.types.json" } diff --git a/package.json b/package.json index c7d00ec15..b41422343 100644 --- a/package.json +++ b/package.json @@ -52,7 +52,7 @@ "test": "bash ./scripts/test.sh", "help": "bash ./scripts/help.sh", "generate-cli-doc": "bash ./scripts/generate-cli-doc.sh", - "generate-types-package": "ts-node ./types/generate-package.ts", + "generate-types-package": "ts-node ./packages/types/generate-package.ts", "parse-log": "node ./dist/scripts/parse-log.js", "prune-storage": "node ./dist/scripts/prune-storage.js", "postinstall": "test -n \"$NOCLIENT\" || (cd client && yarn install --pure-lockfile)", diff --git a/types/README.md b/packages/types/README.md similarity index 100% rename from types/README.md rename to packages/types/README.md diff --git a/types/generate-package.ts b/packages/types/generate-package.ts similarity index 94% rename from types/generate-package.ts rename to packages/types/generate-package.ts index ae061f9b0..0c14514e7 100644 --- a/types/generate-package.ts +++ b/packages/types/generate-package.ts @@ -12,7 +12,7 @@ run() }) async function run () { - const typesPath = resolve(cwd(), './types/') + const typesPath = resolve(cwd(), './packages/types/') const typesDistPath = resolve(cwd(), typesPath, './dist/') const typesDistPackageJsonPath = resolve(typesDistPath, './package.json') const typesDistGitIgnorePath = resolve(typesDistPath, './.gitignore') @@ -22,7 +22,7 @@ async function run () { const clientPackageJson = await readJson(resolve(cwd(), './client/package.json')) await remove(typesDistPath) - execSync('npm run tsc -- -b --verbose types', { stdio: 'inherit' }) + execSync('npm run tsc -- -b --verbose packages/types', { stdio: 'inherit' }) execSync(`npm run resolve-tspaths -- --project ${distTsConfigPath} --src ${typesDistPath} --out ${typesDistPath}`, { stdio: 'inherit' }) const allDependencies = Object.assign( @@ -42,7 +42,7 @@ async function run () { package: { dependencies: allDependencies } } - const { dependencies: unusedDependencies } = await depcheck(resolve(cwd(), './types/'), depcheckOptions) + const { dependencies: unusedDependencies } = await depcheck(resolve(typesPath), depcheckOptions) console.log(`Removing ${Object.keys(unusedDependencies).length} unused dependencies.`) const dependencies = Object .keys(allDependencies) diff --git a/types/src/client/index.ts b/packages/types/src/client/index.ts similarity index 100% rename from types/src/client/index.ts rename to packages/types/src/client/index.ts diff --git a/types/src/client/tsconfig.json b/packages/types/src/client/tsconfig.json similarity index 73% rename from types/src/client/tsconfig.json rename to packages/types/src/client/tsconfig.json index dea4c131c..bb76fbe21 100644 --- a/types/src/client/tsconfig.json +++ b/packages/types/src/client/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../../../tsconfig.base.json", + "extends": "../../../../tsconfig.base.json", "compilerOptions": { "stripInternal": true, "removeComments": false, @@ -9,7 +9,7 @@ "tsBuildInfoFile": "../../dist/tsconfig.client.types.tsbuildinfo" }, "references": [ - { "path": "../../../client/tsconfig.types.json" } + { "path": "../../../../client/tsconfig.types.json" } ], "files": ["index.ts"] } diff --git a/types/src/index.ts b/packages/types/src/index.ts similarity index 100% rename from types/src/index.ts rename to packages/types/src/index.ts diff --git a/types/tests/test.ts b/packages/types/tests/test.ts similarity index 100% rename from types/tests/test.ts rename to packages/types/tests/test.ts diff --git a/types/tsconfig.dist.json b/packages/types/tsconfig.dist.json similarity index 100% rename from types/tsconfig.dist.json rename to packages/types/tsconfig.dist.json diff --git a/types/tsconfig.json b/packages/types/tsconfig.json similarity index 57% rename from types/tsconfig.json rename to packages/types/tsconfig.json index 514683886..f8e16f6b4 100644 --- a/types/tsconfig.json +++ b/packages/types/tsconfig.json @@ -1,5 +1,5 @@ { - "extends": "../tsconfig.base.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "stripInternal": true, "removeComments": false, @@ -9,14 +9,14 @@ "rootDir": "./src/", "tsBuildInfoFile": "./dist/tsconfig.server.types.tsbuildinfo", "paths": { - "@server/*": [ "../../server/*" ], - "@shared/*": [ "../../shared/*" ], - "@client/*": [ "../../client/src/*" ] + "@server/*": [ "../../../server/*" ], + "@shared/*": [ "../../../shared/*" ], + "@client/*": [ "../../../client/src/*" ] } }, "references": [ - { "path": "../shared/tsconfig.types.json" }, - { "path": "../server/tsconfig.types.json" }, + { "path": "../../shared/tsconfig.types.json" }, + { "path": "../../server/tsconfig.types.json" }, { "path": "./src/client/tsconfig.json" } ], "files": ["./src/index.ts"] diff --git a/scripts/ci.sh b/scripts/ci.sh index 070a104cc..5b757d94b 100755 --- a/scripts/ci.sh +++ b/scripts/ci.sh @@ -40,9 +40,9 @@ findTestFiles () { find $1 -type f -name "*.js" $exception | xargs echo } -if [ "$1" = "types" ]; then +if [ "$1" = "types-package" ]; then npm run generate-types-package - npm run tsc -- --noEmit --esModuleInterop types/tests/test.ts + npm run tsc -- --noEmit --esModuleInterop packages/types/tests/test.ts elif [ "$1" = "client" ]; then npm run build diff --git a/server/tsconfig.types.json b/server/tsconfig.types.json index 824834066..da6b572ea 100644 --- a/server/tsconfig.types.json +++ b/server/tsconfig.types.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../types/dist/server", + "outDir": "../packages/types/dist/server", "stripInternal": true, "removeComments": false, "emitDeclarationOnly": true diff --git a/shared/tsconfig.types.json b/shared/tsconfig.types.json index 73c1cae6c..6acfc05e1 100644 --- a/shared/tsconfig.types.json +++ b/shared/tsconfig.types.json @@ -1,7 +1,7 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "outDir": "../types/dist/shared", + "outDir": "../packages/types/dist/shared", "stripInternal": true, "removeComments": false, "emitDeclarationOnly": true -- 2.41.0