Skip to content

chore: make package template a proper Yarn workspace - #10087

Merged
Mrtenz merged 12 commits into
mainfrom
mrtenz/template-workspace
Sep 14, 2026
Merged

Mrtenz merged 12 commits into
mainfrom
mrtenz/template-workspace

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Sep 3, 2026

Copy link
Copy Markdown
Member

Explanation

The scripts/create-package/package-template directory was not previously listed as a Yarn workspace, which meant Yarn constraints were not checked against it. This made it easy for the template to drift out of alignment with the monorepo's other packages over time.

This PR adds the template to the workspaces list and gives it a real package name (@metamask/package-template) so that constraints can run against it. Fields that vary per package (description, directory name) remain as placeholders. Constraints are relaxed in two places where the template legitimately differs from real packages: the homepage uses a placeholder directory name, and the code owner check is skipped.

References

N/A

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Low Risk
Scaffolding and monorepo tooling changes only; no runtime product behavior.

Overview
Turns the new-package scaffold into a real workspace at packages/package-template named @metamask/package-template (marked private) so Yarn constraints keep it aligned with other packages, with targeted relaxations for placeholder homepage and skipped CODEOWNERS checks.

create-package now copies from that workspace path instead of scripts/create-package/package-template, skips build/test artifacts (dist/, coverage/, *.tsbuildinfo), and strips private from generated package.json files. Placeholder replacement uses the scoped template name in template files; root tsconfig references, teams.json, and the lockfile register the workspace.

Reviewed by Cursor Bugbot for commit b33cb75. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds `scripts/create-package/package-template` to the monorepo's
workspaces list so that Yarn constraints are enforced against it,
making it easier to keep the template aligned with other packages.

The template's package name is set to `@metamask/package-template`
(a real resolvable name), with placeholders only for fields that
vary per package. Constraints are relaxed where needed: the homepage
uses a placeholder directory name, and the codeowner check is skipped
for the template.
@Mrtenz
Mrtenz force-pushed the mrtenz/template-workspace branch from ade9889 to b499356 Compare September 14, 2026 14:41
@Mrtenz
Mrtenz marked this pull request as ready for review September 14, 2026 15:15
@Mrtenz
Mrtenz deployed to default-branch September 14, 2026 15:15 — with GitHub Actions Active

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit d92fd47. Configure here.

Comment thread packages/package-template/README.md
Comment thread scripts/create-package/utils.ts

@mcmire mcmire left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We might want to move create-package itself into a workspace, but this is good on its own.

One question, but otherwise looks good.

Comment thread scripts/create-package/utils.ts Outdated

// Directories and file patterns generated by build/test tools that must not
// be copied from the package template into new packages.
const TEMPLATE_IGNORE_PATTERNS = [

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

What do you think about putting this const at the top of the file along with the others?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Makes sense, done!

@mcmire mcmire left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I tested out the create-package utility and yarn lint passes (aside from the requirement to assign a codeowner to the package). Looks good.

@Mrtenz
Mrtenz added this pull request to the merge queue Sep 14, 2026
Merged via the queue into main with commit 39ef577 Sep 14, 2026
338 checks passed
@Mrtenz
Mrtenz deleted the mrtenz/template-workspace branch September 14, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants