diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-28 15:07:46 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-28 15:10:55 +0100 |
commit | 81d02aac56d76227c094d40b17b29875d88417f4 (patch) | |
tree | 3d99f59bb4edc18cf15b1f7843617ff942a3ef96 | |
parent | 10a72a7e617273cdbe897766f77f427eb57b689a (diff) | |
download | PeerTube-81d02aac56d76227c094d40b17b29875d88417f4.tar.gz PeerTube-81d02aac56d76227c094d40b17b29875d88417f4.tar.zst PeerTube-81d02aac56d76227c094d40b17b29875d88417f4.zip |
Fix types package dependencies
-rw-r--r-- | package.json | 3 | ||||
-rw-r--r-- | packages/types/generate-package.ts | 38 | ||||
-rw-r--r-- | server/tests/api/server/follow-constraints.ts | 2 | ||||
-rw-r--r-- | server/tests/api/server/follows.ts | 2 | ||||
-rw-r--r-- | server/tests/api/users/users.ts | 2 | ||||
-rw-r--r-- | yarn.lock | 7 |
6 files changed, 38 insertions, 16 deletions
diff --git a/package.json b/package.json index b41422343..b0df43ffa 100644 --- a/package.json +++ b/package.json | |||
@@ -211,6 +211,9 @@ | |||
211 | "ts-node": "10.4.0", | 211 | "ts-node": "10.4.0", |
212 | "typescript": "^4.0.5" | 212 | "typescript": "^4.0.5" |
213 | }, | 213 | }, |
214 | "resolutions": { | ||
215 | "depcheck/@babel/parser": "7.16.4" | ||
216 | }, | ||
214 | "bundlewatch": { | 217 | "bundlewatch": { |
215 | "files": [ | 218 | "files": [ |
216 | { | 219 | { |
diff --git a/packages/types/generate-package.ts b/packages/types/generate-package.ts index 853989d68..125259bb4 100644 --- a/packages/types/generate-package.ts +++ b/packages/types/generate-package.ts | |||
@@ -1,8 +1,8 @@ | |||
1 | import { execSync } from 'child_process' | 1 | import { execSync } from 'child_process' |
2 | import depcheck, { PackageDependencies } from 'depcheck' | 2 | import depcheck, { PackageDependencies } from 'depcheck' |
3 | import { copyFile, readJson, remove, writeFile, writeJSON } from 'fs-extra' | 3 | import { copyFile, readJson, remove, writeFile, writeJSON } from 'fs-extra' |
4 | import { resolve } from 'path' | 4 | import { join, resolve } from 'path' |
5 | import { cwd } from 'process' | 5 | import { root } from '../../shared/core-utils' |
6 | 6 | ||
7 | if (!process.argv[2]) { | 7 | if (!process.argv[2]) { |
8 | console.error('Need version as argument') | 8 | console.error('Need version as argument') |
@@ -20,14 +20,14 @@ run() | |||
20 | }) | 20 | }) |
21 | 21 | ||
22 | async function run () { | 22 | async function run () { |
23 | const typesPath = resolve(cwd(), './packages/types/') | 23 | const typesPath = __dirname |
24 | const typesDistPath = resolve(cwd(), typesPath, './dist/') | 24 | const typesDistPath = join(typesPath, 'dist') |
25 | const typesDistPackageJsonPath = resolve(typesDistPath, './package.json') | 25 | const typesDistPackageJsonPath = join(typesDistPath, 'package.json') |
26 | const typesDistGitIgnorePath = resolve(typesDistPath, './.gitignore') | 26 | const typesDistGitIgnorePath = join(typesDistPath, '.gitignore') |
27 | const mainPackageJson = await readJson(resolve(cwd(), './package.json')) | 27 | const mainPackageJson = await readJson(join(root(), 'package.json')) |
28 | const distTsConfigPath = resolve(cwd(), typesPath, './tsconfig.dist.json') | 28 | const distTsConfigPath = join(typesPath, 'tsconfig.dist.json') |
29 | const distTsConfig = await readJson(distTsConfigPath) | 29 | const distTsConfig = await readJson(distTsConfigPath) |
30 | const clientPackageJson = await readJson(resolve(cwd(), './client/package.json')) | 30 | const clientPackageJson = await readJson(join(root(), 'client', 'package.json')) |
31 | 31 | ||
32 | await remove(typesDistPath) | 32 | await remove(typesDistPath) |
33 | execSync('npm run tsc -- -b --verbose packages/types', { stdio: 'inherit' }) | 33 | execSync('npm run tsc -- -b --verbose packages/types', { stdio: 'inherit' }) |
@@ -35,8 +35,9 @@ async function run () { | |||
35 | 35 | ||
36 | const allDependencies = Object.assign( | 36 | const allDependencies = Object.assign( |
37 | mainPackageJson.dependencies, | 37 | mainPackageJson.dependencies, |
38 | mainPackageJson.devDepencies, | 38 | mainPackageJson.devDependencies, |
39 | clientPackageJson.dependencies | 39 | clientPackageJson.dependencies, |
40 | clientPackageJson.devDependencies | ||
40 | ) as PackageDependencies | 41 | ) as PackageDependencies |
41 | 42 | ||
42 | // https://github.com/depcheck/depcheck#api | 43 | // https://github.com/depcheck/depcheck#api |
@@ -50,7 +51,20 @@ async function run () { | |||
50 | package: { dependencies: allDependencies } | 51 | package: { dependencies: allDependencies } |
51 | } | 52 | } |
52 | 53 | ||
53 | const { dependencies: unusedDependencies } = await depcheck(resolve(typesPath), depcheckOptions) | 54 | const result = await depcheck(typesDistPath, depcheckOptions) |
55 | |||
56 | if (Object.keys(result.invalidDirs).length !== 0) { | ||
57 | console.error('Invalid directories detected.', { invalidDirs: result.invalidDirs }) | ||
58 | process.exit(-1) | ||
59 | } | ||
60 | |||
61 | if (Object.keys(result.invalidFiles).length !== 0) { | ||
62 | console.error('Invalid files detected.', { invalidFiles: result.invalidFiles }) | ||
63 | process.exit(-1) | ||
64 | } | ||
65 | |||
66 | const unusedDependencies = result.dependencies | ||
67 | |||
54 | console.log(`Removing ${Object.keys(unusedDependencies).length} unused dependencies.`) | 68 | console.log(`Removing ${Object.keys(unusedDependencies).length} unused dependencies.`) |
55 | const dependencies = Object | 69 | const dependencies = Object |
56 | .keys(allDependencies) | 70 | .keys(allDependencies) |
diff --git a/server/tests/api/server/follow-constraints.ts b/server/tests/api/server/follow-constraints.ts index 0f3c138ad..455fbc762 100644 --- a/server/tests/api/server/follow-constraints.ts +++ b/server/tests/api/server/follow-constraints.ts | |||
@@ -14,7 +14,7 @@ describe('Test follow constraints', function () { | |||
14 | let userToken: string | 14 | let userToken: string |
15 | 15 | ||
16 | before(async function () { | 16 | before(async function () { |
17 | this.timeout(90000) | 17 | this.timeout(240000) |
18 | 18 | ||
19 | servers = await createMultipleServers(2) | 19 | servers = await createMultipleServers(2) |
20 | 20 | ||
diff --git a/server/tests/api/server/follows.ts b/server/tests/api/server/follows.ts index cd34df15d..c588cf664 100644 --- a/server/tests/api/server/follows.ts +++ b/server/tests/api/server/follows.ts | |||
@@ -12,7 +12,7 @@ describe('Test follows', function () { | |||
12 | let servers: PeerTubeServer[] = [] | 12 | let servers: PeerTubeServer[] = [] |
13 | 13 | ||
14 | before(async function () { | 14 | before(async function () { |
15 | this.timeout(30000) | 15 | this.timeout(120000) |
16 | 16 | ||
17 | servers = await createMultipleServers(3) | 17 | servers = await createMultipleServers(3) |
18 | 18 | ||
diff --git a/server/tests/api/users/users.ts b/server/tests/api/users/users.ts index ff9172a82..7023b3f08 100644 --- a/server/tests/api/users/users.ts +++ b/server/tests/api/users/users.ts | |||
@@ -230,7 +230,7 @@ describe('Test users', function () { | |||
230 | }) | 230 | }) |
231 | 231 | ||
232 | it('Should have an expired access token', async function () { | 232 | it('Should have an expired access token', async function () { |
233 | this.timeout(15000) | 233 | this.timeout(60000) |
234 | 234 | ||
235 | await server.sql.setTokenField(server.accessToken, 'accessTokenExpiresAt', new Date().toISOString()) | 235 | await server.sql.setTokenField(server.accessToken, 'accessTokenExpiresAt', new Date().toISOString()) |
236 | await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) | 236 | await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString()) |
@@ -913,7 +913,12 @@ | |||
913 | chalk "^2.0.0" | 913 | chalk "^2.0.0" |
914 | js-tokens "^4.0.0" | 914 | js-tokens "^4.0.0" |
915 | 915 | ||
916 | "@babel/parser@^7.12.5", "@babel/parser@^7.16.0", "@babel/parser@^7.16.4", "@babel/parser@^7.16.5", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": | 916 | "@babel/parser@7.16.4", "@babel/parser@^7.12.5": |
917 | version "7.16.4" | ||
918 | resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.4.tgz#d5f92f57cf2c74ffe9b37981c0e72fee7311372e" | ||
919 | integrity sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng== | ||
920 | |||
921 | "@babel/parser@^7.16.0", "@babel/parser@^7.16.4", "@babel/parser@^7.16.5", "@babel/parser@^7.6.0", "@babel/parser@^7.9.6": | ||
917 | version "7.16.6" | 922 | version "7.16.6" |
918 | resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.6.tgz#8f194828193e8fa79166f34a4b4e52f3e769a314" | 923 | resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.6.tgz#8f194828193e8fa79166f34a4b4e52f3e769a314" |
919 | integrity sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ== | 924 | integrity sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ== |