Skip to content

Explicitly declare optional peer deps in just-scripts#825

Draft
Copilot wants to merge 10 commits intov3from
copilot/explicitly-declare-optional-peer-deps
Draft

Explicitly declare optional peer deps in just-scripts#825
Copilot wants to merge 10 commits intov3from
copilot/explicitly-declare-optional-peer-deps

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 26, 2026

  • Add tryRequire() packages as optional peer deps
  • Remove webpackCliInitTask and @webpack-cli/init dep
  • Use ^ major ranges instead of >=
  • Convert .syncpackrc.json to JS
  • Rename .syncpackrc.js to syncpack.config.js
  • Add resolve() packages as optional peer deps
  • Update version ranges to match 2020-era major versions + all subsequent majors
  • Install/upgrade optional peer dep packages as devDependencies of just-scripts
  • Update tryRequire to take a generic type parameter <T>
  • Update callsites to use tryRequire<typeof import('...')>(...)
  • Enable esModuleInterop: true in root tsconfig.json
  • Convert import * as X from 'cjs'import X from 'cjs' where needed
  • Convert import X = require('cjs')import X from 'cjs'
  • Fix type errors from upgraded packages (sass callback, webpack callback, etc.)
  • Fix exec.spec.ts - use jest.mock for child_process with mock spy on spawn
  • Restore nodeExecTask.test.ts and tscTask.spec.ts to use jest.mock / jest.spyOn
  • Build, test, lint, format all pass
  • Code review feedback addressed

📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

Copilot AI changed the title [WIP] Fix implicit optional peer dependencies in just-scripts Explicitly declare optional peer deps in just-scripts Mar 26, 2026
Copilot AI requested a review from ecraig12345 March 26, 2026 01:31
Copy link
Copy Markdown
Member

@ecraig12345 ecraig12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Member

@ecraig12345 ecraig12345 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +39 to +46
"autoprefixer": "^9.0.0",
"fork-ts-checker-webpack-plugin": "^4.0.0",
"html-webpack-plugin": "^4.0.0",
"node-sass": "^4.0.0",
"postcss": "^8.0.0",
"postcss-clean": "^1.0.0",
"postcss-rtl": "^1.0.0",
"sass": "^1.0.0",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. You should also add any optional peer deps which are referenced with resolve()
  2. For each optional peer dep, can you figure out what was the current version as of 2020 and update the range to allow that major version and all major versions after? Also reply to this comment with the list of major versions of each package and their release dates or if you're not able to determine this.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added all resolve() packages and updated ranges in 6ade4f5. Here's the version data for all optional peer deps:

Package Latest as of 2020 Range
@microsoft/api-extractor 7.12.1 (2020-12-10) ^7.0.0
@microsoft/loader-load-themed-styles 1.9.21 (2020-12-14) ^1.0.0 || ^2.0.0
autoprefixer 10.1.0 (2020-12-08) ^10.0.0
css-loader 5.0.1 (2020-11-04) ^5.0.0 || ^6.0.0 || ^7.0.0
esbuild 0.8.28 (2020-12-31) >=0.8.0 (never had v1)
eslint 7.16.0 (2020-12-18) ^7.0.0 || ^8.0.0 || ^9.0.0 || ^10.0.0
fork-ts-checker-webpack-plugin 6.0.8 (2020-12-20) ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0
html-webpack-plugin 4.5.0 (2020-09-21) ^4.0.0 || ^5.0.0
jest 26.6.3 (2020-11-04) ^26.0.0 || ^27.0.0 || ^28.0.0 || ^29.0.0 || ^30.0.0
node-sass 5.0.0 (2020-10-31) ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 || ^9.0.0
postcss 8.2.2 (2020-12-29) ^8.0.0
postcss-clean 1.1.0 (2017-09-15) ^1.0.0
postcss-loader 4.1.0 (2020-11-19) ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0
postcss-rtl 1.7.3 (2020-03-11) ^1.0.0 || ^2.0.0
prettier 2.2.1 (2020-11-28) ^2.0.0 || ^3.0.0
sass 1.32.0 (2020-12-30) ^1.0.0
sass-loader 10.1.0 (2020-11-11) ^10.0.0 || ^11.0.0 || ^12.0.0 || ^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0
style-loader 2.0.0 (2020-10-09) ^2.0.0 || ^3.0.0 || ^4.0.0
tar-fs 2.1.1 (2020-11-06) ^2.0.0 || ^3.0.0
tslint 6.1.3 (2020-07-31) ^6.0.0 (deprecated)
tslint-microsoft-contrib 6.2.0 (2019-05-24) ^6.0.0 (deprecated)
typescript 4.1.3 (2020-12-11) ^4.0.0 || ^5.0.0 || ^6.0.0
webpack 5.11.1 (2020-12-28) ^4.0.0 || ^5.0.0
webpack-cli 4.3.1 (2020-12-31) ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0
webpack-dev-server 3.11.1 (2020-12-29) ^3.0.0 || ^4.0.0 || ^5.0.0

Copilot AI and others added 6 commits March 26, 2026 05:46
Add peerDependencies and peerDependenciesMeta to packages/just-scripts/package.json
for all packages that are optionally loaded via tryRequire() calls:
- @microsoft/api-extractor
- @webpack-cli/init
- autoprefixer
- fork-ts-checker-webpack-plugin
- html-webpack-plugin
- node-sass
- postcss
- postcss-clean
- postcss-rtl
- sass
- webpack

Add .syncpackrc.json to ignore peer deps in version group checks.

Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/e2e2b5e5-58e7-4bd3-af15-4bcdd013a7f4
Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/e2e2b5e5-58e7-4bd3-af15-4bcdd013a7f4
…nvert syncpackrc to JS

- Remove webpackCliInitTask and @webpack-cli/init peer dep
- Change peer dep version ranges from >=X.0.0 to ^X.0.0
- Use "^4.0.0 || ^5.0.0" for webpack
- Convert .syncpackrc.json to .syncpackrc.js for comments
- Update API report

Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/96f0d11d-bd59-433f-b2d5-5fa1a5ae7585
… 2020-era ranges

- Renamed .syncpackrc.js → syncpack.config.js
- Added 15 new optional peer deps from resolve() calls:
  css-loader, esbuild, eslint, jest, @microsoft/loader-load-themed-styles,
  postcss-loader, prettier, sass-loader, style-loader, tar-fs, tslint,
  tslint-microsoft-contrib, typescript, webpack-cli, webpack-dev-server
- Updated all version ranges to start from the major version current as of 2020
  and include all subsequent major versions

Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/f75e797b-01f2-4961-abec-869214f33579
Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/08b9028b-3b5d-440d-a530-351080a2b2d2
Copilot AI and others added 4 commits March 26, 2026 05:46
…nerics

Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/08b9028b-3b5d-440d-a530-351080a2b2d2
…, restore jest.mock for tscTask and nodeExecTask

Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/2d508d7e-292b-4b3b-bf6c-c3ea4efab44d
Co-authored-by: ecraig12345 <5864305+ecraig12345@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/just/sessions/2d508d7e-292b-4b3b-bf6c-c3ea4efab44d
@ecraig12345 ecraig12345 force-pushed the copilot/explicitly-declare-optional-peer-deps branch from 245cb49 to 0047285 Compare March 26, 2026 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Explicitly declare optional peer deps

2 participants