refactor: extract zip utilities into shared @aws-cdk/tools package#1512
Merged
mrgrain merged 1 commit intoJun 12, 2026
Merged
Conversation
Contributor
Dependency ReviewThe following issues were found:
License Issuespackages/@aws-cdk/private-tools/package.json
packages/aws-cdk/package.json
yarn.lock
OpenSSF ScorecardScorecard details
Scanned Files
|
619a9b9 to
6a6d511
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1512 +/- ##
=======================================
Coverage 88.64% 88.64%
=======================================
Files 77 77
Lines 11293 11293
Branches 1565 1565
=======================================
Hits 10011 10011
Misses 1253 1253
Partials 29 29
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
9fca289 to
cecbc10
Compare
Contributor
|
Total lines changed 2254 is greater than 1000. Please consider breaking this PR down. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1512 +/- ##
=======================================
Coverage 88.73% 88.73%
=======================================
Files 77 77
Lines 11359 11359
Branches 1585 1584 -1
=======================================
Hits 10079 10079
Misses 1250 1250
Partials 30 30
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
rix0rrr
reviewed
Jun 11, 2026
…ols`
Replace the custom `CdkTypeScriptWorkspace` subclass with a `ToolMixin`
that implements projen's `IMixin` interface. Consumers now use:
const project = new yarn.TypeScriptWorkspace({ ... });
project.with(tools.zip);
Also renames `@aws-cdk/tools` to `@aws-cdk/private-tools` to make it
clear this is not a published package.
The `defineTools` function now accepts a formal `tools: Record<string, ToolDefinition>`
where each tool declares its `deps` and optional `devDeps`.
rix0rrr
approved these changes
Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Both
cdk-assets-libandtoolkit-libcarried their own copy of the zip utilities (zipDirectory,zipString) wrappingarchiverandfast-glob. This duplication made it easy for the implementations to drift apart — thetoolkit-libversion had already lost the deterministic date reset, for example.This PR introduces a new private (unpublished)
@aws-cdk/toolspackage that hosts small, self-contained utilities. Each tool lives in its own subdirectory underlib/, is type-checked bytsc, and bundled byesbuildwith--packages=external— so the bundled output contains only the code we wrote, while third-party packages stay as plainrequire(...)calls.Consumer packages cherry-pick tools at pre-compile time via a
useToolsoption on the newCdkTypeScriptWorkspaceprojen construct, using typed tool references (e.g.useTools: [tools.zip]). For each tool it:.js/.d.tsintolib/private/tools/<name>/. These files are committed, sotsc --buildof dependent projects (e.g. the CLI) can resolve them without first running this package's pre-compile step.archiver,fast-glob) to the consuming package.Keeping those dependencies external to the bundle (rather than inlining them) is deliberate. The
aws-cdkCLI bundlescdk-assets-libandtoolkit-libtogether; if each shipped its own inlined copy ofarchiver(and itslodash/fast-globdeps), the CLI bundle would carry the implementation multiple times. Declaring the deps and keeping them external lets the bundler resolve them to a single shared copy, matching the pre-refactor footprint.Adding a new tool is just: create
lib/<tool>/index.tsin the tools package, declare its third-party deps intoolDeps, anduseTools: [tools.<tool>]in each consumer.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license