mirror of
https://github.com/transloadit/uppy.git
synced 2026-07-17 16:50:22 +00:00
meta: fix TS integration (#4741)
This commit is contained in:
parent
ab0c656536
commit
222b427ec3
2 changed files with 22 additions and 3 deletions
17
.github/workflows/ci.yml
vendored
17
.github/workflows/ci.yml
vendored
|
|
@ -103,5 +103,22 @@ jobs:
|
|||
corepack yarn run build:locale-pack
|
||||
- name: Run type tests
|
||||
run: corepack yarn run test:type
|
||||
- name: Drop manual tyoes
|
||||
# For backward compatiblity reasons, Uppy plugins ship a manual crafted d.ts file.
|
||||
# We don't want to remove that file to not break users.
|
||||
# However, we want to validate the types based on the types inferred from source.
|
||||
run: |
|
||||
node --input-type=module <<'EOF'
|
||||
import { existsSync } from 'node:fs';
|
||||
import { opendir, readFile, writeFile } from 'node:fs/promises';
|
||||
for await (const dirent of await opendir('./packages/@uppy')) {
|
||||
if (existsSync(`./packages/@uppy/${dirent.name}/tsconfig.build.json`)) {
|
||||
const pjsonPath = `./packages/@uppy/${dirent.name}/package.json`
|
||||
const pjson = JSON.parse(await readFile(pjsonPath));
|
||||
delete pjson.types
|
||||
await writeFile(pjsonPath, JSON.stringify(pjson))
|
||||
}
|
||||
}
|
||||
EOF
|
||||
- name: Attempt building TS packages
|
||||
run: corepack yarn run build:ts
|
||||
|
|
|
|||
|
|
@ -28,12 +28,14 @@ if (packageJSON.type !== 'module') {
|
|||
|
||||
const references = Object.keys(packageJSON.dependencies || {})
|
||||
.concat(Object.keys(packageJSON.peerDependencies || {}))
|
||||
.concat(Object.keys(packageJSON.devDependencies || {}))
|
||||
.filter((pkg) => pkg.startsWith('@uppy/'))
|
||||
.map((pkg) => ({ path: `../${pkg.slice('@uppy/'.length)}` }))
|
||||
.map((pkg) => ({
|
||||
path: `../${pkg.slice('@uppy/'.length)}/tsconfig.build.json`,
|
||||
}))
|
||||
|
||||
const depsNotYetConvertedToTS = references.filter(
|
||||
(ref) =>
|
||||
!existsSync(new URL(`${ref.path}/tsconfig.json`, packageRoot)),
|
||||
(ref) => !existsSync(new URL(ref.path, packageRoot)),
|
||||
)
|
||||
|
||||
if (depsNotYetConvertedToTS.length) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue