You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(esm): convert crwa to esm and bundle (#9786)
Follow up to #9783. This PR
converts the `create-redwood-app` package to ESM and bundles all its
dependencies. I started with `create-redwood-app` because the
requirements for making it ESM were relatively trivial compared to the
other packages since it just needs to be run by `yarn create`, and yarn
create just runs a bin.
For `create-redwood-app` I'm just using esbuild. Why not use tsup?
1. We're just distributing a bin. We're not distributing a dual-module
package with types
2. tsup hasn't been committed to in over a month and a half, whereas
esbuild releases often and is committed to more-or-less daily. That
doesn't automatically disqualify it (OSS is hard), but makes me wary.
I'll consider it for packages that distribute more than a bin
More on bundling. Bundling this package has benefits, namely decreasing
the install time—yarn doesn't have to fetch its dependencies, there are
none. But I'm mostly doing it as an exercise because we need to do it
more. For background on the shims (`jsBanner`) see
evanw/esbuild#1921. It's nothing bespoke and
it's what tsup[^tsup] and Vite[^vite] would've done anyway.
Other notes:
- Updates the package's `README.md`; this could be updated more but I
didn't want to spend too much time on it
- Adds e2e tests for the node version check
Two new e2e tests make sure we're checking node version correctly. I
can't use nvm since 1. it's not easily scriptable (it's a shell built-in
or something) and 2. it doesn't seem like we all use it, so I just added
these tests to CI and use the GitHub action to change the node version
- Fixes a bug I introduced in
#9728
The node version check would throw if it didn't pass because
`engines.yarn` was removed. This wasn't released
- Converted files to just `.js` since Node recognized them as ESM from
`type` in `package.json`
- Reordered `yarn create-redwood-app`'s options in help; I tried to put
the ones that were more likely to be used first
- Removed the header from `--help` and `--version`
[^tsup]:
https://github.com/egoist/tsup/blob/8c26e63c92711d60c05aedd3cdc358530ba266c5/assets/esm_shims.js
[^vite]:
https://github.com/vitejs/vite/blob/8de7bd2b68db27b83d9484cc8d4e26436615168e/packages/vite/rollup.config.ts#L288-L295
Copy file name to clipboardexpand all lines: packages/create-redwood-app/README.md
+31-41
Original file line number
Diff line number
Diff line change
@@ -18,39 +18,35 @@
18
18
19
19
<h2align="center">Ship today with architecture for tomorrow.</h2>
20
20
21
-
Redwood is an opinionated, edge-ready framework for modern multi-client applications, built on React, GraphQL, and Prisma with full TypeScript support and ready to go with zero config.
21
+
Redwood is an opinionated framework for modern multi-client applications, built on React, GraphQL, and Prisma with full TypeScript support and ready to go with zero config.
22
22
23
23
Want great developer experience and easy scaling? How about an integrated front- and back-end test suite, boilerplate code generators, component design, logging, API security + auth, and serverless or traditional deploy support? Redwood is here! Redwood works with the components and development workflow you love but with simple conventions and helpers to make your experience even better.
24
24
25
-
<br>
26
-
27
25
<h2>Quick Start</h2>
28
26
29
-
Redwood requires Node.js >=14.x <=16.x and Yarn v1.15 (or newer).
30
-
```console
31
-
yarn create redwood-app redwood-project
32
-
cd redwood-project
27
+
Redwood requires Node.js =20.x.
28
+
29
+
```bash
30
+
yarn create redwood-app my-redwood-app
31
+
cd my-redwood-app
32
+
yarn install
33
33
yarn redwood dev
34
34
```
35
35
36
36
<h3>Resources</h3>
37
37
38
-
- The [Redwood Tutorial](https://redwoodjs.com/docs/tutorial): The best way to learn Redwood
38
+
- The [Redwood Tutorial](https://redwoodjs.com/docs/tutorial): the best way to learn Redwood
39
39
- The [Redwood CLI](https://redwoodjs.com/docs/cli-commands): code generators, DB helpers, setup commands, and more
40
40
-[Documentation](https://redwoodjs.com/docs) and [How To's](https://redwoodjs.com/how-to/custom-function)
41
41
- Join the Community [Forums](https://community.redwoodjs.com) and [Chat](https://discord.gg/redwoodjs)
42
42
43
-
<br>
44
-
45
-
<h1>Contributing to create-redwood-app</h1>
43
+
<h2>Contributing to create-redwood-app</h2>
46
44
47
-
_Contributors are Welcome! Get started [here](https://redwoodjs.com/docs/contributing). And don't hesitate to ask for help on the forums and chat_
45
+
_Contributors are Welcome! Get started [here](https://redwoodjs.com/docs/contributing). And don't hesitate to ask for help on the forums and chat_.
48
46
49
47
**Table of Contents**
50
48
<!-- toc -->
51
49
-[Description](#description)
52
-
-[Package Leads](#package-leads)
53
-
-[Roadmap](#roadmap)
54
50
-[Local Development](#local-development)
55
51
-[Installation Script](#installation-script)
56
52
-[Template Codebase](#template-codebase)
@@ -60,55 +56,45 @@ _Contributors are Welcome! Get started [here](https://redwoodjs.com/docs/contrib
60
56
## Description
61
57
62
58
This package creates and installs a Redwood project, which is the entry point for anyone using Redwood. It has two parts:
63
-
- The installation script `create-redwood-app.js`
64
-
- Project template code in the `template/` directory
65
-
66
-
> _For information about contributing to the Redwood Framework in general, [please start here](https://redwoodjs.com/docs/contributing)._
- add option to install as either TypeScript or JavaScript project (defaults to TypeScript)
77
-
- add package tests, which may be accomplished by including in Cypress E2E CI
59
+
- The installation script [`src/create-redwood-app.js`](./src/create-redwood-app.js)
60
+
- Project template code in the [`templates/`](./templates/) directory
78
61
79
62
## Local Development
80
63
81
64
### Installation Script
82
-
The installation script is built with [Yargs](https://github.com/yargs/yargs)
65
+
66
+
The installation script is built with [Yargs](https://github.com/yargs/yargs).
83
67
84
68
### Template Codebase
85
-
The project codebase in `template/` uses [Yarn Workspace v1](https://classic.yarnpkg.com/en/docs/workspaces/) for a monorepo project containing the API and Web Sides. Redwood packages are included in `template/package.json`, `template/web/package.json`, and `template/api/package.json`, respectively.
86
69
87
-
### How to run create-redwood-app from your local repo and create a project
70
+
The project codebase in [`templates/`](./templates/) uses [Yarn Workspaces](https://yarnpkg.com/features/workspaces) for a monorepo project containing the API and Web Sides. Redwood packages are included in `templates/ts/package.json`, `templates/ts/web/package.json`, and `templates/ts/api/package.json`, respectively.
71
+
72
+
### How to run `create-redwood-app` from your local repo and create a project
73
+
88
74
First, run the following commands in the root of the monorepo:
75
+
89
76
```bash
90
77
yarn install
91
78
yarn build
92
79
```
93
80
94
-
Then, we need to navigate to the create redwood app package and build the script:
81
+
Then, navigate to the create redwood app package:
82
+
95
83
```bash
96
84
cd packages/create-redwood-app
97
-
yarn build
98
85
```
99
86
100
-
_Note:_ You can also use `yarn build:watch` instead of `yarn build` to watch for changes and rebuild automatically.
101
-
102
-
This will generate the `create-redwood-app.js` file inside the `dist` directory.
87
+
Run `yarn node` on the built file (`dist/create-redwood-app.js`) and pass in the path to the new project:
103
88
104
-
To use the script, run `node` on that file (dist/create-redwood-app.js) and pass in the path to the new project:
0 commit comments