Skip to content

Commit 002890a

Browse files
authored
Multi-package setup: types/zod + legacy wrapper (#277)
* Add multi-package proposal and fingerprint script * Update proposal for zod3 and types strategy * Refine proposal for zod versioning and type generation * Add type generation scaffold and equality check * chore: monorepo structure and fingerprinting * chore: align types version with node and transloadit * chore: add changeset for monorepo alignment * chore: version packages with changesets * docs: add cross-repo schema validation todo * docs: mark cross-repo schema validation complete * chore: sync transloadit wrapper packaging * fix: align codecov path and schema exports * fix: pack job and types exports * refactor: unify pack flow and exports * docs: add dual zod v3/v4 generation plan * chore(zod): add v4 sync and parity checks * docs: rename plan and harden zod fixtures * test: guard zod export parity * test: add assembly status parity fixtures * chore: slim transloadit pack output * docs: note legacy transloadit packaging * fix: stabilize e2e tooling paths * chore: expand yarn check scope * fix: harden zod scripts and tooling * fix: normalize type export paths * fix: guard zod sync patching * docs(ci): note Node 24 requirement for root tests * chore: update tooling requirements and parity checks * chore: apply yarn check formatting * fix: restore biome and sync before zod tests * chore: update yarn.lock * Fix Biome lint after yarn install * Consolidate toolchain devDependencies * Run knip from yarn check * Run knip across workspaces * Add root knip dep scripts * Run knip deps check in CI * Add CI checks for parity and zod types * Refine verify scripts and CI wiring * Fix CI types build and CLI bin naming * Sync zod sources before typecheck * Release patch versions * Align transloadit bin entry
1 parent c2aed9c commit 002890a

200 files changed

Lines changed: 10447 additions & 232 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.ai/AGENTS.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This document serves as a quick reference for agentic coding assistants working
44

55
## Check your work
66

7-
After making changes, always run `corepack yarn check`, this lints with typescript, formats code,
8-
and runs quick unit tests. Remember that this formats code and may make changes, that you are to
9-
commit if you were working on those files.
7+
After making changes, always run `corepack yarn check`, which runs Knip (with fixes/removals),
8+
lints TypeScript, formats code, and runs quick unit tests. Remember that Knip and formatting may
9+
make changes that you must review and commit when you touched the affected files.
1010

1111
## When running in GitHub Actions
1212

.changeset/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Changesets
2+
3+
Run `yarn changeset` to add a release note for your change.

.changeset/config.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"$schema": "https://unpkg.com/@changesets/config@3.1.1/schema.json",
3+
"changelog": [
4+
"@changesets/cli/changelog",
5+
{
6+
"repo": "transloadit/node-sdk"
7+
}
8+
],
9+
"commit": false,
10+
"fixed": [["@transloadit/node", "transloadit", "@transloadit/types", "@transloadit/zod"]],
11+
"linked": [],
12+
"access": "public",
13+
"baseBranch": "main",
14+
"updateInternalDependencies": "patch",
15+
"ignore": []
16+
}

.github/workflows/ci.yml

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -21,44 +21,33 @@ jobs:
2121
with:
2222
node-version: 22
2323
- run: corepack yarn
24-
- run: corepack yarn pack
24+
- run: corepack yarn run pack
2525
- uses: actions/upload-artifact@v4
2626
with:
2727
name: package
2828
path: '*.tgz'
2929

30-
biome:
31-
name: Lint (Biome)
30+
verify:
31+
name: Verify (fast)
3232
runs-on: ubuntu-latest
3333
steps:
3434
- uses: actions/checkout@v4
3535
- uses: actions/setup-node@v4
3636
with:
37-
node-version: 22
38-
- run: corepack yarn
39-
- run: corepack yarn lint:js
40-
41-
knip:
42-
name: Knip
43-
runs-on: ubuntu-latest
44-
steps:
45-
- uses: actions/checkout@v4
46-
- uses: actions/setup-node@v4
47-
with:
48-
node-version: 22
37+
node-version: 24
4938
- run: corepack yarn
50-
- run: corepack yarn knip
39+
- run: corepack yarn verify
5140

