-
Notifications
You must be signed in to change notification settings - Fork 14
feat(cli): Generate package #767
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
Conversation
✅ Deploy Preview for cedarjs canceled.
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t test --minWorkers=1 --maxWorkers=4 |
✅ Succeeded | 1m 32s | View ↗ |
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 7s | View ↗ |
nx run-many -t build |
✅ Succeeded | 3m 30s | View ↗ |
nx run-many -t test:types |
✅ Succeeded | 9s | View ↗ |
☁️ Nx Cloud last updated this comment at 2026-01-01 23:10:43 UTC
Greptile SummaryThis PR adds a new
Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant CLI
participant packageHandler
participant yargsHandlerHelpers
participant templateForFile
participant getPaths
participant generateTemplate
participant writeFilesTask
participant eslint
User->>CLI: cedar generate package @org/name
CLI->>packageHandler: handler({ name, typescript, tests, ... })
packageHandler->>packageHandler: Validate name (max 1 slash)
packageHandler->>packageHandler: Parse org and name from input
packageHandler->>packageHandler: Generate folderName (param-case)
loop For each template file
packageHandler->>templateForFile: Request file generation
templateForFile->>getPaths: Get packages path
getPaths-->>templateForFile: Return /path/to/project/packages
templateForFile->>templateForFile: Build full output path
templateForFile->>generateTemplate: Render template with vars
generateTemplate-->>templateForFile: Return rendered content
templateForFile-->>packageHandler: Return [outputPath, content]
end
packageHandler->>packageHandler: Transform TS to JS if needed
packageHandler->>writeFilesTask: Write all files
writeFilesTask-->>packageHandler: Files written
packageHandler->>eslint: Run eslint --fix on generated files
eslint-->>packageHandler: Files formatted
packageHandler-->>CLI: Success
CLI-->>User: Package generated at packages/folder-name/
|
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.
11 files reviewed, 13 comments
packages/cli/src/commands/generate/package/__tests__/package.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/generate/package/__tests__/package.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/generate/package/__tests__/package.test.ts
Outdated
Show resolved
Hide resolved
packages/cli/src/commands/generate/package/__tests__/package.test.ts
Outdated
Show resolved
Hide resolved
c31387f to
ef038a8
Compare
|
@greptileai Please do a full review again |
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.
14 files reviewed, 3 comments

This is a new CLI command that lets you generate a package for code that can be shared between both the web and api sides.
The command is
yarn cedar generate package <name>Here's a checklist of things I want to add for this feature: #725
I won't do them all in this PR though. I'll release this as soon as I have an MVP working. I might put it behind a feature flag
The most annoying missing feature right now is full support for
yarn cedar dev. Currently you have to manually go and runyarn build(no "cedar") inside the package directory after any change to the package before you runyarn cedar dev. To make your life slightly less painful you can start a separate terminal and runyarn watchand the package will be automatically rebuilt on changes. If you have more than one package you need to open a separate terminal and runyarn watchfor each package.There is also no HMR for the api side. You need to restart the
yarn cedar devprocess for every change to a package that affects the api side.