-
Notifications
You must be signed in to change notification settings - Fork 413
refactor(release): project manifests from shipped files #4152
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,6 +245,55 @@ export function isMakaDevelopmentArtifact(relativePath) { | |
| ); | ||
| } | ||
|
|
||
| function releaseExportTarget(target) { | ||
| if (typeof target === 'string') { | ||
| return isMakaDevelopmentArtifact(target) ? undefined : target; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [P3] Leaf-level pruning also drops |
||
| } | ||
| if (Array.isArray(target)) { | ||
| const projected = target.map(releaseExportTarget).filter((entry) => entry !== undefined); | ||
| return projected.length === 0 ? undefined : projected; | ||
| } | ||
| if (target && typeof target === 'object') { | ||
| const projected = Object.fromEntries( | ||
| Object.entries(target) | ||
| .map(([condition, value]) => [condition, releaseExportTarget(value)]) | ||
| .filter(([, value]) => value !== undefined), | ||
| ); | ||
| return Object.keys(projected).length === 0 ? undefined : projected; | ||
| } | ||
| return target; | ||
| } | ||
|
|
||
| const WORKSPACE_RELEASE_MANIFEST_FIELDS = [ | ||
| 'name', | ||
| 'version', | ||
| 'description', | ||
| 'license', | ||
| 'type', | ||
| 'sideEffects', | ||
| 'main', | ||
| 'exports', | ||
| 'bin', | ||
| 'engines', | ||
| 'dependencies', | ||
| 'optionalDependencies', | ||
| 'peerDependencies', | ||
| 'peerDependenciesMeta', | ||
| ]; | ||
|
|
||
| export function workspaceReleaseManifest(manifest) { | ||
| const releaseManifest = Object.fromEntries( | ||
| WORKSPACE_RELEASE_MANIFEST_FIELDS.filter((field) => manifest[field] !== undefined).map( | ||
| (field) => [field, manifest[field]], | ||
| ), | ||
| ); | ||
| if (releaseManifest.exports !== undefined) { | ||
| const projected = releaseExportTarget(releaseManifest.exports); | ||
| releaseManifest.exports = projected === undefined ? {} : projected; | ||
| } | ||
| return releaseManifest; | ||
| } | ||
|
|
||
| export function isCurrentDevelopmentJavaScript( | ||
| workspaceRoot, | ||
| relativePath, | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[P3] The Electron staging path prunes release manifests only for
mcp,runtime, andruntime-host. The npm-CLI and standalone paths prune every workspace, so the Electron asar keeps whateverexportseach other@maka/*package ships as-is, including any./test-only/*branches. If the desktop depends on a package other than these three that exposes test-only exports, they will ride into the archive. Consider deriving the full set of shipped@makapackage names (e.g. from the desktop's dependencies) instead of a hardcoded triple, so staging stays consistent with the other two packaging paths.