build: migrate from Yarn 1 to Yarn 4 - #174
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (7)
Limit details: You’ve used the included review currently available. Your 110 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. WalkthroughThe repository adopts Yarn 4.18.0, updates workspace commands and configuration, enables Corepack in workflows, and changes dependency installation modes for CI, release, and bundle-size jobs. ChangesYarn 4 migration
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The dependency migration is merge-ready after normal checks and review; no actionable merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 6✅ Passed checks (6 passed)
Full details: Docstring CoverageExplanation No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0 files. (7 skipped: 7 unsupported.) Full details: Security CheckExplanation No introduced unaddressed security concern found. The PR changes dependency tooling, workflows, and configuration only; it adds no application code or credential-handling logic. The new external dependency is the pinned ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Bundle size report
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
4e56108 to
873b851
Compare
## Summary Gives the Angular workspace real linting — its `fix` was a no-op stub and `check` only ran `tsc` — by adopting **angular-eslint 16.3.1** (matching Angular 16), configured manually (`.eslintrc.json` + an `ng lint` target) rather than via the schematic. - Workspace scripts now match the repo vocabulary: `fix` = `eslint projects --fix`, `check` = `eslint projects && tsc --noEmit`, plus an `ng lint` CLI target. The root `check`/`fix` fan-out picks these up automatically, so CI now gates on Angular lint. - Fixed all preexisting findings (4 errors / 5 warnings → 0/0): removed an unused import, and in the non-exported `oneschema.samples.ts` renamed sample classes to `*Component` suffixes, replaced `any` with `unknown`, and `_`-prefixed intentionally unused callback args. - One targeted inline disable: `OneSchemaButton` in `oneschema.button.ts` keeps its name (it's part of the published `@oneschema/angular` API surface), with `component-class-suffix` disabled on that line and a justification comment. - Public API verified unchanged: `public-api.ts` exports, the `lib-oneschema-button` selector, and the generated `.d.ts` files are byte-identical before/after. Stacked on #174 (Yarn 4 migration — this PR's lockfile additions are in the v8 format). ## Test plan Under Node 24 / Yarn 4.18.0: - Angular workspace: `yarn fix` (no churn), `yarn check` (eslint 0 errors 0 warnings + tsc), `yarn test:ci` (karma 2/2 headless), `yarn build` — all pass - Root `yarn fix` + `yarn check` pass (only the preexisting non-gating React Hooks warning remains) - Built package public surface diffed before/after — no differences Link to Devin session: https://app.devin.ai/sessions/a90df1407fe74fe990a9e3f3bfa772d3 Open in Devin Desktop: https://app.devin.ai/desktop/session/a90df1407fe74fe990a9e3f3bfa772d3?variant=devin Requested by: @behnam-oneschema --------- Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
## Summary
Redesigns the published package entrypoints so `@arethetypeswrong/cli`
passes on every package, and flips attw in `check:packages` from
report-only to **gating**.
For the 5 Rollup packages (`@oneschema/importer`, `react`, `vue`,
`filefeeds`, `filefeeds-react`):
- Each `package.json` gains an explicit `exports` map — `import` →
`./dist/module.mjs` + `./dist/index.d.mts`, `require` → `./dist/main.js`
+ `./dist/index.d.cts` — plus `"./dist/*"` (kept open deliberately: the
importer's UMD bundle is consumed via CDN deep paths) and
`"./package.json"`. `main`/`module` stay for legacy resolvers; top-level
`types` moves to the `.d.cts`.
- Rollup additionally emits `dist/module.mjs` (true-ESM twin of
`module.js`), and a new shared post-build step `scripts/dual-types.mjs`
derives `index.d.mts` (copy) and `index.d.cts` from the generated
`index.d.ts`. For packages with a default export, the `.d.cts` replaces
`export { X as default, ... }` with the interop-truthful shape:
```ts
declare const _default: { default: typeof X; /* named runtime exports */
};
declare namespace _default { /* type-only exports, e.g. OneSchemaParams
*/ }
export = _default;
```
which matches exactly what the CJS bundle (`exports: "named"`:
`exports.default` + named + `__esModule`) provides — the bare
`require()` result is a non-callable object, and the declaration says so
— while the namespace merge preserves the full public type surface
(type-only exports like `OneSchemaParams`) for CJS/node10 consumers.
This clears attw's `MissingExportEquals`/node10/node16 findings on all
four resolution modes.
- Packaging hygiene while here: canonical `repository.url`,
`sideEffects: false`, and a `files` allowlist (Vue was shipping its
`test/` pages).
- Dependent workspaces (`react`, `vue`, `filefeeds-react`, `angular`)
get a tsconfig `paths` entry mapping `@oneschema/importer`/`filefeeds`
to the built `.d.mts`, so local `tsc` doesn't misread the new `.d.cts`
under their legacy `moduleResolution: node`. The Angular spec tsconfig
clears `paths` so Karma specs resolve the installed package (runtime +
its complete `.d.cts` types). Vue's internal import gains a `.js`
extension so its emitted declarations resolve under node16 ESM.
`@oneschema/angular` is left as-is: it's the standard ng-packagr 16
ESM-only shape, and I verified a `"type": "module"` post-process just
trades `FalseCJS` for `InternalResolutionError` (extensionless imports
in generated d.ts). Its attw run uses `--profile esm-only --ignore-rules
cjs-resolves-to-esm false-cjs` with a comment noting a real fix needs
the Angular 17+ toolchain. Verified the built Angular declarations keep
bare `@oneschema/importer` specifiers (no deep paths leak).
Ships a **patch** changeset for the 5 packages — deliberately not minor:
`@oneschema/angular` peer-depends on `importer@^0.7.0` and the packages
are `linked`, so a minor (0.8.0) would knock the peer range out-of-range
and cascade the whole linked group to a 1.0.0 major.
Stacked on #175 (angular-eslint) → #174 (Yarn 4).
## Test plan
- `yarn build` + `yarn check:packages`: publint and attw green on all 6
packages (previously 5/6 had attw findings)
- attw per-package: node10 / node16-CJS / node16-ESM / bundler all 🟢 for
the 5 Rollup packages
- Runtime sanity: `require("./dist/main.js").default` is a function;
`import x from "./dist/module.mjs"` is a function
- CJS/node10-mode consumer probe: `.default(...)` call +
`OneSchemaParams` type import from `@oneschema/importer` both typecheck;
negative probe confirms calling the bare `require()` result fails with
TS2349 (matching runtime)
- `yarn workspace @oneschema/angular check`; `@oneschema/angular-example
test:ci` Chrome Headless 2/2 specs
- `yarn fix`, workspace `check`s, root `yarn check` all pass (only
preexisting filefeeds-react hooks warning)
- `yarn changeset status`: all 6 publishable packages at patch, no major
cascade
Link to Devin session:
https://app.devin.ai/sessions/a90df1407fe74fe990a9e3f3bfa772d3
Open in Devin Desktop:
https://app.devin.ai/desktop/session/a90df1407fe74fe990a9e3f3bfa772d3?variant=devin
Requested by: @behnam-oneschema
---------
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Summary
Migrates the monorepo from Yarn 1.22 to Yarn 4.18.0 (Berry) via Corepack, keeping the classic
node_moduleslayout (nodeLinker: node-modulesin.yarnrc.yml) so package builds see an identical dependency tree.Key mechanics:
"packageManager": "yarn@4.18.0"pins the version; contributors just runcorepack enableonce (documented in CONTRIBUTING.md). No Yarn binaries are checked in —.gitignoregets the standard.yarn/*entries.yarn.lockis migrated to the v8 lockfile format (large mechanical diff, marked linguist-generated).yarn workspaces run, so root scripts move toyarn workspaces foreach -A run <script>(builduses--topological-devfor dependency order). For that ordering to work,@oneschema/angular's dependency on@oneschema/importeris now declared in the workspace's devDependencies (it resolves to the local workspace, matching the published lib's existing^0.7.0peer range). The rootcleannow runs workspace cleans beforerm -rf node_modules, since the old order deleted the binaries it needed.yarn check, so bareyarn checknow runs the root script — docs simplified accordingly.setup-node(socache: yarnresolves through Corepack) and switch installs toyarn install --immutable. Exception: the bundle-size job's base checkout is built withcorepack yarn@1.22.22 install --frozen-lockfile— whilemainpredates this PR its lockfile is still v1 format, and an explicit Corepack pin is required because Yarn 4 otherwise refuses to run against the PR checkout'spackageManagerguard.resolutions(human-id) and Changesets 2.31.1 are untouched; the Yarn-1--ignore-enginesfriction with Changesets v3 disappears, which unblocks the publishing PR ci: publish via npm trusted publishing (OIDC), changesets cli v3 #155 cleanly.Stacked on #172 (Node 24 + CONTRIBUTING.md); base will retarget to
mainwhen it merges.Test plan
All under Node v24.18.0 / Yarn 4.18.0:
yarn install --immutableagainst the committed migrated lockfile — passesyarn build,yarn check:packages(publint all green, attw report-only unchanged),yarn check(prettier + htmlhint + workspace checks),yarn test:ci(Angular karma 2/2 headless) — all passyarn fixproduces no changes;yarn changeset --helpworks under Yarn 4scripts/bundle-size.mjsruns against the new build outputcorepack yarn@1.22.22 install --frozen-lockfile && corepack yarn@1.22.22 buildsucceeds (covers the bundle-size base install)Link to Devin session: https://app.devin.ai/sessions/a90df1407fe74fe990a9e3f3bfa772d3
Open in Devin Desktop: https://app.devin.ai/desktop/session/a90df1407fe74fe990a9e3f3bfa772d3?variant=devin
Requested by: @behnam-oneschema