Fix types package dependencies
This commit is contained in:
parent
10a72a7e61
commit
81d02aac56
|
@ -211,6 +211,9 @@
|
||||||
"ts-node": "10.4.0",
|
"ts-node": "10.4.0",
|
||||||
"typescript": "^4.0.5"
|
"typescript": "^4.0.5"
|
||||||
},
|
},
|
||||||
|
"resolutions": {
|
||||||
|
"depcheck/@babel/parser": "7.16.4"
|
||||||
|
},
|
||||||
"bundlewatch": {
|
"bundlewatch": {
|
||||||
"files": [
|
"files": [
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { execSync } from 'child_process'
|
import { execSync } from 'child_process'
|
||||||
import depcheck, { PackageDependencies } from 'depcheck'
|
import depcheck, { PackageDependencies } from 'depcheck'
|
||||||
import { copyFile, readJson, remove, writeFile, writeJSON } from 'fs-extra'
|
import { copyFile, readJson, remove, writeFile, writeJSON } from 'fs-extra'
|
||||||
import { resolve } from 'path'
|
import { join, resolve } from 'path'
|
||||||
import { cwd } from 'process'
|
import { root } from '../../shared/core-utils'
|
||||||
|
|
||||||
if (!process.argv[2]) {
|
if (!process.argv[2]) {
|
||||||
console.error('Need version as argument')
|
console.error('Need version as argument')
|
||||||
|
@ -20,14 +20,14 @@ run()
|
||||||
})
|
})
|
||||||
|
|
||||||
async function run () {
|
async function run () {
|
||||||
const typesPath = resolve(cwd(), './packages/types/')
|
const typesPath = __dirname
|
||||||
const typesDistPath = resolve(cwd(), typesPath, './dist/')
|
const typesDistPath = join(typesPath, 'dist')
|
||||||
const typesDistPackageJsonPath = resolve(typesDistPath, './package.json')
|
const typesDistPackageJsonPath = join(typesDistPath, 'package.json')
|
||||||
const typesDistGitIgnorePath = resolve(typesDistPath, './.gitignore')
|
const typesDistGitIgnorePath = join(typesDistPath, '.gitignore')
|
||||||
const mainPackageJson = await readJson(resolve(cwd(), './package.json'))
|
const mainPackageJson = await readJson(join(root(), 'package.json'))
|
||||||
const distTsConfigPath = resolve(cwd(), typesPath, './tsconfig.dist.json')
|
const distTsConfigPath = join(typesPath, 'tsconfig.dist.json')
|
||||||
const distTsConfig = await readJson(distTsConfigPath)
|
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)
|
await remove(typesDistPath)
|
||||||
execSync('npm run tsc -- -b --verbose packages/types', { stdio: 'inherit' })
|
execSync('npm run tsc -- -b --verbose packages/types', { stdio: 'inherit' })
|
||||||
|
@ -35,8 +35,9 @@ async function run () {
|
||||||
|
|
||||||
const allDependencies = Object.assign(
|
const allDependencies = Object.assign(
|
||||||
mainPackageJson.dependencies,
|
mainPackageJson.dependencies,
|
||||||
mainPackageJson.devDepencies,
|
mainPackageJson.devDependencies,
|
||||||
clientPackageJson.dependencies
|
clientPackageJson.dependencies,
|
||||||
|
clientPackageJson.devDependencies
|
||||||
) as PackageDependencies
|
) as PackageDependencies
|
||||||
|
|
||||||
// https://github.com/depcheck/depcheck#api
|
// https://github.com/depcheck/depcheck#api
|
||||||
|
@ -50,7 +51,20 @@ async function run () {
|
||||||
package: { dependencies: allDependencies }
|
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.`)
|
console.log(`Removing ${Object.keys(unusedDependencies).length} unused dependencies.`)
|
||||||
const dependencies = Object
|
const dependencies = Object
|
||||||
.keys(allDependencies)
|
.keys(allDependencies)
|
||||||
|
|
|
@ -14,7 +14,7 @@ describe('Test follow constraints', function () {
|
||||||
let userToken: string
|
let userToken: string
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(90000)
|
this.timeout(240000)
|
||||||
|
|
||||||
servers = await createMultipleServers(2)
|
servers = await createMultipleServers(2)
|
||||||
|
|
||||||
|
|
|
@ -12,7 +12,7 @@ describe('Test follows', function () {
|
||||||
let servers: PeerTubeServer[] = []
|
let servers: PeerTubeServer[] = []
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
this.timeout(30000)
|
this.timeout(120000)
|
||||||
|
|
||||||
servers = await createMultipleServers(3)
|
servers = await createMultipleServers(3)
|
||||||
|
|
||||||
|
|
|
@ -230,7 +230,7 @@ describe('Test users', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('Should have an expired access token', async 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, 'accessTokenExpiresAt', new Date().toISOString())
|
||||||
await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())
|
await server.sql.setTokenField(server.accessToken, 'refreshTokenExpiresAt', new Date().toISOString())
|
||||||
|
|
|
@ -913,7 +913,12 @@
|
||||||
chalk "^2.0.0"
|
chalk "^2.0.0"
|
||||||
js-tokens "^4.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"
|
version "7.16.6"
|
||||||
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.6.tgz#8f194828193e8fa79166f34a4b4e52f3e769a314"
|
resolved "https://registry.yarnpkg.com/@babel/parser/-/parser-7.16.6.tgz#8f194828193e8fa79166f34a4b4e52f3e769a314"
|
||||||
integrity sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==
|
integrity sha512-Gr86ujcNuPDnNOY8mi383Hvi8IYrJVJYuf3XcuBM/Dgd+bINn/7tHqsj+tKkoreMbmGsFLsltI/JJd8fOFWGDQ==
|
||||||
|
|
Loading…
Reference in New Issue