52-
typescript:
53-
name: Lint (TypeScript)
41+
verify-full:
42+
name: Verify (full)
5443
runs-on: ubuntu-latest
5544
steps:
5645
- uses: actions/checkout@v4
5746
- uses: actions/setup-node@v4
5847
with:
59-
node-version: 22
48+
node-version: 24
6049
- run: corepack yarn
61-
- run: corepack yarn lint:ts
50+
- run: corepack yarn verify:full
6251

6352
unit:
6453
name: Unit tests (Node ${{ matrix.node }})
@@ -75,13 +64,18 @@ jobs:
7564
with:
7665
node-version: ${{ matrix.node }}
7766
- run: corepack yarn
67+
# Root unit tests execute TypeScript scripts via Node's strip-types support.
68+
# Keep those on Node 24+; Node 20/22 only run @transloadit/node unit tests.
7869
- run: corepack yarn test:unit
70+
if: matrix.node == 24
71+
- run: corepack yarn workspace @transloadit/node test:unit
72+
if: matrix.node != 24
7973
- name: Upload coverage reports artifact
8074
if: matrix.node == 24
8175
uses: actions/upload-artifact@v4
8276
with:
8377
name: coverage-reports
84-
path: coverage/
78+
path: packages/node/coverage/
8579

8680
e2e:
8781
name: E2E tests
@@ -111,14 +105,14 @@ jobs:
111105
TRANSLOADIT_KEY: ${{ secrets.TRANSLOADIT_KEY }}
112106
TRANSLOADIT_SECRET: ${{ secrets.TRANSLOADIT_SECRET }}
113107
NODE_OPTIONS: --trace-deprecation --trace-warnings
114-
CLOUDFLARED_PATH: ./cloudflared-linux-amd64
108+
CLOUDFLARED_PATH: ${{ github.workspace }}/cloudflared-linux-amd64
115109
DEBUG: 'transloadit:*'
116110

117111
- name: Generate the badge from the json-summary
118-
run: node --experimental-strip-types test/generate-coverage-badge.ts coverage/coverage-summary.json
112+
run: node --experimental-strip-types packages/node/test/generate-coverage-badge.ts packages/node/coverage/coverage-summary.json
119113
- name: Move HTML report and badge to the correct location
120114
run: |
121-
mv coverage/lcov-report static-build
115+
mv packages/node/coverage/lcov-report static-build
122116
mv coverage-badge.svg static-build/
123117
# *** BEGIN PUBLISH STATIC SITE STEPS ***
124118
# Use the standard checkout action to check out the destination repo to a separate directory
@@ -180,8 +174,8 @@ jobs:
180174
runs-on: ubuntu-latest
181175
needs:
182176
- pack
183-
- biome
184-
- typescript
177+
- verify
178+
- verify-full
185179
- unit
186180
if: startsWith(github.ref, 'refs/tags/')
187181
permissions:
@@ -191,11 +185,12 @@ jobs:
191185
- uses: softprops/action-gh-release@v1
192186
with:
193187
draft: true
188+
- uses: actions/checkout@v4
194189
- uses: actions/setup-node@v4
195190
with:
196191
node-version: 22
197192
registry-url: https://registry.npmjs.org
198-
- uses: actions/download-artifact@v4
199-
with: { name: package }
200-
- run: npm install -g npm@^11.5.1
201-
- run: npm publish *.tgz --provenance
193+
- run: corepack yarn
194+
- run: corepack yarn changeset publish
195+
env:
196+
NPM_CONFIG_PROVENANCE: "true"

.gitignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ sample.js
88
npm-debug.log
99
env.sh
1010
/coverage
11+
packages/node/coverage
1112

