1
0
Fork 0

Cleanup types dist before compilation

This commit is contained in:
Chocobozzz 2021-12-16 18:03:52 +01:00
parent 9d1b826b8a
commit 077f344891
No known key found for this signature in database
GPG key ID: 583A612D890159BE

View 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 { execSync } from 'child_process'
import depcheck, { PackageDependencies } from 'depcheck' import depcheck, { PackageDependencies } from 'depcheck'
import { copyFile, readJson, remove, writeFile, writeJSON } from 'fs-extra'
import { resolve } from 'path'
import { cwd } from 'process'
run() run()
.then(() => process.exit(0)) .then(() => process.exit(0))
@ -12,8 +12,6 @@ run()
}) })
async function run () { async function run () {
execSync('npm run tsc -- -b --verbose types', { stdio: 'inherit' })
const typesPath = resolve(cwd(), './types/') const typesPath = resolve(cwd(), './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')
@ -23,6 +21,9 @@ async function run () {
const distTsConfig = await readJson(distTsConfigPath) const distTsConfig = await readJson(distTsConfigPath)
const clientPackageJson = await readJson(resolve(cwd(), './client/package.json')) const clientPackageJson = await readJson(resolve(cwd(), './client/package.json'))
await remove(typesDistPath)
execSync('npm run tsc -- -b --verbose types', { stdio: 'inherit' })
const allDependencies = Object.assign( const allDependencies = Object.assign(
mainPackageJson.dependencies, mainPackageJson.dependencies,
mainPackageJson.devDepencies, mainPackageJson.devDepencies,