]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - types/generate-package.ts
Translated using Weblate (Chinese (Simplified))
[github/Chocobozzz/PeerTube.git] / types / generate-package.ts
index e0bdd721ab73b3e8e942210798129414faaf45a5..ae061f9b0f930536596927113d0ddaebc3aa8ad9 100644 (file)
@@ -1,8 +1,8 @@
-import { copyFile, readJson, writeFile, writeJSON } from 'fs-extra'
-import { resolve } from 'path'
-import { cwd } from 'process'
 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'
 
 run()
   .then(() => process.exit(0))
@@ -12,7 +12,6 @@ run()
   })
 
 async function run () {
-  execSync('npm run build:types', { stdio: 'inherit' })
   const typesPath = resolve(cwd(), './types/')
   const typesDistPath = resolve(cwd(), typesPath, './dist/')
   const typesDistPackageJsonPath = resolve(typesDistPath, './package.json')
@@ -22,6 +21,10 @@ async function run () {
   const distTsConfig = await readJson(distTsConfigPath)
   const clientPackageJson = await readJson(resolve(cwd(), './client/package.json'))
 
+  await remove(typesDistPath)
+  execSync('npm run tsc -- -b --verbose types', { stdio: 'inherit' })
+  execSync(`npm run resolve-tspaths -- --project ${distTsConfigPath} --src ${typesDistPath} --out ${typesDistPath}`, { stdio: 'inherit' })
+
   const allDependencies = Object.assign(
     mainPackageJson.dependencies,
     mainPackageJson.devDepencies,
@@ -67,9 +70,5 @@ async function run () {
   console.log(`Writing git ignore to ${typesDistGitIgnorePath}`)
   await writeFile(typesDistGitIgnorePath, '*.tsbuildinfo')
 
-  console.log('Copying tsconfig files')
-  await copyFile(distTsConfigPath, resolve(typesDistPath, './tsconfig.json'))
-  await copyFile(resolve(cwd(), './tsconfig.base.json'), resolve(typesDistPath, './tsconfig.base.json'))
-
   await copyFile(resolve(typesPath, './README.md'), resolve(typesDistPath, './README.md'))
 }