1213
.pnp.*
1314
.yarn/*
@@ -19,3 +20,10 @@ env.sh
1920
.aider*
2021
.DS_Store
2122
.env
23+
packages/types/src/generated
24+
packages/zod/src/v3
25+
packages/zod/src/v4
26+
packages/transloadit/src
27+
packages/transloadit/README.md
28+
packages/transloadit/CHANGELOG.md
29+
packages/transloadit/LICENSE

CONTRIBUTING.md

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ To check for updates, run:
2020
yarn upgrade-interactive
2121
```
2222

23+
## Tooling requirements
24+
25+
Local tooling (the TypeScript scripts in `scripts/` and package tests) requires Node 22.18+ so `node file.ts` works without flags. The published packages still support Node 20+ at runtime.
26+
2327
## Linting
2428

2529
This project is linted using Biome. You can lint the project by running:
@@ -79,19 +83,34 @@ Coverage reports are:
7983

8084
View the coverage report locally by opening `coverage/index.html` in your browser.
8185

82-
## Releasing
86+
## Packaging the legacy `transloadit` package
8387

84-
Only maintainers can make releases. Releases to [npm](https://www.npmjs.com) are automated using GitHub actions. To make a release, perform the following steps:
88+
The `packages/transloadit` folder is a generated legacy wrapper. The `src` directory and top-level `README.md`, `CHANGELOG.md`, and `LICENSE` are produced during packing by `scripts/prepare-transloadit.ts` and are not tracked in git. If you need to validate the legacy package contents, run:
8589

86-
1. Update `CHANGELOG.md` with a new entry describing the release. And `git add CHANGELOG.md && git commit -m "Update CHANGELOG.md"`.
87-
2. Update the version using npm. This will update the version in the `package.json` file and create a git tag. E.g.:
90+
```sh
91+
yarn pack
92+
```
8893

89-
- `npm version patch`
90-
- OR, for pre-releases: `npm version prerelease`
94+
## Releasing
9195

92-
3. Push the tag to GitHub: `git push origin main --tags`
93-
4. If the tests pass, GitHub actions will now publish the new version to npm.
96+
Only maintainers can make releases. Releases to [npm](https://www.npmjs.com) are automated using GitHub actions and Changesets (including the legacy `transloadit` package). To make a release, perform the following steps:
97+
98+
1. Create a changeset:
99+
- `yarn changeset`
100+
2. Version packages (updates `CHANGELOG.md` + workspace `package.json` files):
101+
- `yarn changeset version`
102+
- `git add -A && git commit -m "chore: version packages"`
103+
3. Push the version commit and tags:
104+
- `git push origin main`
105+
4. Publish (maintainers only; GitHub Actions handles the release):
106+
- `yarn changeset publish`
94107
5. When successful add [release notes](https://github.com/transloadit/node-sdk/releases).
95-
6. If this was a pre-release, remember to run this to reset the [npm `latest` tag](https://www.npmjs.com/package/transloadit?activeTab=versions) to the previous version (replace `x.y.z` with previous version):
108+
6. Scoped packages publish with the `experimental` dist-tag by default. If you need to promote a scoped package to `latest`, update the tag manually.
109+
7. If this was a pre-release, remember to reset the [npm `latest` tag](https://www.npmjs.com/package/transloadit?activeTab=versions) to the previous version (replace `x.y.z` with previous version):
110+
- `npm dist-tag add transloadit@X.Y.Z latest`
111+
112+
### Release FAQ
96113

97-
- `npm dist-tag add transloadit@X.Y.Z latest`
114+
- **Lockstep versions:** Changesets use a fixed group, so version bumps and releases are always in lock‑step across `transloadit`, `@transloadit/node`, `@transloadit/types`, and `@transloadit/zod`.
115+
- **Legacy parity:** `transloadit` is generated from `@transloadit/node` artifacts via `scripts/prepare-transloadit.ts`, then verified with `yarn parity:transloadit`. Only `package.json` metadata drift is allowed; any other drift fails.
116+
- **Experimental packages:** Scoped packages (`@transloadit/node`, `@transloadit/types`, `@transloadit/zod`) publish with the `experimental` dist-tag. The unscoped `transloadit` package remains stable.

biome.json

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.2.4/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
33
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
44
"files": {
55
"ignoreUnknown": false,
66
"includes": [
77
"**",
88
"!package.json",
99
"!coverage",
10+
"!**/coverage",
1011
"!dist",
1112
"!fixture",
1213
"!.vscode",
13-
"!src/alphalib"
14+
"!packages/**/dist",
15+
"!packages/**/node_modules",
16+
"!packages/node/src/alphalib"
1417
]
1518
},
1619
"formatter": {
@@ -93,6 +96,10 @@
9396
"actions": { "source": { "organizeImports": "on" } }
9497
},
9598
"overrides": [
99+
{
100+
"includes": ["**/package.json"],
101+
"formatter": { "expand": "always" }
102+
},
96103
{
97104
"includes": ["*.html"],
98105
"javascript": { "formatter": { "quoteStyle": "double" } }

0 commit comments

Comments
 (0)