diff --git a/.chronus/changes/remove-js-yaml-lodash-typespec-java-2026-7-10-0-0-0.md b/.chronus/changes/remove-js-yaml-lodash-typespec-java-2026-7-10-0-0-0.md new file mode 100644 index 0000000000..6200f9ae98 --- /dev/null +++ b/.chronus/changes/remove-js-yaml-lodash-typespec-java-2026-7-10-0-0-0.md @@ -0,0 +1,7 @@ +--- +changeKind: dependencies +packages: + - "@azure-tools/typespec-java" +--- + +[Java] Remove unused `js-yaml` and `lodash` dependencies. diff --git a/packages/typespec-java/CONTRIBUTING.md b/packages/typespec-java/CONTRIBUTING.md index 469452372c..0eb1f72a60 100644 --- a/packages/typespec-java/CONTRIBUTING.md +++ b/packages/typespec-java/CONTRIBUTING.md @@ -37,17 +37,48 @@ refresh `core.patch` if its context no longer applies. ## Build ```bash -# Full build: build:generator (emitter.jar via Maven + core.patch, requires JDK 11+ -# and Maven) then build:emitter (copy sources from core + tsc). -pnpm build +# From the repo root, install workspace dependencies. +pnpm install -# Just the TypeScript half (no jar; fast): -pnpm build:emitter +# From the repo root, build the dependencies first. The ^... filter builds +# @azure-tools/typespec-java dependencies without building typespec-java itself. +pnpm turbo run --filter "@azure-tools/typespec-java^..." build -# Build and pack a .tgz (what emitter-tests consumes): +# Then build and pack @azure-tools/typespec-java. This builds the generator +# (emitter.jar via Maven + core.patch, requires JDK 11+ and Maven), builds the +# emitter TypeScript, and packs the .tgz consumed by emitter-tests. +cd packages/typespec-java pwsh ./Build-TypeSpec.ps1 ``` +### Pinning the core commit (`core-commit.json`) + +`Copy-Sources.ps1` copies the emitter sources from the `core/` submodule's current checkout. The +optional `core-commit.json` pins a specific upstream `core` commit to copy from instead: + +```json +{ "sha": "3cb616e4e8c3d5b6954bac9832b97445450a71af" } +``` + +The pinned SHA is fetched if needed and used only when it is **newer** than the current checkout (the +submodule never moves backwards). The submodule is checked out transiently for the copy, then always +restored to its original SHA, keeping `pnpm build` and CI git-status checks clean. To advance the pin, +update the `sha`. + +### Troubleshooting + +If `pnpm turbo ...` fails with `'turbo' is not recognized as an internal or external command` +after `pnpm install`, the local install tree is missing Turbo's binary shim. From the repo root, +force pnpm to refresh the local install state and rerun the command: + +```powershell +pnpm install --force +pnpm turbo run --filter "@azure-tools/typespec-java^..." build +``` + +Changing the npm registry has been observed to clear this symptom, possibly because +pnpm re-resolves packages or relinks local binaries after the registry setting changes. + ## Before making a Pull request Make sure to run the following commands: diff --git a/packages/typespec-java/package.json b/packages/typespec-java/package.json index de803ab928..c96af63d3b 100644 --- a/packages/typespec-java/package.json +++ b/packages/typespec-java/package.json @@ -64,8 +64,6 @@ "dependencies": { "@autorest/codemodel": "catalog:", "@azure-tools/codegen": "catalog:", - "js-yaml": "catalog:", - "lodash": "catalog:", "yaml": "catalog:" }, "devDependencies": { @@ -76,8 +74,6 @@ "@azure-tools/typespec-client-generator-core": "workspace:^", "@azure-tools/typespec-liftr-base": "catalog:", "@azure-tools/openai-typespec": "catalog:", - "@types/js-yaml": "catalog:", - "@types/lodash": "catalog:", "@types/node": "catalog:", "@typespec/compiler": "workspace:^", "@typespec/events": "workspace:^", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 397b0bb856..992588a9a3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -183,12 +183,6 @@ catalogs: '@types/hast': specifier: ^3.0.4 version: 3.0.4 - '@types/js-yaml': - specifier: ~4.0.9 - version: 4.0.9 - '@types/lodash': - specifier: ~4.17.24 - version: 4.17.24 '@types/micromatch': specifier: ^4.0.10 version: 4.0.10 @@ -363,12 +357,6 @@ catalogs: is-unicode-supported: specifier: ^2.1.0 version: 2.1.0 - js-yaml: - specifier: ^4.2.0 - version: 4.2.0 - lodash: - specifier: ~4.18.1 - version: 4.18.1 log-symbols: specifier: ^7.0.1 version: 7.0.1 @@ -3695,12 +3683,6 @@ importers: '@azure-tools/codegen': specifier: 'catalog:' version: 2.10.1 - js-yaml: - specifier: 'catalog:' - version: 4.2.0 - lodash: - specifier: 'catalog:' - version: 4.18.1 yaml: specifier: 'catalog:' version: 2.9.0 @@ -3726,12 +3708,6 @@ importers: '@azure-tools/typespec-liftr-base': specifier: 'catalog:' version: 0.14.0 - '@types/js-yaml': - specifier: 'catalog:' - version: 4.0.9 - '@types/lodash': - specifier: 'catalog:' - version: 4.17.24 '@types/node': specifier: 'catalog:' version: 26.0.0 @@ -8352,9 +8328,6 @@ packages: '@types/keyv@3.1.4': resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} - '@types/lodash@4.17.24': - resolution: {integrity: sha512-gIW7lQLZbue7lRSWEFql49QJJWThrTFFeIMJdp3eH4tKoxm1OvEPg02rm4wCCSHS0cL3/Fizimb35b7k8atwsQ==} - '@types/mdast@4.0.4': resolution: {integrity: sha512-kGaNbPh1k7AFzgpud/gMdvIm5xuECykRR+JnWKQno9TAXVa6WIVCGTPvYGekIDL4uwCZQSYbUxNBSb1aUo79oA==} @@ -20242,8 +20215,6 @@ snapshots: dependencies: '@types/node': 26.0.0 - '@types/lodash@4.17.24': {} - '@types/mdast@4.0.4': dependencies: '@types/unist': 3.0.3 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index dcc758d352..f804086a6b 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -82,8 +82,6 @@ catalog: "@types/debounce": ^1.2.4 "@types/express": ^5.0.6 "@types/hast": ^3.0.4 - "@types/js-yaml": ~4.0.9 - "@types/lodash": ~4.17.24 "@types/micromatch": ^4.0.10 "@types/morgan": ^1.9.10 "@types/multer": ^2.1.0 @@ -142,8 +140,6 @@ catalog: happy-dom: ^20.9.0 hast-util-to-html: ^9.0.5 is-unicode-supported: ^2.1.0 - js-yaml: ^4.2.0 - lodash: ~4.18.1 log-symbols: ^7.0.1 lzutf8: "0.6.3" micromatch: ^4.0.8