Skip to content

Commit 2660eda

Browse files
authored
feat(bins): Use cedar as a CedarJS CLI binary name (#497)
1 parent 6adcab8 commit 2660eda

File tree

9 files changed

+68
-29
lines changed

9 files changed

+68
-29
lines changed

docs/docs/quick-start.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ Then change into that directory, yarn install, and start the development server:
3434
```
3535
cd my-cedar-project
3636
yarn install
37-
yarn cedarjs dev
37+
yarn cedar dev
3838
```
3939

4040
Your browser should automatically open to [http://localhost:8910](http://localhost:8910) where you'll see the Welcome Page, which links out to many great resources:
@@ -48,7 +48,7 @@ From dev to deploy, the CLI is with you the whole way.
4848
And there's quite a few commands at your disposal:
4949

5050
```
51-
yarn cedarjs --help
51+
yarn cedar --help
5252
```
5353

5454
For all the details, see the [CLI reference](cli-commands.md).
@@ -81,39 +81,39 @@ defining your app's data models. And Prisma
8181
migrations hassle-free:
8282

8383
```
84-
yarn cedarjs prisma migrate dev
84+
yarn cedar prisma migrate dev
8585
8686
# ...
8787
8888
? Enter a name for the new migration: › create posts
8989
```
9090

91+
You'll be prompted for the name of your migration. `create posts` will do.
92+
9193
:::tip
9294

93-
If you feel `cedarjs` is too long to type out all the time, you can use `cdr` as
94-
an alias:
95+
If you feel `yarn cedar` is too long to type out all the time, you can add
96+
`alias cedar='yarn cedar'` as an alias to your shell and then just use `cedar`
9597

9698
```
97-
yarn cdr prisma migrate dev
98-
yarn cdr dev
99+
cedar prisma migrate dev
100+
cedar dev
99101
# etc
100102
```
101103

102104
:::
103105

104-
You'll be prompted for the name of your migration. `create posts` will do.
105-
106106
Now let's generate everything we need to perform all the CRUD (Create, Retrieve, Update, Delete) actions on our `Post` model:
107107

108108
```
109-
yarn cedarjs generate scaffold post
109+
yarn cedar generate scaffold post
110110
```
111111

112112
Navigate to [http://localhost:8910/posts/new](http://localhost:8910/posts/new), fill in the title and body, and click "Save":
113113

114114
<img src="https://user-images.githubusercontent.com/300/73028004-72262c00-3de9-11ea-8924-66d1cc1fceb6.png" alt="Create a new post" />
115115

116-
Did we just create a post in the database? Yup! With `yarn cedarjs generate scaffold <model>`, Cedar created all the pages, components, and services necessary to perform all CRUD actions on our posts table.
116+
Did we just create a post in the database? Yup! With `yarn cedar generate scaffold <model>`, Cedar created all the pages, components, and services necessary to perform all CRUD actions on our posts table.
117117

118118
## Frontend first with Storybook
119119

@@ -122,23 +122,23 @@ That's more than ok — Cedar integrates Storybook so that you can work on desig
122122
Mockup, build, and verify your React components, even in complete isolation from the backend:
123123

124124
```
125-
yarn cedarjs storybook
125+
yarn cedar storybook
126126
```
127127

128128
Seeing "Couldn't find any stories"?
129129
That's because you need a `*.stories.{tsx,jsx}` file.
130130
The CedarJS CLI makes getting one easy enough — try generating a [Cell](./cells), CedarJS's data-fetching abstraction:
131131

132132
```
133-
yarn cedarjs generate cell examplePosts
133+
yarn cedar generate cell examplePosts
134134
```
135135

136136
The Storybook server should hot reload and now you'll have four stories to work with.
137137
They'll probably look a little bland since there's no styling.
138138
See if the CedarJS CLI's `setup ui` command has your favorite styling library:
139139

140140
```
141-
yarn cedarjs setup ui --help
141+
yarn cedar setup ui --help
142142
```
143143

144144
## Testing with Vitest
@@ -147,7 +147,7 @@ It'd be hard to scale from side project to startup without a few tests.
147147
Cedar fully integrates Vitest with both the front- and back-ends, and makes it easy to keep your whole app covered by generating test files with all your components and services:
148148

149149
```
150-
yarn cedarjs test
150+
yarn cedar test
151151
```
152152

153153
To make the integration even more seamless, CedarJS augments Vitest with database [scenarios](testing.md#scenarios) and [GraphQL mocking](testing.md#mocking-graphql-calls).
@@ -157,15 +157,15 @@ To make the integration even more seamless, CedarJS augments Vitest with databas
157157
CedarJS is designed for both serverless deploy targets like Netlify and Vercel and serverful deploy targets like Render and AWS:
158158

159159
```
160-
yarn cedarjs setup deploy --help
160+
yarn cedar setup deploy --help
161161
```
162162

163163
Don't go live without auth!
164164
Lock down your app with CedarJS's built-in, database-backed authentication system ([dbAuth](authentication.md#self-hosted-auth-installation-and-setup)), or integrate with
165165
the most popular third-party auth providers:
166166

167167
```
168-
yarn cedarjs setup auth --help
168+
yarn cedar setup auth --help
169169
```
170170

171171
## Next Steps
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2025-10-24
2+
3+
I've been agonizing over what name to use for the CedarJS CLI binary pretty much
4+
since I first started working on Cedar. I've tried `cedarjs`, `cdr`, `cj`.
5+
Nothing felt quite right. RedwoodJS, which this project is forked from, used
6+
`redwood` and `rw`. But in reality everyone used `rw`, and it was also what most
7+
of the documentation used. So I got used to the short and sweet `rw`.
8+
9+
In practice though, it's really more like `yarn rw`, so seven characters. Pretty
10+
early I created an alias in my shell so I could just type `cedar` and it'd
11+
expand to `yarn cedarjs`. That meant I only had to type five characters instead
12+
of seven. And it felt really goot to use.
13+
14+
For the longest time I considered adding an optional step to the initial setup
15+
of a Cedar app to add that alias to the user's shell configuration file. And
16+
then just use `cedar dev`, `cedar build` etc in the documentation. I recently
17+
realized though that doing that will only set it up for the person that first
18+
creates the app. Everyone else working on it (everyone else in the user's team)
19+
wouldn't be able to use that command. Also if you (or AI) works in ephemeral
20+
environments the alias won't be available there. So I finally decided I would
21+
_not_ have create-cedar-app add the alias.
22+
23+
At the same time I decided that, I also decided I have to start using the
24+
command the documentation says to use, to get a feel for what my users would be
25+
typing all day. So I added `cdr` as a short-form alternative of `cedarjs` and
26+
started using `yarn cdr` for everything. But it just never felt quite right. It
27+
just wasn't very nice to type out for some reason.
28+
29+
So now I'm trying `yarn cedar`. It's longer, but maybe it feels more natural.
30+
Another bold move to try could be just `yarn c`. I kind of like that
31+
`yarn cedar` is more explicit though, especially as I'm going to have to teach
32+
AI to use this thing. If I go with `cedar` there's also the added benefit that
33+
I can just maintain _one_ name for the cli binary.

packages/api/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@
6464
"main": "./dist/index.js",
6565
"types": "./dist/index.d.ts",
6666
"bin": {
67-
"cdr": "./dist/cjs/bins/redwood.js",
68-
"cedarjs": "./dist/cjs/bins/redwood.js",
67+
"cdr": "./dist/cjs/bins/cedar.js",
68+
"cedar": "./dist/cjs/bins/cedar.js",
69+
"cedarjs": "./dist/cjs/bins/cedar.js",
6970
"redwood": "./dist/cjs/bins/redwood.js",
7071
"rw": "./dist/cjs/bins/redwood.js",
7172
"rwfw": "./dist/cjs/bins/rwfw.js",
File renamed without changes.

packages/core/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
"license": "MIT",
1111
"type": "module",
1212
"bin": {
13-
"cdr": "./dist/bins/cedarjs.js",
14-
"cedarjs": "./dist/bins/cedarjs.js",
13+
"cdr": "./dist/bins/cedar.js",
14+
"cedar": "./dist/bins/cedar.js",
15+
"cedarjs": "./dist/bins/cedar.js",
1516
"cedarjs-api-server-watch": "./dist/bins/cedarjs-api-server-watch.js",
1617
"cedarjs-serve-api": "./dist/bins/cedarjs-serve-api.js",
1718
"cross-env": "./dist/bins/cross-env.js",
File renamed without changes.

packages/web/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@
114114
"main": "./dist/index.js",
115115
"types": "dist/index.d.ts",
116116
"bin": {
117-
"cdr": "./dist/cjs/bins/cedarjs.js",
118-
"cedarjs": "./dist/cjs/bins/cedarjs.js",
117+
"cdr": "./dist/cjs/bins/cedar.js",
118+
"cedar": "./dist/cjs/bins/cedar.js",
119+
"cedarjs": "./dist/cjs/bins/cedar.js",
119120
"cross-env": "./dist/cjs/bins/cross-env.js",
120121
"msw": "./dist/cjs/bins/msw.js",
121122
"redwood": "./dist/cjs/bins/redwood.js",
File renamed without changes.

yarn.lock

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,8 +2623,9 @@ __metadata:
26232623
redis:
26242624
optional: true
26252625
bin:
2626-
cdr: ./dist/cjs/bins/redwood.js
2627-
cedarjs: ./dist/cjs/bins/redwood.js
2626+
cdr: ./dist/cjs/bins/cedar.js
2627+
cedar: ./dist/cjs/bins/cedar.js
2628+
cedarjs: ./dist/cjs/bins/cedar.js
26282629
redwood: ./dist/cjs/bins/redwood.js
26292630
rw: ./dist/cjs/bins/redwood.js
26302631
rwfw: ./dist/cjs/bins/rwfw.js
@@ -3440,8 +3441,9 @@ __metadata:
34403441
tsx: "npm:4.20.5"
34413442
typescript: "npm:5.9.2"
34423443
bin:
3443-
cdr: ./dist/bins/cedarjs.js
3444-
cedarjs: ./dist/bins/cedarjs.js
3444+
cdr: ./dist/bins/cedar.js
3445+
cedar: ./dist/bins/cedar.js
3446+
cedarjs: ./dist/bins/cedar.js
34453447
cedarjs-api-server-watch: ./dist/bins/cedarjs-api-server-watch.js
34463448
cedarjs-serve-api: ./dist/bins/cedarjs-serve-api.js
34473449
cross-env: ./dist/bins/cross-env.js
@@ -4232,8 +4234,9 @@ __metadata:
42324234
react: 19.0.0-rc-f2df5694-20240916
42334235
react-dom: 19.0.0-rc-f2df5694-20240916
42344236
bin:
4235-
cdr: ./dist/cjs/bins/cedarjs.js
4236-
cedarjs: ./dist/cjs/bins/cedarjs.js
4237+
cdr: ./dist/cjs/bins/cedar.js
4238+
cedar: ./dist/cjs/bins/cedar.js
4239+
cedarjs: ./dist/cjs/bins/cedar.js
42374240
cross-env: ./dist/cjs/bins/cross-env.js
42384241
msw: ./dist/cjs/bins/msw.js
42394242
redwood: ./dist/cjs/bins/redwood.js

0 commit comments

Comments
 (0)