1
0
Fork 0

Move types package in packages/

This commit is contained in:
Chocobozzz 2021-12-28 10:18:15 +01:00
parent 52b356cfe2
commit 6627dbc957
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
15 changed files with 22 additions and 20 deletions

View File

@ -39,7 +39,7 @@ jobs:
strategy: strategy:
fail-fast: false fail-fast: false
matrix: 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: env:
PGUSER: peertube PGUSER: peertube

4
.gitignore vendored
View File

@ -53,4 +53,6 @@ yarn-error.log
# TypeScript # TypeScript
*.tsbuildinfo *.tsbuildinfo
/types/dist/
# Packages
/packages/types/dist/

View File

@ -4,11 +4,11 @@
"stripInternal": true, "stripInternal": true,
"removeComments": false, "removeComments": false,
"declaration": true, "declaration": true,
"outDir": "../types/dist/client/", "outDir": "../packages/types/dist/client/",
"emitDeclarationOnly": true, "emitDeclarationOnly": true,
"composite": true, "composite": true,
"rootDir": "src/", "rootDir": "src/",
"tsBuildInfoFile": "../types/dist/tsconfig.client.tsbuildinfo" "tsBuildInfoFile": "../packages/types/dist/tsconfig.client.tsbuildinfo"
}, },
"references": [ "references": [
{ "path": "../shared/tsconfig.types.json" } { "path": "../shared/tsconfig.types.json" }

View File

@ -52,7 +52,7 @@
"test": "bash ./scripts/test.sh", "test": "bash ./scripts/test.sh",
"help": "bash ./scripts/help.sh", "help": "bash ./scripts/help.sh",
"generate-cli-doc": "bash ./scripts/generate-cli-doc.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", "parse-log": "node ./dist/scripts/parse-log.js",
"prune-storage": "node ./dist/scripts/prune-storage.js", "prune-storage": "node ./dist/scripts/prune-storage.js",
"postinstall": "test -n \"$NOCLIENT\" || (cd client && yarn install --pure-lockfile)", "postinstall": "test -n \"$NOCLIENT\" || (cd client && yarn install --pure-lockfile)",

View File

@ -12,7 +12,7 @@ run()
}) })
async function run () { async function run () {
const typesPath = resolve(cwd(), './types/') const typesPath = resolve(cwd(), './packages/types/')
const typesDistPath = resolve(cwd(), typesPath, './dist/') const typesDistPath = resolve(cwd(), typesPath, './dist/')
const typesDistPackageJsonPath = resolve(typesDistPath, './package.json') const typesDistPackageJsonPath = resolve(typesDistPath, './package.json')
const typesDistGitIgnorePath = resolve(typesDistPath, './.gitignore') const typesDistGitIgnorePath = resolve(typesDistPath, './.gitignore')
@ -22,7 +22,7 @@ async function run () {
const clientPackageJson = await readJson(resolve(cwd(), './client/package.json')) const clientPackageJson = await readJson(resolve(cwd(), './client/package.json'))
await remove(typesDistPath) 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' }) execSync(`npm run resolve-tspaths -- --project ${distTsConfigPath} --src ${typesDistPath} --out ${typesDistPath}`, { stdio: 'inherit' })
const allDependencies = Object.assign( const allDependencies = Object.assign(
@ -42,7 +42,7 @@ async function run () {
package: { dependencies: allDependencies } 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.`) console.log(`Removing ${Object.keys(unusedDependencies).length} unused dependencies.`)
const dependencies = Object const dependencies = Object
.keys(allDependencies) .keys(allDependencies)

View File

@ -1,5 +1,5 @@
{ {
"extends": "../../../tsconfig.base.json", "extends": "../../../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"stripInternal": true, "stripInternal": true,
"removeComments": false, "removeComments": false,
@ -9,7 +9,7 @@
"tsBuildInfoFile": "../../dist/tsconfig.client.types.tsbuildinfo" "tsBuildInfoFile": "../../dist/tsconfig.client.types.tsbuildinfo"
}, },
"references": [ "references": [
{ "path": "../../../client/tsconfig.types.json" } { "path": "../../../../client/tsconfig.types.json" }
], ],
"files": ["index.ts"] "files": ["index.ts"]
} }

View File

@ -1,5 +1,5 @@
{ {
"extends": "../tsconfig.base.json", "extends": "../../tsconfig.base.json",
"compilerOptions": { "compilerOptions": {
"stripInternal": true, "stripInternal": true,
"removeComments": false, "removeComments": false,
@ -9,14 +9,14 @@
"rootDir": "./src/", "rootDir": "./src/",
"tsBuildInfoFile": "./dist/tsconfig.server.types.tsbuildinfo", "tsBuildInfoFile": "./dist/tsconfig.server.types.tsbuildinfo",
"paths": { "paths": {
"@server/*": [ "../../server/*" ], "@server/*": [ "../../../server/*" ],
"@shared/*": [ "../../shared/*" ], "@shared/*": [ "../../../shared/*" ],
"@client/*": [ "../../client/src/*" ] "@client/*": [ "../../../client/src/*" ]
} }
}, },
"references": [ "references": [
{ "path": "../shared/tsconfig.types.json" }, { "path": "../../shared/tsconfig.types.json" },
{ "path": "../server/tsconfig.types.json" }, { "path": "../../server/tsconfig.types.json" },
{ "path": "./src/client/tsconfig.json" } { "path": "./src/client/tsconfig.json" }
], ],
"files": ["./src/index.ts"] "files": ["./src/index.ts"]

View File

@ -40,9 +40,9 @@ findTestFiles () {
find $1 -type f -name "*.js" $exception | xargs echo 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 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 elif [ "$1" = "client" ]; then
npm run build npm run build

View File

@ -1,7 +1,7 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../types/dist/server", "outDir": "../packages/types/dist/server",
"stripInternal": true, "stripInternal": true,
"removeComments": false, "removeComments": false,
"emitDeclarationOnly": true "emitDeclarationOnly": true

View File

@ -1,7 +1,7 @@
{ {
"extends": "./tsconfig.json", "extends": "./tsconfig.json",
"compilerOptions": { "compilerOptions": {
"outDir": "../types/dist/shared", "outDir": "../packages/types/dist/shared",
"stripInternal": true, "stripInternal": true,
"removeComments": false, "removeComments": false,
"emitDeclarationOnly": true "emitDeclarationOnly": true