Fix types package dependencies

pull/4696/head
Chocobozzz 2021-12-28 15:07:46 +01:00
parent 10a72a7e61
commit 81d02aac56
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
6 changed files with 38 additions and 16 deletions

View File

@ -211,6 +211,9 @@
"ts-node": "10.4.0",
"typescript": "^4.0.5"
},
"resolutions": {
"depcheck/@babel/parser": "7.16.4"
},
"bundlewatch": {
"files": [
{

View File

@ -1,8 +1,8 @@
import { execSync } from 'child_process'
import depcheck, { PackageDependencies } from 'depcheck'
import { copyFile, readJson, remove, writeFile, writeJSON } from 'fs-extra'
import { resolve } from 'path'
import { cwd } from 'process'
import { join, resolve } from 'path'
import { root } from '../../shared/core-utils'
if (!process.argv[2]) {
console.error('Need version as argument')
@ -20,14 +20,14 @@ run()
})
async function run () {
const typesPath = resolve(cwd(), './packages/types/')
const typesDistPath = resolve(cwd(), typesPath, './dist/')
const typesDistPackageJsonPath = resolve(typesDistPath, './package.json')
const typesDistGitIgnorePath = resolve(typesDistPath, './.gitignore')
const mainPackageJson = await readJson(resolve(cwd(), './package.json'))
const distTsConfigPath = resolve(cwd(), typesPath, './tsconfig.dist.json')
const typesPath = __dirname
const typesDistPath = join(typesPath, 'dist')
const typesDistPackageJsonPath = join(typesDistPath, 'package.json')
const typesDistGitIgnorePath = join(typesDistPath, '.gitignore')
const mainPackageJson = await readJson(join(root(), 'package.json'))
const distTsConfigPath = join(typesPath, 'tsconfig.dist.json')
const distTsConfig = await readJson(distTsConfigPath)
const clientPackageJson = await readJson(resolve(cwd(), './client/package.json'))
const clientPackageJson = await readJson(join(root(), 'client', 'package.json'))
await remove(typesDistPath)
execSync('npm run tsc -- -b --verbose packages/types', { stdio: 'inherit' })
@ -35,8 +35,9 @@ async function run () {
const allDependencies = Object.assign(
mainPackageJson.dependencies,
mainPackageJson.devDepencies,
clientPackageJson.dependencies
mainPackageJson.devDependencies,
clientPackageJson.dependencies,
clientPackageJson.devDependencies
) as PackageDependencies
// https://github.com/depcheck/depcheck#api
@ -50,7 +51,20 @@ async function run () {
package: { dependencies: allDependencies }
}
const { dependencies: unusedDependencies } = await depcheck(resolve(typesPath), depcheckOptions)
const result = await depcheck(typesDistPath, depcheckOptions)
if (Object.keys(result.invalidDirs).length !== 0) {
console.error('Invalid directories detected.', { invalidDirs: result.invalidDirs })
process.exit(-1)
}
if (Object.keys(result.invalidFiles).length !== 0) {
console.error('Invalid files detected.', { invalidFiles: result.invalidFiles })
process.exit(-1)
}
const unusedDependencies = result.dependencies
console.log(`Removing ${Object.keys(unusedDependencies).length} unused dependencies.`)
const dependencies = Object
.keys(allDependencies)

View File

@ -14,7 +14,7 @@ describe('Test follow constraints', function () {
let userToken: string
before(async function () {
this.timeout(90000)
this.timeout(240000)
servers = await createMultipleServers(2)

View File

@ -12,7 +12,7 @@ describe('Test follows', function () {
let servers: PeerTubeServer[] = []
before(async function () {
this.timeout(30000)
this.timeout(120000)
servers = await createMultipleServers(3)

View File

@ -230,7 +230,7 @@ describe('Test users', function () {
})
it('Should have an expired access token', async function () {
this.timeout(15000)
this.timeout(60000)
await server.sql.setTokenField(server.accessToken, 'accessTokenExpiresAt', new Date().toISOString())
await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())

View File

@ -913,7 +913,12 @@
chalk "^2.0.0"
js-tokens "^4.0.0"
"@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":
"@babel/parser@7.16.4", "@babel/parser@^7.12.5":
version "7.16.4"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.4.tgz#d5f92f57cf2c74ffe9b37981c0e72fee7311372e"
integrity sha512-6V0qdPUaiVHH3RtZeLIsc+6pDhbYzHR8ogA8w+f+Wc77DuXto19g2QUwveINoS34Uw+W8/hQDGJCx+i4n7xcng==
"@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":
version "7.16.6"
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.6.tgz#8f194828193e8fa79166f34a4b4e52f3e769a314"
integrity sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==